Bio::Species.pm (Rel.0.60)

Hilmar.Lapp@pharma.novartis.com Hilmar.Lapp@pharma.novartis.com
Fri, 5 May 2000 08:24:28 -0400


Full_Name: Hilmar Lapp
Module: Bio::Species
Version: Rel.0.60
OS: Irix
Submission from: fw7.novartis.com (194.191.169.70)


Dear all,

there is a bug in Bio::Species.pm concerning how
species, genus, and subspecies are stored and retrieved, leading
to $species->species() returning an empty string and
$species->genus() returning the species name, if the sequence
objects were generated by running GenBank or EMBL files through
Bio::SeqIO (formats 'genbank', or 'embl').

While $species->species() and $species->genus() both
access the @classification array internally, $species->sub_species()
doesn't. This leads to a problem when the @classification
array is set by modules like Bio::SeqIO::genbank.pm and
Bio::SeqIO::embl.pm which seem to know (should they despite
it's not documented in Species.pm?) that setting $species->classification(@ary)
will suffice. Doing so, those modules even add subspecies to
@classification for which Species.pm is not prepared.

Enclosed is a patch for Bio::Species.pm which fixes this.
As a consequence, the array passed to $species->classification(@ary)
is now required to have the subspecies as the very first
element of the array, which should be added to the
documentation. Since subspecies is obviously a part of the
classification if it is important enough to be specified in a sequence
databank entry, it should be generally there, even though it
will be mostly empty.

Cheers,

	Hilmar

If the patch gets corrupted through this web interface, I can resend it.
Just let me know.

-------------------------------------------------------------------------
Hilmar Lapp                        email: Hilmar.Lapp@pharma.novartis.com
NFI IFD/Bioinformatics             phone: +43 1 86634 631 (work)
Brunner Str. 59                           +43 1 8132951   (home)
A-1235 Vienna                      fax:   +43 1 86634 727
-------------------------------------------------------------------------

*** Species.pm.orig     Fri May  5 14:18:07 2000
--- Species.pm  Fri May  5 15:20:12 2000
***************
*** 91,99 ****
             @classification = $self->classification();
   Function: Fills or returns the classifcation list in
             the object.  The array provided must be in
!            the order SPECIES, GENUS ---> KINGDOM.
!            The first element of the array, the species,
!            must be in lower case, and the rest in title
             case.  Only species must be present.
   Example : $self->classification(qw( sapiens Homo Hominidae
             Catarrhini Primates Eutheria Mammalia Vertebrata
--- 91,99 ----
             @classification = $self->classification();
   Function: Fills or returns the classifcation list in
             the object.  The array provided must be in
!            the order SUBSPECIES, SPECIES, GENUS ---> KINGDOM.
!            The first and second element of the array, the subspecies and
!            species, must be in lower case, and the rest in title
             case.  Only species must be present.
   Example : $self->classification(qw( sapiens Homo Hominidae
             Catarrhini Primates Eutheria Mammalia Vertebrata
***************
*** 113,127 ****
          # Check the names supplied in the classification string
          {
              # Species should be in lower case
!             my $species = $classification[0];
              $self->validate_species_name( $species );
  
              # All other names must be in title case
!             for (my $i = 1; $i < @classification; $i++) {
                  $self->validate_name( $classification[$i] );
              }
          }
!         
          # Store classification
          $self->{'classification'} = [ @classification ];
      } else {
--- 113,127 ----
          # Check the names supplied in the classification string
          {
              # Species should be in lower case
!             my $species = $classification[1];
              $self->validate_species_name( $species );
  
              # All other names must be in title case
!             for (my $i = 2; $i < @classification; $i++) {
                  $self->validate_name( $classification[$i] );
              }
          }
! 
          # Store classification
          $self->{'classification'} = [ @classification ];
      } else {
***************
*** 191,199 ****
      
      if ($species) {
          $self->validate_species_name( $species );
!         $self->{'classification'}[0] = $species;
      } else {
!         return $self->{'classification'}[0];
      }
  }
  
--- 191,199 ----
      
      if ($species) {
          $self->validate_species_name( $species );
!         $self->{'classification'}[1] = $species;
      } else {
!         return $self->{'classification'}[1];
      }
  }
  
***************
*** 209,221 ****
  =cut
  
  sub sub_species{
!    my $obj = shift;
     if( @_ ) {
        my $value = shift;
!       $obj->{'sub_species'} = $value;
      }
!     return $obj->{'sub_species'};
! 
  }
  
  =head2 genus
--- 209,220 ----
  =cut
  
  sub sub_species{
!    my $self = shift;
     if( @_ ) {
        my $value = shift;
!       $self->{'classification'}[0] = $value;
      }
!     return $self->{'classification'}[0];
  }
  
  =head2 genus
***************
*** 237,245 ****
      
      if ($genus) {
          $self->validate_name( $genus );
!         $self->{'classification'}[1] = $genus;
      } else {
!         return $self->{'classification'}[1];
      }
  
  }
--- 236,244 ----
      
      if ($genus) {
          $self->validate_name( $genus );
!         $self->{'classification'}[2] = $genus;
      } else {
!         return $self->{'classification'}[2];
      }
  
  }


=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl-guts.html
====================================================================