Skip to content

Do not impute at GWAS-observed positions in RAISS - #573

Open
Yining97 wants to merge 1 commit into
StatFunGen:mainfrom
Yining97:rss-raiss-typed-position-guard
Open

Do not impute at GWAS-observed positions in RAISS#573
Yining97 wants to merge 1 commit into
StatFunGen:mainfrom
Yining97:rss-raiss-typed-position-guard

Conversation

@Yining97

Copy link
Copy Markdown
Contributor

Problem

RAISS chose imputation targets purely by variant_id: unknowns <- which(!refPanel$variant_id %in% knownsId). So a genomic position already typed in the GWAS still had its other panel forms imputed — a second allele or the opposite orientation of a site the GWAS actually measured. On the ADSP R5 panel this inflated the imputed set (43 observed multi-allelic positions → 2,969 imputed variants in one block) and manufactured redundant records at measured positions, contradicting the intent of imputation (fill un-observed variants).

Fix

In both RAISS entry points (raissSingleMatrix and raissSingleMatrixFromX), a panel variant is an imputation target only if its canonical (chrom, pos) is not present in the observed z-scores, on top of the existing variant_id check. Positions with no GWAS observation — including genuinely multi-allelic sites — still impute all their panel forms, so legitimately imputed variants remain available to fine-mapping and the credible set.

Validation

  • Synthetic panel with a second allele at a typed position: the old selection imputes it; the guard does not. Un-observed positions still impute, and an un-observed multi-allelic site keeps both ALTs. Verified on both the LD-matrix and SVD (fromX) paths.
  • Also fixed generate_dummy_data, which sampled the known set's variant_id and pos independently (placing a known id at a foreign position) — an inconsistent fixture the guard correctly flags; now drawn from the same panel rows.
  • Full suite: this branch 3035 rows / 3 failed / 6 errors vs clean main 3033 / 3 / 6 (+2 new tests) — identical failure counts, zero new regressions. The 3 failures are pre-existing order-dependent joint-dispatcher tests (pass in isolation); the 6 errors are the pre-existing test_ctwasPipeline.R ones.

Tests added: test_sumstatsQc.R +2 (both RAISS paths).

🤖 Generated with Claude Code

RAISS selected imputation targets by variant_id only, so a position already
typed in the GWAS still had its other panel forms (a second allele / opposite
orientation) imputed. Guard the target set by observed (chrom,pos) in both
raissSingleMatrix and raissSingleMatrixFromX; un-observed positions, including
genuinely multi-allelic sites, still impute all their forms.

Also fixes generate_dummy_data, which sampled the known set's variant_id and pos
independently (an inconsistent fixture the guard correctly flags).
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