Learn R Programming

ClassDiscovery (version 3.4.0)

Mosaic: Class "Mosaic"

Description

Produce “Eisen” plots of microarray or proteomics data.

Usage

Mosaic(data,
       sampleMetric="pearson",
       sampleLinkage="average",
       geneMetric="euclid",
       geneLinkage="average",
       usecor=FALSE,
       center=FALSE,
       name="My mosaic")
# S4 method for Mosaic
pltree(x, colors, labels, …)
# S4 method for Mosaic,missing
plot(x, main=x@name, center=FALSE,
  scale=c("none", "row", "column"), limits=NULL,
  sampleColors=NULL, sampleClasses=NULL,
  geneColors=NULL, geneClasses=NULL, …)

Arguments

data

Either a data frame or matrix with numeric values or an ExpressionSet as defined in the BioConductor tools for analyzing microarray data.

sampleMetric

Any valid distance metric that can be passed to the distanceMatrix function

sampleLinkage

Any valid linkage method that can be passed to the hclust function

geneMetric

Any valid distance metric that can be passed to the distanceMatrix function

geneLinkage

Any valid linkage method that can be passed to the hclust function

center

logical scalar. If TRUE, center the data rows.

usecor

logical scalar. If TRUE, scale the data rows to have standard deviation one.

name

character string specifying the name of this object

x

object of class Mosaic

scale

Same as in heatmap.

colors

An optional vector of character strings containing color names to be used when labeling the trees in the dendrogram. If provided, then the length should equal the number of columns in the original data matrix.

labels

An optional vector of character strings used to label the leaves in the dendrogram. If omitted, the column names are used.

main

character string specifying the main title for the plot

limits

An numeric vector. If provided, the data is truncated for display purposes, both above and below, at the minimum and maximum values of limits.

sampleColors

An optional character vector containing colors that will be used to label different sample types with a color bar across the top of the heat map.

sampleClasses

A logical vector or factor used to classify the samples into groups. Alternatively, an integer specifying the number k of groups into which to cut the sample dendrogram.

geneColors

An optional character vector containing colors that will be used to label different gene types with a color bar along the side of the heat map.

geneClasses

A logical vector or factor used to classify the genes into groups. Alternatively, an integer specifying the number k of groups into which to cut the gene dendrogram.

Additional parameters for heatmap.

Value

The Mosaic function constructs and returns a valid object of the Mosaic class.

Objects from the Class

Objects should be created with the Mosaic function.

Slots

data:

The matrix containing the numerical data

samples:

A dendrogram of class hclust produced by clustering the biological samples (columns of data).

genes:

A dendrogram of class hclust produced by clustering the genes (columns of data).

sampleMetric:

A character string; the distance metric used to cluster the samples.

sampleLinkage:

A character string; the linkage rule used to cluster the samples.

geneMetric:

A character string; the distance metric used to cluster the genes.

geneLinkage:

A character string; the linkage rule used to cluster the genes.

call:

An object of class call recording how the object was constructed.

name:

A character string; the name of this object.

Methods

plot

signature(x = Mosaic, y = missing): Produce the “Eisen” plot, using heatmap.

pltree

signature(x = Mosaic): Plot the sample class dendrogram in the object.

summary

signature(object = Mosaic): Write out a summary of the object.

Details

One of the earliest papers in the microarray literature used independent clustering of the genes (rows) and samples (columns) to produce dendrograms that were plotted along with a red-green heat map of the centered expression values. Since that time, literally thousand of additional papers have published variations on these red-green images. R includes a function, heatmap that builds such figures. However, that function is general purpose and has numerous optional parameters to tweak the display. The purpose of the Mosaic class is to provide a simplified object-oriented wrapper around heatmap, which as a side benefit allows us to keep track of the distance metrics and linkage rules that were used to produce the resulting figure.

References

Eisen MB, Spellman PT, Brown PO, Botstein D. Cluster analysis and display of genome-wide expression patterns. Proc Natl Acad Sci U S A. 1998 Dec 8;95(25):14863-8.

See Also

cutree, hclust, heatmap

Examples

Run this code
# NOT RUN {
showClass("Mosaic")

## simulate data from three different sample groups
d1 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
d2 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
d3 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
dd <- cbind(d1, d2, d3)
kind <- factor(rep(c('red', 'green', 'blue'), each=10))

## prepare the Mosaic object
m <- Mosaic(dd,
            sampleMetric='pearson',
            geneMetric='spearman',
            center=TRUE,
            usecor=TRUE)
summary(m)

## The default plot with red-green color map
plot(m, col=redgreen(64))

## change to a blue-yellow color map, and mark the four top splits in the
## sample direction with a color bar along the top
plot(m, col=blueyellow(128), sampleClasses=4,
     sampleColors=c('red', 'green', 'blue', 'black'))

## This time, mark the three classes that we know are there
plot(m, col=blueyellow(128), sampleClasses=kind,
     sampleColors=c('red', 'green', 'blue'))

plot(m, col=blueyellow(128),
     geneClasses=3, geneColors=c('red', 'green', 'black'))

## In addition, mark the top 5 splits in the gene dendrogram
plot(m,
     col=blueyellow(128),
     sampleClasses=kind,
     sampleColors=c('red', 'green', 'black'),
     geneClasses=5,
     geneColors=c('cyan', 'magenta', 'royalblue', 'darkgreen', 'orange'))

## plot the sample dendrogram by itself
cols <- as.character(kind)
pltree(m, labels=1:30, colors=cols)

## cleanup
rm(d1, d2, d3, dd, kind, cols, m)
# }

Run the code above in your browser using DataLab