[Bioperl-l] Return $hit->name by Score Bit value when parsing blast result

Jason Stajich jason.stajich at duke.edu
Fri Aug 12 08:06:07 EDT 2005


They are supposed to be returned in the order they are found in the  
report -- although I remember there may be something inconsistent  
with the code added to handle PSIBlast parsing too.  I've not yet  
investigated this so so I don't know whether or not it is a bug.


At any rate, you can always collect all the Hits into an array an  
sort them:

my @hits = $result->hits;
for my $hit ( sort { $a->bits <=> $b->bits } @hits ) {

}

If you read the documentation for Bio::Search::Result::ResultI you'll  
see a 'sort_hits' function which should also allow you to provide a  
sorting function to control the order of the hits.

-jason
On Aug 12, 2005, at 3:53 AM, Andrew Leung wrote:

> Hi,
>
> I did a StandAloneBlast and this resulted in a blast result object.  
> When I
> use obj->next_result and obj->next_hit methods to list the hit name
> (hit->name), I found that they are not returned in an order that is  
> similar
> to a standard blast result. In a standard blast report, we are  
> familiar with
> the fact that hits are ordered by score bit values. With bioperl,  
> how can I
> list the hits by score bits? Shall I manually extract all the hits'  
> score
> bit and then do a hash sorting? Or, they are a better way to  
> achieve it.
>
> Andrew
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12/




More information about the Bioperl-l mailing list