[Bioperl-l] parsing blast results

Chris Fields cjfields at uiuc.edu
Tue Feb 27 09:11:37 EST 2007

On Feb 27, 2007, at 7:26 AM, Luba Pardo wrote:

> Hi,
> I am using the module Bio::SearchIO to parse some blast results. I  
> would
> like to store the ids of the results into an array but I am not  
> sure if this
> is possible to do it with an existing subroutine. Does anyone have  
> an idea
> whether there is a method included within the module Bio::SearchIO  
> to do so?
> Thanks in advance,
> L.Pardo

Bio::SearchIO doesn't currently have a method to retrieve all the  
accessions in a BLAST result.  The best way to do this is to iterate  
through the objects:

my @accs;

while (my $result = $searchio->next_result) {
     while (my $hit = $result->next_hit) {
         push @accs, $hit->accession;
         # do whatever else here...

print join ',', @accs;

I don't think all accessions in the description are parsed out at the  
moment, just the first one (or the one in the hit table).  If you  
want all of them or if you want the NCBI GI you'll need to parse them  
out of the description heading ($hit->description).


More information about the Bioperl-l mailing list