ANJAN PURKAYASTHA | 18 Sep 23:24

Retrieving taxonomy information from a GenBank file

Hi,
I'm using the following code to access the "ORGANISM" tag value for the
record NC_002526.
I get a value of 0 even though the ORGANISM tag  has a value.  Any idea how
this might be corrected?
Thanks.
Anjan

my $gb= new Bio::DB::GenBank;

my $seq = $gb->get_Seq_by_acc('NC_002526');

my $des= $seq->get_tag_values("ORGANISM");

--

-- 
=============================
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142

purkayas [at] wi [dot] mit [dot] edu
703.740.6939
Jason Stajich | 18 Sep 23:56

Re: Retrieving taxonomy information from a GenBank file

You want the species object ($seq->species)  -- see the Seq HOWTO,  
much of the Seq API is explained.
  http://bioperl.org/wiki/HOWTO:Feature-Annotation#The_Species_Object

-jason
On Sep 18, 2008, at 2:27 PM, ANJAN PURKAYASTHA wrote:

> Hi,
> I'm using the following code to access the "ORGANISM" tag value for  
> the
> record NC_002526.
> I get a value of 0 even though the ORGANISM tag  has a value.  Any  
> idea how
> this might be corrected?
> Thanks.
> Anjan
>
>
> my $gb= new Bio::DB::GenBank;
>
> my $seq = $gb->get_Seq_by_acc('NC_002526');
>
> my $des= $seq->get_tag_values("ORGANISM");
>
> -- 
> =============================
> anjan purkayastha, phd
> bioinformatics analyst
> whitehead institute for biomedical research
> nine cambridge center
(Continue reading)

Torsten Seemann | 29 Sep 03:46
Favicon

Re: Retrieving taxonomy information from a GenBank file

Anjan,

>> I'm using the following code to access the "ORGANISM" tag value for the
>> record NC_002526.
>> I get a value of 0 even though the ORGANISM tag  has a value.  Any idea
>> how
>> this might be corrected?
>> my $des= $seq->get_tag_values("ORGANISM");

> You want the species object ($seq->species)  -- see the Seq HOWTO, much of
> the Seq API is explained.
>  http://bioperl.org/wiki/HOWTO:Feature-Annotation#The_Species_Object

Of course Jason is correct here but there was still a semantic bug in
your code anyway which you should probably be aware of.
$seq->get_tag_values() returns an ARRAY which you are trying to store
in a SCALAR ($des). An array, in a scalar context, returns the SIZE of
the array, which in your case was zero (0) as there were no ORGANISM
tags. What you probably meant was:

my($des) = $seq->get_tag_values("ORGANISM");
# or
my $des = ($seq->get_tag_values("ORGANISM")) [ 0 ];

--

-- 
--Torsten Seemann
--Victorian Bioinformatics Consortium, Dept. Microbiology, Monash University
--Tel: 9905 9010 / 0422 923 024

Gmane