Add test suite and CI#7
Merged
Merged
Conversation
Adds a pytest battery (32 tests) covering: - the per-segment metric helpers (identity, matched, query length, MD-tag detection) against hand-crafted segments with known values; - filterSAMbyIdentity / filterSAMbyPercentMatched retention at several cutoffs, on both SAM and BAM input, and that MD-less reads are dropped; - output-format selection (SAM stays text, BAM is binary, and the *output* extension wins over the input one) — guarding the single-process fixes; - default output-path naming for filenames containing 'sam'/'bam'; - filterSAM dispatch: invalid filter / out-of-range cutoff raising, and the single-vs-parallel routing, including that n_processes<=1 never invokes the splitting machinery (regression guard for #3), plus an end-to-end parallel run that matches the serial result. Adds a GitHub Actions workflow (conda + bioconda samtools/pysam, pip parallelbam) running pytest on push and PRs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The conda-based workflow failed to solve: with channel-priority strict and the action's implicit `defaults` channel, the solver pulled ancient `defaults` pysam builds (pysam 0.7.7 needs python <3.0) and hit a libdeflate conflict. Switch to actions/setup-python + apt samtools + pip (pysam, numpy, pytest, parallelbam all have wheels / are pure-python). Simpler, faster, and avoids the conda channel/ToS mess. Verified locally against the PyPI pysam 0.24.0 wheel: 32 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the pytest battery + CI that was written alongside #6 but didn't make it into
main(PR #6 merged at the-p 1fix commit only). This is a tests-only change — no production code is modified.What's covered (32 tests)
percent_identity,percent_matched,getQueryLength,getNumberOfMatches,sumMatchesAndMismatches,has_MD_tag) against hand-crafted segments with values verified via pysam.filterSAMbyIdentity/filterSAMbyPercentMatchedretention at several cutoffs, on both SAM and BAM input, and MD-less reads always dropped.sam/bam(guard for the suffix-based extension fix).filterSAMdispatch — invalid filter / out-of-range cutoff raising; single-vs-parallel routing, including thatn_processes <= 1never invokes the splitting machinery (regression guard for performance in multiprocessing mode much worse than single processor #3); and an end-to-end parallel run matching the serial result.CI
GitHub Actions workflow (
.github/workflows/tests.yml): conda + biocondasamtools/pysam, pipparallelbam, thenpyteston push tomainand on PRs. It will register and run once merged to the default branch.🤖 Generated with Claude Code