[Bioperl-l] Retrieving taxonomy information from a GenBank file

Torsten Seemann torsten.seemann at infotech.monash.edu.au
Sun Sep 28 21:46:06 EDT 2008


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


More information about the Bioperl-l mailing list