Skip to contents

The four views over a ColocResult. The object stores one element per tested (QTL credible set, GWAS credible set, block) pair; these accessors project it to the granularity a given analysis needs, rather than any one of them being the stored shape.

getColocPairs()

One row per tested pair – coloc's native $summary granularity. Every testable pair is reported verbatim, including both halves of a credible set that straddles a block boundary; interpreting them is the caller's decision.

getColocVariants()

One row per (pair, variant), carrying colocPp = PP.H4.abf * SNP.PP.H4 – the posterior that this variant is the shared causal one. With pooled = TRUE, one row per (gene, variant) pooled by the rule below.

getColocCredibleSets()

One row per coloc credible set: the smallest set of variants whose cumulative SNP.PP.H4 reaches coverage. This is a THIRD variant set, not guaranteed to be a subset of either input credible set, so its purity is recomputed from LD rather than inherited.

getColocGenes()

One row per gene, pooled across pairs.

Usage

getColocPairs(x, ...)

getColocVariants(x, pooled = FALSE, ...)

getColocCredibleSets(x, coverage = 0.95, minPp4 = NULL, minAbsCorr = 0.8, ...)

getColocGenes(x, ...)

# S4 method for class 'ColocResult'
getColocPairs(x, ...)

# S4 method for class 'ColocResult'
getColocVariants(x, pooled = FALSE, ...)

# S4 method for class 'ColocResult'
getColocGenes(x, ...)

# S4 method for class 'ColocResult'
getColocCredibleSets(
  x,
  coverage = 0.95,
  minPp4 = NULL,
  minAbsCorr = 0.8,
  requireMaxH4 = FALSE,
  ...
)

# S4 method for class 'ColocBoostResult'
getColocPairs(x, ...)

# S4 method for class 'ColocBoostResult'
getColocVariants(x, pooled = FALSE, ...)

Arguments

x

A ColocResult.

...

Additional arguments passed on to methods.

pooled

Logical. getColocVariants() only: pool to one row per (gene, variant) instead of per (pair, variant).

coverage

Cumulative SNP.PP.H4 the credible set must reach.

minPp4

Optional lower bound on the pair's PP.H4.abf. Applied before any LD work, so a stricter threshold costs strictly less.

minAbsCorr

Minimum absolute correlation between credible-set members (purity). Requires the object's ldSketch; when that is absent, purity is reported as NA and no set is dropped.

requireMaxH4

Logical (length 1), default FALSE. When TRUE, keep only pairs whose PP.H4.abf is the largest of the five posterior probabilities, i.e. colocalization is the favoured hypothesis rather than merely a probable one.

Value

A tibble at the requested granularity.

Pooling

For a fixed QTL credible set i, the per-(block, GWAS credible set) results j are mutually exclusive – the shared causal variant is in one block or the other – so they are summed: min(1, sum_j PP.H4_ij), with a warning when the sum exceeds 1 (several GWAS credible sets competing for one QTL signal, which is diagnostic). Distinct QTL credible sets are independent signals and combine as 1 - prod_i (1 - p_i).

Examples

data(qtlFineMappingLbfExample)
data(gwasFineMappingLbfExample)
res <- colocPipeline(
    qtlFineMappingResult = qtlFineMappingLbfExample,
    gwasInput = gwasFineMappingLbfExample
)
head(getColocPairs(res))
#> # A tibble: 6 × 21
#>   study     context trait method gwasStudy gwasMethod blockId qtlCs gwasCs nSnps
#>   <chr>     <chr>   <chr> <chr>  <chr>     <chr>      <chr>   <int>  <int> <int>
#> 1 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 2 test_stu… contex… ENSG… susie  gwas1     susie      region…     2      1   200
#> 3 test_stu… contex… ENSG… susie  gwas1     susie      region…     3      1   200
#> 4 test_stu… contex… ENSG… susie  gwas1     susie      region…     4      1   200
#> 5 test_stu… contex… ENSG… susie  gwas1     susie      region…     5      1   200
#> 6 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      2   200
#> # ℹ 11 more variables: hit1 <chr>, hit2 <chr>, PP.H0.abf <dbl>,
#> #   PP.H1.abf <dbl>, PP.H2.abf <dbl>, PP.H3.abf <dbl>, PP.H4.abf <dbl>,
#> #   idx1 <int>, idx2 <int>, qtlRetainedMass <dbl>, gwasRetainedMass <dbl>
head(getColocVariants(res))
#> # A tibble: 6 × 24
#>   study     context trait method gwasStudy gwasMethod blockId qtlCs gwasCs nSnps
#>   <chr>     <chr>   <chr> <chr>  <chr>     <chr>      <chr>   <int>  <int> <int>
#> 1 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 2 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 3 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 4 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 5 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 6 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> # ℹ 14 more variables: hit1 <chr>, hit2 <chr>, PP.H0.abf <dbl>,
#> #   PP.H1.abf <dbl>, PP.H2.abf <dbl>, PP.H3.abf <dbl>, PP.H4.abf <dbl>,
#> #   idx1 <int>, idx2 <int>, qtlRetainedMass <dbl>, gwasRetainedMass <dbl>,
#> #   variant_id <chr>, SNP.PP.H4 <dbl>, colocPp <dbl>
getColocGenes(res)
#> # A tibble: 2 × 9
#>   study      context  trait     method gwasStudy gwasMethod  PP.H4 nQtlCs nPairs
#>   <chr>      <chr>    <chr>     <chr>  <chr>     <chr>       <dbl>  <int>  <int>
#> 1 test_study context1 ENSG0000… susie  gwas1     susie      0.0278      5     25
#> 2 test_study context2 ENSG0000… susie  gwas1     susie      0.0267      5     25
head(getColocCredibleSets(res, minPp4 = 0.001))
#> # A tibble: 6 × 27
#>   study     context trait method gwasStudy gwasMethod blockId qtlCs gwasCs nSnps
#>   <chr>     <chr>   <chr> <chr>  <chr>     <chr>      <chr>   <int>  <int> <int>
#> 1 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      1   200
#> 2 test_stu… contex… ENSG… susie  gwas1     susie      region…     2      1   200
#> 3 test_stu… contex… ENSG… susie  gwas1     susie      region…     3      1   200
#> 4 test_stu… contex… ENSG… susie  gwas1     susie      region…     4      1   200
#> 5 test_stu… contex… ENSG… susie  gwas1     susie      region…     5      1   200
#> 6 test_stu… contex… ENSG… susie  gwas1     susie      region…     1      2   200
#> # ℹ 17 more variables: hit1 <chr>, hit2 <chr>, PP.H0.abf <dbl>,
#> #   PP.H1.abf <dbl>, PP.H2.abf <dbl>, PP.H3.abf <dbl>, PP.H4.abf <dbl>,
#> #   idx1 <int>, idx2 <int>, qtlRetainedMass <dbl>, gwasRetainedMass <dbl>,
#> #   csSize <int>, csCoverage <dbl>, leadVariant <chr>, leadPp <dbl>,
#> #   csVariants <list>, purity <dbl>