diff --git a/.Rbuildignore b/.Rbuildignore index 40982c5..3aa50e5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -17,3 +17,5 @@ ^cran-comments\.md$ ^LICENSE\.md$ ^README\.md$ +^docs$ +^_pkgdown\.yml$ diff --git a/.github/environment/pixi.toml b/.github/environment/pixi.toml index 53cd3f8..24b6137 100644 --- a/.github/environment/pixi.toml +++ b/.github/environment/pixi.toml @@ -15,6 +15,7 @@ rcmdcheck = "R -e 'pkg <- list.files(\"..\", pattern = \".tar.gz\", full.names = use_major_version = "R -e 'usethis::Use_version(which = \"major\", push = FALSE)'" use_minor_version = "R -e 'usethis::use_version(which = \"minor\", push = FALSE)'" use_patch_version = "R -e 'usethis::use_version(which = \"patch\", push = FALSE)'" +pkgdown_build = "R -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = TRUE)'" [feature.r43] dependencies = {"r-base" = "4.3.*"} @@ -33,3 +34,4 @@ r44 = {features = ["r44"]} "r-mass" = "*" "r-rcmdcheck" = "*" "r-tidyverse" = "*" +"qpdf" = "*" diff --git a/.github/workflows/dispatch_pkgdown_build.yml b/.github/workflows/dispatch_pkgdown_build.yml new file mode 100644 index 0000000..cc503de --- /dev/null +++ b/.github/workflows/dispatch_pkgdown_build.yml @@ -0,0 +1,33 @@ +name: Dispatch rebuild website + +on: + workflow_dispatch: + +jobs: + update_website: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - name: Checkout main + uses: actions/checkout@v4 + with: + ref: main + + - name: Create TOML from recipe + run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE} + + - name: Setup pixi + uses: prefix-dev/setup-pixi@v0.8.4 + + - name: Update pkgdown site + run: pixi run pkgdown_build + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 06a664c..d1a38cc 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,5 +1,6 @@ name: Post-merge actions + on: pull_request_target: types: [closed] @@ -29,5 +30,34 @@ jobs: - name: Setup pixi uses: prefix-dev/setup-pixi@v0.8.4 - # - name: Check unit test code coverage - # run: pixi run codecov + - name: Check unit test code coverage + run: pixi run codecov + + update_website: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - name: Checkout main + uses: actions/checkout@v4 + with: + ref: main + + - name: Create TOML from recipe + run: .github/workflows/create_toml_from_yaml.sh ${GITHUB_WORKSPACE} + + - name: Setup pixi + uses: prefix-dev/setup-pixi@v0.8.4 + + - name: Update pkgdown site + run: pixi run pkgdown_build + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/DESCRIPTION b/DESCRIPTION index 9965c63..63f1cd9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,6 +15,7 @@ Authors@R: c( Maintainer: Xuewei Cao 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 +LazyDataCompression: xz LazyData: true RoxygenNote: 7.3.2 URL: https://github.com/StatFunGen/colocboost diff --git a/NAMESPACE b/NAMESPACE index 0738505..46ff399 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,12 +1,7 @@ # Generated by roxygen2: do not edit by hand export(colocboost) -export(colocboost_assemble) -export(colocboost_check_update_jk) -export(colocboost_inits) export(colocboost_plot) -export(colocboost_update) -export(colocboost_workhorse) export(get_cos_summary) export(get_strong_colocalization) importFrom(grDevices,adjustcolor) diff --git a/R/colocboost_assemble.R b/R/colocboost_assemble.R index 289d2ff..e8de97a 100644 --- a/R/colocboost_assemble.R +++ b/R/colocboost_assemble.R @@ -18,7 +18,7 @@ #' #' Summary of the colocboost results and get the output of colocboost (TO-DO-LIST) #' -#' @export +#' @noRd colocboost_assemble <- function(cb_obj, coverage = 0.95, weight_fudge_factor = 1.5, diff --git a/R/colocboost_check_update_jk.R b/R/colocboost_check_update_jk.R index b185a4d..069ecf9 100644 --- a/R/colocboost_check_update_jk.R +++ b/R/colocboost_check_update_jk.R @@ -1,14 +1,10 @@ - - - - -#' Model selection scheme in ColocBoost +#' @title Model selection scheme in ColocBoost #' #' @details #' Model selection scheme in proximity smoothed gradient boosting algorithm to select update traits and update variants at each iteration. #' #' @return update_status and real_update_jk for each trait -#' @export +#' @noRd colocboost_check_update_jk <- function(cb_model, cb_model_para, cb_data, prioritize_jkstar = TRUE, jk_equiv_corr = 0.8, ##### more than 2 traits diff --git a/R/colocboost_init.R b/R/colocboost_init.R index bd32b88..e35277d 100644 --- a/R/colocboost_init.R +++ b/R/colocboost_init.R @@ -1,5 +1,3 @@ - - #' @title Set of Internal functions for initial colocboost objects #' #' @description @@ -21,7 +19,7 @@ #' #' @keywords cb_objects #' @rdname colocboost_objects -#' @export +#' @noRd colocboost_inits <- function() { message("This function initializes colocboost objects. See details for more information.") } diff --git a/R/colocboost_plot.R b/R/colocboost_plot.R index 645d1b3..0debc09 100644 --- a/R/colocboost_plot.R +++ b/R/colocboost_plot.R @@ -4,7 +4,7 @@ #' #' @description `colocboost_plot` generates visualization plots for colocalization events from a ColocBoost analysis. #' -#' @param Output object from `colocboost` analysis +#' @param cb_output Output object from `colocboost` analysis #' @param y Specifies the y-axis values, default is "log10p" for -log10 transformed marginal association p-values. #' @param pos Optional plotting range of x-axis to zoom in to a specific region. #' @param plot_target_only Logical, if TRUE only plots colocalization with target outcome, default is FALSE. diff --git a/R/colocboost_update.R b/R/colocboost_update.R index 706cfe7..ae17e83 100644 --- a/R/colocboost_update.R +++ b/R/colocboost_update.R @@ -1,5 +1,3 @@ - - #' Joint boosting algorithm in ColocBoost #' #' @details @@ -7,7 +5,7 @@ #' #' @importFrom utils head tail #' @return colocboost object after gradient boosting update -#' @export +#' @noRd colocboost_update <- function(cb_model, cb_model_para, cb_data, tau = 0.01, learning_rate_decay = 1, diff --git a/R/colocboost_workhorse.R b/R/colocboost_workhorse.R index b8e5699..edaf737 100644 --- a/R/colocboost_workhorse.R +++ b/R/colocboost_workhorse.R @@ -12,7 +12,7 @@ #' #' There is a version for LD free version with one causal assumption, implemented in `colocboost_one_causal`. #' -#' @export +#' @noRd colocboost_workhorse <- function(cb_data, M=NULL, tau = 0.01, diff --git a/README.md b/README.md index 69f2137..457f5c0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ColocBoost for multi-trait colocalization in molecular QTL and GWAS studies -[![Codecov test coverage](https://codecov.io/gh/StatFunGen/colocboost/branch/master/graph/badge.svg)](https://codecov.io/gh/StatFunGen/colocboost?branch=master) +[![Codecov test coverage](https://codecov.io/gh/StatFunGen/colocboost/branch/main/graph/badge.svg)](https://codecov.io/gh/StatFunGen/colocboost?branch=main) [![CRAN Version](https://www.r-pkg.org/badges/version/colocboost)](https://cran.r-project.org/package=colocboost) This R package implements ColocBoost --- motivated and designed for colocalization analysis ([first formulated here](https://journals.plos.org/plosgenetics/article?id=10.1371/journal.pgen.1004383)) 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. diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..bf4cfdc --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://statfungen.github.io/colocboost + +template: + bootstrap: 5 diff --git a/data/Ind_5traits.rda b/data/Ind_5traits.rda index 7a71840..59489c4 100644 Binary files a/data/Ind_5traits.rda and b/data/Ind_5traits.rda differ diff --git a/data/Sumstat_5traits.rda b/data/Sumstat_5traits.rda index 9c31aa3..b55b42e 100644 Binary files a/data/Sumstat_5traits.rda and b/data/Sumstat_5traits.rda differ diff --git a/man/colocboost_assemble.Rd b/man/colocboost_assemble.Rd deleted file mode 100644 index 1a6210f..0000000 --- a/man/colocboost_assemble.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colocboost_assemble.R -\name{colocboost_assemble} -\alias{colocboost_assemble} -\title{Main function for colocboost post aggregating analysis} -\usage{ -colocboost_assemble( - cb_obj, - coverage = 0.95, - weight_fudge_factor = 1.5, - check_null = 0.1, - check_null_method = "profile", - check_null_max = 2e-05, - dedup = TRUE, - overlap = TRUE, - n_purity = 100, - min_abs_corr = 0.5, - sec_coverage_thresh = 0.8, - median_abs_corr = NULL, - min_cluster_corr = 0.8, - median_cos_abs_corr = 0.8, - weaker_effect = TRUE, - merge_cos = TRUE, - tol = 1e-09, - output_level = 1 -) -} -\description{ -Main function for colocboost post aggregating analysis -} -\details{ -The following functions are included in the post-hoc analysis: - -Colocalization signal - \code{colocboost_assemble_cos} - identify the colocalized confidence sets and the corresponding causal configurations. - -Un-colocalization signal - \code{colocboost_assemble_ucos} - identify the causal confidence sets for each outcome only. - -Add-hoc merge_cos functions including - -\itemize{ -\item{merge_coloc_single}{merge the colocalized sets and the single causal set if pass the \code{median_cos_abs_corr}} -\item{merge_single}{merge the single causal sets for different outcomes if pass the \code{median_cos_abs_corr}} -} - -Refine of the colocalization sets (TO-DO-LIST) - -Summary of the colocboost results and get the output of colocboost (TO-DO-LIST) -} diff --git a/man/colocboost_check_update_jk.Rd b/man/colocboost_check_update_jk.Rd deleted file mode 100644 index 5c61363..0000000 --- a/man/colocboost_check_update_jk.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colocboost_check_update_jk.R -\name{colocboost_check_update_jk} -\alias{colocboost_check_update_jk} -\title{Model selection scheme in ColocBoost} -\usage{ -colocboost_check_update_jk( - cb_model, - cb_model_para, - cb_data, - prioritize_jkstar = TRUE, - jk_equiv_corr = 0.8, - jk_equiv_loglik = 1, - func_compare = "min_max", - coloc_thresh = 0.1 -) -} -\value{ -update_status and real_update_jk for each trait -} -\description{ -Model selection scheme in ColocBoost -} -\details{ -Model selection scheme in proximity smoothed gradient boosting algorithm to select update traits and update variants at each iteration. -} diff --git a/man/colocboost_objects.Rd b/man/colocboost_objects.Rd deleted file mode 100644 index ca4153c..0000000 --- a/man/colocboost_objects.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colocboost_init.R -\name{colocboost_inits} -\alias{colocboost_inits} -\title{Set of Internal functions for initial colocboost objects} -\usage{ -colocboost_init_data(X, Y, dict_YX, Z, LD, N_sumstat, dict_sumstatLD, Var_y, SeBhat) -colocboost_init_model(cb_data) -colocboost_init_para(cb_data, cb_model) -} -\description{ -The \code{colocboost_inits} function provides an interface for initializing different colocboost objects, including data, model, -and model parameters. This documentation serves as a summary for all related initialization functions. -} -\details{ -The following functions are included in this set: -\code{colocboost_init_data} initial colocboost data object. -\code{colocboost_init_model} initial colocboost model object. -\code{colocboost_init_para} initial colocboost model global parameters object. - -These functions are not exported individually and are accessed via \code{colocboost_inits}. -} -\keyword{cb_objects} diff --git a/man/colocboost_plot.Rd b/man/colocboost_plot.Rd index 3dc5817..03900c5 100644 --- a/man/colocboost_plot.Rd +++ b/man/colocboost_plot.Rd @@ -35,6 +35,8 @@ colocboost_plot( ) } \arguments{ +\item{cb_output}{Output object from \code{colocboost} analysis} + \item{y}{Specifies the y-axis values, default is "log10p" for -log10 transformed marginal association p-values.} \item{pos}{Optional plotting range of x-axis to zoom in to a specific region.} @@ -86,8 +88,6 @@ colocboost_plot( \item{title_style}{Vector of two numbers for title style (size, boldness), default is c(2.5, 2)} \item{...}{Additional parameters passed to \code{plot} functions} - -\item{Output}{object from \code{colocboost} analysis} } \value{ Visualization plot for each colcoalization event. diff --git a/man/colocboost_update.Rd b/man/colocboost_update.Rd deleted file mode 100644 index 8ec5624..0000000 --- a/man/colocboost_update.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colocboost_update.R -\name{colocboost_update} -\alias{colocboost_update} -\title{Joint boosting algorithm in ColocBoost} -\usage{ -colocboost_update( - cb_model, - cb_model_para, - cb_data, - tau = 0.01, - learning_rate_decay = 1, - func_simplex = "z2z", - lambda = 0.5, - lambda_target_outcome = 1, - LD_free = FALSE, - dynamic_learning_rate = TRUE -) -} -\value{ -colocboost object after gradient boosting update -} -\description{ -Joint boosting algorithm in ColocBoost -} -\details{ -The gradient boosting algorithm for multiple outcomes -} diff --git a/man/colocboost_workhorse.Rd b/man/colocboost_workhorse.Rd deleted file mode 100644 index 4d6c07d..0000000 --- a/man/colocboost_workhorse.Rd +++ /dev/null @@ -1,47 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colocboost_workhorse.R -\name{colocboost_workhorse} -\alias{colocboost_workhorse} -\title{Workhorse of colocboost} -\usage{ -colocboost_workhorse( - cb_data, - M = NULL, - tau = 0.01, - prioritize_jkstar = TRUE, - learning_rate_init = 0.01, - learning_rate_decay = 1, - func_simplex = "z2z", - lambda = 0.5, - lambda_target_outcome = 1, - jk_equiv_corr = 0.8, - jk_equiv_loglik = 1, - stop_thresh = 1e-06, - func_multi_test = "lfdr", - stop_null = 0.05, - multi_test_max = 1, - multi_test_thresh = 1, - ash_prior = "normal", - p.adjust.methods = "fdr", - func_compare = "min_max", - coloc_thresh = 0.1, - LD_free = FALSE, - dynamic_learning_rate = TRUE, - target_outcome_idx = NULL, - outcome_names = NULL -) -} -\description{ -Workhorse of colocboost -} -\details{ -The following functions are included in the gradient boosting iterations: - -Step 1: \code{colocboost_check_update_jk} selection scheme to choose outcomes need to be updated in each iteration. - -Step 2: \code{colocboost_update} core function of the proximity smoothed gradient boosting update. - -Step 3: check the stop criteria for each outcome. - -There is a version for LD free version with one causal assumption, implemented in \code{colocboost_one_causal}. -} diff --git a/vignettes/Install.Rmd b/vignettes/Install.Rmd index af85f41..236ba9f 100644 --- a/vignettes/Install.Rmd +++ b/vignettes/Install.Rmd @@ -7,7 +7,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -To install Seurat, [R](https://www.r-project.org/) version 4.0 or greater is required. We also recommend installing [R Studio](https://www.rstudio.com/). +To install Seurat, [R](https://www.r-project.org/) version 4.0 or greater is required. We also recommend installing [R Studio](https://posit.co/). Seurat is available on [CRAN](https://cran.r-project.org/package=colocboost)??? for all platforms. To install, run: @@ -33,7 +33,7 @@ BiocManager::install("qvalue") # Install the development version of ColocBoost from GitHub -Install the development version of ColocBoost - directly from [GitHub](https://github.com/xueweic/colocboost). +Install the development version of ColocBoost - directly from [GitHub](https://github.com/StatFunGen/colocboost). ```{r eval = FALSE} # Enter commands in R (or R studio, if installed) diff --git a/vignettes/announcements.Rmd b/vignettes/announcements.Rmd index b42258f..e99d349 100644 --- a/vignettes/announcements.Rmd +++ b/vignettes/announcements.Rmd @@ -1,9 +1,11 @@ --- title: "News" -output: - html_document: - theme: united - df_print: kable +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{News} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} + --- ## **Initial release in ColocBoost**