Hello,
I have cobbled together a small script that parses a BLASTxml file. It seems to parse the xml file just fine (judging from what it prints to the screen). The problem is the hsp.fas alignment file is incomplete. This file only contains one of the alignments contained in the BLAST output.
I would like to have all the alignments (including the query sequence in each of the individual alignments) that I see in the BLAST outputs (for example if I designate m -2 I get a complete file from the blastall).
Any suggestions? -Thanks!
module load perl
#give the name of the blast xml file to parse in the line where it says 'file =>'
use Bio::SearchIO;
#Use m -7 to generate xml file from blastall
my $in = new Bio::SearchIO(-format => 'blastxml',
-file => 'BLASToutxml');
while( my $result = $in->next_result ) {
## $result is a Bio::Search::Result::ResultI compliant object
while( my $hit = $result->next_hit ) {
## $hit is a Bio::Search::Hit::HitI compliant object
while( my $hsp = $hit->next_hsp ) {
## $hsp is a Bio::Search::HSP::HSPI compliant object
#ENTER desired sequence length
if( $hsp->length('total') > 50 ) {
#ENTER desired percent identity
if ( $hsp->percent_identity >= 75 ) {
print "Query=", $result->query_name,
" Hit=", $hit->name,
" Length=", $hsp->length('total'),
" Percent_id=", $hsp->percent_ide ...