[BioC] Colours in degradation plot
kfbargad at lg.ehu.es
kfbargad at lg.ehu.es
Mon Feb 7 16:47:55 CET 2005
Dear Jim,
thanks for your useful chunk of code. I pasted it and got some
results, i.e, two different types of lines, but the command reached an
erro and didn´t draw all the curves in my degradation plot. I had 27
arrays and got only twelve lines, and the error I got is the following:
> my.plotAffyRNAdeg(AffyRNAdeg(data), col=1:length(sampleNames(data)))
Error in plot.xy(xy.coords(x, y), type = type, col = col, lty =
lty, ...) :
invalid line type
I got eight solid lines and four ·-· lines
Can you give me some more hints?
Regards,
David
You will likely have a hard time using just colors to separate the
samples. Changing the line type is likely to work better for you.
Unfortunately, plotAffyRNAdeg() doesn't have a lty variable that you
can
use to change the line type. However, it is not difficult to add.
Something like the following might do the trick (although what I have
done here is hackish and ad hoc).
my.plotAffyRNAdeg <- function (rna.deg.obj, transform
= "shift.scale",
cols = NULL, lntype = NULL, ...)
{
if (!is.element(transform, c("shift.scale", "shift.only",
"neither")))
stop("Tranform must be 'shift.scale','shift.only',
or 'neither'")
mns <- rna.deg.obj$means.by.number
if (is.null(cols))
cols = rep(4, dim(mns)[1])
ylab = "Mean Intensity"
if (transform == "shift.scale") {
sds <- rna.deg.obj$ses
mn <- mns[, 1]
mns <- sweep(mns, 1, mn)
mns <- mns/(sds)
mns <- sweep(mns, 1, 1:(dim(mns)[1]), "+")
ylab <- paste(ylab, ": shifted and scaled")
}
else if (transform == "shift.only") {
mn <- mns[, 1]
mns <- sweep(mns, 1, mn)
mns <- sweep(mns, 1, 1:(dim(mns)[1]), "+")
ylab <- paste(ylab, ": shifted")
}
plot(-2, -1, pch = "", xlim = range(-1, (dim(mns)[2])), ylim =
range(min(as.vector(mns)) -
1, max(as.vector(mns)) + 1), xlab = "5' <-----> 3'\n Probe
Number ",
ylab = ylab, axes = FALSE, main = "RNA digestion plot",
...)
axis(1)
axis(2)
if(is.null(lntype)){
full <- floor(dim(mns)[1]/8)
mod <- dim(mns)[1]%%8
for(i in (seq(along=full)))
lntype <- c(lntype, rep(i, 8))
lntype <- c(lntype, rep(full + 1, mod))
}
for (i in 1:dim(mns)[1]) lines(0:((dim(mns)[2] - 1)), mns[i,
], col = cols[i], lty = lntype[i])
}
Paste this into your R session, then you can do something like:
my.plotAffyRNAdeg(AffyRNAdeg(abatch), col=1:length(sampleNames
(abatch)))
HTH,
Jim
More information about the Bioconductor
mailing list