Skip to contents

Assemble a ColocResult from a pair-level table and the per-pair variant tables that go with it. Callers normally get one from colocPipeline rather than building it directly.

Usage

ColocResult(pairs, variants, ldReference = NULL)

Arguments

pairs

A data frame with one row per tested pair, carrying at least the identity columns of both sides (study, context, trait, method and gwasStudy, gwasContext, gwasTrait, gwasMethod), blockId, qtlCs, gwasCs, nSnps and PP.H0.abf through PP.H4.abf. A GWAS side has no context or trait axis, so those two columns are NA for it.

variants

A list, parallel to pairs' rows, of per-pair data frames with a variant_id column and a SNP.PP.H4 column.

ldReference

Optional genotype panel (see readGenotypes) for the LD reference, used by colocCredibleSets to compute purity.

Value

A ColocResult.

Examples

pairs <- data.frame(
    study = "s1", context = "c1", trait = "g1", method = "susie",
    gwasStudy = "G1", gwasContext = NA_character_,
    gwasTrait = NA_character_, gwasMethod = "susie",
    blockId = "chr1_1_1000",
    qtlCs = 1L, gwasCs = 1L, nSnps = 2L,
    PP.H0.abf = 0.1, PP.H1.abf = 0.1, PP.H2.abf = 0.1,
    PP.H3.abf = 0.1, PP.H4.abf = 0.6
)
variants <- list(data.frame(
    variant_id = c("chr1:100:A:G", "chr1:200:C:T"),
    SNP.PP.H4 = c(0.7, 0.3)
))
ColocResult(pairs, variants)
#> ColocResult with 1 colocalized pair(s)
#>   studies     : s1 
#>   paired with : G1 
#>   variants    : 2 across all pairs
#>   max PP.H4   : 0.6