Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Collapse a phylogenetic clade by support values
#Code to collapse a phylogeny by a tree's support values, when nodes have support value names
#tree = phylogenetic tree, cutoff = support value cutoff (can be changed or made into a vector)
h <- which(tree$node.label < cutoff)
nodes <- matrix(h + Ntip(tree))
nodes <- nodes[-1]
k <- matrix(tree$edge[,2])
j <- matrix(nrow = length(i), ncol = 1)
for (i in 1:length(nodes)){
j[i] = which(k == nodes[i])
tree$edge.length[j] <- 0
newtree <- di2multi(tree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.