Skip to content

Locus rows keep chromosome case; one grammar from legume-genomic-types - #18

Merged
YPARK merged 1 commit into
mainfrom
locus-keep-case
Oct 1, 2026
Merged

YPARK merged 1 commit into
mainfrom
locus-keep-case

Conversation

@YPARK

@YPARK YPARK commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Problem

parse_locus lowercased the whole row name, so auto-detected Locus { merge_overlapping: true } and Mixed alignment (e.g. read_data_on_shared_rows) renamed chrX:0-100 to x_0_100. Names outside the overlap map fell back to canon_locus, which keeps case (X_0_100), so one chromosome could come out two ways, and case-sensitive chromosome matching downstream silently missed X, Y and M.

The parser also split from the left, so contig names carrying _ or - stopped being loci. On a Mixed axis those then went through the gene rule, and distinct contig peaks could collapse into one row.

Change

The locus grammar and its canonical key now come from legume-genomic-types 0.4.6 (coordinates::parse_interval, PeakCoord::locus_key), the single owner of the grammar.

  • Keys are {chr}_{start}_{end} with chr dropped and case kept, on every path: the overlap map, its fallback, Locus without merging, and Mixed.
  • Contig names keep their _ and - and round-trip through the key.
  • Mixed per-name dispatch lives in one helper shared by canonicalize and build_mixed_kind_canonicalizer.
  • The fragments builder's chromosome key reuses chr_stripped instead of a local copy.
  • parse_locus keeps its signature.

Behaviour changes (patch release 0.6.24)

  • Letter chromosomes keep their case in canonical row names (x_… becomes X_…). Outputs or models stored with the old lowercase names will not match these rows by case-sensitive lookup.
  • An empty interval (start == end) is no longer treated as a locus.
  • A non-locus name on a Locus axis now passes through unchanged instead of being separator-folded.

Tests

  • New: shared-rows load of two files keeps X_0_100 (fails before this change).
  • New: case kept on every canonicalizer path; contig names with _ parse and round-trip; contig peaks stay distinct loci on a Mixed axis.

parse_locus lowercased the whole row name, so auto-detected Locus and
Mixed alignment renamed chrX:0-100 to x_0_100, while names outside the
overlap map fell back to canon_locus and kept case (X_0_100). The same
chromosome could come out two ways, and case-sensitive chromosome
matching downstream silently missed X, Y and M. The parser also split
from the left, so contig names carrying '_' or '-' stopped being loci;
on a Mixed axis they then went through the gene rule and distinct
contig peaks could collapse into one row.

The locus grammar and its key now come from legume-genomic-types
(coordinates::parse_interval, PeakCoord::locus_key), the one owner:

- keys are chr_start_end with "chr" dropped and case kept, on the
  overlap map, its fallback, Locus without merging, and Mixed alike;
- contig names keep their '_' and '-' and round-trip through the key;
- an empty interval (start == end) is no longer a locus;
- a non-locus name on a Locus axis passes through unchanged;
- the fragments builder's chromosome key reuses chr_stripped.

parse_locus keeps its signature. Release 0.6.24.
@YPARK
YPARK merged commit 9b263cf into main Oct 1, 2026
5 checks passed
@YPARK
YPARK deleted the locus-keep-case branch October 1, 2026 23:00
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