[Bioperl-l] How to use gi2taxonid

Chris Fields cjfields at uiuc.edu
Mon Jul 10 21:09:12 UTC 2006


Hubert,

In case you didn't get this going, there may be another option now.  I have
started work on a new set of modules called Bio::DB::EUtilities in
bioperl-live, intended as a back-end for NCBI database searches.  It can be
used directly if needed though.  You can use EPost/Elink to directly
retrieve the taxonIDs using the following script (pass a file containing the
protein/nucleotide primary ID on command line).  The below retrieves
taxonid's using protein GI's:


use Bio::DB::EUtilities;
my @ids;

while (my $id = <>) {
    chomp $id;
    push @ids, $id;
}

my $epost = Bio::DB::EUtilities->new(
                                       -eutil       => 'epost',
                                       -db          => 'protein',
                                       -id          => \@ids,
                                      );

$epost->get_response;

my $elink = Bio::DB::EUtilities->new(
                                     -eutil        => 'elink',
                                     -cookie        => $epost->next_cookie,
                                     -db           => 'taxonomy',
                                     );

$elink->get_response;

my @tax_ids = $elink->get_db_ids;



Chris

> hi,
> I have downloaded the gi2taxonid file to get the taxonid for a GI  
> number
> taken from a report as recommended here, but I don't know how to  
> use the
> gi2taxonid file.
> Jason wrote in a previous post that you have to make a DB_File out of
> it, but I don't know how....and finally tie it to a hash....
> Can anybody give me a hint how to use it..... my final goal is to get
> the taxonomy.
>
> thanks
> Hubert

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





More information about the Bioperl-l mailing list