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().
Usage
krigingOutlierQc(
zScore,
R,
n,
variantIds = NULL,
zThreshold = 2,
logLRThreshold = 2,
methodArgs = KrigingOptions()
)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).- methodArgs
Extra arguments for
susieR::kriging_rss(), built withKrigingOptions–r_tolands.
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.291 0.173 -0.471 0.0897 FALSE
#> 2 chr22:32119867:T:G -0.114 0.159 -0.277 0.0323 FALSE
#> 3 chr22:32119961:T:G -2.55 -0.119 -2.44 -0.531 FALSE
#> 4 chr22:32120053:T:C 0.653 -0.128 0.792 0.148 FALSE
#> 5 chr22:32120593:A:G -1.62 0.0604 -1.70 0.174 FALSE
#> 6 chr22:32120636:T:C -1.47 0.147 -1.62 0.378 FALSE
#> 7 chr22:32120932:G:A -0.430 0.0934 -0.527 0.0704 FALSE
#> 8 chr22:32120975:A:G 0.964 0.0462 0.925 -0.0782 FALSE
#> 9 chr22:32121290:C:T 0.0767 0.299 -0.227 -0.0413 FALSE
#> 10 chr22:32121498:A:C 1.30 0.214 1.11 -0.500 FALSE
#> 11 chr22:32121635:T:G -0.0892 -0.0599 -0.0298 -0.00949 FALSE
#> 12 chr22:32121702:A:G -1.09 -0.145 -0.952 -0.277 FALSE
#> 13 chr22:32121936:G:A 0.249 0.162 0.0883 -0.0703 FALSE
#> 14 chr22:32122351:A:G 1.39 0.200 1.21 -0.500 FALSE
#> 15 chr22:32122676:A:G -0.0794 -0.0607 -0.0191 -0.00857 FALSE
#> 16 chr22:32123055:A:G 1.25 0.0193 1.24 -0.0425 FALSE
#> 17 chr22:32123164:T:C -0.357 0.282 -0.650 0.180 FALSE
#> 18 chr22:32123383:T:C -0.711 0.340 -1.07 0.434 FALSE
#> 19 chr22:32123461:T:C -1.24 -0.0481 -1.20 -0.103 FALSE
#> 20 chr22:32123806:C:T 1.24 0.202 1.06 -0.452 FALSE
#>