Subject: | Bio::Phylo::Treedrawer: _y_internals - Some Nodes do not have a y-coordinate |
Date: | Tue, 08 May 2007 13:36:05 +0200 |
To: | bug-Bio-Phylo [...] rt.cpan.org |
From: | Stephan Struckmann <struckma [...] uni-greifswald.de> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
unfortunately I have to post a real bug: Under certain conditions (I
think, it depends on the node degree), some nodes are placed with
(x,y)=(x,0). This is because they don't get an y-coordinate in
_y_internals. This function runs only until the root has an y
coordinate, but the root can get one before all the other nodes have
this coordinate, if their y-coordinate is not necessary to position
the root: Only the first and the last daughter are needed to place a
node, not all. I observed this error really with the tree below. I
propose the following patch:
sub _y_internals {
my $self = shift;
my $tree = $self->get_tree;
my $ready = 0 ;
# while ( !$tree->get_root->get_generic('y') ) { This is the
first old line to be replaced
while ( !$ready ) { #
This is my proposal
$ready = 1 ;
foreach my $e ( @{ $tree->get_internals } ) {
my $y1 = $e->get_first_daughter->get_generic('y');
my $y2 = $e->get_last_daughter->get_generic('y');
if ( $y1 && $y2 ) {
my $y = ( $y1 + $y2 ) / 2;
$e->set_generic( 'y' => $y );
# } This is the second old line to be replaced
} else { $ready = 0 ; } # This is my proposal
}
}
}
Greetings from Germany,
Stephan
-
-----------------------------------------------------------------------------
The tree (Euarchontoglires was misplaced, I think):
(
'Gallus gallus':4,
(
'Ornithorhynchus anatinus':4,
(
(
'Trichosurus vulpecula':4,
Macropus:4
)Diprotodontia:4,
(
'Orycteropus afer':4,
(
(
(
Otolemur:4,
(
(
Eulemur:4,
Lemur:4
)Lemuridae:4,
Microcebus:4
)Lemuriformes:4
)Strepsirrhini:4,
(
(
(
'Homo sapiens':4,
'Pan troglodytes':4
)'Homo/Pan/Gorilla group':4,
(
'Colobus guereza':4,
(
Papio:4,
Cercopithecus:4,
'Macaca mulatta':4
)Cercopithecinae:4
)Cercopithecidae:4
)Catarrhini:4,
(
'Aotus azarai':4,
Callicebus:4,
Callithrix:4
)Platyrrhini:4
)Simiiformes:4
)Primates:4,
(
Cavia:4,
(
'Mus musculus':4,
'Rattus norvegicus':4
)Murinae:4
)Rodentia:4
)Euarchontoglires:4,
(
'Erinaceus europaeus':4,
(
Carolliinae:4,
Rhinolophidae:4
)Microchiroptera:4,
(
Sus:4,
(
Bos:4,
'Ovis aries':4
)Bovidae:4
)Cetartiodactyla:4,
'Equus caballus':4,
(
Canis:4,
Felis:4
)Carnivora:4
)Laurasiatheria:4,
'Dasypus novemcinctus':4
)Eutheria:4
)Theria:4
)Mammalia:4
)Amniota:4;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGQGCk8viug4UfhY8RAmg3AJ90QrTz6wLfVT//0XoWTXvMq6TsNQCgqoZ/
6F86sJlodrTPP66t4OepkD8=
=PRgE
-----END PGP SIGNATURE-----
Message body not shown because it is not plain text.