Skip to content

feat: find fgumi and fgbio variant reviews with bedspec.ext.captainslog - #90

Merged
clintval merged 4 commits into
mainfrom
feat/ext-captainslog-fgbio-fgumi
Oct 27, 2026
Merged

clintval merged 4 commits into
mainfrom
feat/ext-captainslog-fgbio-fgumi

Conversation

@clintval

@clintval clintval commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Extends bedspec.ext.captainslog, whose as_interval now also reads the variant reviews of captainslog's new captainslog.fgumi and captainslog.fgbio (clintval/captainslog#5, released in 0.2.0) as 0-based, half-open spans, to register with register_locatable.
fgumi's review and fgbio's ReviewConsensusVariants write one row for each consensus read carrying a variant, and each row covers the base of its variant.

Record Coordinates Base Name
fgumi.ConsensusVariantReviewInfo, fgbio.ConsensusVariantReviewInfo chrom, pos 1-based, the variant's VCF POS none

A review row is a Bed3, like a CpG.
The extension names a span for the feature it covers, a target or a SNP, and never for the sample or read group a row also holds.
A review row's only name is its consensus_read, which is one of many reads at the same variant and spans more than the variant's base, so it does not name the feature at the span.

No other fgumi or fgbio record is located.
ErrorRateByReadPositionMetric.position is a cycle within a read, not a position on the reference, so the record raises TypeError like any other; the rest, and fgbio's hand-written histograms, hold no coordinates.

Dependencies

  • The captainslog extra rises from captainslog-ngs >=0.1.0 to >=0.2.0, the first release with captainslog.fgumi and captainslog.fgbio. The lock moves from 0.1.0 to 0.2.0 and changes nothing else.

Testing

  • uv run poe check-all passes on the locked captainslog 0.2.0: 729 tests, none skipped, and mypy and basedpyright clean.
  • Against captainslog's review.txt fixture, which fgumi and fgbio write byte for byte the same, both tools' rows give Bed3("chr1", start=500, end=501), and that base of the simulated reference is the row's ref, an A between a C and a G.
  • A TreeDetector of registered review rows finds the row at its base and not at the bases on either side.

Release

This PR bumps bedspec to 4.4.0 in pyproject.toml and uv.lock, a minor release for the records it now locates.
After the squash merge, tagging the merge commit 4.4.0 publishes it.

Summary by CodeRabbit

  • New Features
    • Reviewed variants from fgumi and fgbio can now be converted to genomic intervals, with 1-based positions mapped to 0-based spans.
  • Bug Fixes
    • Unsupported fgbio records without reference positions are rejected with a clear type error.
  • Documentation
    • Updated the supported-records documentation to include reviewed variants.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

as_interval now converts fgumi and fgbio ConsensusVariantReviewInfo records into unnamed BED intervals. The project updates its captainslog dependency minimum and adds tests for conversion, overlap queries, and unsupported record types.

Changes: Captainslog interval conversion

Layer / File(s) Summary
Add reviewed-variant interval conversion
bedspec/ext/_captainslog.py, pyproject.toml, README.md
as_interval supports fgumi and fgbio ConsensusVariantReviewInfo records and returns an unnamed interval from pos - 1 to pos. The README lists these records. The project version changes to 4.4.0, and the minimum captainslog-ngs version changes to 0.2.0.
Test conversion and overlap behavior
tests/ext/test_captainslog.py, tests/test_ext_imports.py
Tests check conversion to [500, 501), reference-base matching, and fgumi overlap queries at the variant position and adjacent intervals. They also check that an error-rate-by-read-position record raises TypeError and block imports of the fgumi and fgbio modules.

Priority: Not assessed

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

  • clintval/bedspec#88: Adds the captainslog extension and as_interval function that this change extends.
Merge Risk: Minimal · up to 213f3

No actionable merge-blocking risk was identified in the reviewed change.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@clintval
clintval merged commit 626a9fc into main Oct 27, 2026
46 checks passed
@clintval
clintval deleted the feat/ext-captainslog-fgbio-fgumi branch October 27, 2026 20:35
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