Skip to content

Add scripts/refbuild: build GOR chromSeq reference builds from FASTA - #133

Open
gorfather wants to merge 1 commit into
gorpipe:mainfrom
gorfather:refbuild-fasta-to-chromseq
Open

Add scripts/refbuild: build GOR chromSeq reference builds from FASTA#133
gorfather wants to merge 1 commit into
gorpipe:mainfrom
gorfather:refbuild-fasta-to-chromseq

Conversation

@gorfather

Copy link
Copy Markdown
Contributor

What

Adds scripts/refbuild/ — tooling to build GOR chromSeq reference builds from standard FASTA.

GOR's reference-build commands and functions (VARJOIN, VARMERGE, VARNORM and refbase() / refbases()) read reference bases from a build folder holding one <contig>.txt per chromosome (one byte per base, no newlines) plus buildsize.gor and buildsplit.txt. GOR does not read FASTA directly, and there was no in-repo tool to produce that layout. This fills that gap.

Contents

  • fasta_to_chromseq.py — stream a FASTA (plain or gzipped) into <contig>.txt, measure buildsize.gor, emit buildsplit.txt from GOR's built-in split tables, and write gor_config.txt. Handles Ensembl vs UCSC contig naming (--chr-prefix, --mt) and primary-assembly filtering (--primary). Streams, so memory stays flat on whole genomes.
  • download_build.sh — one-shot download + convert for hg38/hg19 (Ensembl by default, UCSC alternative); bundles the source URLs.
  • chromseq_to_gor.py + validate.sh — drive gorpipe against a build to prove GOR reads it correctly: refbase() vs the stored bytes, and VCF REF alleles vs refbases() (e.g. a GIAB cross-check).
  • README.md — download URLs, conversion, config wiring, validation, and a buildsize vs buildsplit explanation.

Notes

  • The split tables mirror ReferenceBuildDefaults.java (hg19 shares hg18's table); buildsize.gor is measured from the FASTA.
  • Reference data is intentionally kept out of the repo — only the scripts and URLs live here; builds go to a user-chosen root.
  • Verified: converter round-trips tests/data/ref_mini byte-for-byte, and full Ensembl GRCh38/GRCh37 builds pass genome-wide self-consistency and GIAB chr21 REF cross-checks.

🤖 Generated with Claude Code

GOR's reference-build commands and functions (VARJOIN, VARMERGE, VARNORM and
refbase()/refbases()) read reference bases from a build folder holding one
<contig>.txt per chromosome (one byte per base, no newlines) plus buildsize.gor
and buildsplit.txt. There was no in-repo tool to produce that layout from FASTA.

- fasta_to_chromseq.py: stream a FASTA (plain/gz) into <contig>.txt, measure
  buildsize.gor, emit buildsplit.txt from GOR's built-in tables, write
  gor_config.txt. Handles Ensembl vs UCSC naming (--chr-prefix, --mt) and
  primary-assembly filtering.
- download_build.sh: one-shot download + convert for hg38/hg19 (Ensembl default,
  UCSC alternative); bundles the curl URLs.
- chromseq_to_gor.py + validate.sh: drive gorpipe against a build to verify GOR
  reads it correctly -- refbase() vs the stored bytes, and VCF REF alleles vs
  refbases() (e.g. a GIAB cross-check).
- README.md: download URLs, conversion, config wiring, validation, and a
  buildsize-vs-buildsplit explanation.

Reference data itself is kept out of the repo (built into a user-chosen root).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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