my
$error
;
BEGIN {
$error
= 0;
if
( $@ ) {
}
plan
tests
=> 1;
}
ok(1);
if
(0) {
ok(1);
ok
my
$taxonL
= Bio::Taxonomy::Taxon->new;
ok
$taxonL
->description(
'this could be anything'
);
ok
$taxonL
->taxon(
'could this be called name?'
);
ok
$taxonL
->id(
'could this be called taxid?'
);
skip 1,
$taxonL
->branch_length(
'should accept only numerical values?'
);
ok
$taxonL
->branch_length(5);
ok
$taxonL
->id(
'could this be called taxid?'
);
ok
$taxonL
->rank(
'species'
);
ok
$taxonL
->rank,
'species'
;
skip 1,
$taxonL
->rank(
'foo is not a rank, class variable @RANK not initialised'
);
ok
$taxonL
->to_string,
'"could this be called taxid?":5'
;
my
$taxonR
= new Bio::Taxonomy::Taxon;
my
$taxon
= new Bio::Taxonomy::Taxon(
-id
=>
'ancient'
,
-taxon
=>
'genus'
);
ok
$taxon
->id(),
'ancient'
;
ok
$taxon
->taxon(),
'genus'
;
ok
$taxon
->internal_id, 2;
ok
$taxonL
->internal_id, 0;
ok
$taxon
->add_Descendent(
$taxonL
);
$taxon
->add_Descendent(
$taxonR
);
ok
scalar
$taxon
->each_Descendent, 2;
ok
$taxon
->remove_Descendent(
$taxonR
);
ok
$taxon
->remove_all_Descendents();
$taxon
->add_Descendent(
$taxonL
);
ok
$taxonL
->ancestor->id,
'ancient'
;
ok
$taxonL
->branch_length(5);
ok
$taxonL
->is_Leaf, 1;
ok
$taxon
->is_Leaf, 0;
ok
$taxon
->height, 6;
ok
$taxonL
->height, 5;
ok
$taxon
->invalidate_height,
undef
;
ok
$taxonL
->classify(1), 2;
skip(1,
"skip classify weirdness"
);
skip(1,
"skip classify weirdness"
);
skip(1,
"skip classify weirdness"
);
ok
$taxon
->distance_to_root, 0;
ok
$taxonL
->distance_to_root, 1;
skip(1,
'Skip this weird function'
);
my
$human
=new Bio::Species;
my
$chimp
=new Bio::Species;
my
$bonobo
=new Bio::Species;
$human
->classification(
qw( sapiens Homo Hominidae
Catarrhini Primates Eutheria
Mammalia Euteleostomi Vertebrata
Craniata Chordata
Metazoa Eukaryota )
);
$chimp
->classification(
qw( troglodytes Pan Hominidae
Catarrhini Primates Eutheria
Mammalia Euteleostomi Vertebrata
Craniata Chordata
Metazoa Eukaryota )
);
$bonobo
->classification(
qw( paniscus Pan Hominidae
Catarrhini Primates Eutheria
Mammalia Euteleostomi Vertebrata
Craniata Chordata
Metazoa Eukaryota )
);
my
@ranks
= (
'superkingdom'
,
'kingdom'
,
'phylum'
,
'subphylum'
,
'no rank 1'
,
'no rank 2'
,
'class'
,
'no rank 3'
,
'order'
,
'suborder'
,
'family'
,
'genus'
,
'species'
);
my
$taxonomy
=new Bio::Taxonomy(
-ranks
=> \
@ranks
,
-method
=>
'trust'
,
-order
=> -1);
ok
my
$tree1
=new Bio::Taxonomy::Tree;
my
$tree2
=new Bio::Taxonomy::Tree;
$tree1
->make_species_branch(
$human
,
$taxonomy
);
$tree2
->make_species_branch(
$chimp
,
$taxonomy
);
my
(
$homo_sapiens
) =
$tree1
->get_leaves;
ok
ref
$homo_sapiens
,
'Bio::Taxonomy::Taxon'
;
ok
$tree1
->
splice
(
$tree2
);
ok
$tree1
->add_species(
$bonobo
,
$taxonomy
);
ok
join
(
", "
,
map
{
$_
->taxon}
$tree1
->get_leaves),
'Homo sapiens, Pan troglodytes, Pan paniscus'
;
ok
$tree1
->remove_branch(
$homo_sapiens
);
ok
join
(
", "
,
map
{
$_
->taxon}
$tree1
->get_leaves),
'Pan troglodytes, Pan paniscus'
;
}