prettyDend {made4} | R Documentation

## Draw hierarchical tree of gene expression data with a colorbar for numerous class vectors

### Description

Function which performs a hierarchical cluster analysis of data, drawing a dendrogram, with colorbars for different sample covariate beneath the dendrogram

### Usage

    prettyDend(dataset, labels = NULL, title = "", classvec = NULL,
     covars=1, returnTree=FALSE, getPalette=getcol,...)

### Arguments

`dataset` | a `matrix`, `data.frame`, `ExpressionSet` or `marrayRaw-class`. If the input is gene expression data in a `matrix` or `data.frame`. The rows and columns are expected to contain the variables (genes) and cases (array samples) respectively.
`labels` | Vector, labels to be placed on samples in plots. Default is rownames(dataset).
`title` | Character, label to be placed on plots. Default is `NULL`.
`classvec` | A `factor` or `vector` or `matrix` or `data.frame` which describes the classes in columns of the `dataset`. Default is `NULL`.
`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 `FALSE`.
`getPalette` | Function, which generates a palette of colors. The default uses `getcol` function in made4. Other examples are provided below
`...` | further arguments passed to or from other methods.

### Details

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.

### Author(s)

Aedin Culhane

### See Also

See also as `overview`, `hclust`

### Examples

      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])

[Package made4 version 1.66.0 Index]