Skip to contents

Scores a condition using a fine-mapping table: takes the lead (max-PIP) variant of each credible set, intersects with the contrast variants, picks the least-significant lead by deviation p-value, and returns the maximum pairwise \(|\mathrm{mean}| / \mathrm{se}\) at that variant – the "finemap" feature score of mash_posterior.ipynb.

Usage

scoreFromCs(fineMapping, contrastResults, condition)

Arguments

fineMapping

A fine-mapping data.frame with cs_order, pip and variants columns (credible-set index 0 = not in a CS).

contrastResults

A contrast table from mashPosteriorContrast with a feature_id column.

condition

Condition label whose deviation p-value column is used; if that column is absent and exactly one pairwise contrast exists, the pairwise p-value is used instead.

Value

A single numeric score, or NA when nothing overlaps.

Examples

data(mashPosteriorExample)
om <- matrix(c(0.1, 0.2, 0.3), 1, 3,
  dimnames = list("chr1:100:A:G", c("a", "b", "c")))
pm <- matrix(c(0.5, 0.3, -0.2), 1, 3,
  dimnames = list("chr1:100:A:G", c("a", "b", "c")))
pv <- array(diag(3) * 0.1, dim = c(3, 3, 1))
dimnames(pv) <- list(c("a", "b", "c"), c("a", "b", "c"), NULL)
cr <- fitMashContrast(1L, om, pm, pv)
scoreFromCs(fineMapping = mashPosteriorExample$fineMapping,
  contrastResults = cr, condition = "a")
#> [1] NA