plot.DesignContrast: Plot a DesignContrast object with two heatmaps

plot.DesignContrastR Documentation

Plot a DesignContrast object with two heatmaps

Description

The function plots a ComplexHeatmap containing two matrices, one of the design matrix and the other of the contrast matrix.

Usage

## S3 method for class 'DesignContrast'
plot(
  x,
  y = NULL,
  title = NULL,
  clusterDesign = FALSE,
  clusterSamples = FALSE,
  clusterContrasts = FALSE,
  designRange = NULL,
  contrastRange = NULL,
  designParams = NULL,
  contrastParams = NULL,
  ...
)

Arguments

x

A DesignContrast object

y

NULL, ignored

title

Title of the object, used in the title of the heatmaps

clusterDesign

Logical, cluster rows of the design matrix

clusterSamples

Logical, cluster columns of the design matrix

clusterContrasts

Logical, cluster rows of the contrast matrix (notice that the contrast matrix required by limma is the transposed contrast matrix)

designRange

NULL or a vector of length 2, giving range of the design matrix to be visualized. If NULL, the whole range is used.

contrastRange

NULL or a vector of length 2, giving range of the contrast matrix to be visualized. If NULL, a symmetric range of the largest absolute value and its negate is used.

designParams

Other parameters passed to Heatmap for the design matrix

contrastParams

Other parameters passed to Heatmap for the contrast matrix

...

Ignored

Value

Heatmap object

Examples

myFac <- gl(3,3, labels=c("baseline", "treat1", "treat2"))
myDesign <- model.matrix(~myFac)
colnames(myDesign) <- c("baseline", "treat1", "treat2")
myContrast <- limma::makeContrasts(contrasts=c("treat1", "treat2"), levels=myDesign)
res1 <- DesignContrast(myDesign, myContrast, groups=myFac)
res2 <- DesignContrast(myDesign, myContrast, groups=myFac, dispLevels=c("C", "T1", "T2"))
plot(res1, title="DesCon 1")
plot(res2, title="DesCon 1 (identical)")
plot(res2, title="DesCon 1 (identical)", designRange=c(-2,2), 
    contrastRange=c(-2,1),
    designParams=list(row_names_gp=grid::gpar(fontsize=8)),
    contrastParams=list(column_names_gp=grid::gpar(fontsize=12, color="red")))

bedapub/ribiosExpression documentation built on Feb. 2, 2025, 3:21 p.m.