The problem I am working on right now requires that, given a phylogenetic tree object in R and a particular tip of that tree, I need to find the sum of all the branch lengths up to that tip. Finding this for either a phylo or a phylo4 object would be equivalent, as I can freely convert between the two kinds of object.
I imagine that this should not be to complicated. The package "phylobase" provides a function for finding all the ancestors of a prespecified node, and we can access the edge lengths on a tree using @edge.lengths for a phylo4 object.
However, I'm having trouble accessing the edges that I need without resorting to string manipulation on the edge labels. Does anyone know of a more direct way to solve this problem?