Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@
}


#' @title Report accumulated messages and warnings
#' @description Centralized reporting of info/warning messages collected
#' during argument validation. Reads from the calling environment.
#' @noRd
.report_messages <- function() {
.verbose_msg("\n")

# Report warnings
if (!is.null(warning.messages)) {
warning(warning.messages, immediate. = TRUE, call. = FALSE)
}
if (!is.null(param.warnings)) {
warning(param.warnings, immediate. = TRUE, call. = FALSE)
}

# Report info messages
if (!is.null(info.messages)) {
.verbose_msg(paste0("\n", info.messages, "\n"))
}
if (!is.null(param.messages)) {
.verbose_msg(paste0("\n", param.messages, "\n"))
}

.verbose_msg("\n")
}


#' @title Internal file path checker
#' @description An internal function to check for correct file paths for
#' the required input files. User can either provide path to folder with all
Expand Down
7 changes: 1 addition & 6 deletions R/permute.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,7 @@ permute_polylinkr_data <- function(plr_input, permute = TRUE, n_permutations = 5
align = "center", col = "cyan", border_col = "cyan"))

# report collated warnings and messages
.verbose_msg("\n")
if (!is.null(warning.messages)) warning(warning.messages, immediate. = T, call. = F)
if (!is.null(info.messages)) .verbose_msg(paste0("\n", info.messages, "\n"))
if (!is.null(param.warnings)) warning(param.warnings, immediate. = T, call. = F)
if (!is.null(param.messages)) .verbose_msg(paste0("\n", param.messages, "\n"))
.verbose_msg("\n")
.report_messages()

##=========================================================================##
## PART 2: Calculate standardised gene scores
Expand Down
7 changes: 1 addition & 6 deletions R/prune.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,7 @@ prune_polylinkr_data <- function(plr_input, n_fdr = 300L, estimate_pi0 = TRUE,
align = "center", col = "cyan", border_col = "cyan"))

# report collated warnings and messages
.verbose_msg("\n")
if (!is.null(warning.messages)) warning(warning.messages, immediate. = T, call. = F)
if (!is.null(info.messages)) .verbose_msg(paste0("\n", info.messages, "\n"))
if (!is.null(param.warnings)) warning(param.warnings, immediate. = T, call. = F)
if (!is.null(param.messages)) .verbose_msg(paste0("\n", param.messages, "\n"))
.verbose_msg("\n")
.report_messages()

##=========================================================================##
##PART 2: generate FDR sets and empirical prepare objects for pruning step
Expand Down
7 changes: 1 addition & 6 deletions R/rescale.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,7 @@ rescale_polylinkr_data <- function(plr_input, rescale = TRUE, fast = TRUE, ac =
align = "center", col = "cyan", border_col = "cyan"))

# report collated warnings and messages
.verbose_msg("\n")
if (!is.null(warning.messages)) warning(warning.messages, immediate. = T, call. = F)
if (!is.null(info.messages)) .verbose_msg(paste0("\n", info.messages, "\n"))
if (!is.null(param.warnings)) warning(param.warnings, immediate. = T, call. = F)
if (!is.null(param.messages)) .verbose_msg(paste0("\n", param.messages, "\n"))
.verbose_msg("\n")
.report_messages()

##==========================================================================##
## PART 2: Calculate genomic autocovariance
Expand Down
Loading