Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* 02species.t now compared to similarly behaving instance, also creat…

…es comparable array

* remove debugging lines

svn path=/bioperl-db/trunk/; revision=15998
  • Loading branch information...
commit 184df9db6b3ea4f9e2d272cd08b4e39d89a5d3c2 1 parent 3e7e0b7
cjfields authored
Showing with 16 additions and 15 deletions.
  1. +1 −1  lib/Bio/DB/BioSQL/SpeciesAdaptor.pm
  2. +15 −14 t/02species.t
View
2  lib/Bio/DB/BioSQL/SpeciesAdaptor.pm
@@ -96,7 +96,6 @@ use strict;
use Bio::DB::BioSQL::BasePersistenceAdaptor;
use Bio::DB::PersistentObjectI;
use Bio::Species;
-use Data::Dumper;
@ISA = qw(Bio::DB::BioSQL::BasePersistenceAdaptor);
@@ -265,6 +264,7 @@ sub populate_from_row{
# get the classification array in a separate query
my $clf = $self->get_classification($rows->[0]);
if($clf && ref $clf eq 'ARRAY') {
+
# for the species object we do not maintain the nodes that don't
# correspond to a standard rank, so remove them (e.g., 'root')
while($clf->[0]->[1] && ($clf->[0]->[1] eq "no rank")) {
View
29 t/02species.t
@@ -1,6 +1,9 @@
# -*-Perl-*-
# $Id$
+use strict;
+use warnings;
+
BEGIN {
use lib 't';
use Bio::Root::Test;
@@ -9,30 +12,28 @@ BEGIN {
use_ok('Bio::Species');
}
-$biosql = DBTestHarness->new("biosql");
+my $biosql = DBTestHarness->new("biosql");
ok $biosql;
-$db = $biosql->get_DBAdaptor();
+my $db = $biosql->get_DBAdaptor();
ok $db;
-$s = Bio::Species->new('-classification' => [reverse(
- qw(Eukaryota Metazoa Chordata
- Vertebrata Mammalia Eutheria
- Primates Catarrhini Hominidae
- Homo sapiens))]);
-$p_s = $db->create_persistent($s);
+my $s = Bio::Species->new('-classification' => [reverse(
+ qw(Eukaryota Metazoa Chordata Vertebrata Mammalia Eutheria
+ Primates Catarrhini Hominidae Homo), 'Homo sapiens')]);
+my $p_s = $db->create_persistent($s);
ok $p_s;
isa_ok $p_s,"Bio::DB::PersistentObjectI";
isa_ok $p_s,"Bio::Species";
$p_s->create();
-$dbid = $p_s->primary_key();
+my $dbid = $p_s->primary_key();
ok $dbid;
-$adp = $db->get_object_adaptor($s);
+my $adp = $db->get_object_adaptor($s);
ok $adp;
isa_ok $adp,"Bio::DB::PersistenceAdaptorI";
-$dbobj = $adp->find_by_primary_key($dbid);
+my $dbobj = $adp->find_by_primary_key($dbid);
is ($dbobj->species, $s->species);
is ($dbobj->genus, $s->genus);
@@ -43,7 +44,7 @@ while(@dbclf || @clf) {
is (shift(@dbclf), shift(@clf));
}
-$dbobj2 = $adp->find_by_unique_key($s);
+my $dbobj2 = $adp->find_by_unique_key($s);
ok $dbobj2;
if($dbobj2) {
is ($dbobj2->primary_key(), $dbobj->primary_key());
@@ -76,8 +77,8 @@ if($dbobj2) {
is ($dbobj2->genus, $s->genus);
is ($dbobj2->binomial, $s->binomial);
is ($dbobj2->ncbi_taxid, $s->ncbi_taxid);
- is ($dbobj2->common_name, "human");
- is ($dbobj2->sub_species, "subsp. sapiens");
+ is ($dbobj2->common_name, $p_s->common_name);
+ is ($dbobj2->sub_species, $p_s->sub_species);
is (scalar($dbobj2->classification), scalar($s->classification));
@dbclf = $dbobj->classification();
@clf = $s->classification();
Please sign in to comment.
Something went wrong with that request. Please try again.