Overlap QTL and GWAS top loci by allele-aware variant matching
Source:R/overlapTopLoci.R
overlapTopLoci.RdIntersect the top-loci tables of a QtlFineMappingResult and a
GwasFineMappingResult on shared variants, matched with pecotmr's
allele-aware matchVariants (handling strand flips / ref-alt swaps
rather than naive id equality). The GWAS side is harmonized to the QTL
orientation: its signed effect columns (beta, z,
conditional_effect) are sign-flipped and its effect-allele frequency
(af) is complemented wherever a swap occurred. The result keeps the
variant key columns once (from the QTL, the reference orientation) and
prefixes every other column qtl_ / gwas_. A variant shared
across several QTL contexts and/or GWAS studies yields one row per (QTL entry
x GWAS entry) pair (a wide cross-product per variant).
Usage
overlapTopLoci(qtl, gwas, ...)
# S4 method for class 'QtlFineMappingResult,GwasFineMappingResult'
overlapTopLoci(
qtl,
gwas,
signalCutoff = 0.025,
type = c("data.frame", "GRanges"),
...
)Arguments
- qtl
A
QtlFineMappingResult.- gwas
A
GwasFineMappingResult.- ...
Ignored.
- signalCutoff
PIP cutoff forwarded to
getTopLocifor both inputs. Default 0.025.- type
"data.frame"(default) or"GRanges".
Value
A tibble (or GRanges) keyed on the QTL variant
(variant_id, chrom, pos, A1, A2) with all other columns prefixed
qtl_ / gwas_. Zero rows when there is no allele-aware
overlap.
See also
getTopLoci, matchVariants
Examples
data(qtlFineMappingLbfExample)
data(gwasFineMappingLbfExample)
overlapTopLoci(qtlFineMappingLbfExample, gwasFineMappingLbfExample)
#> # A tibble: 100 × 49
#> variant_id chrom pos A1 A2 qtl_study qtl_context qtl_trait
#> <chr> <chr> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 chr22:10416669:A:T chr22 10416669 T A test_stu… context1 ENSG0000…
#> 2 chr22:10424460:A:T chr22 10424460 T A test_stu… context1 ENSG0000…
#> 3 chr22:10443846:A:T chr22 10443846 T A test_stu… context1 ENSG0000…
#> 4 chr22:10456378:A:T chr22 10456378 T A test_stu… context1 ENSG0000…
#> 5 chr22:10456420:A:T chr22 10456420 T A test_stu… context1 ENSG0000…
#> 6 chr22:10475014:A:T chr22 10475014 T A test_stu… context1 ENSG0000…
#> 7 chr22:10499732:A:T chr22 10499732 T A test_stu… context1 ENSG0000…
#> 8 chr22:10500354:A:T chr22 10500354 T A test_stu… context1 ENSG0000…
#> 9 chr22:10525507:A:T chr22 10525507 T A test_stu… context1 ENSG0000…
#> 10 chr22:10528863:A:T chr22 10528863 T A test_stu… context1 ENSG0000…
#> # ℹ 90 more rows
#> # ℹ 41 more variables: qtl_blockId <chr>, qtl_method <chr>, qtl_N <dbl>,
#> # qtl_af <dbl>, qtl_beta <dbl>, qtl_se <dbl>, qtl_pip <dbl>, qtl_logBF <dbl>,
#> # qtl_cs_95 <chr>, qtl_cs_70 <chr>, qtl_cs_50 <chr>, qtl_cs_95_purity <dbl>,
#> # qtl_cs_70_purity <dbl>, qtl_cs_50_purity <dbl>, qtl_within_cs_pip <dbl>,
#> # qtl_gene <chr>, qtl_event <chr>, qtl_grange_start <int>,
#> # qtl_grange_end <int>, gwas_study <chr>, gwas_context <chr>, …