getClade | R Documentation |
This function aims to output the monophyletic group (node number or name) that contains a given set of terminal taxa, and only them.
getClade(tree, taxa, output = "number")
tree |
The phylogenetic tree to provide |
taxa |
The taxa (tips only) forming the monophyletic group (i.e., a monophyletic group is at least composed of two tips). |
output |
Optional. The format of the output (i.e., the node). Can be either the node number according to the |
This function heavy relies on the function getDescendants
from the package phytools, which give all phylogenetical units (i.e., tips and nodes) that are contained in a given clade.
By specifying only some of the descendants of a node, the function returns the apicalmost node uniting them (i.e., the crown group node).
The number or name of the node containing the given tips.
newick_tree<-c("((((A,B),C),(D,E)),F);") # Create a simple tree in NEWICk format
tree<-ape::read.tree(text = newick_tree) # Read it
plot(tree)
ape::nodelabels() # Plot it together with node numbers
taxa<-c("A","B","C") # A monophyletic group
getClade(tree,taxa) # The actual 9 on the phylogeny
getClade(tree,taxa,output="node number") # The node number three going from the root
tree2<-ape::makeNodeLabel(tree,method="number",prefix="N") # Adding names to the nodes
plot(tree2)
ape::nodelabels(tree2$node.label)
getClade(tree2,taxa,output="name")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.