[BioRuby] BioRuby: newick parser
Naohisa GOTO
ngoto at gen-info.osaka-u.ac.jp
Tue Mar 13 14:23:26 UTC 2012
Hi Pjotr,
The design of Bio::Tree that a nod has no tree information and
only tree object have node information was what I intended.
This makes easy to split a tree into subtrees, to build a tree
from scratch, to concatenate trees, to replace nodes and edges, etc.
However, as you described, for traversing a static tree,
indirect operations are needed which are sometimes annoying.
Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org
On Mon, 12 Mar 2012 17:24:38 +0100
Pjotr Prins <pjotr.public14 at thebird.nl> wrote:
> On Mon, Mar 12, 2012 at 03:18:48PM +0900, Naohisa GOTO wrote:
> > When writing HOWTO based on BioPerl HOWTO:Trees,
> > (http://bioruby.open-bio.org/wiki/HOWTO:Trees but still incomplete)
> > I'm thinking to add/modify some API about speficying nodes/edges.
>
> After some trying I agree. The Bio::Tree::Node object should know
> 'more' about its state. I would like to do something like:
>
> root.leaf?.should == false
> node = root.childeren.first
> node.leaf?.should == false
> node2 == node.childeren.first
> node.leaf?.should == true
> node2.edge(node).distance.should == 1.34
>
> now I need to do something like
>
> tree = @tree
> node = tree.get_node_by_name('node')
> tree.get_edge(node, tree.parent(node)).distance.should == 1.34
>
> which uses the tree state to get a node edge, and does not feel that
> intuitive.
>
> I'll try to extend Bio::Tree for bio-alignment, see what works.
>
> Pj.
More information about the BioRuby
mailing list