Skip to content

Classify per-species loci in fetch and always emit the scaffold in FASTA headers - #4

Merged
gwct merged 1 commit into
mainfrom
locus-classification
Sep 22, 2026
Merged

gwct merged 1 commit into
mainfrom
locus-classification

Conversation

@gwct

@gwct gwct commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Fixes behavior where scaffolds for non-reference species were silently dropped from FASTA headers.

  • Scaffold is always in FASTA headers. It previously lived only in an internal dict key, so --fasta-dedupe most-seq or --expected-species discarded it so it can't be resolved to a position in a multi-scaffold genome. Records spanning several source sequences now comma-join them rather than silently naming one.

  • Per-element classification in maf_fetch_summary.tsv (12 new columns, always written, MAF or FASTA): how many species are a clean single locus vs split / multi_scaffold / multi_strand / no_bases, plus the extent and concentration of the splits.

  • Opt-in --loci-table writes per-(element, species, block) rows with each species' source scaffold, MAF-frame coordinates and srcSize, so a per-species BED is a filter away.

  • Reference-side columns renamed ref.n.overlapping.blocks / ref.block.bases, and interblock.distances removed. It was structurally all zeros and invited being read as a per-species contiguity check. The check survives as a ref-coverage-gap warning.

  • Crash fix: -fh species-coords-id with a 3-column BED raised UnboundLocalError.

Why classification rather than just fixing the header: MAF blocks are contiguous in the reference only, so a stitched non-reference row can be several pieces from different places, and the header's span is a bounding box. On real data 88.5% of (element, species) pairs are genuinely one locus; the rest aren't, and now say so.

Breaking: the summary schema changed (a column removed, two renamed, 12 added), so positional parsers need updating. Per-region .maf/.fa output is byte-identical to v0.5.0 across all 14 tested configurations. 137 tests passing.

🤖 Generated with Claude Code

@gwct
gwct merged commit f88bd95 into main Sep 22, 2026
1 check passed
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