[BioC] Affy Package - MAplot Function help needed...
James W. MacDonald
jmacdon at med.umich.edu
Wed Feb 15 15:36:39 CET 2006
Hi Joern,
Joern Wessels wrote:
> Hi everybody,
> this is my very first post to this mailing list :-) I have got a problem I
> could not solve via manual or google:
> When I use the Maplot function of the affy package on more than three array
> data sets, the text in the fields showing Median and IQR is to big to be
> shown correctly.
> I tried to use the "cex.main, cex.lab, cex.axis, cex.sub but aside from
> changing axis text I could not change anything. Using ?MAplot did not
> produce any useable help (for me as a beginner at least).
>
> I used the following line to get my graphs:
>
> MAplot(Data, pairs = TRUE)
>
> I sombody could help me with that I would be one happy R rookie user.
Well, unfortunately the cex arguments for the text is hard coded, so no
combination of cex.xxx = ? is going to change things. I will probably
fix this so you can pass the cex argument to the function, but that will
take a few days to propagate to the devel download repository and would
require that you use the devel version of R. Neither of these things is
likely to be a good thing for a rookie, so the best fix in this case is
for you to make a modified function that will do what you want (which
has the added benefit of helping you to learn R).
When you call MAplot() with pairs = TRUE, this function calls another
function called mva.pairs(). If you type mva.pairs at an R prompt, it
will be printed to the screen:
> mva.pairs
function (x, labels = colnames(x), log.it = TRUE, span = 2/3,
family.loess = "gaussian", digits = 3, line.col = 2, main = "MVA
plot", ...)
{
if (log.it)
x <- log2(x)
J <- dim(x)[2]
frame()
old.par <- par(no.readonly = TRUE)
on.exit(par(old.par))
par(mfrow = c(J, J), mgp = c(0, 0.2, 0), mar = c(1, 1, 1,
1), oma = c(1, 1.4, 2, 1))
for (j in 1:(J - 1)) {
par(mfg = c(j, j))
plot(1, 1, type = "n", xaxt = "n", yaxt = "n", xlab = "",
ylab = "")
text(1, 1, labels[j], cex = 2)
for (k in (j + 1):J) {
par(mfg = c(j, k))
yy <- x[, j] - x[, k]
xx <- (x[, j] + x[, k])/2
sigma <- IQR(yy)
mean <- median(yy)
ma.plot(xx, yy, tck = 0, show.statistics = FALSE,
pch = ".", xlab = "", ylab = "", tck = 0, span = span,
...)
par(mfg = c(k, j))
txt <- format(sigma, digits = digits)
txt2 <- format(mean, digits = digits)
plot(c(0, 1), c(0, 1), type = "n", ylab = "", xlab = "",
xaxt = "n", yaxt = "n")
text(0.5, 0.5, paste(paste("Median:", txt2), paste("IQR:",
txt), sep = "\n"), cex = 2)
}
}
par(mfg = c(J, J))
plot(1, 1, type = "n", xaxt = "n", yaxt = "n", xlab = "",
ylab = "")
text(1, 1, labels[J], cex = 2)
mtext("A", 1, outer = TRUE, cex = 1.5)
mtext("M", 2, outer = TRUE, cex = 1.5, las = 1)
mtext(main, 3, outer = TRUE, cex = 1.5)
invisible()
}
You can then copy this output and paste it into your favorite text
editor. Fix the first line to say something like this:
my.mva.pairs <- function (x, labels = colnames(x), log.it = TRUE, span =
2/3, family.loess = "gaussian", digits = 3, line.col = 2, main = "MVA
plot", cex.text = 2, ...)
Note the change in the function name (along with the <- ), and the
addition of cex.text = 2.
Now change the line that reads
text(0.5, 0.5, paste(paste("Median:", txt2), paste("IQR:",
txt), sep = "\n"), cex = 2)
to say
text(0.5, 0.5, paste(paste("Median:", txt2), paste("IQR:",
txt), sep = "\n"), cex = cex.text)
Now you can either copy/paste this function back into your R session, or
save it as something like my.mva.pairs.R and source() it into your R
session.
You are almost there - MAplot does some pre-processing of the data first
that you will have to do by hand. You need to extract the raw intensity
data from your AffyBatch and pass that to your new function:
pms <- unlist(indexProbes(Data, "both"))
x <- intensity(Data)[pms, ]
my.mva.pairs(x, cex.text = 1)
Poking around in other people's code and seeing what it does/changing it
to do slightly different things is one of the best ways IMO to learn R.
HTH,
Jim
>
> Thanks,
> Jörn
>
>
> ________________
> Jörn Weßels
> Diplom-Biologe
>
> Philipps-Universität Marburg
> Fachbereich Biologie - Tierphysiologie
> Karl-von-Frisch-Str. 8
> 35032 Marburg an der Lahn
>
> Tel.: +49 (0) 6421 28 23547
> Fax: +49 (0) 6421 28 28937
> Mobil: +49 (0) 170 9346198
> E-Mail: wessels at staff.uni-marburg.de
> Webseite:
> http://cgi-host.uni-marburg.de/~omtierph/stoff/member.php?mem=wessels&lang=d
> e
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
--
James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
More information about the Bioconductor
mailing list