[BioC] Colours in degradation courve

James W. MacDonald jmacdon at med.umich.edu
Mon Jan 31 19:35:53 CET 2005


kfbargad at lg.ehu.es wrote:
> Dear users,
> 
> I am getting RNA degradation curves of 20 arrays, but the colours in 
> the graph are repeated, so when I use the legend I cannot name them 
> apart. 
> 
> I use col=1:length(names), and I only get 9 different colours, the 
> colours are recicled, due to the default palette.
> What palette could I use for 20 or more arrays? I have tried other 
> palettes but some of the colours are very difficult to separate

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



> 
> thanks in advance,
> 
> David
> 
> _______________________________________________
> 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



More information about the Bioconductor mailing list