[BioC] Boxplot from dataframe...

Wolfgang Huber huber at ebi.ac.uk
Mon Jan 9 15:32:30 CET 2006


Hi David,

I am not sure I understand what you want to achieve but if x is a 
matrix, something like

   sx = x[ logicalvector, ]
   boxplot(sx ~ col(sx), col="mistyrose")

should do the job. And if x is a dataframe you can even do away with the 
"~col(sx)". You might also want to have a look at the multiecdf and 
multidensity functions in the devel version of geneplotter.

  Cheers
  Wolfgang



David Ruau wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> I wrote a little function to do a boxplot for a row element of a 
> numeric matrix. Indeed for a specific probeset of a expression value 
> matrix but the problem is not with bioconductor functions but on the 
> right use of R.
> 
> Is there a simpler way to do a boxplot for a specific probeset from 
> either a AffyBatch or an expression matrix?
> - ---- code ----
> myboxplot <- function(id,e.mat){
> 
> 	require(mgu74av2)
> 	# grab the expression values
> 	x <- e.mat[rownames(e.mat)==id]
> 
> 	# make column of those expression value
> 	c1 <- as.list(t(x[1:3])) # Exp1
> 	c2 <- as.list(t(x[4:6])) # Exp2
> 	c3 <- as.list(t(x[7:9])) # Exp3
> 	c4 <- as.list(t(x[10:12])) # Exp4
> 	c5 <- as.list(t(x[13:14])) # Exp5
> 	c6 <- as.list(t(x[15:17])) # Exp6
> 
> 	# Little transformation for c5 as there is only 2 value for it and 3 
> for the others.
> 	c5 <- c(c5, NA) # because only 2 values
> 	
> 	# combinaison of the column
> 	x <- cbind(c1,c2,c3,c4,c5,c6)
> 	
> 	# Convert to a dataframe
> 	x <- as.data.frame(x)
> 
> 	# Add name to the column
> 	colnames(x) <- c("Exp1", "Exp2", "Exp3", "Exp4", "Exp5", "Exp6")
> 	
> 	# Grab gene name for plot's title
> 	y <- mget (id, env= mgu74av2GENENAME)	
> 	names(y) <- NULL
> 
> 	boxplot(x)
> 	title(main=y, sub=id)
> }
> - ----
> Thanks,
> David
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
> 
> iD8DBQFDwmHB7EoGVUIQyhERAuRiAJ491zrSB/zD7P8aRMkc7nKPu496rwCggnsi
> gi2RwP7t2CQcC0pTsTVFsos=
> =6H0E
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor


-- 
Best regards
   Wolfgang

-------------------------------------
Wolfgang Huber
European Bioinformatics Institute
European Molecular Biology Laboratory
Cambridge CB10 1SD
England
Phone: +44 1223 494642
Fax:   +44 1223 494486
Http:  www.ebi.ac.uk/huber



More information about the Bioconductor mailing list