data(gCMAPData)
## generate CMAPCollection with two sets (drug1, drug2)
sets <- induceCMAPCollection(gCMAPData, "z", higher=-2, lower=2)[,1:2]
sampleNames(sets) <- c("set1", "set2")
## extract per-gene scores as matrices
res <- featureScores(sets, gCMAPData)
class(res) ## list
names(res) ## one element per set
class(res[["set1"]]) ## matrix
dim(res[["set1"]])
## or as lists of score vectors
res2 <- featureScores(sets, gCMAPData, simplify=FALSE)
class(res2[["set1"]]) ## list
length(res2[["set1"]])
## stripplot for set2, colored by annotated sign
m <- res[["set2"]][,"drug2"]
colors <- ifelse( attr(res[["set2"]], "sign") == "up", "red", "blue")
gene.sign <- factor( attr(res[["set2"]], "sign"))
boxplot(
m ~ gene.sign,
col=c("blue", "red"),
ylab="z-score",
xlab="Query gene sign",
main="Set 2"
)
Run the code above in your browser using DataLab