[Bioperl-l] parsing blast XML reports with Bio::SearchIO
Jonathan Flowers
jonathanmflowers at gmail.com
Thu Aug 13 19:41:21 UTC 2009
Hi,
I am trying to parse BLAST reports written in XML using Bio::SearchIO. When
running the following code on a set of reports (multiple query results in a
single file), I only get one ResultI object. I tried running the same code
on a file in 'blast' format and obtained the expected results (ie one
ResultI object for each query), suggesting that the issue is with blastxml.
I found an old thread on this listserv where someone had had a similar
problem, but could not find how it was resolved.
I am using Bioperl 1.5.2 and the XML reports were generated using blastall
with the -m7 option.
my $in = new Bio::SearchIO(-format => 'blastxml', -file =>
'blastreport.xml' );
while( my $result = $in->next_result ) {
print $result->query_name,"\n";
while( my $hit = $result->next_hit ) {
while( my $hsp = $hit->next_hsp ) {
#do something with hsp
}
}
}
Thanks
Jonathan
More information about the Bioperl-l
mailing list