Skip to content

Frozen dictionaries: match lowercased locus keys to case-kept rows - #19

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

YPARK merged 1 commit into
mainfrom
frozen-locus-case-fallback

Conversation

@YPARK

@YPARK YPARK commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

data-beans 0.6.5 to 0.6.23 wrote locus row keys with the chromosome lowercased (x_0_100 for chrX:0-100); 0.6.24 keeps case (X_0_100). A frozen feature dictionary saved from the old keys no longer matched the new rows, so X, Y, M and contig peaks silently dropped out of a frozen load.

Change

load_frozen_feature_host gets a second pass after the exact match:

  • A target row left unmatched takes the unused source row with the same case-folded locus key.
  • Keys come from the shared locus grammar (feature_names::folded_locus_key, next to locus_key), so only names that parse as loci take part.
  • A folded key that names more than one source row, or more than one target spelling, is left unmatched and reported in a warning; nothing is guessed.
  • Exact matches are never replaced.
  • The pass is skipped under FeatureNameKind::Exact.
  • How many rows matched this way is logged.

Tests

  • A lowercased dictionary matches case-kept rows (X, M, a contig), with an exact match alongside.
  • Two target spellings, or two source spellings, of one folded key stay unmatched.
  • An exact match is never replaced by the fallback.
  • Exact skips the fallback.

Version 0.6.25.

data-beans 0.6.5 to 0.6.23 wrote locus row keys with the chromosome
lowercased (x_0_100 for chrX:0-100); 0.6.24 keeps case. A frozen
feature dictionary saved from the old keys no longer matched the new
rows, so X, Y, M and contig peaks dropped out of a frozen load.

After the exact pass, a second pass matches a still-unmatched target
row to the unused source row with the same case-folded locus key. Keys
come from the shared locus grammar (feature_names::folded_locus_key),
so only names that parse as loci take part. A folded key that names
more than one source row or more than one target spelling is left
unmatched and reported; exact matches are never replaced. The pass is
skipped under FeatureNameKind::Exact. Release 0.6.25.
@YPARK
YPARK merged commit 916ea02 into main Oct 1, 2026
5 checks passed
@YPARK
YPARK deleted the frozen-locus-case-fallback branch October 1, 2026 23:16
YPARK added a commit that referenced this pull request Oct 1, 2026
This reverts commit 916ea02 (#19), never published. The fallback
matched locus keys with the chromosome case ignored inside the frozen
loader, loosening Locus/Mixed matching for every caller, without
saying which rows matched which way. Case can tell scaffolds apart in
some assemblies. Old dictionaries with lowercased locus keys should be
migrated once, explicitly, or retrained; the loader stays strict.
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