#!/usr/local/bin/perl

use Bio::SearchIO;

# read blastoutput file into a new instance
my $blast_report = new Bio::SearchIO ('-format' => 'blasttable',
                                      '-file'   => $ARGV[0]);

# get next result and cycle
while( my $result = $blast_report->next_result) {
	# get next hit and cycle
	while( my $hit = $result->next_hit()) {
    		# get next HSP and cycle
		while( my $hsp = $hit->next_hsp()) {  
			if ( $hsp->length('total') >= 50 )
			{
				if ( $hsp->percent_identity >= 75 )
				{
					if ( $hsp->evalue() < 0.00001 )
					{
				    		print $result->query_name(), "\n";
					} 
				}
            }
		}
	}
}
exit 0;
