Question: Collapsing poorly supported nodes into polytomies in R - using 'Phangorn' and 'ape'
gravatar for confusedious
4.1 years ago by
confusedious400 wrote:

I am currently using the excellent R packages 'Phangorn' and 'ape' to do some parsimony-based phylogenetic analysis with the 'pratchet' fuction (parsimony ratchet) and have encountered a bit of a problem with nodes that I feel should probably be collapsed into polytomies.

At current the bootstrapped trees I am producing contain several nodes with bootstrap supports of either zero or very negligible support (that is the trees contain forced bifurcations). I am calculating the mean bootstrap score for any given tree (I am using numerous variants of the alignment to see which produces the best supported tree on average), and I have solved the problem of nodes with value zero by simply dividing the sum of the node support scores by the number of non-zero nodes. Where I am encountering a problem, however, is that nodes with very negligible support (i.e. less than 10) are of course still being counted, and this results in the mean node bootstrap support jumping way up for any tree that contains nodes with zero support.

A simpler solution would be to collapse nodes with bootstrap scores below a given value into polytomies. This way I could simply calculate the mean node support in a straight-forward manner without worrying about zero nodes or nodes with unacceptably low support.

Using the 'phylo' class objects and functions that are present in 'Phangorn' and 'ape', could anyone advise on how to collapse nodes that have support scores below a user-set value?

Alternatively, is there a way I can ask the 'pratchet' function to produce trees that do not force bifurcations onto poorly (or zero) supported nodes?

Thank you for your help.


ADD COMMENTlink modified 5 months ago by emre.cto0 • written 4.1 years ago by confusedious400
gravatar for Brice Sarver
4.1 years ago by
Brice Sarver2.5k
United States
Brice Sarver2.5k wrote:

The function di2multi() in ape will collapse branches with lengths below a particular threshold into a hard polytomy.

Which tree are you placing support values on? A majority-rule consensus tree? If this is the case, I would read the tree into R, identify branches with low support values, and replace those branch lengths with a value below a threshold passed to di2multi(). If you need a soft polytomy (i.e., still bifurcating but with zero-length branches), I would then randomly resolve polytomies using multi2di(), again in ape.

Depending on the approach, support values may be placed on nodes or on branches, so keep that in mind.

ADD COMMENTlink written 4.1 years ago by Brice Sarver2.5k

Thank you for this Brice. I will give di2multi() a try. After spending some time reading over the code what I have is a parsimony ratchet tree that is then tested for support by bootstrapping rather than a consensus by majority after bootstrapping. This is potentially why some of the node support scores are so very low (I would not expect such low scores with a consensus by majority). On a side note, I will take a look at what can be done about producing a consensus tree from this data and how it might alter my results.

ADD REPLYlink modified 4.1 years ago • written 4.1 years ago by confusedious400

I have just tried using di2multi() to collapse a zero node in a test data set but it is failing with the following error:

Error in di2multi(boottree, tol = 0.1) : the tree has no branch length

On examining the phylo object I get the following:

Phylogenetic tree with 63 tips and 61 internal nodes.

Tip labels:
    Seq1, Seq2, Seq3, Seq4, Seq5, ...
Node labels:
    100, 0, 2, 9, 19, 14, ...

Unrooted; no branch lengths.

I'll have to generate edge lengths.

ADD REPLYlink modified 4.1 years ago • written 4.1 years ago by confusedious400

I solved this using acctran(tree, data) - it added edge lengths. I can now use di2multi() to collapse edges based on a tolerance setting.

Is there another way that this can be done without needing to generate edge lengths? In other words, rather than creating polytomies based on edge lengths shorter than a tolerable value, is it possible to collapse nodes that simply have a poor bootstrap support regardless of edge length?

ADD REPLYlink modified 4.1 years ago • written 4.1 years ago by confusedious400
gravatar for emre.cto
5 months ago by
emre.cto0 wrote:

It has been years since the question was posted but if anyone is still looking for an easy answer, itol allows you to delete the branches under a certain threshold of bootstrap value that you specify. You can extract the resulting tree in any graphical or text format (svg, newick, pdf etc.)

ADD COMMENTlink written 5 months ago by emre.cto0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1731 users visited in the last hour