##create example data
eset = matrix(rnorm(500*20),500,20, dimnames=list(1:500,1:20))
labels = c(rep("A",10),rep("B",10))
##genes 1:30 are differentially expressed
eset[1:30, labels=="B"] = eset[1:30, labels=="B"] + 1
geneSets = list(diff.set=1:30, base.set=31:60)
##Run qusage
set.results = qusage(eset, labels, "B-A", geneSets)
##Plot results
plotDensityCurves(set.results)
##plot just the first curve with a different color
plotDensityCurves(set.results, path.index=1, col=2, lwd=2)
##plot the CDFs of the curves
coords = plotDensityCurves(set.results, plot=FALSE)
plot(0, type="n", xlim=c(-1,2),ylim=c(0,1),xlab="x",ylab="CDF")
for(i in 1:length(coords)){
points = coords[[i]]
x = points$x
y = cumsum(points$y)/sum(points$y)
lines(x,y,col=i)
}
Run the code above in your browser using DataLab