From 1f9a971c709f6bf5cbbe225acef5e9e0942a8e4b Mon Sep 17 00:00:00 2001 From: xuewei cao <36172337+xueweic@users.noreply.github.com> Date: Sat, 19 Apr 2025 04:52:56 -0400 Subject: [PATCH 1/2] Update colocboost_pipeline.R --- R/colocboost_pipeline.R | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/R/colocboost_pipeline.R b/R/colocboost_pipeline.R index 65d2053d..787a326c 100644 --- a/R/colocboost_pipeline.R +++ b/R/colocboost_pipeline.R @@ -197,7 +197,7 @@ load_multitask_regional_data <- function(region, # a string of chr:start-end for #' This function perform a multi-trait colocalization using ColocBoost #' #' @param region_data A region data loaded from \code{load_regional_data}. -#' @param target_trait Name of trait if perform targeted ColocBoost +#' @param focal_trait Name of trait if perform focaled ColocBoost #' @param event_filters A list of pattern for filtering events based on context names. Example: for sQTL, list(type_pattern = ".*clu_(\\d+_[+-?]).*",valid_pattern = "clu_(\\d+_[+-?]):PR:",exclude_pattern = "clu_(\\d+_[+-?]):IN:") #' @param maf_cutoff A scalar to remove variants with maf < maf_cutoff, dafault is 0.005. #' @param pip_cutoff_to_skip_ind A vector of cutoff values for skipping analysis based on PIP values for each context. Default is 0. @@ -221,7 +221,7 @@ load_multitask_regional_data <- function(region, # a string of chr:start-end for #' #' @export colocboost_analysis_pipeline <- function(region_data, - target_trait = NULL, + focal_trait = NULL, event_filters = NULL, # - analysis xqtl_coloc = TRUE, @@ -462,47 +462,47 @@ colocboost_analysis_pipeline <- function(region_data, message(paste("====== Performing xQTL-only ColocBoost on", length(Y), "contexts. =====")) t11 <- Sys.time() traits <- names(Y) - target_idx <- NULL - if (!is.null(target_trait)) { - if (target_trait %in% traits) { - target_idx <- which(traits == target_trait) + focal_outcome_idx <- NULL + if (!is.null(focal_trait)) { + if (focal_trait %in% traits) { + focal_outcome_idx <- which(traits == focal_trait) } } res_xqtl <- colocboost( X = X, Y = Y, dict_YX = dict_YX, - outcome_names = traits, target_idx = target_idx, ... + outcome_names = traits, focal_outcome_idx = focal_outcome_idx, ... ) t12 <- Sys.time() analysis_results$xqtl_coloc <- res_xqtl analysis_results$computing_time$Analysis$xqtl_coloc <- t12 - t11 } - # - run joint GWAS no targeted version of ColocBoost + # - run joint GWAS no focaled version of ColocBoost if (joint_gwas & !is.null(sumstats)) { - message(paste("====== Performing non-targeted version GWAS-xQTL ColocBoost on", length(Y), "contexts and", length(sumstats), "GWAS. =====")) + message(paste("====== Performing non-focaled version GWAS-xQTL ColocBoost on", length(Y), "contexts and", length(sumstats), "GWAS. =====")) t21 <- Sys.time() traits <- c(names(Y), names(sumstats)) res_gwas <- colocboost( X = X, Y = Y, sumstat = sumstats, LD = LD_mat, dict_YX = dict_YX, dict_sumstatLD = dict_sumstatLD, - outcome_names = traits, target_idx = NULL, ... + outcome_names = traits, focal_outcome_idx = NULL, ... ) t22 <- Sys.time() analysis_results$joint_gwas <- res_gwas analysis_results$computing_time$Analysis$joint_gwas <- t22 - t21 } - # - run targeted version of ColocBoost for each GWAS + # - run focaled version of ColocBoost for each GWAS if (separate_gwas & !is.null(sumstats)) { t31 <- Sys.time() res_gwas_separate <- analysis_results$separate_gwas for (i_gwas in 1:nrow(dict_sumstatLD)) { current_study <- names(sumstats)[i_gwas] - message(paste("====== Performing targeted version GWAS-xQTL ColocBoost on", length(Y), "contexts and ", current_study, "GWAS. =====")) + message(paste("====== Performing focaled version GWAS-xQTL ColocBoost on", length(Y), "contexts and ", current_study, "GWAS. =====")) dict <- dict_sumstatLD[i_gwas, ] traits <- c(names(Y), current_study) res_gwas_separate[[current_study]] <- colocboost( X = X, Y = Y, sumstat = sumstats[dict[1]], LD = LD_mat[dict[2]], dict_YX = dict_YX, - outcome_names = traits, target_idx = length(traits), ... + outcome_names = traits, focal_outcome_idx = length(traits), ... ) } t32 <- Sys.time() From c2a4444cbc2a12d5799eef428abccd102a187cb6 Mon Sep 17 00:00:00 2001 From: xueweic Date: Sat, 19 Apr 2025 11:34:20 +0000 Subject: [PATCH 2/2] Update documentation --- man/colocboost_analysis_pipeline.Rd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/colocboost_analysis_pipeline.Rd b/man/colocboost_analysis_pipeline.Rd index 551f43a2..bfa7f1bb 100644 --- a/man/colocboost_analysis_pipeline.Rd +++ b/man/colocboost_analysis_pipeline.Rd @@ -6,7 +6,7 @@ \usage{ colocboost_analysis_pipeline( region_data, - target_trait = NULL, + focal_trait = NULL, event_filters = NULL, xqtl_coloc = TRUE, joint_gwas = FALSE, @@ -24,7 +24,7 @@ colocboost_analysis_pipeline( \arguments{ \item{region_data}{A region data loaded from \code{load_regional_data}.} -\item{target_trait}{Name of trait if perform targeted ColocBoost} +\item{focal_trait}{Name of trait if perform focaled ColocBoost} \item{event_filters}{A list of pattern for filtering events based on context names. Example: for sQTL, list(type_pattern = ".*clu_(\\d+_[+-?]).*",valid_pattern = "clu_(\\d+_[+-?]):PR:",exclude_pattern = "clu_(\\d+_[+-?]):IN:")}