Closed kmshort closed 3 years ago
Ok, I've worked it out for myself by trawling through the code for WebGestaltROra.r. I'm posting this here to help others that might have the same question.
setCoverNum = 10
nThreads = 4
idsInSet <- sapply(output_from_WebGestaltR_function$overlapId, strsplit, split=";")
names(idsInSet) <- output_from_WebGestaltR_function$geneSet
minusLogP <- -log(output_from_WebGestaltR_function$pValue)
minusLogP[minusLogP == Inf] <- -log(.Machine$double.eps)
wscRes <- weightedSetCover(idsInSet, 1 / minusLogP, setCoverNum, nThreads)
regards, K
.. and one more thing. The weightedSetCover output doesn't provide the full table like it does in the Web version. This is what you can do to get the full table.
weightedGO_full <- output_from_WebGestaltR_function[c(match(wscRes$topSets, output_from_WebGestaltR_function$geneSet)),]
Hi, I've read the documentation on weightedSetCover, but I'm unsure of the arguments.
I have an output from the WebGestaltR function, so I think I can use output_from_WebGestaltR_function$geneset For the "idsInSet" argument. Is that right?
And importantly, what about the "costs" argument, where should they come from? I tried output_from_WebGestaltR_function$expect but that didn't work either. The result from weightedSetCover was:
If I use isOutput = TRUE, weightedSetCover seems to be calculated in the output HTML on the fly when you click on the "Weighted Set Cover" button, but not the equivalent R code to do the same thing. I just want to do the same thing in R and have it as an R object.
many thanks, Kieran