Special treatment for GRef references in vg haplptypes - #5030
Open
glennhickey wants to merge 1 commit into
Open
Conversation
Sampling with a gref reference (gref_CHM13) copied every gref _alt path through verbatim, which pinned the whole cover and left nothing to remove. Gref fragments are now held out of the reference-inclusion pass and, once each construction job's GBWT is built, clipped to the runs whose nodes and edges already exist there, so the topology is identical to sampling with the base reference. Surviving pieces keep their names and coordinates as subranges (gref_CHM13#0#chr1_7_alt[500]), and --min-gref-len (default 50) drops short ones. Chain naming now prefers a contig from outside the gref namespace, and the guard against a reference contig named like a gref fragment tests the fragment base name, so it fires for subranged reference paths too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01836gaZCYTCFbsHzjUXXFC6
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.
When doing haplotype sampling, you usually want to keep the reference (ex for surjecting / genotyping). But if you are working with Graph Reference (GRef), there's a problem: keeping the reference, which covers most of the graph, will prevent haplotype sampling from actually simplifying the graph -- as most nodes and edges will be part of the reference.
My original mindset was to never haplotype sample on GRef. Rather use, ex,
CHM13, then downstream link the sampled gam back to a complete graph with GRef paths etc. But this doesn't work properly with @benedictpaten's new vg call, which wants a sampled GAM and a sampled graph to work with all at once.So this PR changes
vg haplotypes's sampling behaviour when faced with a graph reference. It will now only preserve the base contigs of the graph reference, and clip remove the alt contigs as needed.So the end result of setting gref_CHM13 or CHM13 as a reference for haplotype sampling will be topologically identical. But using gref_CHM13 will keep covering gref (sub) intervals for as much of the sampled graph as possible.
This is all thanks to Claude/Fable and uses existing naming conventions to determine whether paths are GRef or not...
Changelog Entry
To be copied to the draft changelog by merger: