[Bioperl-l] help-> SearchIO

Rondon Neto rondonbio at yahoo.com.br
Mon Sep 19 13:46:36 UTC 2011


Hi guys! I need your help in a loop that I have in SearchIO.
I need to check the nucleotide coverage of querys using BLAST. I'm using the script below. It's open the alignment, create arrays for each query with zeros in each nucleotide position but, when I adds values to the coverage of each nucleotide, the script does it once and passes to another query.
Can you hek me?
Thank you very much,

Rondon
a Brazilian friend.


use Bio::SearchIO;
 
my $alignment = new Bio::SearchIO ( -format => 'blastXML',
                             -file   => $alignment_file );

my %positions;
while (my $result = $alignment->next_result) {
while (my $hit = $result->next_hit) {
while (my $hsp = $hit->next_hsp) {
my $query_name = $result->query_name();
my $tam = $result -> query_length();
my @pos = $hsp->seq_inds('query','identical');
for (0..$tam){ ${$positions{$query_name}}[$_] = 0 } # make arrays for each query and populate with 0 in each position
foreach my $num (@pos) {
${$positions{$query_name}}[$num -1]++;    #This loop is where I believe that is an error.
}
}
}
}

foreach my $key (keys %positions){
print "$key\t@{$positions{$key}}\n";
}

exit;




More information about the Bioperl-l mailing list