Skip to content

supports excluding reads by a tag's value, with tests - #272

Merged
brentp merged 5 commits into
brentp:masterfrom
bwlang:tag_exclusion
Oct 29, 2026
Merged

brentp merged 5 commits into
brentp:masterfrom
bwlang:tag_exclusion

Conversation

@bwlang

@bwlang bwlang commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@brentp

brentp commented Aug 27, 2026

Copy link
Copy Markdown
Owner

hi, the implementation looks fine, though I'd rather move the spec.find(':') to before the alignment processing so it's only done once.
I am hesitant to add since it doesn't seem to be widely needed. What's the use-case for this?

@bwlang

bwlang commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

hi... thanks for getting back!
my application is for measuring coverage of "optical duplicates" these are encoded only on a tag (the flag mixes both PCR and optical duplicates). I wanted to see if they cluster up at particular loci. Once could do this with samtools filtering ahead of mosdepth at the cost of an extra bam copy (in this case 100+G). There may be other tag only encodings in e.g. methylation sequencing bams written by bismark etc. I'll make the change you suggested and let you decide whether this is worth a few more lines.

bwlang and others added 3 commits August 27, 2026 07:20
nim-unicodedb 0.14.1 now requires nim >= 1.6.20, and it is pulled in
transitively via docopt -> regex, so the 1.6.18 matrix legs fail at
dependency resolution with "Unsatisfied dependency: nim (>= 1.6.20)".
1.6.20 is the final 1.6.x release, so this keeps the same
oldest-supported-Nim intent.
d4binding/src/api.rs:252 declares `memcpy` as
`fn(*mut c_char, *const c_char, usize)` instead of
`fn(*mut c_void, *const c_void, usize) -> *mut c_void`.

Recent rustc denies that by default via the `invalid_runtime_symbol_definitions`
lint, so the ubuntu runners (which ship a newer preinstalled toolchain
than the macOS ones) fail with exit code 101 before mosdepth is built

rather than patching upstream, i think we can ignore this lint...

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

MD-tag filters can silently retain CRAM reads excluded from equivalent BAM files, while invalid tag names can cause incorrect filtering or out-of-range access.

2 open issues
What changed in this PR

Adds tag-value read exclusion to mosdepth’s coverage calculation, supporting selective duplicate filtering alongside existing flag-based filters.

Changes:

  • Adds comma-separated --exclude-tag TAG:VALUE filters and requests auxiliary-tag decoding for CRAM.
  • Adds functional tests for duplicate filtering, absent tags, multiple exclusions, and malformed input.
  • Updates the CI Nim version and adds a Rust lint workaround for D4 builds.
File Description
mosdepth.nim Adds option parsing, read filtering, help text, and CRAM auxiliary-tag decoding.
functional-tests.sh Adds tag-exclusion scenarios and expected coverage checks.
.github/​workflows/​build.yml Updates Nim 1.6.18 to 1.6.20 and suppresses a Rust lint during D4 compilation.

Review effort: Max

Comment thread mosdepth.nim Resolved
Comment thread mosdepth.nim Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@brentp
brentp merged commit 9406f59 into brentp:master Oct 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants