[BioC] plotMA in LIMMA

Gordon Smyth smyth at wehi.EDU.AU
Sat May 19 03:11:45 CEST 2007


Well, one method would be to give lmFit a more 
informative data object in the first place. E.g.,

    library(Biobase)
    y <- new("ExpressionSet",exprs=x)
    fit <- lmFit(y,design)

instead of

    fit <- lmFit(x,design)

Indeed, if your data are Affymetrix expression 
values (all your previous posts have been about 
Affy data), you would ordinarily end up with a 
data object in the first place from rma(), 
gcrma() or vsn(). Apparently you have Affy 
expression values on a file which are already 
background corrected and summarised but not 
normalised. That seems to me an unusual 
situation, as summarised data obtained from the 
internet is usually already normalised.

Another method would be to compute the Amean component yourself:

   fit <- lmFit(x,design)
   fit$Amean <- rowMeans(x,na.rm=TRUE)

At 07:47 PM 18/05/2007, Lev Soinov wrote:
>Dear Gordon and List,
>
>Could you, please recommend the 
>simplest/quickest way to create MAplots using 
>the plotMA function if the data supplied to lmFit is “matrix”?
>In the last versions of limma you removed the 
>calculation of Amean and therefore, plotMA 
>doesn’t work directly on fit objects.
>My Data.txt file is an expression matrix with 30 
>samples, the first columns represent gene IDs (31 columns in total).
>The code that I use is below.
>
>With kind regards,
>
> > s<-scan("Data.txt",what='character')
>Read 387593 items
> > sm<-matrix(s,byrow=TRUE,ncol=31)
> > rownames(sm)<-sm[,1]
> > sm<-sm[,2:ncol(sm)]
> > snn<-apply(sm,2,as.numeric)
> > rownames(snn)<-rownames(sm)
> >
> > signals<-snn

A bit easier would be

   s <- read.delim("Data.txt",sep="")
   signals <- as.matrix(s[,-1])
   rownames(signals) <- s[,1]

Best wishes
Gordon

> > temp<-normalizeBetweenArrays(log2(signals), method="quantile")
> >
> > design <- model.matrix(~0 
> +factor(c(3,2,4,5,1,4,3,6,6,1,2,1,3,5,4,2,5,6,3,4,5,6,1,2,3,4,5,6,1,2)))
> >
> > colnames(design) <- c("Untreated","L1","L2","L1A","L2A","A")
> > contrast.matrix <- 
> makeContrasts(L1-Untreated, L2-Untreated, 
> L1A-Untreated, L2A-Untreated, A-Untreated, levels=design)
> >
> > fit <- lmFit(temp, design)
> > fit2 <- contrasts.fit(fit, contrast.matrix)
> > fit2 <- eBayes(fit2)
> > plotMA(fit2, array=1)
>Error in xy.coords(x, y, xlabel, ylabel, log) :
>         'x' and 'y' lengths differ
>In addition: Warning messages:
>1: is.na() applied to non-(list or vector) in: is.na(x)
>2: no non-missing arguments to min; returning Inf
>3: no non-missing arguments to max; returning –Inf
>
>
> > sessionInfo()
>R version 2.4.1 (2006-12-18)
>i386-pc-mingw32
>
>locale:
>LC_COLLATE=English_United 
>Kingdom.1252;LC_CTYPE=English_United 
>Kingdom.1252;LC_MONETARY=English_United 
>Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
>attached base packages:
>[1] 
>"tools"     "stats"     "graphics"  "grDevices" 
>"utils"     "datasets"  "methods"   "base"
>
>other attached packages:
>      vsn  Biobase    limma
>"1.12.0" "1.12.2"  "2.9.8"



More information about the Bioconductor mailing list