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
6 changes: 4 additions & 2 deletions R/colocboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,13 @@ colocboost <- function(X = NULL, Y = NULL, # individual data
multicorrection_cut = 1,
ash_prior = "normal", # only applicable if func_multicorrection = lfsr
p.adjust.methods = "fdr",
pv_cutoff = 1e-4,
npc_cutoff = 0.7,
check_null = 0.1, # the cut off value for change conditional objective function
check_null_method = "profile",
check_null_max = 0.02,
residual_correlation = NULL, # sample overlap, it is diagonal if it is NULL
LD_obj = FALSE,
dynamic_step = TRUE,
weaker_ucos = TRUE,
output_level = 1){

Expand Down Expand Up @@ -557,6 +558,7 @@ colocboost <- function(X = NULL, Y = NULL, # individual data
func_compare = func_compare,
coloc_thres = coloc_thres,
LD_obj = LD_obj,
dynamic_step = dynamic_step,
target_idx = target_idx,
outcome_names = outcome_names)

Expand All @@ -566,7 +568,7 @@ colocboost <- function(X = NULL, Y = NULL, # individual data
coverage = coverage,
func_intw = func_intw,
alpha = alpha,
pv_cutoff = pv_cutoff,
npc_cutoff = npc_cutoff,
check_null = check_null,
check_null_method = check_null_method,
check_null_max = check_null_max,
Expand Down
7 changes: 4 additions & 3 deletions R/colocboost_addhoc_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ merge_cos_ucos <- function(cb_obj, out_cos, out_ucos, coverage = 0.95,
min_between <- res[1]
max_between <- res[2]
ave_between <- res[3]
# is.between <- ((min_between>min_abs_corr) & (abs(max_between-1) < tol))
is.between <- (min_between>min_abs_corr) * (abs(max_between-1)<tol) * (ave_between>between_purity)
is.between <- ((min_between>between_purity) & (abs(max_between-1) < tol))
# is.between <- (min_between>min_abs_corr) * (abs(max_between-1)<tol) * (ave_between>between_purity)
if (is.between){
is_overlap = c(is_overlap, j)
# -- add weight
Expand Down Expand Up @@ -154,7 +154,8 @@ merge_ucos <- function(cb_obj, past_out,
ave_between[i.between, j.between] <- ave_between[j.between, i.between] <- res[3]
}
}
is.between <- (min_between>min_abs_corr) * (abs(max_between-1)<tol) * (ave_between>between_purity)
# is.between <- (min_between>min_abs_corr) * (abs(max_between-1)<tol) * (ave_between>between_purity)
is.between <- ((min_between>between_purity) & (abs(max_between-1) < tol))
if (sum(is.between) != 0){
temp <- sapply(1:nrow(is.between), function(x){
tt <- c(x, which(is.between[x,] != 0))
Expand Down
10 changes: 4 additions & 6 deletions R/colocboost_assemble.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ colocboost_assemble <- function(cb_obj,
check_null = 0.1,
check_null_method = "profile",
check_null_max=2e-5,
pv_cutoff = 1e-4,
npc_cutoff = 0.7,
dedup = TRUE,
overlap = TRUE,
n_purity = 100,
Expand Down Expand Up @@ -193,10 +193,7 @@ colocboost_assemble <- function(cb_obj,
# - colocalization results
cb_obj$cb_model_para$alpha <- alpha
cb_obj$cb_model_para$coverage <- coverage
cos_results <- get_cos_details(cb_obj, coloc_out = past_out$cos$cos, data_info = data_info)
if (!is.null(pv_cutoff) & !is.null(cos_results$cos_results)){
cos_results <- cos_pvalue_filter(cos_results, data_info = data_info, pv_cutoff = pv_cutoff)
}
cos_results <- get_cos_details(cb_obj, coloc_out = past_out$cos$cos, data_info = data_info, npc_cutoff = npc_cutoff)
cb_output <- list("vcp" = cos_results$vcp,
"cos_details" = cos_results$cos_results,
"data_info" = data_info,
Expand All @@ -210,7 +207,8 @@ colocboost_assemble <- function(cb_obj,

# - save model and all coloc and single information for diagnostic
if (output_level != 1){
tmp <- get_full_output(cb_obj = cb_obj, past_out = past_out, variables = data_info$variables, cb_output = cb_output)
tmp <- get_full_output(cb_obj = cb_obj, past_out = past_out, variables = data_info$variables,
cb_output = cb_output)
if (output_level == 2){
cb_output <- c(cb_output, list("ucos_details" = tmp$ucos_details))
cb_output <- cb_output[c("cos_summary", "vcp", "cos_details", "data_info", "model_info", "ucos_details")]
Expand Down
4 changes: 2 additions & 2 deletions R/colocboost_assemble_cos.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ colocboost_assemble_cos <- function(cb_obj,

} else {

av <- lapply(coloc_outcomes, function(i){
get_avWeigth(cb_model, i, update, pos.coloc[pos_temp_coloc_each])
av <- lapply(coloc_outcomes, function(ii){
get_avWeigth(cb_model, ii, update, pos.coloc[pos_temp_coloc_each])
})
weight_coloc <- do.call(cbind, av)

Expand Down
Loading
Loading