Drop panel-unsupported variants at QC LD lookups instead of aborting - #594
Merged
Merged
Conversation
summaryStatsQc aborts when a harmonized GWAS variant has no entry in the pruned LD panel (kriging prefilter: N variant id(s) not present in the LD sketch panel). The panel filter prunes once before harmonization, and harmonization drops variants the pruned panel can't cover -- but co-located indels survive that: the R5 panel puts an insertion and a deletion on the same POS column with tag ids, harmonization joins by (chrom, pos) so the deletion survives, then the kriging and z-mismatch lookups match by (chrom, pos, allele) tuple and can't resolve it once its partner row is pruned. .panelVariantFilter already documents that the drop-or-error call for a panel-absent variant belongs to .ldFromSketch's onMissing; the QC lookups were the only callers still using the default "error". Make .qcKrigingFlip and .applyLdMismatchQcToEntry pass onMissing="drop", align the entry to the panel-supported subset, and record the dropped count in the qcInfo audit. Leave fine-mapping's onMissing="error" as the post-QC invariant.
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.
What
summaryStatsQcaborts when a harmonized variant has no entry in the pruned LD panel:The kriging prefilter (
.qcKrigingFlip) and z-mismatch QC (.applyLdMismatchQcToEntry) now call.ldFromSketch(onMissing = "drop")and align the entry to the panel-supported subset, dropping the unsupported variants (recorded in the qcInfo audit) instead of aborting. Fine-mapping's.ldFromSketch(onMissing = "error")is unchanged.Why
The panel MAF/MAC/missingness filter prunes the LD panel once, before harmonization, and harmonization then drops any GWAS variant the pruned panel no longer covers -- so the panel-filter path is normally orphan-safe (a
--mafsweep to 0.45, dropping 9349 of 9633 variants, orphans nothing). Co-located indels are the exception: the R5 panel puts an insertion and a deletion on the same POS column with tag ids (e.g.chr21:13988152:INS:Tandchr21:13988153:DEL:T, both at POS 13988152). Harmonization joins by(chrom, pos)so the deletion survives the prune, but the QC lookups match by(chrom, pos, allele)tuple and can't resolve it once its partner row is pruned..panelVariantFilteralready documents that a panel-absent variant is passed through and the drop-or-error decision belongs to.ldFromSketch's onMissing. #585 dropped these during harmonization; #590 replaced that with.repairVariantIds(which keeps them), re-exposing the abort. Dropped variants have no LD in the pruned panel and can't be fine-mapped regardless, so dropping is the correct outcome.Tests
.qcKrigingFlipand.applyLdMismatchQcToEntrywith the orphan condition: they drop the variant and record the count instead of aborting; a no-orphan entry is unchanged; fine-mapping still errors on a genuinely absent variant.