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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
^\.git
^\.github
^\.gitignore
^\.covrignore
^codecov.yml
^src/Makevars$
^tests/testthat/__snaps$
Expand Down
4 changes: 4 additions & 0 deletions .github/recipe/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ build:
requirements:
host:
- r-base
- r-matrixstats
- r-rfast
run:
- r-base
- r-matrixstats
- r-rfast

tests:
- script:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE}

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4

- name: Run unit tests
run: pixi run --environment ${{ matrix.environment }} devtools_test
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE}

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4

- name: Run unit tests
run: pixi run --environment ${{ matrix.environment }} devtools_test
Expand All @@ -83,7 +83,7 @@ jobs:
run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE}

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4

- name: Run unit tests
run: pixi run --environment ${{ matrix.environment }} devtools_test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conda_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
tarBall: true

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4
with:
run-install: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE}

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4

# - name: Check unit test code coverage
# run: pixi run codecov
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE}

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4

- name: Update version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE}

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.8.4

- name: Run unit tests
run: pixi run devtools_document
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: colocboost
Type: Package
Date: 2024-09-01
Title: Multi-context colocalization analysis tool for molecular QTL and GWAS studies
Title: Multi-Context Colocalization Analysis Tool for Molecular QTL and GWAS Studies
Version: 0.1.0
Authors@R: c(
person(given = "Xuewei", family = "Cao", email = "xc2270@cumc.columbia.edu", role = c("cre", "aut")),
Expand All @@ -12,7 +12,7 @@ Authors@R: c(
person(given = "Kushal", family = "Dey", email = "deyk@mskcc.org", role = c("aut")),
person(given = "Gao", family = "Wang", email = "gw2411@cumc.columbia.edu", role = c("aut"))
)
Maintainer: The package maintainer <xc2270@cumc.columbia.edu>
Maintainer: Xuewei Cao <xc2270@cumc.columbia.edu>
Description: This R package implements ColocBoost --- motivated and designed for colocalization analysis of multiple genetic association studies --- as a multi-task learning approach to variable selection regression with highly correlated predictors and sparse effects, based on frequentist statistical inference. It provides statistical evidence to identify which subsets of predictors have non-zero effects on which subsets of response variables.
Encoding: UTF-8
LazyData: true
Expand All @@ -33,4 +33,4 @@ Suggests:
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
License: MIT
License: MIT + file LICENSE
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2025
COPYRIGHT HOLDER: StatFunGen authors
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

25 changes: 25 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,28 @@ export(colocboost_get_methods)
export(colocboost_inits)
export(colocboost_update)
export(colocboost_workhorse)
importFrom(grDevices,adjustcolor)
importFrom(graphics,abline)
importFrom(graphics,axis)
importFrom(graphics,legend)
importFrom(graphics,mtext)
importFrom(graphics,par)
importFrom(graphics,points)
importFrom(graphics,text)
importFrom(stats,as.dist)
importFrom(stats,cor)
importFrom(stats,cutree)
importFrom(stats,density)
importFrom(stats,dnorm)
importFrom(stats,hclust)
importFrom(stats,median)
importFrom(stats,na.omit)
importFrom(stats,pchisq)
importFrom(stats,pnorm)
importFrom(stats,predict)
importFrom(stats,qnorm)
importFrom(stats,quantile)
importFrom(stats,smooth.spline)
importFrom(stats,var)
importFrom(utils,head)
importFrom(utils,tail)
1 change: 1 addition & 0 deletions R/colocboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
#' \item{vcp}{The variable colocalized probability for each variable.}
#' \item{data_info}{A object with detailed information from input data}
#'
#' @importFrom stats na.omit
#' @export
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/colocboost_addhoc_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ merge_cos_ucos <- function(cb_obj, out_cos, out_ucos, coverage = 0.95,

}


#' @importFrom stats na.omit
merge_ucos <- function(cb_obj, past_out,
min_abs_corr = 0.5,
median_abs_corr = NULL,
Expand Down
2 changes: 1 addition & 1 deletion R/colocboost_assemble.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ colocboost_assemble <- function(cb_obj,
tol = 1e-9,
output_level = 1){

if (class(cb_obj) != "colocboost"){
if (!inherits(cb_obj, "colocboost")){
stop("Input must from colocboost object!")}

# - data information
Expand Down
3 changes: 2 additions & 1 deletion R/colocboost_assemble_cos.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#' @importFrom stats as.dist cutree hclust
colocboost_assemble_cos <- function(cb_obj,
coverage = 0.95,
func_intw = "fun_R",
Expand All @@ -14,7 +15,7 @@ colocboost_assemble_cos <- function(cb_obj,
between_purity = 0.8,
tol = 1e-9){

if (class(cb_obj) != "colocboost"){
if (!inherits(cb_obj, "colocboost")){
stop("Input must from colocboost function!")}

cb_model <- cb_obj$cb_model
Expand Down
7 changes: 2 additions & 5 deletions R/colocboost_assemble_ucos.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@




#' @importFrom stats as.dist cutree hclust
colocboost_assemble_ucos <- function(cb_obj_single,
coverage = 0.95,
check_null = 0.1,
Expand All @@ -17,7 +14,7 @@ colocboost_assemble_ucos <- function(cb_obj_single,
weaker_ucos = TRUE,
tol = 1e-9){

if (class(cb_obj_single) != "colocboost"){
if (!inherits(cb_obj_single, "colocboost")){
stop("Input must from colocboost function!")}

cb_data <- cb_obj_single$cb_data
Expand Down
6 changes: 3 additions & 3 deletions R/colocboost_check_update_jk.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ colocboost_check_update_jk <- function(cb_model, cb_model_para, cb_data,




#' @importFrom stats median
boost_check_update_jk_notarget <- function(cb_model, cb_model_para, cb_data,
prioritize_jkstar = TRUE,
jk_equiv_cor = 0.8, ##### more than 2 traits
Expand Down Expand Up @@ -534,7 +534,7 @@ boost_check_update_jk_target <- function(cb_model, cb_model_para, cb_data,
return(cb_model_para)
}


#' @importFrom stats cor
get_LD_jk1_jk2 <- function(jk1, jk2,
X = NULL, XtX = NULL, N = NULL,
remain_jk = NULL){
Expand Down Expand Up @@ -660,4 +660,4 @@ estimate_change_profile_res <- function(jk,
}




9 changes: 5 additions & 4 deletions R/colocboost_init.R
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ colocboost_init_model <- function(cb_data,

#' @noRd
#' @keywords cb_objects
#' @importFrom utils tail
colocboost_init_para <- function(cb_data, cb_model,tau=0.01,
func_prior = "z2z",
lambda = 0.5, lambda_target = 1,
Expand Down Expand Up @@ -508,7 +509,7 @@ get_lfsr <- function(z, miss_idx = NULL, ash_prior = "normal"){
return(lfsr)
}


#' @importFrom stats pchisq
get_lfdr <- function(z, miss_idx = NULL){
P <- length(z)
lambda_max <- 0.95
Expand All @@ -519,7 +520,7 @@ get_lfdr <- function(z, miss_idx = NULL){
result <- try({
lfdr_nomissing <- qvalue(pchisq(drop(z^2), 1, lower.tail = FALSE), lambda = seq(0.05, lambda_max, 0.05))$lfdr
}, silent = TRUE)
if(class(result) == "try-error") {
if(inherits(result, "try-error")) {
lambda_max <- lambda_max - 0.05 # Decrement lambda_max if error occurs
} else {try_run = 0}
}
Expand All @@ -532,7 +533,7 @@ get_lfdr <- function(z, miss_idx = NULL){
result <- try({
lfdr <- qvalue(pchisq(drop(z^2), 1, lower.tail = FALSE), lambda = seq(0.05, lambda_max, 0.05))$lfdr
}, silent = TRUE)
if(class(result) == "try-error") {
if(inherits(result, "try-error")) {
lambda_max <- lambda_max - 0.05 # Decrement lambda_max if error occurs
} else {try_run = 0}
}
Expand All @@ -541,7 +542,7 @@ get_lfdr <- function(z, miss_idx = NULL){
return(lfdr)
}

#' @importFrom stats pchisq
get_padj <- function(z, miss_idx = NULL, p.adjust.methods = "fdr"){ # test also p.adjust.methods = "BY"
P <- length(z)
if (length(miss_idx)!=0){
Expand Down
2 changes: 1 addition & 1 deletion R/colocboost_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ get_summary_table_fm <- function(cb_output, outcome_names = NULL, gene_name = NU
}



#' @importFrom stats pchisq
cos_pvalue_filter <- function(cos_results, data_info = NULL, pvalue_cutoff = 1e-4){

if (is.null(data_info))
Expand Down
9 changes: 5 additions & 4 deletions R/colocboost_plot.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@


#' @importFrom utils head tail
#' @importFrom graphics abline axis legend mtext par points text
#' @importFrom grDevices adjustcolor
colocboost_plot <- function(cb_output, y = "log10p",
gene_name = NULL,
outcome_idx = NULL,
Expand Down Expand Up @@ -28,7 +29,7 @@ colocboost_plot <- function(cb_output, y = "log10p",
...){


if (class(cb_output) != "colocboost"){
if (!inherits(cb_output, "colocboost")){
stop("Input of colocboost_plot must be a 'colocboost' object!")}

# get cb_plot_input data from colocboost results
Expand Down Expand Up @@ -372,7 +373,7 @@ get_input_plot <- function(cb_output, plot_cos_idx = NULL,
}



#' @importFrom stats pnorm
plot_initial <- function(cb_plot_input, y = "log10p",
points_color = "grey90", cos_color = NULL,
ylim_each = TRUE, gene_name = NULL,
Expand Down
1 change: 1 addition & 0 deletions R/colocboost_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @details
#' The gradient boosting algorithm for multiple outcomes
#'
#' @importFrom utils head tail
#' @return colocboost object after gradient boosting update
#' @export
colocboost_update <- function(cb_model, cb_model_para, cb_data,
Expand Down
13 changes: 8 additions & 5 deletions R/colocboost_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ get_cormat <- function(X, intercepte = FALSE){
}


#' @importFrom utils head tail
check_null_post <- function(cb_obj,
coloc_sets_temp,
coloc_outcomes,
Expand Down Expand Up @@ -191,8 +192,8 @@ check_null_post <- function(cb_obj,
return(ll)
}


get_purity = function (pos, X=NULL, Xcorr=NULL, N = NULL, n = 100) {
#' @importFrom stats na.omit
get_purity <- function(pos, X=NULL, Xcorr=NULL, N = NULL, n = 100) {
get_upper_tri = Rfast::upper_tri
get_median = Rfast::med

Expand Down Expand Up @@ -256,7 +257,7 @@ get_modularity <- function(Weight, B){
}
}


#' @importFrom stats cutree
get_n_cluster <- function(hc, Sigma, m=ncol(Sigma), between_cluster = 0.8){
if (min(Sigma) > between_cluster){
IND = 1
Expand Down Expand Up @@ -300,8 +301,9 @@ w_purity <- function(weights, X=NULL, Xcorr=NULL, N = NULL, n = 100, coverage =
}


#' @importFrom stats na.omit
# - Calculate purity between two confidence sets
get_between_purity = function (pos1, pos2, X=NULL, Xcorr=NULL, N = NULL, miss_idx = NULL, P = NULL){
get_between_purity <- function(pos1, pos2, X=NULL, Xcorr=NULL, N = NULL, miss_idx = NULL, P = NULL){

get_matrix_mult <- function(X_sub1, X_sub2){

Expand Down Expand Up @@ -338,7 +340,8 @@ get_between_purity = function (pos1, pos2, X=NULL, Xcorr=NULL, N = NULL, miss_id
return(c(min(value), max(value), get_median(value)))
}


#' @importFrom stats var
#' @importFrom utils tail
get_cos_evidence <- function(cb_obj, coloc_out, data_info){

get_cos_config <- function(w, config_idx, alpha = 1.5, coverage = 0.95){
Expand Down
2 changes: 1 addition & 1 deletion R/colocboost_workhorse.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ colocboost_workhorse <- function(cb_data,
outcome_names = NULL){


if (class(cb_data) != "colocboost"){
if (!inherits(cb_data, "colocboost")){
stop("Input must from colocboost function!")}

cb_model <- colocboost_init_model(cb_data,
Expand Down
Loading