Repository navigation
Merge pairs gzip level - #15
Merged
Merged
Conversation
Python's gzip default is level 9. On the 96 delta smelt GT-seq samples (14.4 million pairs, 8 jobs) merge-pairs took 211 s at level 9 and 120 s at level 6. The merged reads are identical in all 96 files, and the files are 3.9% larger (1,088 MB against 1,047 MB).
generate writes its sample caches at gzip level 6 too, and each command takes the level as an option from 1 (fastest) to 9 (smallest files). Writing one sample's cache took 1.9 s to 3.3 s at level 9 and 0.7 s to 1.2 s at level 6 on alfalfa, sweetpotato and pecan, for caches 5% to 6% larger. Back to back with 8 jobs, the alfalfa cohort (356 samples) ran in 422 s with its caches at level 9 and in 363 s at level 6, and merge-pairs on the 96 delta smelt samples in 210 s and 122 s. Peak memory is the same at both levels. The level changes no merged read, cache content or MADC row: the alfalfa table, variants sidecar, QC file and all 356 cache payloads are the same at both levels, and so are the 96 merged files. The level is not part of the cache key, so a run reuses caches written at any level.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified, and the change is supported by tests and documentation covering configurable compression, validation, and cache reuse.
No open issues 🎉
What changed in this PR
Adds configurable gzip compression levels for merged FASTQs and generated caches, changing the default to level 6 while preserving data and cache reuse behavior.
Changes:
- Added
--gzip-leveland--cache-gzip-leveloptions with validation. - Propagated compression settings through merge and cache-writing workflows.
- Added tests and documentation covering compression behavior and cache reuse.
| File | Description |
|---|---|
| tests/test_madcats.py | Tests compression levels, validation, and cache reuse behavior. |
| madcats.py | Implements configurable compression defaults, CLI options, validation, and writer integration. |
| docs/src/development/changelog.md | Documents the new compression defaults and behavior. |
| docs/src/development/architecture.md | Documents how compression settings relate to cache keys. |
| docs/src/commands/merge-pairs.md | Documents the --gzip-level option. |
| docs/src/commands/generate.md | Documents the --cache-gzip-level option. |
| docs/DEVELOPMENT.md | Records compression performance measurements and updated test counts. |
Review effort: Lite
Updated help text for gzip compression level arguments to improve clarity.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.


Adjusted the default compression level to be less (6) than the existing level (9). This leads to slightly more storage space being used when writing merged fastq or cache, but speeds up run times. There is also now a user parameter to control compression levels.