Entering edit mode
David Ruau
▴
110
@david-ruau-1473
Last seen 10.3 years ago
-----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-----