| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/common_subtrees.R |
| 3 |
\name{common_subtrees_clusters} |
| 4 |
\alias{common_subtrees_clusters} |
| 5 |
\title{Find clusters of common subtrees} |
| 6 |
\usage{ |
| 7 |
common_subtrees_clusters(dend1, dend2, leaves_get_0_cluster = TRUE, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{dend1}{a \link{dendrogram}.} |
| 11 |
|
| 12 |
\item{dend2}{a \link{dendrogram}.} |
| 13 |
|
| 14 |
\item{leaves_get_0_cluster}{logical (TRUE). Should the leaves which are not part of |
| 15 |
a larger common subtree get a unique cluster number, or the value 0.} |
| 16 |
|
| 17 |
\item{...}{not used.} |
| 18 |
} |
| 19 |
\value{ |
| 20 |
An integer vector, with values indicating which leaves in dend1 form |
| 21 |
a common subtree cluster, with ones available in dend2 |
| 22 |
} |
| 23 |
\description{ |
| 24 |
Gets a dend and the output from "nodes_with_shared_labels" |
| 25 |
and returns a vector (length of labels), indicating the clusters |
| 26 |
forming shared subtrees |
| 27 |
} |
| 28 |
\examples{ |
| 29 |
|
| 30 |
|
| 31 |
library(dendextend) |
| 32 |
dend1 <- 1:6 \%>\% |
| 33 |
dist() \%>\% |
| 34 |
hclust() \%>\% |
| 35 |
as.dendrogram() |
| 36 |
dend2 <- dend1 \%>\% set("labels", c(1:4, 6:5)) |
| 37 |
tanglegram(dend1, dend2) |
| 38 |
|
| 39 |
clusters1 <- common_subtrees_clusters(dend1, dend2) |
| 40 |
dend1_2 <- color_branches(dend1, clusters = clusters1) |
| 41 |
plot(dend1_2) |
| 42 |
plot(dend1_2, horiz = TRUE) |
| 43 |
tanglegram(dend1_2, dend2, highlight_distinct_edges = FALSE) |
| 44 |
tanglegram(dend1_2, dend2) |
| 45 |
} |
| 46 |
\seealso{ |
| 47 |
\link{color_branches}, \link{tanglegram} |
| 48 |
} |