From cf1e55d343b8224876ca8d4986ba26a89366c017 Mon Sep 17 00:00:00 2001 From: Ryan Neff Date: Wed, 11 Apr 2018 13:43:55 -0400 Subject: [PATCH] Treat p-values as numeric before sorting The p variable at some point became a list of character strings that when sorted, do not sort properly due to the number of digits in the p-value. For instance, a p-value of 0.999984 would be sorted as being larger than 0.9999864 even though it's numeric value is smaller. I believe this has the effect of increasing the q-values from the qvalue function because the list is no longer in order, so larger q-values may sometimes be treated as being smaller. This will then decrease the number of significant associations output by WGCNA. --- R/qvalue.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/qvalue.R b/R/qvalue.R index cf35e5c..1514a97 100644 --- a/R/qvalue.R +++ b/R/qvalue.R @@ -87,6 +87,7 @@ qvalue <- function(p, lambda=seq(0,0.90,0.05), pi0.method="smoother", fdr.level= if(!is.null(fdr.level) && (fdr.level<=0 || fdr.level>1)) ## change by Alan: check for valid fdr.level stop("qvalue:: 'fdr.level' must be within (0, 1].") #The estimated q-values calculated here + p <- as.numeric(p) u <- order(p) # change by Alan