Extract Significant cis-QTL Variants
Source:R/AllGenerics.R, R/qtlAssociationPostprocess.R
getSignificantQtls.RdDerive the significant variants under a given correction method
and FDR threshold from a QtlSumStats enriched by
qtlAssociationPostprocess (significance is computed on
demand, never stored).
Usage
getSignificantQtls(x, ...)
# S4 method for class 'QtlSumStats'
getSignificantQtls(
x,
method = c("permutation", "bonferroni_original", "bonferroni_filtered", "qvalue"),
threshold = NULL
)Examples
pBeta <- c(10^(-c(8, 7, 6, 5, 4, 3)), stats::ppoints(54))
G <- length(pBeta)
entries <- lapply(seq_len(G), function(i) {
gr <- GenomicRanges::GRanges("chr1",
IRanges::IRanges(seq(1000L, by = 50L, length.out = 4L), width = 1L))
S4Vectors::mcols(gr) <- S4Vectors::DataFrame(
SNP = paste0("g", i, "_v", 1:4), A1 = "A", A2 = "G",
P = c(pBeta[i] / 5, 0.2, 0.5, 0.8),
af = c(0.3, 0.2, 0.005, 0.4),
tss_distance = c(0L, 500L, 900000L, 2000000L),
tes_distance = c(0L, 500L, 900000L, 2000000L))
gr
})
qss <- QtlSumStats(study = rep("s", G), context = rep("brain", G),
trait = paste0("g", seq_len(G)), entry = entries, genome = "hg19",
n_variants = rep(50L, G), n_variants_filtered = rep(30L, G),
p_beta = pBeta, beta_shape1 = rep(1, G), beta_shape2 = rep(200, G))
pp <- qtlAssociationPostprocess(qss)
getSignificantQtls(pp)
#> GRanges object with 5 ranges and 10 metadata columns:
#> seqnames ranges strand | SNP A1 A2 P
#> <Rle> <IRanges> <Rle> | <character> <character> <character> <numeric>
#> [1] chr1 1000 * | g1_v1 A G 2e-09
#> [2] chr1 1000 * | g2_v1 A G 2e-08
#> [3] chr1 1000 * | g3_v1 A G 2e-07
#> [4] chr1 1000 * | g4_v1 A G 2e-06
#> [5] chr1 1000 * | g5_v1 A G 2e-05
#> af tss_distance tes_distance study context trait
#> <numeric> <integer> <integer> <character> <character> <character>
#> [1] 0.3 0 0 s brain g1
#> [2] 0.3 0 0 s brain g2
#> [3] 0.3 0 0 s brain g3
#> [4] 0.3 0 0 s brain g4
#> [5] 0.3 0 0 s brain g5
#> -------
#> seqinfo: 1 sequence from hg19 genome; no seqlengths