diff --git a/DESCRIPTION b/DESCRIPTION index 62adc0ee..185b8f85 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,6 +25,7 @@ Imports: S4Vectors, SummarizedExperiment, coloc, + colocboost, dplyr, magrittr, matrixStats, @@ -47,7 +48,6 @@ Suggests: bigsnpr, bigstatsr, coda, - colocboost, flashier, fsusieR, GBJ, diff --git a/NAMESPACE b/NAMESPACE index 5d0c6e38..cd43db4f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -286,6 +286,7 @@ importFrom(SummarizedExperiment,SummarizedExperiment) importFrom(SummarizedExperiment,assay) importFrom(SummarizedExperiment,rowRanges) importFrom(coloc,coloc.bf_bf) +importFrom(colocboost,colocboost) importFrom(dplyr,across) importFrom(dplyr,all_of) importFrom(dplyr,any_of) diff --git a/R/colocboost_pipeline.R b/R/colocboost_pipeline.R index ea3a82f5..10275530 100644 --- a/R/colocboost_pipeline.R +++ b/R/colocboost_pipeline.R @@ -14,8 +14,9 @@ build_ld_args <- function(ld_list, subset = NULL) { if (is_geno) list(X_ref = ld_list) else list(LD = ld_list) } -# Run colocboost with tryCatch and timing. -# @noRd +#' Run colocboost with tryCatch and timing. +#' @importFrom colocboost colocboost +#' @noRd .run_colocboost <- function(label, ...) { t1 <- Sys.time() res <- tryCatch( @@ -32,7 +33,7 @@ build_ld_args <- function(ld_list, subset = NULL) { if (!requireNamespace("colocboost", quietly = TRUE)) { stop("The colocboost package is required for colocboost_analysis().") } - do.call(colocboost::colocboost, c(args, dots)) + do.call(colocboost, c(args, dots)) } #' Convert loaded regional data to ColocBoost inputs @@ -94,7 +95,7 @@ region_data_to_colocboost_input <- function(region_data) { #' This wrapper keeps the direct \code{colocboost()} argument surface. All #' ColocBoost inputs and model parameters are supplied through \code{...}. When #' no QC options are requested, the call is passed directly to -#' \code{colocboost::colocboost()}. When QC options are requested, the wrapper +#' \code{colocboost()}. When QC options are requested, the wrapper #' inspects named \code{X}/\code{Y} and/or \code{sumstat}/\code{LD}/\code{X_ref} #' arguments in \code{...}, runs the relevant reusable QC step, and then calls #' ColocBoost on the cleaned inputs. If the required named inputs are not @@ -103,7 +104,7 @@ region_data_to_colocboost_input <- function(region_data) { #' #' @details #' Use \code{colocboost_analysis()} the same way you would use -#' \code{colocboost::colocboost()}: pass the native ColocBoost arguments by +#' \code{colocboost()}: pass the native ColocBoost arguments by #' name, for example \code{X}, \code{Y}, \code{sumstat}, \code{LD}, #' \code{X_ref}, \code{dict_YX}, \code{dict_sumstatLD}, #' \code{outcome_names}, \code{focal_outcome_idx}, \code{effect_est}, @@ -123,13 +124,13 @@ region_data_to_colocboost_input <- function(region_data) { #' \code{impute = TRUE}. #' #' If no QC controls are supplied, this function is a thin direct call to -#' \code{colocboost::colocboost(...)}. +#' \code{colocboost(...)}. #' When QC removes outcomes, \code{outcome_names} and \code{focal_outcome_idx} #' are updated to match the post-QC outcome order. If the requested focal outcome #' is removed by QC, \code{focal_outcome_idx} is set to \code{NULL} with a #' warning. #' -#' @param ... Arguments passed to \code{colocboost::colocboost()}, including +#' @param ... Arguments passed to \code{colocboost()}, including #' data inputs such as \code{X}, \code{Y}, \code{sumstat}, \code{LD}, #' \code{X_ref}, \code{dict_YX}, \code{dict_sumstatLD}, #' \code{outcome_names}, and all ColocBoost model/post-processing options. @@ -148,12 +149,12 @@ region_data_to_colocboost_input <- function(region_data) { #' parseable genomic variant IDs. It can be a .bim/.pvar/.pvar.zst file path, #' a data.frame with variant metadata, or a \code{load_LD_matrix()} result. #' This is a QC-only argument and is not passed to -#' \code{colocboost::colocboost()}. +#' \code{colocboost()}. #' @param variant_convention Allele order used by native ColocBoost-style #' \code{sumstat$variant} and LD/X_ref names when deriving QC inputs: #' \code{"A2_A1"} for pecotmr canonical \code{chr:pos:A2:A1}, or #' \code{"A1_A2"} for \code{chr:pos:A1:A2}. -#' @return The object returned by \code{colocboost::colocboost()}. +#' @return The object returned by \code{colocboost()}. #' @examples #' \dontrun{ #' # Direct ColocBoost call without QC. diff --git a/man/colocboost_analysis.Rd b/man/colocboost_analysis.Rd index 054a20bc..76b530b2 100644 --- a/man/colocboost_analysis.Rd +++ b/man/colocboost_analysis.Rd @@ -21,7 +21,7 @@ colocboost_analysis( ) } \arguments{ -\item{...}{Arguments passed to \code{colocboost::colocboost()}, including +\item{...}{Arguments passed to \code{colocboost()}, including data inputs such as \code{X}, \code{Y}, \code{sumstat}, \code{LD}, \code{X_ref}, \code{dict_YX}, \code{dict_sumstatLD}, \code{outcome_names}, and all ColocBoost model/post-processing options. @@ -41,7 +41,7 @@ row/column names or \code{X_ref} column names are missing or are not parseable genomic variant IDs. It can be a .bim/.pvar/.pvar.zst file path, a data.frame with variant metadata, or a \code{load_LD_matrix()} result. This is a QC-only argument and is not passed to -\code{colocboost::colocboost()}.} +\code{colocboost()}.} \item{variant_convention}{Allele order used by native ColocBoost-style \code{sumstat$variant} and LD/X_ref names when deriving QC inputs: @@ -49,13 +49,13 @@ This is a QC-only argument and is not passed to \code{"A1_A2"} for \code{chr:pos:A1:A2}.} } \value{ -The object returned by \code{colocboost::colocboost()}. +The object returned by \code{colocboost()}. } \description{ This wrapper keeps the direct \code{colocboost()} argument surface. All ColocBoost inputs and model parameters are supplied through \code{...}. When no QC options are requested, the call is passed directly to -\code{colocboost::colocboost()}. When QC options are requested, the wrapper +\code{colocboost()}. When QC options are requested, the wrapper inspects named \code{X}/\code{Y} and/or \code{sumstat}/\code{LD}/\code{X_ref} arguments in \code{...}, runs the relevant reusable QC step, and then calls ColocBoost on the cleaned inputs. If the required named inputs are not @@ -64,7 +64,7 @@ used. } \details{ Use \code{colocboost_analysis()} the same way you would use -\code{colocboost::colocboost()}: pass the native ColocBoost arguments by +\code{colocboost()}: pass the native ColocBoost arguments by name, for example \code{X}, \code{Y}, \code{sumstat}, \code{LD}, \code{X_ref}, \code{dict_YX}, \code{dict_sumstatLD}, \code{outcome_names}, \code{focal_outcome_idx}, \code{effect_est}, @@ -84,7 +84,7 @@ LD-mismatch QC. RAISS imputation is controlled separately by \code{impute = TRUE}. If no QC controls are supplied, this function is a thin direct call to -\code{colocboost::colocboost(...)}. +\code{colocboost(...)}. When QC removes outcomes, \code{outcome_names} and \code{focal_outcome_idx} are updated to match the post-QC outcome order. If the requested focal outcome is removed by QC, \code{focal_outcome_idx} is set to \code{NULL} with a