I am not sure that this is the correct place to request new features, but I was wondering if it would be possible to add an alternative
parameter to limma::cameraPR
to perform one-sided tests? This could be implemented using the following code, which replaces lines 64 to 67 in cameraPR.default
(line numbers based on View
ing the function).
# Matches t.test options (this goes near the top of the function)
alternative <- match.arg(alternative, choices = c("two.sided", "less", "greater"))
# ...
Direction <- rep_len("Up", nsets)
# Update p-values and direction of change
switch(alternative,
two.sided = {
PValue <- 2 * pmin(Down, Up)
Direction[Down < Up] <- "Down"
},
less = {
PValue <- Down
Direction[] <- "Down"
},
greater = {
PValue <- Up
})
# Originally, PValue = TwoSided, but this is changed to PValue = PValue
if (fixed.cor)
tab <- data.frame(NGenes = NGenes, Direction = Direction,
PValue = PValue, stringsAsFactors = FALSE)
else tab <- data.frame(NGenes = NGenes, Correlation = inter.gene.cor,
Direction = Direction, PValue = PValue,
stringsAsFactors = FALSE)
I ask because, while one-sided tests are generally not recommended, if the nonparametric version of CAMERA-PR could perform upper-tail tests, it can be used as an alternative to gene set over-representation analysis (ORA), which uses hypergeometric tests. The input statistics would be cluster membership probabilities from a soft clustering approach like fuzzy C-means. This would allow us to test for localization of gene sets to the cluster centroids; that is, for each set, do the genes have higher cluster membership probabilities than genes not in the set?
Since each cluster would need to be analyzed separately, a for
loop or lapply
would be needed, and then the results would need to be stacked and p-values adjusted across clusters, since no cluster can be considered independent of the others.
I see. I was thinking about it a different way, but I see the connection now. Thank you.
For the example you provided, would it give the lower-tail probabilities (tests if the gene sets are "Down"), since the one-sided p-values for the "Up" direction are being subtracted from 1?
I made a mistake in my answer, now corrected!
I've also added lower-tail p-values.
Of course I could have written camera() and cameraPR() to return the one-sided p-values in the first place, which are already computed internally, but I thought that returning a a single two-sided p-value instead of two one-sided p-values would be simpler to read and of more general use.