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 @@ -16,3 +16,4 @@
^\.pixi
^cran-comments\.md$
^LICENSE\.md$
^README\.md$
2 changes: 1 addition & 1 deletion .github/environment/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ devtools_document = "R -e 'devtools::document()'"
devtools_test = "R -e 'devtools::test()'"
codecov = "R -e 'covr::codecov(quiet = FALSE)'"
build = "R -e 'devtools::build()'"
rcmdcheck = "R -e 'pkg <- list.files(\"..\", pattern = \".tar.gz\", full.names = TRUE); rcmdcheck::rcmdcheck(path = pkg[1], args = c(\"--as-cran\"))'"
rcmdcheck = "R -e 'pkg <- list.files(\"..\", pattern = \".tar.gz\", full.names = TRUE); rcmdcheck::rcmdcheck(path = pkg[1], args = c(\"--as-cran\", \"--no-manual\"))'"
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)'"
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: colocboost
Type: Package
Date: 2024-09-01
Date: 2025-04-13
Title: Multi-Context Colocalization Analysis Tool for Molecular QTL and GWAS Studies
Version: 0.1.0
Authors@R: c(
Expand Down
3 changes: 0 additions & 3 deletions R/colocboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#' (default is 0.8) but within the same locus. This step addresses potential instabilities in linkage disequilibrium (LD) estimation
#' that may arise from small sample sizes or discrepancies in minor allele frequencies (MAF) across different confidence sets.
#'
#' @section Input Data:
#' @param X A list of genotype matrices for different outcomes, or a single matrix if all outcomes share the same genotypes.
#' Each matrix should have column names, if sample sizes and variables possibly differing across matrices.
#' @param Y A list of vectors of outcomes or an N by L matrix if it is considered for the same X and multiple outcomes.
Expand All @@ -40,7 +39,6 @@
#' @param effect_se Matrix of standard errors associated with the beta values
#' @param effect_n A scalar or a vector of sample sizes for estimating regression coefficients. Highly recommended!
#'
#' @section Model Parameters
#' @param M The maximum number of gradient boosting rounds. If the number of outcomes are large, it will be automatically increased to a larger number.
#' @param stop_thresh The stop criterion for overall profile loglikelihood function.
#' @param tau The smooth parameter for proximity adaptive smoothing weights for the best update jk-star.
Expand All @@ -64,7 +62,6 @@
#' @param p.adjust.methods The adjusted pvalue method in stats:p.adj when \code{func_multi_test = "fdr"}
#' @param residual_correlation The residual correlation based on the sample overlap, it is diagonal if it is NULL.
#'
#' @section Post Inference Parameters
#' @param coverage A number between 0 and 1 specifying the \dQuote{coverage} of the estimated colocalization confidence sets (CoS) (default is 0.95).
#' @param min_cluster_corr The small correlation for the weights distributions across different iterations to be decided having only one cluster.
#' @param dedup If \code{dedup = TRUE}, the duplicate confidence sets will be removed in the post-processing.
Expand Down
12 changes: 0 additions & 12 deletions man/colocboost.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 20 additions & 48 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,36 @@

## Overview

This repository contains a comprehensive testing framework for the [colocboost](https://github.com/StatFunGen/colocboost) R package. The framework is designed to ensure the reliability and correctness of the package's functionality through automated testing.
This repository contains a comprehensive testing framework for the [colocboost](https://github.com/StatFunGen/colocboost) R package. The framework is designed to ensure the reliability and correctness of package functionality through automated testing.

## Quick Start

1. Navigate to test folder:
```bash
cd tests
```
1. Our unit testing setup is managed by `pixi`. Please follow the instructions at [https://pixi.sh/latest/#installation](https://pixi.sh/latest/#installation) if you have not already installed `pixi`.

2. **First time use**: run the setup script to install required packages and configure the testing environment:
```r
# install.packages(c("devtools", "testthat", "covr", "roxygen2"))
source("setup_testthat.R")
```
2. In the root of this repository, run the helper script to create a pixi.toml file. This file is deliberately ignored in `.gitignore` because it is ephemeral and will be regenerated whenever CI is run.

```bash
.github/workflows/create_toml_from_yaml.sh $(pwd)
```

3. Run all tests:
```r
devtools::load_all()
devtools::test()
```
or,
3. Run all tests with a `pixi` task:
```bash
Rscript run_tests.R
pixi run devtools_test
```
To test one file:
```r
devtools::test_active_file("testthat/test_colocboost.R")
or test one file using `pixi run`:
```bash
pixi run R -e 'devtools::test_active_file("tests/testthat/test_colocboost.R")'
```

## Files and Structure

- `setup_testthat.R`: Script to set up the testthat infrastructure
- `run_tests.R`: Script to run all tests and generate test coverage reports
- `testthat/`: Directory containing test files
- `test_package.R`: Tests for basic package functionality
- `test_colocboost.R`: Tests for the main colocalization functions
- `test_utils.R`: Tests for utility functions
- `test_model.R`: Tests for model fitting and prediction functions
- `.github/workflows/`: GitHub Actions workflow configurations

## How To Use

### Running Tests Locally

To run the tests locally, you can use:

```r
devtools::test()
```

Or run individual test files:

```r
devtools::test_file("testthat/test_colocboost.R")
```

### Adding New Tests

When adding new functionality to the colocboost package, corresponding tests should be added to maintain test coverage. Follow these steps:
Expand All @@ -84,23 +58,21 @@ test_that("new_function produces expected output", {

### Test Coverage

The `covr` package is used to measure test coverage, which indicates what percentage of your code is being tested. Aim for at least 80% coverage for a reliable package.
The `covr` package is used to measure test coverage, which indicates what percentage of the code is being tested.

To generate a test coverage report:
```r
library(covr)
coverage <- package_coverage()
report(coverage)
```bash
pixi run codecov
```

## GitHub Actions Workflow

This testing framework includes GitHub Actions workflows that automatically run the tests on every push and pull request. The workflows test the package on multiple operating systems (Windows, macOS, and Linux) to ensure cross-platform compatibility.
This testing framework includes GitHub Actions workflows that automatically run the tests on every pull request. The workflows test the package on Linux and macOS to ensure cross-platform compatibility.

The workflow is defined in `.github/workflows/R-CMD-check.yaml` and automatically runs:
- R CMD check
- Test coverage reporting
The workflow is defined in `.github/workflows/ci.yaml` and automatically runs:
- `R CMD check`
- Test coverage reporting with [codecov.io](codecov.io)

Test results and coverage statistics are available on the GitHub Actions page after each push or pull request.
Test results and coverage statistics are available on the GitHub Actions page after each pull request.

For more information, check the [testthat documentation](https://testthat.r-lib.org/).
39 changes: 0 additions & 39 deletions tests/run_tests.R

This file was deleted.

130 changes: 0 additions & 130 deletions tests/setup_testthat.R

This file was deleted.