Skip to content

Fix reference bases for zero-depth output positions - #112

Merged
sstadick merged 1 commit into
perf/reuse-indexed-readersfrom
fix/zero-depth-reference-bases
Oct 31, 2026
Merged

sstadick merged 1 commit into
perf/reuse-indexed-readersfrom
fix/zero-depth-reference-bases

Conversation

@sstadick

Copy link
Copy Markdown
Owner

Summary

Stacked on #111 so this PR shows only the zero-depth fix. Merge #111 first, then retarget this PR to master if GitHub has not done so automatically.

Populate REF_BASE after assembling all output positions, including uncovered bases added by --keep-zeros. This fixes inconsistent TSV column counts when a reference is supplied and handles entirely uncovered contigs as well as leading, internal, and trailing gaps.

The annotation step uses the original zero-based reference coordinate regardless of the selected output coordinate mode. Each region retrieves its reference sequence once.

Validation

  • A serialized-output regression test covers BAM and CRAM, zero-based and one-based coordinates, and zero retention enabled/disabled: eight cases total.
  • Before the fix, all four --keep-zeros cases failed with the CSV column-count error; the four controls passed.
  • After the fix, all eight cases passed, checking reference bases, positions, depths, row order, and row count.
  • Full cargo test --locked: 24 library tests, 106 binary tests, and one doctest passed.
  • cargo fmt --check passed.
  • cargo clippy --locked --all-targets completed with existing warnings.

AI disclosure

Implemented with Amp. Draft for human review.

Fill reference bases after assembling all output positions so --keep-zeros emits consistent TSV columns, including on entirely uncovered contigs.

Exercise serialized BAM and CRAM output in both coordinate modes, with and without zero retention. The keep-zeros cases reproduce the CSV error before this fix and pass afterward.

Implemented with Amp; pending human review.

Amp-Thread-ID: https://ampcode.com/threads/T-01a18c50-92d6-73c8-af62-326ba8f97fd3
Co-authored-by: Amp <amp@ampcode.com>
@sstadick
sstadick marked this pull request as ready for review October 31, 2026 09:46
@sstadick
sstadick merged commit 6bf0bf8 into perf/reuse-indexed-readers Oct 31, 2026
@sstadick
sstadick deleted the fix/zero-depth-reference-bases branch October 31, 2026 09:46
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.

1 participant