Browse code

added option to squeezeVariance also for getPvalues function

Nils Kurzawa authored on 09/04/2020 13:48:44
Showing2 changed files

... ...
@@ -154,6 +154,8 @@ computeFdr <- function(df_out, df_null){
154 154
 #' fitAndEvalDataset
155 155
 #' @param df_null data frame containing results from analysis by
156 156
 #' bootstrapNull
157
+#' @param squeezeDenominator logical indicating whether F statistic
158
+#' denominator should be shrinked using limma::squeezeVar
157 159
 #' 
158 160
 #' @return data frame annotating each protein with a FDR based on 
159 161
 #' it's F statistic and number of observations
... ...
@@ -176,12 +178,18 @@ computeFdr <- function(df_out, df_null){
176 178
 #' @import dplyr
177 179
 #' @importFrom stats density
178 180
 #' @importFrom stats p.adjust
179
-getPvalues <- function(df_out, df_null){
181
+getPvalues <- function(df_out, df_null,
182
+                       squeezeDenominator = FALSE){
180 183
     dataset <- nObs <- nObsRound <- F_statistic <- 
181 184
         is_decoy <- max_rank <- true_cumsum <- 
182 185
         null_cumsum <- representative <- clustername <- 
183 186
         dataset <- FDR <- all_true <- all_null <- NULL
184 187
     
188
+    if(squeezeDenominator){
189
+        df_out <- .shrinkFstat(df_out, trueOrNull = "true")
190
+        df_null <- .shrinkFstat(df_null, trueOrNull = "null")
191
+    }
192
+    
185 193
     out_df <- bind_rows(df_out %>% mutate(dataset = "true"),
186 194
                         df_null) %>%
187 195
         mutate(nObsRound = round(nObs/10)*10) %>%
... ...
@@ -5,7 +5,7 @@
5 5
 \title{Compute p-values for given F statistics based on true and
6 6
 null dataset}
7 7
 \usage{
8
-getPvalues(df_out, df_null)
8
+getPvalues(df_out, df_null, squeezeDenominator = FALSE)
9 9
 }
10 10
 \arguments{
11 11
 \item{df_out}{data frame containing results from analysis by
... ...
@@ -13,6 +13,9 @@ fitAndEvalDataset}
13 13
 
14 14
 \item{df_null}{data frame containing results from analysis by
15 15
 bootstrapNull}
16
+
17
+\item{squeezeDenominator}{logical indicating whether F statistic
18
+denominator should be shrinked using limma::squeezeVar}
16 19
 }
17 20
 \value{
18 21
 data frame annotating each protein with a FDR based on