Source: http://www.bioperl.org/wiki/HOWTO:SearchIO
use strict;
use Bio::SearchIO;
my $usage = "Bio_SearchIO_blast.pl infile\n";
my $sInFile = shift or die $usage;
my $in = new Bio::SearchIO(-format => 'blast', -file   => $sInFile);

while( my $result = $in->next_result ) {
        print "result_algorithm: " . $result->algorithm() . " \n";
        print "result_algorithm_version: " . $result->algorithm_version() . " \n";
        print "result_query_name: " . $result->query_name() . " \n";
        print "result_query_accession: " . $result->query_accession() . " \n";
        print "result_query_length: " . $result->query_length() . " \n";
        print "result_query_description: " . $result->query_description() . " \n";
        print "result_database_name: " . $result->database_name() . " \n";
        print "result_database_letters: " . $result->database_letters() . " \n";
        print "result_database_entries: " . $result->database_entries() . " \n";
        print "result_available_statistics: " . $result->available_statistics() . " \n";
        print "result_available_parameters: " . $result->available_parameters() . " \n";
        print "result_num_hits: " . $result->num_hits() . " \n";

        while( my $hit = $result->next_hit ) {
                print "\n";
                print "hit_name: " . $hit->name() . " \n";
                print "hit_Length of the Hit sequence: " . $hit->length() . " \n";
                print "hit_accession: " . $hit->accession() . " \n";
                print "hit_hit description: " . $hit->description() . " \n";
                print "hit_algorithm: " . $hit->algorithm() . " \n";
                print "hit_hit raw score: " . $hit->raw_score() . " \n";
                print "hit_hit significance: " . $hit->significance() . " \n";
                print "hit_hit bits: " . $hit->bits() . " \n";
                print "hit_number of HSPs in hit: " . $hit->num_hsps() . " \n";
                print "hit_locus name: " . $hit->locus() . " \n";

                while( my $hsp = $hit->next_hsp ) {
                        print "\n";
                        print "hsp_algorithm: " . $hsp->algorithm() . " \n";
                        print "hsp_evalue: " . $hsp->evalue() . " \n";
                        print "hsp_alias for evalue(): " . $hsp->expect() . " \n";
                        print "hsp_frac_identical: " . $hsp->frac_identical() . " \n";
                        print "hsp_frac_conserved: " . $hsp->frac_conserved() . " \n";
                        print "hsp_number of gaps: " . $hsp->gaps() . " \n";
                        print "hsp_query string from alignment: " . $hsp->query_string() . " \n";
                        print "hsp_hit string from alignment: " . $hsp->hit_string() . " \n";
                        print "hsp_string from alignment: " . $hsp->homology_string() . " \n";
                        print "hsp_length of HSP (including gaps) : " . $hsp->length('total') . " \n";
                        print "hsp_length of hit participating in alignment minus gaps: " . $hsp->length('hit') . " \n";
                        print "hsp_length of query participating in alignment minus gaps: " . $hsp->length('query') . " \n";
                        print "hsp_Length of the HSP (including gaps) alias for length('total'): " . $hsp->hsp_length() . " \n";
                        print "hsp_frame: " . $hsp->frame() . " \n";
                        print "hsp_number of conserved residues: " . $hsp->num_conserved() . " \n";
                        print "hsp_number of identical residues: " . $hsp->num_identical() . " \n";
                        print "hsp_rank: " . $hsp->rank() . " \n";
                        print "hsp_identical positions as array: " . $hsp->seq_inds('query','identical') . " \n";
                        print "hsp_conserved, but not identical positions as array: " . $hsp->seq_inds('query','conserved-not-identical') . " \n";
                        print "hsp_conserved or identical positions as array: " . $hsp->seq_inds('query','conserved') . " \n";
                        print "hsp_identical positions as array: " . $hsp->seq_inds('hit','identical') . " \n";
                        print "hsp_conserved not identical positions as array: " . $hsp->seq_inds('hit','conserved-not-identical') . " \n";
                        print "hsp_conserved or identical positions as array, with runs of consecutive numbers compressed: " . $hsp->seq_inds('hit','conserved',1) . " \n";
                        print "hsp_score: " . $hsp->score() . " \n";
                        print "hsp_score in bits: " . $hsp->bits() . " \n";
                        print "hsp_start and end as array of query: " . $hsp->range('query') . " \n";
                        print "hsp_start and end as array of hit: " . $hsp->range('hit') . " \n";
                        print "hsp_% identical: " . $hsp->percent_identity() . " \n";
                        print "hsp_strand of the hit: " . $hsp->strand('hit') . " \n";
                        print "hsp_strand of the query: " . $hsp->strand('query') . " \n";
                        print "hsp_start position from alignment of query: " . $hsp->start('query') . " \n";
                        print "hsp_end position from alignment of query: " . $hsp->end('query') . " \n";
                        print "hsp_start position from alignment of hit: " . $hsp->start('hit') . " \n";
                        print "hsp_end position from alignment of hit: " . $hsp->end('hit') . " \n";
                        print "hsp_number of identical and conserved as array of hit: " . $hsp->matches('hit') . " \n";
                        print "hsp_number of identical and conserved as array of query: " . $hsp->matches('query') . " \n";
                }
        }
}
arrow
arrow
    全站熱搜

    wenching520 發表在 痞客邦 留言(0) 人氣()