MAplotW {wrGraph}R Documentation

MA-plot (differential intensity versus average intensity)

Description

This type of plot for display of relative changes versus (mean) absolute abundance is very common in high-throughput biology, see MA-plot. Basically one compares two independent series of measures (ie gene transcript or protein abundance values) of 2 samples/data-sets or the means of 2 groups of replicates. And the log-fold-change ('Minus'=M) is plotted againts the absolute mean value ('Average'=A). Furthermore, output from statistical testing by moderTest2grp or moderTestXgrp can be directly read to produce MA plots for diagnostic purpose. Please note, that plotting a very high number of points in transparency (eg >10000) may take several seconds.

Usage

MAplotW(
  Mvalue,
  Avalue = NULL,
  useComp = 1,
  filtFin = NULL,
  ProjNa = NULL,
  FCthrs = NULL,
  subTxt = NULL,
  grayIncrem = TRUE,
  col = NULL,
  pch = 16,
  compNa = NULL,
  batchFig = FALSE,
  cexMa = 1.8,
  cexLa = 1.1,
  limM = NULL,
  limA = NULL,
  annotColumn = c("SpecType", "GeneName", "EntryName", "Accession", "Species", "Contam"),
  annColor = NULL,
  cexPt = NULL,
  cexSub = NULL,
  cexTxLab = 0.7,
  namesNBest = NULL,
  NbestCol = 1,
  NaSpecTypeAsContam = TRUE,
  useMar = c(6.2, 4, 4, 2),
  returnData = FALSE,
  callFrom = NULL,
  silent = FALSE,
  debug = FALSE
)

Arguments

Mvalue

(numeric, list or MArrayLM-object) main data to plot; if numeric, the content will be used as M-values (and A-values must be provided separateley); if list or MArrayLM-object, it must conatin list-elements named Mvalue and means to extract all information needed for plotting

Avalue

(numeric, list or data.frame) if NULL it is assumed that M-values can be extracted form argument Avalue

useComp

(integer) choice of one of multiple comparisons present in Mvalue (if generated using moderTestXgrp())

filtFin

(matrix or logical) The data may get filtered before plotting: If FALSE no filtering will get applied; if matrix of TRUE/FALSE it will be used as optional custom filter, otherwise (if Mvalue if an MArrayLM-object eg from limma) a default filtering based on the filtFin element will be applied

ProjNa

(character) custom title

FCthrs

(numeric) Fold-Change threshold (display as line) give as Fold-change and NOT log2(FC)

subTxt

(character) custom sub-title

grayIncrem

(logical) if TRUE, display overlay of points (not exceeding threshold) as increased shades of gray

col

(character) custom color(s) for points of plot (see also par)

pch

(integer) type of symbol(s) to plot (default=16) (see also par)

compNa

depreciated, please use useComp instead

batchFig

(logical) if TRUE figure title and axes legends will be kept shorter for display on fewer splace

cexMa

(numeric) font-size of title, as expansion factor (see also cex in par)

cexLa

(numeric) size of axis-labels, as expansion factor (see also cex in par)

limM

(numeric, length=2) range of axis M-values

limA

(numeric, length=2) range of axis A-values

annotColumn

(character) column names of annotation to be extracted (only if Mvalue is MArrayLM-object containing matrix $annot). The first entry (typically 'SpecType') is used for different symbols in figure, the second (typically 'GeneName') is used as prefered text for annotating the best points (if namesNBest allows to do so.)

annColor

(character or integer) colors for specific groups of annotation (only if Mvalue is MArrayLM-object containing matrix $annot)

cexPt

(numeric) size of points, as expansion factor (see also cex in par)

cexSub

(numeric) size of subtitle, as expansion factor (see also cex in par)

cexTxLab

(numeric) size of text-labels for points, as expansion factor (see also cex in par)

namesNBest

(integer or character, length=1) number of best points to add names in figure; if 'passThr' all points passing FC-filter will be selected; if the initial object Mvalue contains a list-element called 'annot' the second of the column specified in argument annotColumn will be used as text

NbestCol

(character or integer) colors for text-labels of best points

NaSpecTypeAsContam

(logical) consider lines/proteins with NA in Mvalue$annot[,"SpecType"] as contaminants (if a 'SpecType' for contaminants already exits)

useMar

(numeric,length=4) custom margings (see also par)

returnData

(logical) optional returning data.frame with (ID, Mvalue, Avalue, FDRvalue, passFilt)

callFrom

(character) allow easier tracking of messages produced

silent

(logical) suppress messages

debug

(logical) additional messages for debugging

Value

This function plots an MA-plot (to the current graphical device); if returnData=TRUE, a data.frame with ($ID, $Mvalue, $Avalue, $FDRvalue, $passFilt) gets returned

See Also

(for PCA) plotPCAw

Examples

library(wrMisc)
set.seed(2005); mat <- matrix(round(runif(600),2), ncol=6)
rownames(mat) <- c(rep(letters[1:25],each=3), letters[2:26])
MAplotW(mat[,2] -mat[,1], A=rowMeans(mat))
## assume 2 groups with 3 samples each
matMeans <- rowGrpMeans(mat, gr=gl(2,3,labels=LETTERS[3:4]))
MAplotW(M=matMeans[,2] -matMeans[,1], A=matMeans) 
## assume 2 groups with 3 samples each and run moderated t-test (from package 'limma')
tRes <- moderTest2grp(mat, gl(2,3))
MAplotW(tRes$Mval, tRes$Amean)                          
MAplotW(M=tRes$Mval, A=tRes$means, FCth=1.3) 
MAplotW(tRes)
MAplotW(tRes, limM=c(-2,2), FCth=1.3) 


[Package wrGraph version 1.3.7 Index]