combine_trees | R Documentation |
Returns a graph representing the consensus tree between two phylogenetic trees.
combine_trees(
phylotree_1,
phylotree_2,
palette = GeRnika::palettes$Simpsons,
labels = FALSE
)
phylotree_1 |
A |
phylotree_2 |
A |
palette |
A vector composed by the hexadecimal code of three colors. "The Simpsons" palette used as default. |
labels |
A boolean, if |
a dgr_graph
object representing the consensus graph between phylotree_1
phylotree_2
.
# Load the predefined B matrices of the package
B_mats <- GeRnika::B_mats
B_real <- B_mats[[2]]$B_real
B_alg1 <- B_mats[[2]]$B_alg1
# Generate the tags for the genes of
# the phyogenetic tree
tags <- LETTERS[1:nrow(B_real)]
# Instantiate two \code{Phylotree} class objects on
# the basis of the B matrices
phylotree_real <- B_to_phylotree(
B = B_real,
labels = tags)
phylotree_alg1 <- B_to_phylotree(
B = B_alg1,
labels = tags)
# Create the consensus tree between phylotree_real
# and phylotree_alg1
consensus <- combine_trees(
phylotree_1 = phylotree_real,
phylotree_2 = phylotree_alg1)
# Render the consensus tree
DiagrammeR::render_graph(consensus)
# Load another palette
palette_1 <- GeRnika::palettes$Lancet
# Create the consensus tree between phylotree_real
# and phylotree_alg1 using tags and another palette
consensus_tag <- combine_trees(
phylotree_1 = phylotree_real,
phylotree_2 = phylotree_alg1,
palette = palette_1,
labels = TRUE)
# Render the consensus tree using tags and the
# selected palette
DiagrammeR::render_graph(consensus_tag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.