[BioC] Sweave & limma mystery

Philipp Pagel p.pagel at wzw.tum.de
Mon Jun 2 22:25:27 CEST 2008


	Hi!

I have a pretty odd (and lengthly to describe) problem involving plotMA
(from package limma) and Sweave: Inside a Sweave document I want to plot
4 MA-plots in one plot device. After the first two plots I set the
weight of all control spots to zero in order remove them from the plot. 
To my surprise, the changed weights appear to have a magic effect on the
two first plots as well when judged by the resulting pdf file. BUT: the
plots Sweave generates in the X11 device in parallel (why does it do
that in the first place?) look fine.

OK - that was quite abstract and hard to understand so here is the
smallest example I was able to put together:

I use the Bob.RData file found here:
http://bioinf.wehi.edu.au/limma/data/Bob.RData

SpotTypes.txt looks like this:

----------------------snip----------------------------------
SpotType        ID      Library Color
gene    *       *       black
control *       Control red
----------------------snip----------------------------------

And here is my report.Snw file:

----------------------snip----------------------------------
\documentclass[11pt]{scrartcl}
\begin{document}
<<echo=F>>=
	require(limma)
	load('Bob.RData')
	spottypes = readSpotTypes()
	RG$genes$Status = controlStatus(spottypes, RG)
	RG$weights <- matrix( rep(1, dim(RG)[1]*dim(RG)[2]), ncol=dim(RG)[2] )
@

Some text here\dots

<<>>=
	MA <- normalizeWithinArrays(RG, bc.method='normexp', method="robustspline", offset=50)
	MA <- normalizeBetweenArrays(MA, method="scale")
@

Even more text here\dots

<<fig=T, echo=F>>=
	oldpar <- par(no.readonly = TRUE)
	par(las=1, cex=0.7, mfrow=c(2,2), oma=c(0,0,0,0))

	plotMA(MA, array=1, legend=F)
	plotMA(MA, array=2, legend=F)
	# hide all control spots
	MA$weights[MA$genes$Status != 'gene', ] <- 0.0
	plotMA(MA, array=1, legend=F)
	plotMA(MA, array=2, legend=F)
	par(oldpar)
@
\end {document}
----------------------snip----------------------------------

in R:

> Sweave('report.Snw')

and then

pdflatex report.tex

My R version/platform:

platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          7.0
year           2008
month          04
day            22
svn rev        45424
language       R
version.string R version 2.7.0 (2008-04-22)

limma Version: 2.14.2 Date: 2008/05/22

To see what I mean compare the plot in report.pdf to the screen output:
On the screen the first row has red control spots and the second doesn't
-- in the report no control spots are plotted in any of the 4 plots.

Can anyone reproduce this? If so - any ideas how/why this happens?

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel



More information about the Bioconductor mailing list