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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Imports:
S4Vectors,
SummarizedExperiment,
coloc,
colocboost,
dplyr,
magrittr,
matrixStats,
Expand All @@ -47,7 +48,6 @@ Suggests:
bigsnpr,
bigstatsr,
coda,
colocboost,
flashier,
fsusieR,
GBJ,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 10 additions & 9 deletions R/colocboost_pipeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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},
Expand All @@ -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.
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions man/colocboost_analysis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.