Description Usage Arguments Details Author(s) See Also Examples
Function which performs a hierarchical cluster analysis of data, drawing a dendrogram, with colorbars for different sample covariate beneath the dendrogram
1 2 |
dataset |
a |
labels |
Vector, labels to be placed on samples in plots. Default is rownames(dataset). |
title |
Character, label to be placed on plots. Default is |
classvec |
A |
covars |
Numeric. The columns of the data.frame classve to be used as class vectors. These will be displayed as color bars under the dendrogram. The default is 1 (column 1). |
returnTree |
Logical. Return the hieracrhical cluster analysis results. Default is |
getPalette |
Function, which generates a palette of colors. The default uses |
... |
further arguments passed to or from other methods. |
The hierarchical plot is produced using average linkage cluster analysis with 1- Pearson's correlation metric. The default set of colors used to generate the color bars of the plots can be changed (see example below). By default, if there is only two levels in the factor, the colors will be black and grey.
Aedin Culhane
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | data(khan)
logkhan<-log2(khan$train)
# Get a character vector which defines which khan samples are cell lines or tissue sample
khanAnnot= cbind(as.character(khan$train.classes),khan$cellType)
print(khanAnnot[1:3,])
# Add 2 color bar, one for cancer subtype, another for cell type under dendrogram
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2), labels=khan$train.classes)
# To change the palette of colors
# Use topo.colors(), see colors() for more help on inbuilt palettes
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2),
labels=khan$train.classes, getPalette=topo.colors)
# To use RColorBrewer Palettes
library(RColorBrewer)
# Use RColorBrewer Dark2 which contains 8 colors
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2),
labels=khan$train.classes, getPalette=function(x) brewer.pal(8,"Dark2")[1:x])
# Use RColorBrewer Set1 which contains 9 colors
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2),
labels=khan$train.classes, getPalette=function(x) brewer.pal(9,"Set1")[1:x])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.