[Bioperl-l] blast best hit

Jordi Durban jordi.durban at gmail.com
Thu Mar 31 10:23:54 EDT 2011


Hi,
I did a pair of scripts to parse a blastxml report. I'd like know your
opinion.
First I obtained a file with tab separated results (whatever you want) from
the blast results according to some Bioperl modules as SearchIO. That is:
hit_name    query_name    e-value    score
hit_name    query-name   e-value     score
.
.

Then, I parse that file as an array where:
foreach my $line ($array[0]){ ###### best hit
        next if $seen {$line}++; ##### non-repeated lines
        push @unique , $line[1]; ### best hit outcome in a new array
       }

I hope this helps and I look forward some opinions.






2011/3/31 Brian Osborne <bosborne11 at verizon.net>

> Boyang,
>
> You can sort the hits, by any criterion you want:
>
> my @hits = $result->hits;
> @hits = sort { $a-> bits <=> $b->bits } @hits;
>
> BIO
>
> On Mar 31, 2011, at 8:28 AM, boyang zhe wrote:
>
> > Hi,
> >
> > I just want to parse the blast results ,and get the best hit.
> >
> > One way is to parse the results as usual, then get the first hit and exit
> > the loop.
> >
> > I checked the bioperl document, and find that there is a method
> > best_hit_only in Bio::SearchIO::blast.pm.
> > But it only return 1/0. So my question is how to use this method to get
> the
> > best hit.
> >
> > Thank you very much!
> >
> > Boyang
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>



-- 
Jordi


More information about the Bioperl-l mailing list