[Bioperl-l] [Quick help needed] Getting Organism info using NCBI Accession numbers : sample code included

Abhishek Pratap abhishek.vit at gmail.com
Wed Apr 20 13:14:04 EDT 2011


Hi John

Thanks for your reply. I think your code does exactly what I needed. In
batch cases it runs a bit slow but still able to fetch lineage using NCBI
Accession.

FYI : I love the speed of Bio::LITE::Taxonomy but it only works on NCBI GI.

So I am wondering if I can convert Accession -> GI quickly then I can get my
results far more faster.

-Abhi

On Mon, Apr 18, 2011 at 10:30 AM, John SJ Anderson <genehack at genehack.org>wrote:

> On Fri, Apr 15, 2011 at 18:39, Abhishek Pratap <abhishek.vit at gmail.com>
> wrote:
>
> > I want to seach NCBI for Locus name "CP000490" and get the organism
> lineage
>
> Maybe this will at least get you started:
>
> #! /opt/perl/bin/perl
>
> use strict;
> use warnings;
> use 5.010;
>
> use Bio::DB::GenBank;
>
> my @ids = qw( NW_001884661 EZ361133 CP000490 );
> my $gbh = Bio::DB::GenBank->new();
>
> foreach my $id( @ids ) {
>  say "* ID: $id";
>  my $seq = $gbh->get_Seq_by_acc( $id );
>  my $org = $seq->species;
>  say join ' ' , $org->classification , "\n";
> }
>
>
> j.
>


More information about the Bioperl-l mailing list