Perl modules

Parsing blast results

Module is Bio::SearchIO

my $in = new Bio::SearchIO(-format => 'blast', -file => 'report.bls');
 
while( my $result = $in->next_result ) { 
  while( my $hit = $result->next_hit ) { 
    while( my $hsp = $hit->next_hsp ) { 
      if( $hsp->length('total') > 100 ) { 
        if ( $hsp->percent_identity >= 75 ) { 
	  print "Hit= ", $hit->name, ",
	         Length=", $hsp->length('total'), ",
	         Percent_id=", $hsp->percent_identity, "\n";
        } 
      } 
    } 
  } 
} 

Example: blastparse.pl



Table of Contents.
Previous |