[Bioperl-l] parse blast report for the best evalue

Chris Fields cjfields at uiuc.edu
Mon Apr 9 16:50:05 UTC 2007


You should probably use sort_hits() with a coderef that sorts by  
evalue to ensure that you retrieve the best evalue (significance()  
for hits) (see POD for Bio::Search::Result::ResultI).  You could then  
do something like:

my $hit;

unless ($result->no_hits_found) {
    # pass coderef to sort by evalue
    $result->sort_hits(\&sort_by_evalue);
    # retrieve first (best) hit
    $hit = $result->next_hit;
}

# do whatever you want with the best Hit

If you plan on retaining data from hits over a ton of different  
reports it may be best (memory-wise) to only retain the data you want  
for each hit instead of retaining the actual object.  For instance,  
if you only care about the description and evalue set up a simple  
data structure to house what you want by the query data instead of  
retaining all the extra stuff in the Hit object you don't need (all  
the HSP data, etc).

chris

On Apr 8, 2007, at 11:18 PM, DeeGee wrote:

>
> hi all,
> i'm trying to parse a blast report using Bio::SearchIO as follows,  
> but since
> this blast report is generated with many against many (database) fasta
> sequences, there're many individual blast reports (one for each of the
> sequence from the query file). i was wondering if there is a way to  
> get only
> the best hit (with best evalue) from each one of them.
>
> ##### part of my script ######
> my $in = new Bio::SearchIO(-format => 'blast',  -file   =>  
> $blast_report);
> while( my $result = $in->next_result ) {
>         while( my $hit = $result->next_hit ) {
>               ...........
>
> thanks.
>
>
> -- 
> View this message in context: http://www.nabble.com/parse-blast- 
> report-for-the-best-evalue-tf3545784.html#a9898358
> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign






More information about the Bioperl-l mailing list