Skip to content

Instantly share code, notes, and snippets.

@rbuels
Created November 5, 2009 16:14
Show Gist options
  • Select an option

  • Save rbuels/227164 to your computer and use it in GitHub Desktop.

Select an option

Save rbuels/227164 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
my $new_seq = Bio::Seq::RichSeq->new();
my $searchio = Bio::SearchIO->new( -format => 'blastxml',
-file => 'blastout.xml' );
while ( my $result = $searchio->next_result() ) {
while( my $hit = $result->next_hit ) {
# process the Bio::Search::Hit::HitI object
while( my $hsp = $hit->next_hsp ) {
# process the Bio::Search::HSP::HSPI object
# tweak the dna seq
$new_seq->seq( 'AACTGCGCTAGCTACGATCACA' );
# make a new feature and attach it
my $feat = Bio::SeqFeature::Generic->new( -start => 5,
-end => 523,
...
);
$new_seq->annotations->add_Annotation($feat);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment