View source: R/consensus_taxonomies.R
consensus_taxonomies | R Documentation |
Given a rooted phylogenetic tree and taxonomies for all tips, compute corresponding consensus taxonomies for all nodes in the tree based on their descending tips. The consensus taxonomy of a given node is the longest possible taxonomic path (i.e., to the lowest possible level) such that the taxonomies of all descending tips are nested within that taxonomic path. Some tip taxonomies may be incomplete, i.e., truncated at higher taxonomic levels. In that case, consensus taxonomy building will be conservative, i.e., no assumptions will be made about the missing taxonomic levels.
consensus_taxonomies(tree, tip_taxonomies = NULL, delimiter = ";")
tree |
A rooted tree of class "phylo". |
tip_taxonomies |
Optional, character vector of length Ntips, listing taxonomic paths for the tips. If |
delimiter |
Character, the delimiter between taxonomic levels (e.g., ";" for SILVA and Greengenes taxonomies). |
Examples:
If the descending tips of a node have taxonomies "A;B;C" and "A;B;C;D" and "A;B;C;E", then their consensus taxonomy is "A;B;C".
If the descending tips of a node have taxonomies "A;B" and "A;B;C;D" and "A;B;C;E", then their consensus taxonomy is "A;B".
If the descending tips of a node have taxonomies "X;B;C" and "Y;B;C", then their consensus taxonomy is "" (i.e., empty).
A character vector of length Nnodes, listing the inferred consensus taxonomies for all nodes in the tree.
Stilianos Louca
place_tips_taxonomically
# generate a random tree
tree = generate_random_tree(list(birth_rate_factor=0.1), max_tips=7)$tree
# define a character vector storing hypothetical tip taxonomies
tip_taxonomies = c("R;BB;C", "AA;BB;C;DD", "AA;BB;C;E",
"AA;BB", "AA;BB;D", "AA;BB;C;F", "AA;BB;C;X")
# compute consensus taxonomies and store them in the tree as node labels
tree$node.label = castor::consensus_taxonomies(tree,
tip_taxonomies = tip_taxonomies,
delimiter = ";")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.