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

John SJ Anderson genehack at genehack.org
Mon Apr 18 17:30:18 UTC 2011


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