Skip to content

cmuts test

Purpose

cmuts test runs the integration test suite to verify that cmuts is installed correctly and functioning as expected. The tests validate mutation counting accuracy across various scenarios.

Usage

cmuts test [OPTIONS]

Options

Option Description
--quick Run only fast tests, skipping slow stress tests
--cram Run only CRAM format tests
-k EXPR Run tests matching the given expression (pytest syntax)
-v Increase verbosity

Examples

Run all tests:

cmuts test

Run quick tests only (recommended for CI):

cmuts test --quick

Run only CRAM-specific tests:

cmuts test --cram

Run tests matching a pattern:

cmuts test -k "edge"

Test Categories

The test suite includes several categories of tests:

Edge Case Tests

Deterministic tests with specific, controlled inputs to verify correct behavior in boundary conditions:

  • Minimal single-read processing
  • Short reads at minimum length threshold
  • High MAPQ and PHRED filtering
  • Quality window averaging
  • Mutation type filtering (mismatches, insertions, deletions)
  • Collapse distance handling
  • Multiple references

CRAM Format Tests

Tests specifically for CRAM file format support:

  • Basic CRAM processing
  • CRAM with quality filters

Random Fuzzing Tests

Tests with randomly generated parameters to catch edge cases:

  • Random BAM file processing
  • Random CRAM file processing

Stress Tests (Slow)

Large-scale tests marked with @pytest.mark.slow:

  • Large reference sequences
  • Many references
  • High coverage scenarios
  • Extended fuzzing with many iterations

Requirements

The test suite requires:

  • pytest (install via pip install pytest)
  • samtools (for BAM/CRAM conversion)
  • h5py (for HDF5 comparison)
  • numpy (for numerical comparison)

Output

Tests output a summary showing passed/failed tests:

============================= test session starts ==============================
...
tests/python/test_core.py::TestEdgeCases::test_minimal_single_read PASSED
tests/python/test_core.py::TestEdgeCases::test_short_reads_at_min_length PASSED
...
============================= 85 passed in 15.10s ==============================

Validation Criteria

Each test validates that:

  1. Counts match: The mutation counts from cmuts core match the expected counts generated by cmuts generate
  2. No crashes: Processing completes without errors
  3. Correct filtering: Quality and length filters are applied correctly