首页 > 代码库 > Bioperl 解析blast的输出结果

Bioperl 解析blast的输出结果

用bioperl 解析blast的默认输出结果, 整理成-m8格式的输出

#!/usr/bin/perluse Bio::SearchIO;my ($blast) = @ARGV;my $searchio = new Bio::SearchIO(-format => "blast",                                 -file   => "test.bls");while (my $result = $searchio->next_result) {    while (my $hit = $result->next_hit) {        while (my $hsp = $hit->next_hsp) {            my $query_name   = $result->query_name;            my $query_length = $result->query_length;            my $align        = $hsp->homology_string;            $align           =~ s/ /0/g;            my $hit_name     = $hit->name;            my $identity     = sprintf "%0.2f", $hsp->frac_identical * 100;            my $mismatch     =()= $hsp->seq_inds(hit,nomatch);            my $gaps         = $hsp->gaps;            my $align_length = $hsp->hsp_length;            my $query_start  = $hsp->start(query);            my $query_end    = $hsp->end(query);            my $hit_start    = $hsp->start(hit);            my $hit_end      = $hsp->end(hit);            my $evalue       = $hsp->evalue;            my $bit_score    = $hsp->bits;            print qq{$query_name\t$hit_name\t$identity\t$align_length\t$mismatch\t$gaps\t$query_start\t$query_end\t$hit_start\t$hit_end\t$evalue\t$bit_score\n};        }    }}

 

Bioperl 解析blast的输出结果