plotMD.DGEList {edgeR} | R Documentation

## Mean-Difference Plot of Count Data

### Description

Creates a mean-difference plot (aka MA plot) with color coding for highlighted points.

### Usage

    ## S3 method for class 'DGEList'
    plotMD(object, column=1, xlab="Average log CPM (this sample and others)",
           ylab="log-ratio (this sample vs others)",
           main=colnames(object)[column], status=object$genes$Status,
           zero.weights=FALSE, prior.count=3, ...)
    ## S3 method for class 'DGEGLM'
    plotMD(object, column=ncol(object), coef=NULL, xlab="Average log CPM",
           ylab="log-fold-change", main=colnames(object)[column],
           status=object$genes$Status, zero.weights=FALSE, ...)
    ## S3 method for class 'DGELRT'
    plotMD(object, xlab="Average log CPM", ylab="log-fold-change",
           main=object$comparison, status=object$genes$Status, contrast=1,
           values=names(table(status)), col=NULL, adjust.method="BH", p.value=0.05, ...)
    ## S3 method for class 'DGEExact'
    plotMD(object, xlab="Average log CPM", ylab="log-fold-change",
           main=NULL, status=object$genes$Status, values=names(table(status)),
           col=NULL, adjust.method="BH", p.value=0.05, ...)

### Arguments

`object` | an object of class `DGEList`, `DGEGLM`, `DGEGLM` or `DGEExact`.
`column` | integer, column of `object` to be plotted.
`coef` | alternative to `column` for fitted model objects. If specified, then `column` is ignored.
`xlab` | character string, label for x-axis
`ylab` | character string, label for y-axis
`main` | character string, title for plot
`status` | vector giving the control status of each spot on the array, of same length as the number of rows of `object`. If `NULL` under the `DGEList` or `DGEGLM` method, then all points are plotted in the default color, symbol and size. If `NULL` under the `DGELRT` or `DGEExact` method, then `decideTestsDGE` is run to determine the status of all the genes. The up-regulated DE genes are highlighted in red and down-regulated in blue.
`zero.weights` | logical, should spots with zero or negative weights be plotted?
`prior.count` | the average prior count to be added to each observation. Larger values produce more shrinkage.
`contrast` | integer specifying which log-fold-change to be plotted in the case of testing multiple contrasts. Only used for the `DGELRT` method with multiple contrasts.
`values` | character vector giving values of `status` to be highlighted on the plot. Defaults to unique values of `status`.
`col` | vector of colors for highlighted points, either of unit length or of same length as `values`.
`adjust.method` | character string passed to `decideTestsDGE` specifying p-value adjustment method. Only used when `status` is `NULL`. See `decideTestsDGE` for details.
`p.value` | numeric value between 0 and 1 giving the desired size of the test. Only used and passed to `decideTestsDGE` when `status` is `NULL`.
`...` | other arguments are passed to `plotWithHighlights`.

### Details

A mean-difference plot (MD-plot) is a plot of log fold changes (differences) versus average log values (means). The history of mean-difference plots and MA-plots is reviewed in Ritchie et al (2015).

For `DGEList` objects, a between-sample MD-plot is produced. Counts are first converted to log2-CPM values. An articifial array is produced by averaging all the samples other than the sample specified. A mean-difference plot is then producing from the specified sample and the artificial sample. This procedure reduces to an ordinary mean-difference plot when there are just two arrays total.

If `object` is an `DGEGLM` object, then the plot is an fitted model MD-plot in which the estimated coefficient is on the y-axis and the average logCPM value is on the x-axis. If `object` is an `DGEExact` or `DGELRT` object, then the MD-plot displays the logFC vs the logCPM values from the results table.

The `status` vector can correspond to any grouping of the probes that is of interest. If `object` is a fitted model object, then `status` vector is often used to indicate statistically significance, so that differentially expressed points are highlighted.

The `status` can be included as the component `object$genes$Status` instead of being passed as an argument to `plotMD`.

See `plotWithHighlights` for how to set colors and graphics parameters for the highlighted and non-highlighted points.

### Value

A plot is created on the current graphics device.

### Author(s)

Gordon Smyth

### References

Ritchie, ME, Phipson, B, Wu, D, Hu, Y, Law, CW, Shi, W, and Smyth, GK (2015). limma powers differential expression analyses for RNA-sequencing and microarray studies. Nucleic Acids Research Volume 43, e47. https://doi.org/10.1093/nar/gkv007

### See Also

`plotSmear`

The driver function for `plotMD` is `plotWithHighlights`.

[Package edgeR version 3.24.3 Index]