Scope RAISS imputation to the analysis region, not the whole sketch - #561
Open
Yining97 wants to merge 1 commit into
Open
Scope RAISS imputation to the analysis region, not the whole sketch#561Yining97 wants to merge 1 commit into
Yining97 wants to merge 1 commit into
Conversation
.runEntrySummaryStatsQc's impute branch built its reference panel and dosage from seq_len(nrow(sketchSnpInfo)) - the entire LD sketch - while every other QC step scopes to the region's variants. With a per-chromosome / genome-wide sketch that materialized an n_samples x n_chromVariants dosage matrix, so --impute was unusable on large chromosomes. Restrict refPanel/dosage to the region window [min(pos)-flank, max(pos)+flank] (imputeOpts$flank, default 0), with a defensive empty-window skip. On chr21 with a per-chromosome panel the materialized dosage drops from 197864 to 10319 columns and --impute
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
summaryStatsQc's RAISS imputation (impute = TRUE, in.runEntrySummaryStatsQc) built its reference panel and genotype dosage from the entire LD sketch (seq_len(nrow(sketchSnpInfo))), while every other panel-using QC step scopes to the region's variants. With a per-chromosome / genome-wide sketch that materializes ann_samples × n_chromVariantsdosage matrix +scale()copy + RAISS SVD over the full panel — so--imputewas unusable on large chromosomes.Now the panel/dosage are scoped to the analysis-region window
[min(pos) − flank, max(pos) + flank]on the region chromosome (onewindowIdxfor bothrefPaneland.dosageMatrix).imputeOpts$flank(default 0) widens the window to recover panel variants just beyond the observed range; an empty window skips imputation defensively.Impact
--imputeusable with per-chromosome / genome-wide LD sketches (memory bounded to the region, like every other QC step).--impute+ a per-chromosome LD meta.Testing
susieR 0.16.6:
test_sumstatsQc.R825 pass — new scoping test (dosage built for the in-window panel variants only), 2 existing impute tests updated to use aflank(they impute beyond the observed range).--impute: dosage materialized drops from 197,864 → 10,319 columns (~19×); run completes, 1,357 variants imputed.