#load the library library(CLEAN) ## a couple toy examples using breast cancer (human) and diets (rat) datasets data(bCa) res <- GRS(bCa$Schmidt.pValues, bCa$Miller.pValues) data(gimmOut) p <- apply(gimmOut$clustData[,-(1:2)], 1, function(x) t.test(x[1:4], x[5:8])$p.val) p <- cbind(geneIDs=gimmOut$clustData[,1], p=p) p2 <- convertGeneTable(p, from="r", to="h") GRS(bCa$Schmidt.pValues, p2) ## example from the manuscript ## read the diets p-values diets <- read.table("diets_pvalues.txt", sep="\t", header=TRUE, stringsAsFactors=FALSE) ## load the GDS and cMap p-values load("CMapPvalues.RData") load("GDShumanPvalues.RData") ## convert rat gene IDs to human diets <- convertGeneTable(diets, from="r", to="h") ## compute GRS score for all GDS p <- diets[,2] gL <- diets[,1] ref.gL <- as.character(GDShuman$pValues[,1]) ## ... on second thought, this may take a while. #res <- apply(GDShuman$pValues[,-1], 2, function(i) {print(i); GRS(p, pValues[, i+1], gL, ref.gL, estimateNullDistr=FALSE)[[2]]}) ## lets just use the first 50 res <- apply(GDShuman$pValues[,2:51], 2, function(ref.p) GRS(p, ref.p, gL, ref.gL, estimateNullDistr=FALSE)[[2]]) res <- cbind(GDShuman$annotation[1:50,], zScore=res, pValue=(1 - pnorm(res)) * 2, FDR=p.adjust((1 - pnorm(res)) * 2, method="fdr"))[order(-res),] ## compute GRS score for cMap data commonGenes <- intersect(CMap$pValues[,1], diets[,1]) rowindex <- match(commonGenes, CMap$pValues[,1]) p <- diets[match(commonGenes, diets[,1]),2] pValues <- CMap$pValues[rowindex, ] #res <- sapply(2:ncol(pValues), function(i) {print(i); GRS(p, pValues[, i], estimateNullDistr=FALSE)[[2]]}) res <- sapply(2:51, function(i) {print(i); GRS(p, pValues[, i], estimateNullDistr=FALSE)[[2]]}) res <- cbind(CMap$annotation[1:50,], zScore=res, pValue=(1 - pnorm(res)) * 2, FDR=p.adjust((1 - pnorm(res)) * 2, method="fdr"))[order(-res),]