Last data update: 2014.03.03

R: Plots log-Fold Change versus log-Concentration (or, M versus...
plotSmearR Documentation

Plots log-Fold Change versus log-Concentration (or, M versus A) for Count Data

Description

Both of these functions plot the log-fold change (i.e. the log of the ratio of expression levels for each gene between two experimential groups) against the log-concentration (i.e. the overall average expression level for each gene across the two groups). To represent counts that were low (e.g. zero in 1 library and non-zero in the other) in one of the two conditions, a 'smear' of points at low A value is presented in plotSmear.

Usage

plotSmear(object, pair=NULL, de.tags=NULL, xlab="Average logCPM", ylab="logFC", pch=19,
     cex=0.2, smearWidth=0.5, panel.first=grid(), smooth.scatter=FALSE, lowess=FALSE, ...)

Arguments

object

DGEList, DGEExact or DGELRT object containing data to produce an MA-plot.

pair

pair of experimental conditions to plot (if NULL, the first two conditions are used). Ignored if object is a DGELRT object.

de.tags

rownames for genes identified as being differentially expressed; use exactTest or glmLRT to identify DE genes. Note that ‘tag’ and ‘gene’ are synonymous here.

xlab

x-label of plot

ylab

y-label of plot

pch

scalar or vector giving the character(s) to be used in the plot; default value of 19 gives a round point.

cex

character expansion factor, numerical value giving the amount by which plotting text and symbols should be magnified relative to the default; default cex=0.2 to make the plotted points smaller

smearWidth

width of the smear

panel.first

an expression to be evaluated after the plot axes are set up but before any plotting takes place; the default grid() draws a background grid to aid interpretation of the plot

smooth.scatter

logical, whether to produce a 'smooth scatter' plot using the KernSmooth::smoothScatter function or just a regular scatter plot; default is FALSE, i.e. produce a regular scatter plot

lowess

logical, indicating whether or not to add a lowess curve to the MA-plot to give an indication of any trend in the log-fold change with log-concentration

...

further arguments passed on to plot

Details

plotSmear is a more sophisticated and superior way to produce an 'MA plot'. plotSmear resolves the problem of plotting genes that have a total count of zero for one of the groups by adding the 'smear' of points at low A value. The points to be smeared are identified as being equal to the minimum estimated concentration in one of the two groups. The smear is created by using random uniform numbers of width smearWidth to the left of the minimum A. plotSmear also allows easy highlighting of differentially expressed (DE) genes.

Value

A plot to the current device

Author(s)

Mark Robinson, Davis McCarthy

See Also

maPlot

Examples

y <- matrix(rnbinom(10000,mu=5,size=2),ncol=4)
d <- DGEList(counts=y, group=rep(1:2,each=2), lib.size=colSums(y))
rownames(d$counts) <- paste("gene",1:nrow(d$counts),sep=".")
d <- estimateCommonDisp(d)
plotSmear(d)

# find differential expression
de <- exactTest(d)

# highlighting the top 500 most DE genes
de.genes <- rownames(topTags(de, n=500)$table)
plotSmear(d, de.tags=de.genes)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(edgeR)
Loading required package: limma
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/edgeR/plotSmear.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotSmear
> ### Title: Plots log-Fold Change versus log-Concentration (or, M versus A)
> ###   for Count Data
> ### Aliases: plotSmear
> 
> ### ** Examples
> 
> y <- matrix(rnbinom(10000,mu=5,size=2),ncol=4)
> d <- DGEList(counts=y, group=rep(1:2,each=2), lib.size=colSums(y))
> rownames(d$counts) <- paste("gene",1:nrow(d$counts),sep=".")
> d <- estimateCommonDisp(d)
> plotSmear(d)
> 
> # find differential expression
> de <- exactTest(d)
> 
> # highlighting the top 500 most DE genes
> de.genes <- rownames(topTags(de, n=500)$table)
> plotSmear(d, de.tags=de.genes)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>