I am having issues with a BioPerl script. I have a blastxml file from a blastx blast and the original multifasta file containing the original nucleotides sequences.
I want to take the blast result (ie. the blast description) and annotated my multifasta file.
I have written 2 while loops that extract the blast descriptions as well as the nucleotide sequence from the multifasta file.
My problem is that I cannot incorporate one of the while loops into the other without loosing the loop property of one of the loops.
See script below:
use warnings;
use strict;
use Bio::SearchIO;
use Bio::SeqIO;
my $search_in = Bio::SearchIO->new(-format => 'blastxml', -file => "$ARGV[0]");
while (my $result = $search_in->next_result) {
while (my $hit = $result->next_hit) {
while (my $hsp = $hit->next_hsp) {
my $qd = $hit->description;
print $qd, "\n";
}
}
}
my $seqio = Bio::SeqIO->new(-format => 'fasta', -file => "$ARGV[1]");
while (my $seqobj = $seqio->next_seq) {
my $nuc = $seqobj->seq();
print $nuc, "\n";
}
I want to take the blast result (ie. the blast description) and annotated my multifasta file.
I have written 2 while loops that extract the blast descriptions as well as the nucleotide sequence from the multifasta file.
My problem is that I cannot incorporate one of the while loops into the other without loosing the loop property of one of the loops.
See script below:
use warnings;
use strict;
use Bio::SearchIO;
use Bio::SeqIO;
my $search_in = Bio::SearchIO->new(-format => 'blastxml', -file => "$ARGV[0]");
while (my $result = $search_in->next_result) {
while (my $hit = $result->next_hit) {
while (my $hsp = $hit->next_hsp) {
my $qd = $hit->description;
print $qd, "\n";
}
}
}
my $seqio = Bio::SeqIO->new(-format => 'fasta', -file => "$ARGV[1]");
while (my $seqobj = $seqio->next_seq) {
my $nuc = $seqobj->seq();
print $nuc, "\n";
}