[Bioperl-l] root node branch length in newick trees writtenincorrectly
Dave Messina
David.Messina at sbc.su.se
Thu Apr 1 14:32:55 UTC 2010
On Apr 1, 2010, at 15:51, Mark A. Jensen wrote:
> Hi Dave,
> The spot in the code you're dealing with looks a little kludgy-- the branch length must fall through to $id when the node in the data file has branch length but no explicit id (like a root node), is that right?
Well, I'm not exactly sure. :) But in case that's true, that's why I left the original code's if block as an elsif.
elsif ( defined $id || defined $bs ) {
$data[-1] .= defined $bs ? $bs : $id;
}
There should probably be an
else {
warn "We should never reach this branch, should we?"
}
following that elsif just in case. Except the lack of an else{} before, I'm not positive that the code isn't relying on the fallthrough.
> Maybe it's more robust to to do a check whether a 'putative id' is actually a float, and shunt it into a branch length variable in that case. (course, maybe ids like "103748923.192934", which would make that bork)... hmm
Yeah. Is there already a method to ask if a node is the root node?
There's $tree->get_root_node() which is kinda close. But I think what we really want is $node->is_root(). I didn't see that in Bio::Tree::NodeI.
Does anyone know if that (or similar) exists?
D
More information about the Bioperl-l
mailing list