MyNixOS website logo
Description

Multi-Context Colocalization Analysis for QTL and GWAS Studies.

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, motivated and designed for colocalization analysis across genome-wide association studies (GWAS) and quantitative trait loci (QTL) studies. The ColocBoost model is described in Cao et. al. (2025) <doi:10.1101/2025.04.17.25326042>.

colocboost unit-testing

Overview

This repository contains a comprehensive testing framework for the colocboost R package. The framework is designed to ensure the reliability and correctness of package functionality through automated testing.

Quick Start

  1. Our unit testing setup is managed by pixi. Please follow the instructions at https://pixi.sh/latest/#installation if you have not already installed pixi.

  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.

    .github/workflows/create_toml_from_yaml.sh $(pwd)
    
  3. Run all tests with a pixi task:

    pixi run devtools_test
    

    or test one file using pixi run:

    pixi run R -e 'devtools::test_active_file("tests/testthat/test_colocboost.R")'
    

Files and Structure

  • testthat/: Directory containing test files
    • test_package.R: Tests for basic package functionality
    • test_colocboost.R: Tests for the main colocalization functions
    • test_inference.R: Tests for the post inference functions
    • test_utils.R: Tests for utility functions
    • test_model.R: Tests for model fitting and prediction functions
  • .github/workflows/: GitHub Actions workflow configurations

Adding New Tests

When adding new functionality to the colocboost package, corresponding tests should be added to maintain test coverage. Follow these steps:

  1. Identify which test file should contain the new tests, or create a new test file if necessary
  2. Write test functions using the testthat package's expectations
  3. Run the tests to ensure they pass

Example test:

test_that("new_function produces expected output", {
  # Arrange
  input_data <- prepare_test_data()
  
  # Act
  result <- new_function(input_data)
  
  # Assert
  expect_equal(result$some_value, expected_value)
  expect_true(is.data.frame(result$data))
})

Test Coverage

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:

pixi run codecov

GitHub Actions Workflow

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/ci.yaml and automatically runs:

  • R CMD check
  • Test coverage reporting with codecov.io

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

For more information, check the testthat documentation.

Metadata

Version

1.0.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows