|
15 | 15 | #' If \code{TRUE}, the data will be log-transformed.
|
16 | 16 | #' @param delog_for_FC \strong{logical} \cr
|
17 | 17 | #' If \code{TRUE}, the fold change will be calculated without the log-transformation.
|
| 18 | +#' @param p_value_zeros_to_min \strong{logical} \cr |
| 19 | +#' If \code{TRUE}, then \code{p_values == 0} will be set to the next smallest value of the p-values. |
18 | 20 | #'
|
19 | 21 | #' @param significant_after_FDR \strong{logical} \cr
|
20 | 22 | #' If \code{TRUE}, candidates for the boxplots and heatmap need to be significant after FDR correction, otherwise all significant candidates will be used.
|
@@ -70,6 +72,7 @@ workflow_ttest <- function(data_path,
|
70 | 72 | var.equal = FALSE,
|
71 | 73 | log_before_test = TRUE,
|
72 | 74 | delog_for_FC = TRUE,
|
| 75 | + p_value_zeros_to_min = TRUE, |
73 | 76 |
|
74 | 77 | significant_after_FDR = TRUE,
|
75 | 78 | max_valid_values_off = 0,
|
@@ -110,6 +113,22 @@ workflow_ttest <- function(data_path,
|
110 | 113 | ifelse(delog_for_FC, "", "not"),
|
111 | 114 | "de-log-transformed for the fold change. \n")
|
112 | 115 |
|
| 116 | + |
| 117 | + if(p_value_zeros_to_min){ |
| 118 | + |
| 119 | + p_value_zero <- which(test_results$p == 0) |
| 120 | + |
| 121 | + if(length(p_value_zero) > 0){ |
| 122 | + next_smallest_value <- sort(unique(test_results$p))[2] |
| 123 | + |
| 124 | + test_results$p[test_results$p == 0] <- next_smallest_value |
| 125 | + |
| 126 | + mess <- paste0(mess, "There were ", length(p_value_zero), " p_values, which were 0. ", |
| 127 | + "They were set to the next smallest occuring value ", next_smallest_value, ". \n") |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + |
113 | 132 | fc_col_name <- paste0("FC_", levels(data[["group"]])[[1]], "_divided_by_", levels(data[["group"]])[[2]])
|
114 | 133 |
|
115 | 134 |
|
@@ -244,6 +263,8 @@ workflow_ttest <- function(data_path,
|
244 | 263 | #' If \code{TRUE}, the data will be log-transformed.
|
245 | 264 | #' @param delog_for_FC \strong{logical} \cr
|
246 | 265 | #' If \code{TRUE}, the fold change will be calculated without the log-transformation.
|
| 266 | +#' @param p_value_zeros_to_min \strong{logical} \cr |
| 267 | +#' If \code{TRUE}, then \code{p_values == 0} will be set to the next smallest value of the p-values. |
247 | 268 | #'
|
248 | 269 | #' @param significant_after_FDR \strong{logical} \cr
|
249 | 270 | #' If \code{TRUE}, candidates for the boxplots and heatmap need to be significant after FDR correction, otherwise all significant candidates will be used.
|
@@ -301,6 +322,7 @@ workflow_ANOVA <- function(data_path,
|
301 | 322 | var.equal = TRUE,
|
302 | 323 | log_before_test = TRUE,
|
303 | 324 | delog_for_FC = TRUE,
|
| 325 | + p_value_zeros_to_min = TRUE, |
304 | 326 |
|
305 | 327 | significant_after_FDR = TRUE,
|
306 | 328 | max_valid_values_off = 0,
|
@@ -336,6 +358,21 @@ workflow_ANOVA <- function(data_path,
|
336 | 358 | mess <- paste0(mess, "ANOVA calculated. \n")
|
337 | 359 |
|
338 | 360 |
|
| 361 | + if(p_value_zeros_to_min){ |
| 362 | + |
| 363 | + p_value_zero <- which(ANOVA_results$p.anova == 0) |
| 364 | + |
| 365 | + if(length(p_value_zero) > 0){ |
| 366 | + next_smallest_value <- sort(unique(ANOVA_results$p.anova))[2] |
| 367 | + |
| 368 | + ANOVA_results$p.anova[ANOVA_results$p.anova == 0] <- next_smallest_value |
| 369 | + |
| 370 | + mess <- paste0(mess, "There were ", length(p_value_zero), " p_values, which were 0. ", |
| 371 | + "They were set to the next smallest occuring value ", next_smallest_value, ". \n") |
| 372 | + } |
| 373 | + } |
| 374 | + |
| 375 | + |
339 | 376 |
|
340 | 377 | #### Create Volcano Plot ####
|
341 | 378 |
|
|
0 commit comments