[Bioperl-l] Bio::Species irritated with "unclassified sequences"

Charles Tilford charles.tilford at bms.com
Thu May 20 20:27:27 UTC 2010


Bio::Species::classification() is irritated with me when I provide it 
with a @class_array that is composed of one node, particularly:

$obj->classification("unclassified sequences")

AFAICT this is a valid, single node taxa "tree":

http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=12908

Subroutine classification is expecting at least two class members, the 
problem with the above call crops up as:

Use of uninitialized value $vals[1] in quotemeta at /stf/biocgi/tilfordc/patch_lib/Bio/Species.pm line 179
( $Id: Species.pm 16700 2010-01-15 19:50:11Z dave_messina $)


... and the relevant code is:

sub classification {
     my ($self, @vals) = @_;

     if (@vals) {
         if (ref($vals[0]) eq 'ARRAY') {
             @vals = @{$vals[0]};
         }

         # make sure the lineage contains us as first or second element
         # (lineage may have subspecies, species, genus ...)
         my $name = $self->node_name;
         my ($genus, $species) = (quotemeta($vals[1]), quotemeta($vals[0]));


That is, it's expecting at least (species, genus) in the array. Am I 
misusing classification(), or Bio::Species in general? I know it's named 
"Species", but I've been using it as a generic tree object for arbitrary 
taxonomy nodes, not just species and subspecies. This block a little 
lower down:

         unless ($self->rank) {
             # and that we are rank species
             $self->rank('species');
         }


... implies that the module can be used for taxa ranks other than 
species. However, doing so would not prevent the module being aggravated 
over a null $vals[1].

The use case here is building Bio::Seq::RichSeq objects pulled from a 
(very large) sequence database, and then dumped / displayed with SeqIO. 
Most are well behaved, but there's a non-trivial number of 'artificial' 
constructs that don't root to an organism.

-CAT






More information about the Bioperl-l mailing list