[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Bioperl-l] branch length score - total length of the spanning subtree Sendu Bala Mon Jul 07 21:17:12 2008

Hilmar Lapp wrote:

On Mar 4, 2008, at 9:37 AM, Sendu Bala wrote:

Daniel Gerlach wrote:
I would like to use bioperl to calculate a branch length score for a given set of nodes and a tree. I know how to get the total branch length by using $tree->total_branch_length, but how could I get the length of the subtree spanning some given nodes which are dispersed over the whole tree (a subset of nodes from the tree which are not monophyletic)?

One 'cheat' way of doing it might be to use splice(-keep_ids => [EMAIL PROTECTED]) or similar, then run total_branch_length() on that. No idea if it will actually give you the right answer though. Let us know! :)

Related to that, will contract_linear_paths() actually do the right thing and adjust branch lengths if it removes internal nodes with outdegree 1?

I think ultimately it boils down to remove_Descendent() being called as appropriate which does the branch length alteration. From a glance I can't answer your question with certainly, but it 'should' do the right thing. It needs to be tested; when I implemented these things I was only concerned with tree topology, not branch lengths or anything else.

Bioperl-l mailing list