From d8e7028749702e66b9a0b603748a88765bd36803 Mon Sep 17 00:00:00 2001 From: Chunmingl Date: Mon, 9 Jun 2025 17:41:44 -0400 Subject: [PATCH] minor fix - ctwas p0 p1 --- R/ctwas_wrapper.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/ctwas_wrapper.R b/R/ctwas_wrapper.R index 645b4b18..83447af5 100644 --- a/R/ctwas_wrapper.R +++ b/R/ctwas_wrapper.R @@ -104,6 +104,11 @@ trim_ctwas_variants <- function(region_data, twas_weight_cutoff = 1e-5, cs_min_c region_data$weights[[group]][[study]]$n_wgt <- nrow(region_data$weights[[group]][[study]]$wgt) } region_data$weights[[group]] <- Filter(Negate(is.null), region_data$weights[[group]]) + context_range <- as.integer(sapply(rownames(region_data$weights[[group]][[study]]$wgt), function(variant) strsplit(variant, "\\:")[[1]][2])) + if(twas_weight_cutoff!=0 | cs_min_cor!=0 | min_pip_cutoff!=0 | max_num_variants!=Inf){ + region_data$weights[[group]][[study]][["p0"]] = min(context_range)# update min max position + region_data$weights[[group]][[study]][["p1"]] = max(context_range) + } } return(region_data$weights[[group]]) }), names(region_data$weights))