clusteringDendrogram | R Documentation |
A simple function using ggdendro
to make a sample dendrogram
clusteringDendrogram(
plotmatrix,
experiment,
colorby = NULL,
cor_method = "pearson",
cluster_method = "ward.D",
plot_title = "",
labelspace = 0.2,
palette = NULL,
palette_name = "Set1"
)
plotmatrix |
Expression/ other data matrix |
experiment |
Annotation for the columns of plotmatrix |
colorby |
Column name in |
cor_method |
Correlation method, passed to cor() (default: pearson). |
cluster_method |
Clustering method, passed to hclust() (default: ward.D). |
plot_title |
Plot title |
labelspace |
Vertical fraction of plot to be used for labels (default: 0.2). |
palette |
Palette of colors, one for each unique value derived from
|
palette_name |
Valid R color palette name |
output A ggplot
output
# Make a dendrogram with the data in airway
require(airway)
data(airway, pakckage = "airway")
clusteringDendrogram(assays(airway)[[1]], data.frame(colData(airway)), colorby = "dex")
# Do the same, but only usig the 1000 most variant rows and see how the
# clustering improves.
mymatrix <- assays(airway)[[1]]
mymatrix <- mymatrix[order(apply(mymatrix, 1, var), decreasing = TRUE)[1:1000], ]
clusteringDendrogram(mymatrix, data.frame(colData(airway)), colorby = "dex")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.