Flags variants whose observed z-score is inconsistent with the value
predicted from its LD neighbours, using susieR's kriging diagnostic.
susieR::kriging_rss() computes the leave-one-out conditional
distribution of each z_i given the rest (with the LD-mismatch scale
s defaulting to susieR::estimate_s_rss()) and a per-variant
logLR for the allele-switch hypothesis. This helper reuses susieR's
own allele-switch rule — logLR > logLRThreshold & abs(z) >
zThreshold (the same logLR > 2 & |z| > 2 used in
susie_rss_utils) — to flag variants whose sign should be flipped.
RSS-only helper, opt-in via alleleFlipKriging; never wired into
alleleQc() / matchRefPanel(). Requires a susieR that provides
kriging_rss() and estimate_s_rss().
Arguments
- zScore
Numeric vector of harmonized z-scores.
- R
Square LD correlation matrix aligned to
zScore.- n
Sample size, forwarded to
susieR::kriging_rss()(whose defaultsissusieR::estimate_s_rss()).- variantIds
Optional variant IDs for the diagnostics table.
- zThreshold
Absolute-z cutoff for the allele-switch rule (default
2, matching susieR).- logLRThreshold
Log-likelihood-ratio cutoff for the allele-switch rule (default
2, matching susieR).
Value
A list with flip (logical vector; TRUE = allele switch,
z-score should be sign-flipped) and diagnostics (data frame of
per-variant z, condmean, z_std_diff, logLR, and
the flipped flag).
Examples
data(eqtlRegionExample)
X <- eqtlRegionExample$X[, 1:20]
R <- cor(X)
krigingOutlierQc(
zScore = rnorm(20), R = R, n = 415, variantIds = colnames(X))
#> $flip
#> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>
#> $diagnostics
#> # A tibble: 20 × 6
#> variant_id z condmean z_std_diff logLR flipped
#> <chr> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 chr22:32119788:T:C 0.596 -4.61e-8 0.597 7.19e- 8 FALSE
#> 2 chr22:32119867:T:G -0.0394 -2.17e-8 -0.0394 -2.23e- 9 FALSE
#> 3 chr22:32119961:T:G -0.662 6.84e-8 -0.662 1.18e- 7 FALSE
#> 4 chr22:32120053:T:C 0.361 2.35e-8 0.361 -2.22e- 8 FALSE
#> 5 chr22:32120593:A:G -0.263 4.75e-8 -0.264 3.27e- 8 FALSE
#> 6 chr22:32120636:T:C -0.772 -1.53e-8 -0.772 -3.08e- 8 FALSE
#> 7 chr22:32120932:G:A 1.81 -3.96e-8 1.81 1.87e- 7 FALSE
#> 8 chr22:32120975:A:G -0.585 -4.37e-8 -0.585 -6.69e- 8 FALSE
#> 9 chr22:32121290:C:T -1.47 -2.18e-8 -1.46 -8.33e- 8 FALSE
#> 10 chr22:32121498:A:C -1.99 -1.98e-9 -1.98 -1.03e- 8 FALSE
#> 11 chr22:32121635:T:G -0.802 6.72e-8 -0.802 1.41e- 7 FALSE
#> 12 chr22:32121702:A:G -0.423 3.44e-8 -0.424 3.81e- 8 FALSE
#> 13 chr22:32121936:G:A 0.250 -6.24e-8 0.250 4.08e- 8 FALSE
#> 14 chr22:32122351:A:G -0.555 -5.68e-8 -0.556 -8.26e- 8 FALSE
#> 15 chr22:32122676:A:G 0.718 8.85e-9 0.718 -1.66e- 8 FALSE
#> 16 chr22:32123055:A:G -1.03 -2.65e-8 -1.03 -7.16e- 8 FALSE
#> 17 chr22:32123164:T:C 0.834 -1.19e-7 0.834 2.60e- 7 FALSE
#> 18 chr22:32123383:T:C -0.661 -7.59e-8 -0.662 -1.31e- 7 FALSE
#> 19 chr22:32123461:T:C -0.0126 1.04e-8 -0.0126 3.42e-10 FALSE
#> 20 chr22:32123806:C:T -0.430 -8.48e-8 -0.431 -9.55e- 8 FALSE
#>