[BioC] suggestions for plotPCA / pca.legend

James W. MacDonald jmacdon at med.umich.edu
Wed Jan 17 19:20:44 CET 2007


Hi Jenny,

Thanks for the input. I'll have to think about it, but right now I am 
not too keen on making this change. I worry that adding something clever 
for a specific purpose might backfire with an unintended consequence.

Note however that the devel version of affycoretools has a 'legend' 
argument that you can set to FALSE to supress the legend. You can then 
add the correct legend by hand.

Best,

Jim

Jenny Drnevich wrote:
> Hi Jim,
> 
> I've been playing around with the versatility of plotPCA - thanks for 
> adding support for matrices! Say I have a 2x2 factorial design, and I want 
> to plot the 4 groups, but not using 4 separate symbols, each with its own 
> color. Instead, I want use 2 symbols to indicate the levels of the first 
> factor and 2 colors to indicate the levels of the second factor. I can do 
> this by using the arguments "pch" and "col" instead of "groups". However, 
> the legend doesn't come out correctly - instead of the 4 symbol/color 
> groups, there are only 2 - one symbol in one color and the other symbol in 
> the other color. I looked at pca.legend and I think I've come up with a 
> fix. At the very beginning, instead of:
> 
> pch <- sort(unique(pch))
> col <- sort(unique(col))
> 
> this worked to give the correct legend:
> 
> gps <- sort(unique(paste(pch,col,sep="A")))
> pch <- as.numeric(sapply(strsplit(gps,"A"),function(x) x[1]))
> col <- as.numeric(sapply(strsplit(gps,"A"),function(x) x[2]))
> 
> 
> It might also be good to include some sort of warning if 
> length(groupnames)!=length(gps); if you forget to put in groupnames in the 
> original call to plotPCA, it defaults to the names of the columns, and the 
> legend symbols get recycled so that the legend is incorrect.
> 
> Cheers,
> Jenny
> 
> 
> 
> 
> 
> Jenny Drnevich, Ph.D.
> 
> Functional Genomics Bioinformatics Specialist
> W.M. Keck Center for Comparative and Functional Genomics
> Roy J. Carver Biotechnology Center
> University of Illinois, Urbana-Champaign
> 
> 330 ERML
> 1201 W. Gregory Dr.
> Urbana, IL 61801
> USA
> 
> ph: 217-244-7355
> fax: 217-265-5066
> e-mail: drnevich at uiuc.edu
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623


**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.



More information about the Bioconductor mailing list