Repository navigation
fix(simulate): write SS sub-sort tag via SortOrder accessors (R2-HDR-01) - #531
Conversation
…/samtools parity
fgbio (`SamOrder.applyTo`: `sortOrder.name() + ":" + ss`) and samtools write the
`SS` header tag as `<sort-order>:<sub-sort>` — e.g. `queryname:natural`,
`unsorted:template-coordinate`. fgumi wrote the bare sub-sort (`natural`,
`template-coordinate`), which diverges from both parity targets: fgbio's
`SamOrder.apply` strips everything up to the first colon
(`s.substring(s.indexOf(':') + 1)`), so a bare `SS:natural` is not re-recognized
as a queryname order. (Template-coordinate happened to round-trip by luck.)
`SortOrder::header_ss_tag` now returns the `<sort-order>:<sub-sort>` form, and
`create_output_header` uses it for both the queryname and template-coordinate
branches. The `<sort-order>` prefix is the value written to the `SO` tag
(`queryname` for queryname sub-sorts, `unsorted` for template-coordinate).
No reader regression: `is_template_coordinate_sorted` already splits on the
first colon and accepts both the prefixed and bare forms (mirroring fgbio), so
fgumi-, fgbio-, and samtools-written headers are all accepted. There is no reader
that inspects the queryname sub-sort value.
R2-HDR-01.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughSort-order ChangesSAM SS header formatting
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #531 +/- ##
==========================================
- Coverage 91.17% 91.11% -0.07%
==========================================
Files 78 78
Lines 51916 51911 -5
==========================================
- Hits 47333 47297 -36
- Misses 4583 4614 +31 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
simulate grouped-reads / mapped-reads hand-formatted the `SS` sub-sort tag as a
bare literal. Reuse `SortOrder::TemplateCoordinate.header_{so,go,ss}_tag()` so the
emitted `@HD SS` matches the <sort-order>:<sub-sort> form this PR establishes for
`sort`, keeping every SS-writing site on one canonical mapping. Stacked on #514
(depends on its keys.rs prefix).
8dcf85f to
9676dc1
Compare
Note: overlap with #576 (simulate → canonical fgumi-sort)#576 routes |
…ORT3-10) The `@HD SS` sub-sort value for a lexicographic queryname sort was written as `lexicographic`, which is not the SAM-spec / samtools-ecosystem spelling (`lexicographical` — the value htsjdk/Picard emit and parsers recognize). The tag is write-only (fgumi determines sort order from `SO`/`GO` and the CLI `--order`, never by parsing an input `SS`), so this is a pure spelling correction with no functional round-trip effect. `header_ss_tag()` now returns `lexicographical`. To avoid a UX papercut — a user seeing `SS:queryname:lexicographical` in output and passing it back — `--order queryname::lexicographical` is accepted as an alias for `queryname::lexicographic`. The CLI vocabulary and the type's `Display` keep the shorter `lexicographic` spelling. Composes with the separate `<SO>:<sub-sort>` prefix fix (SORT3-01, #514/#531 in lib.rs): after both, the header reads `SS:queryname:lexicographical`. Verified: `fgumi sort --order queryname` emits `SS:lexicographical` on this branch.
…ORT3-10) The `@HD SS` sub-sort value for a lexicographic queryname sort was written as `lexicographic`, which is not the SAM-spec / samtools-ecosystem spelling (`lexicographical` — the value htsjdk/Picard emit and parsers recognize). The tag is write-only (fgumi determines sort order from `SO`/`GO` and the CLI `--order`, never by parsing an input `SS`), so this is a pure spelling correction with no functional round-trip effect. `header_ss_tag()` now returns `lexicographical`. To avoid a UX papercut — a user seeing `SS:queryname:lexicographical` in output and passing it back — `--order queryname::lexicographical` is accepted as an alias for `queryname::lexicographic`. The CLI vocabulary and the type's `Display` keep the shorter `lexicographic` spelling. Composes with the separate `<SO>:<sub-sort>` prefix fix (SORT3-01, #514/#531 in lib.rs): after both, the header reads `SS:queryname:lexicographical`. Verified: `fgumi sort --order queryname` emits `SS:lexicographical` on this branch.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…ORT3-10) The `@HD SS` sub-sort value for a lexicographic queryname sort was written as `lexicographic`, which is not the SAM-spec / samtools-ecosystem spelling (`lexicographical` — the value htsjdk/Picard emit and parsers recognize). The tag is write-only (fgumi determines sort order from `SO`/`GO` and the CLI `--order`, never by parsing an input `SS`), so this is a pure spelling correction with no functional round-trip effect. `header_ss_tag()` now returns `lexicographical`. To avoid a UX papercut — a user seeing `SS:queryname:lexicographical` in output and passing it back — `--order queryname::lexicographical` is accepted as an alias for `queryname::lexicographic`. The CLI vocabulary and the type's `Display` keep the shorter `lexicographic` spelling. Composes with the separate `<SO>:<sub-sort>` prefix fix (SORT3-01, #514/#531 in lib.rs): after both, the header reads `SS:queryname:lexicographical`. Verified: `fgumi sort --order queryname` emits `SS:lexicographical` on this branch.
…ORT3-10) The `@HD SS` sub-sort value for a lexicographic queryname sort was written as `lexicographic`, which is not the SAM-spec / samtools-ecosystem spelling (`lexicographical` — the value htsjdk/Picard emit and parsers recognize). The tag is write-only (fgumi determines sort order from `SO`/`GO` and the CLI `--order`, never by parsing an input `SS`), so this is a pure spelling correction with no functional round-trip effect. `header_ss_tag()` now returns `lexicographical`. To avoid a UX papercut — a user seeing `SS:queryname:lexicographical` in output and passing it back — `--order queryname::lexicographical` is accepted as an alias for `queryname::lexicographic`. The CLI vocabulary and the type's `Display` keep the shorter `lexicographic` spelling. Composes with the separate `<SO>:<sub-sort>` prefix fix (SORT3-01, #514/#531 in lib.rs): after both, the header reads `SS:queryname:lexicographical`. Verified: `fgumi sort --order queryname` emits `SS:lexicographical` on this branch.
…ORT3-10) The `@HD SS` sub-sort value for a lexicographic queryname sort was written as `lexicographic`, which is not the SAM-spec / samtools-ecosystem spelling (`lexicographical` — the value htsjdk/Picard emit and parsers recognize). The tag is write-only (fgumi determines sort order from `SO`/`GO` and the CLI `--order`, never by parsing an input `SS`), so this is a pure spelling correction with no functional round-trip effect. `header_ss_tag()` now returns `lexicographical`. To avoid a UX papercut — a user seeing `SS:queryname:lexicographical` in output and passing it back — `--order queryname::lexicographical` is accepted as an alias for `queryname::lexicographic`. The CLI vocabulary and the type's `Display` keep the shorter `lexicographic` spelling. Composes with the separate `<SO>:<sub-sort>` prefix fix (SORT3-01, #514/#531 in lib.rs): after both, the header reads `SS:queryname:lexicographical`. Verified: `fgumi sort --order queryname` emits `SS:lexicographical` on this branch.
…ORT3-10) (#567) The `@HD SS` sub-sort value for a lexicographic queryname sort was written as `lexicographic`, which is not the SAM-spec / samtools-ecosystem spelling (`lexicographical` — the value htsjdk/Picard emit and parsers recognize). The tag is write-only (fgumi determines sort order from `SO`/`GO` and the CLI `--order`, never by parsing an input `SS`), so this is a pure spelling correction with no functional round-trip effect. `header_ss_tag()` now returns `lexicographical`. To avoid a UX papercut — a user seeing `SS:queryname:lexicographical` in output and passing it back — `--order queryname::lexicographical` is accepted as an alias for `queryname::lexicographic`. The CLI vocabulary and the type's `Display` keep the shorter `lexicographic` spelling. Composes with the separate `<SO>:<sub-sort>` prefix fix (SORT3-01, #514/#531 in lib.rs): after both, the header reads `SS:queryname:lexicographical`. Verified: `fgumi sort --order queryname` emits `SS:lexicographical` on this branch.
Extends #514's
<sort-order>:<sub-sort>SS parity tosimulate.simulategrouped-reads/mapped-reads hand-formatted theSStag as a bare literal; this reusesSortOrder::TemplateCoordinate.header_{so,go,ss}_tag()(the accessors #514 makes canonical) so every SS-writing site shares one mapping andsimulateoutput carries the sameunsorted:template-coordinateform.Stacked on #514 — it depends on #514's
keys.rsprefix change, so this targetsnh/fix-sort-ss-header-prefix; GitHub will retarget it tomainonce #514 merges. Surfaced by thefgumi comparehardening validation (#530).Summary by CodeRabbit
Bug Fixes
SStags.queryname:lexicographicandqueryname:natural.unsorted:template-coordinate.Improvements
SO,GO, andSSheader tags according to the selected sort order.