Collapsing poorly supported nodes into polytomies in R - using 'Phangorn' and 'ape'
2
2
Entering edit mode
9.6 years ago
confusedious ▴ 470

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.

phylogenetics Phangorn R polytomies ape • 9.3k views
ADD COMMENT
3
Entering edit mode
9.6 years ago
Brice Sarver ★ 3.8k

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 COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode
5.9 years ago
emre.cto • 0

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.)

https://itol.embl.de/

ADD COMMENT

Login before adding your answer.

Traffic: 2415 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6