[Bioperl-l] branch length score - total length of the spanning subtree

Sendu Bala bix at sendu.me.uk
Tue Mar 4 11:37:47 EST 2008


Hilmar Lapp wrote:
> 
> On Mar 4, 2008, at 9:37 AM, Sendu Bala wrote:
> 
>> Daniel Gerlach wrote:
>>> Hello,
>>> 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 => 
>> \@node_ids) 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.



More information about the Bioperl-l mailing list