Gbz name validation - #38
Merged
Merged
Conversation
A wrong `--pangenome_ref_name` was silent: `vg haplotypes --set-reference` only warns, the sampled graph loses its reference paths, `vg convert -Q` writes no rGFA tags and `pgutil lift` exits 0 with every read unmapped. Read the reference name and contig prefix from the GBWT metadata in the GBZ header instead (new `pangenome_meta` module, well under a second per graph). The backbone reference is the unfragmented reference sample. Make `--pangenome_ref_name` and `--pangenome_contig_prefix` hidden overrides that must agree with the graph, check the backbone contigs and build against the reference FASTA, replace the `grch38.gbz` filename-suffix check, apply the GRCh38 contig-length check only to GRCh38 backbones, and add `check-sample-gbz` / `check-sample-gfa` jobs to both DAGs so a sampled graph or GFA without the reference fails the run. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lo4R3WSNwCYMcKzvGKCqSs
`validate_grch38_contigs` compared the reference index and the `--pop_vcf` with a hard-coded table of the 25 GRCh38 chromosome lengths, so it only ran for a GRCh38 backbone and never looked at the 170 unplaced contigs the HPRC graph also carries. Drop the table and compare the two files instead: every contig of the backbone reference detected in the GBZ must carry the same length in the `--pop_vcf` header as in the reference FASTA index. A CHM13 graph is now checked the same way a GRCh38 one is, a contig absent from the pop VCF or without a length is an error, and the message names the first ten offenders with both lengths. Only the hidden `--skip_contig_checks` flag bypasses the check; `--skip_pangenome_name_checks` does not. The pop VCF header is now parsed in pure Python. `vcf_contigs` and `vcf_id` shelled out to `bcftools view -h`, and `vcf_contigs` returned a fake three-contig dictionary in dry runs, which left the dry run checking nothing and the real run checking everything. `read_vcf_header` opens the file with `gzip` when its first two bytes say so -- the extension is not trusted -- and stops at the first line that is not a header line, so the body is never read: the header of the 10 GB population VCF parses in about 1 ms. Dry runs now parse it too, and fall back only when the file cannot be read at all, which is what the unit tests and the placeholder files behind them need. The `SentieonVcfID` comparison follows the same rule, so a dry run catches a pop VCF that does not belong with the model bundle. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RWPD3suVQRpMZbJHijXhao
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve pangenome validation