Skip to contents

Intersect 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 (posterior_effect, beta, z) 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)

Arguments

qtl

A QtlFineMappingResult.

gwas

A GwasFineMappingResult.

...

Ignored.

signalCutoff

PIP cutoff forwarded to topLoci for both inputs. Default 0.025.

Value

A GRanges keyed on the QTL variant (variant_id, chrom, pos, A1, A2 in mcols()) with all other columns prefixed qtl_ / gwas_. Zero ranges when there is no allele-aware overlap. Take a table with as.data.frame().

See also

topLoci, matchVariants

Examples

data(qtlFineMappingLbfExample)
data(gwasFineMappingLbfExample)
overlapTopLoci(qtlFineMappingLbfExample, gwasFineMappingLbfExample)
#> GRanges object with 100 ranges and 57 metadata columns:
#>         seqnames    ranges strand |         variant_id       chrom       pos
#>            <Rle> <IRanges>  <Rle> |        <character> <character> <integer>
#>     [1]    chr22  10416669      * | chr22:10416669:A:T       chr22  10416669
#>     [2]    chr22  10424460      * | chr22:10424460:A:T       chr22  10424460
#>     [3]    chr22  10443846      * | chr22:10443846:A:T       chr22  10443846
#>     [4]    chr22  10456378      * | chr22:10456378:A:T       chr22  10456378
#>     [5]    chr22  10456420      * | chr22:10456420:A:T       chr22  10456420
#>     ...      ...       ...    ... .                ...         ...       ...
#>    [96]    chr22  10861184      * | chr22:10861184:A:T       chr22  10861184
#>    [97]    chr22  10879425      * | chr22:10879425:A:T       chr22  10879425
#>    [98]    chr22  10889177      * | chr22:10889177:A:T       chr22  10889177
#>    [99]    chr22  10894169      * | chr22:10894169:A:T       chr22  10894169
#>   [100]    chr22  10909667      * | chr22:10909667:A:T       chr22  10909667
#>                  A1          A2   qtl_study qtl_context       qtl_trait
#>         <character> <character> <character> <character>     <character>
#>     [1]           T           A  test_study    context1 ENSG00000283047
#>     [2]           T           A  test_study    context1 ENSG00000283047
#>     [3]           T           A  test_study    context1 ENSG00000283047
#>     [4]           T           A  test_study    context1 ENSG00000283047
#>     [5]           T           A  test_study    context1 ENSG00000283047
#>     ...         ...         ...         ...         ...             ...
#>    [96]           T           A  test_study    context2 ENSG00000283047
#>    [97]           T           A  test_study    context2 ENSG00000283047
#>    [98]           T           A  test_study    context2 ENSG00000283047
#>    [99]           T           A  test_study    context2 ENSG00000283047
#>   [100]           T           A  test_study    context2 ENSG00000283047
#>         qtl_blockId  qtl_method qtl_dataType qtl_dataSource qtl_standardized
#>         <character> <character>  <character>    <character>      <character>
#>     [1]        <NA>       susie         <NA>           <NA>             <NA>
#>     [2]        <NA>       susie         <NA>           <NA>             <NA>
#>     [3]        <NA>       susie         <NA>           <NA>             <NA>
#>     [4]        <NA>       susie         <NA>           <NA>             <NA>
#>     [5]        <NA>       susie         <NA>           <NA>             <NA>
#>     ...         ...         ...          ...            ...              ...
#>    [96]        <NA>       susie         <NA>           <NA>             <NA>
#>    [97]        <NA>       susie         <NA>           <NA>             <NA>
#>    [98]        <NA>       susie         <NA>           <NA>             <NA>
#>    [99]        <NA>       susie         <NA>           <NA>             <NA>
#>   [100]        <NA>       susie         <NA>           <NA>             <NA>
#>             qtl_N    qtl_af qtl_posterior_effect qtl_posterior_se qtl_theta
#>         <numeric> <numeric>            <numeric>        <numeric> <numeric>
#>     [1]        49  0.622449           0.00256440        0.0206322        NA
#>     [2]        49  0.734694           0.00170607        0.0171620        NA
#>     [3]        49  0.887755           0.00205156        0.0185858        NA
#>     [4]        49  0.714286          -0.00154173        0.0164768        NA
#>     [5]        49  0.551020           0.01785522        0.0574818        NA
#>     ...       ...       ...                  ...              ...       ...
#>    [96]        49  0.877551          -0.00159957        0.0167367        NA
#>    [97]        49  0.744898          -0.00714520        0.0353108        NA
#>    [98]        49  0.632653          -0.00244683        0.0201975        NA
#>    [99]        49  0.622449          -0.00155717        0.0165594        NA
#>   [100]        49  0.632653           0.00295716        0.0221636        NA
#>           qtl_pip qtl_logBF   qtl_cs_95   qtl_cs_70   qtl_cs_50
#>         <numeric> <numeric> <character> <character> <character>
#>     [1] 0.0310192 0.2451361     susie_0     susie_0     susie_0
#>     [2] 0.0260968 0.0655952     susie_0     susie_0     susie_0
#>     [3] 0.0280609 0.1400534     susie_0     susie_0     susie_0
#>     [4] 0.0251818 0.0287607     susie_0     susie_0     susie_0
#>     [5] 0.1081658 1.5685390     susie_0     susie_0     susie_0
#>     ...       ...       ...         ...         ...         ...
#>    [96] 0.0253719 0.0403459     susie_0     susie_0     susie_0
#>    [97] 0.0562175 0.8556650     susie_0     susie_0     susie_0
#>    [98] 0.0301980 0.2178388     susie_0     susie_0     susie_0
#>    [99] 0.0251374 0.0308550     susie_0     susie_0     susie_0
#>   [100] 0.0331411 0.3130790     susie_0     susie_0     susie_0
#>         qtl_cs_95_purity qtl_cs_70_purity qtl_cs_50_purity qtl_within_cs_pip
#>                <numeric>        <numeric>        <numeric>         <numeric>
#>     [1]                0                0                0                NA
#>     [2]                0                0                0                NA
#>     [3]                0                0                0                NA
#>     [4]                0                0                0                NA
#>     [5]                0                0                0                NA
#>     ...              ...              ...              ...               ...
#>    [96]                0                0                0                NA
#>    [97]                0                0                0                NA
#>    [98]                0                0                0                NA
#>    [99]                0                0                0                NA
#>   [100]                0                0                0                NA
#>            qtl_gene   qtl_event qtl_grange_start qtl_grange_end  gwas_study
#>         <character> <character>        <integer>      <integer> <character>
#>     [1]        <NA>        <NA>             <NA>           <NA>       gwas1
#>     [2]        <NA>        <NA>             <NA>           <NA>       gwas1
#>     [3]        <NA>        <NA>             <NA>           <NA>       gwas1
#>     [4]        <NA>        <NA>             <NA>           <NA>       gwas1
#>     [5]        <NA>        <NA>             <NA>           <NA>       gwas1
#>     ...         ...         ...              ...            ...         ...
#>    [96]        <NA>        <NA>             <NA>           <NA>       gwas1
#>    [97]        <NA>        <NA>             <NA>           <NA>       gwas1
#>    [98]        <NA>        <NA>             <NA>           <NA>       gwas1
#>    [99]        <NA>        <NA>             <NA>           <NA>       gwas1
#>   [100]        <NA>        <NA>             <NA>           <NA>       gwas1
#>         gwas_context  gwas_trait gwas_blockId gwas_method gwas_dataType
#>          <character> <character>  <character> <character>   <character>
#>     [1]         <NA>        <NA>     region_1       susie          <NA>
#>     [2]         <NA>        <NA>     region_1       susie          <NA>
#>     [3]         <NA>        <NA>     region_1       susie          <NA>
#>     [4]         <NA>        <NA>     region_1       susie          <NA>
#>     [5]         <NA>        <NA>     region_1       susie          <NA>
#>     ...          ...         ...          ...         ...           ...
#>    [96]         <NA>        <NA>     region_1       susie          <NA>
#>    [97]         <NA>        <NA>     region_1       susie          <NA>
#>    [98]         <NA>        <NA>     region_1       susie          <NA>
#>    [99]         <NA>        <NA>     region_1       susie          <NA>
#>   [100]         <NA>        <NA>     region_1       susie          <NA>
#>         gwas_dataSource gwas_standardized    gwas_N   gwas_af
#>             <character>       <character> <numeric> <numeric>
#>     [1]            <NA>              <NA>        49  0.622449
#>     [2]            <NA>              <NA>        49  0.734694
#>     [3]            <NA>              <NA>        49  0.887755
#>     [4]            <NA>              <NA>        49  0.714286
#>     [5]            <NA>              <NA>        49  0.551020
#>     ...             ...               ...       ...       ...
#>    [96]            <NA>              <NA>        49  0.877551
#>    [97]            <NA>              <NA>        49  0.744898
#>    [98]            <NA>              <NA>        49  0.632653
#>    [99]            <NA>              <NA>        49  0.622449
#>   [100]            <NA>              <NA>        49  0.632653
#>         gwas_posterior_effect gwas_posterior_se gwas_theta  gwas_pip gwas_logBF
#>                     <numeric>         <numeric>  <numeric> <numeric>  <numeric>
#>     [1]            0.00256440         0.0206322         NA 0.0310192  0.2451361
#>     [2]            0.00170607         0.0171620         NA 0.0260968  0.0655952
#>     [3]            0.00205156         0.0185858         NA 0.0280609  0.1400534
#>     [4]           -0.00154173         0.0164768         NA 0.0251818  0.0287607
#>     [5]            0.01785522         0.0574818         NA 0.1081658  1.5685390
#>     ...                   ...               ...        ...       ...        ...
#>    [96]           -0.00229932         0.0195861         NA 0.0294869   0.192225
#>    [97]           -0.00224516         0.0193692         NA 0.0291744   0.180958
#>    [98]           -0.00409012         0.0261575         NA 0.0397650   0.505606
#>    [99]           -0.00197104         0.0182566         NA 0.0275997   0.123010
#>   [100]            0.00325284         0.0232268         NA 0.0349927   0.371112
#>          gwas_cs_95  gwas_cs_70  gwas_cs_50 gwas_cs_95_purity gwas_cs_70_purity
#>         <character> <character> <character>         <numeric>         <numeric>
#>     [1]     susie_0     susie_0     susie_0                 0                 0
#>     [2]     susie_0     susie_0     susie_0                 0                 0
#>     [3]     susie_0     susie_0     susie_0                 0                 0
#>     [4]     susie_0     susie_0     susie_0                 0                 0
#>     [5]     susie_0     susie_0     susie_0                 0                 0
#>     ...         ...         ...         ...               ...               ...
#>    [96]     susie_0     susie_0     susie_0                 0                 0
#>    [97]     susie_0     susie_0     susie_0                 0                 0
#>    [98]     susie_0     susie_0     susie_0                 0                 0
#>    [99]     susie_0     susie_0     susie_0                 0                 0
#>   [100]     susie_0     susie_0     susie_0                 0                 0
#>         gwas_cs_50_purity gwas_within_cs_pip   gwas_gene  gwas_event
#>                 <numeric>          <numeric> <character> <character>
#>     [1]                 0                 NA        <NA>        <NA>
#>     [2]                 0                 NA        <NA>        <NA>
#>     [3]                 0                 NA        <NA>        <NA>
#>     [4]                 0                 NA        <NA>        <NA>
#>     [5]                 0                 NA        <NA>        <NA>
#>     ...               ...                ...         ...         ...
#>    [96]                 0                 NA        <NA>        <NA>
#>    [97]                 0                 NA        <NA>        <NA>
#>    [98]                 0                 NA        <NA>        <NA>
#>    [99]                 0                 NA        <NA>        <NA>
#>   [100]                 0                 NA        <NA>        <NA>
#>         gwas_grange_start gwas_grange_end
#>                 <integer>       <integer>
#>     [1]              <NA>            <NA>
#>     [2]              <NA>            <NA>
#>     [3]              <NA>            <NA>
#>     [4]              <NA>            <NA>
#>     [5]              <NA>            <NA>
#>     ...               ...             ...
#>    [96]              <NA>            <NA>
#>    [97]              <NA>            <NA>
#>    [98]              <NA>            <NA>
#>    [99]              <NA>            <NA>
#>   [100]              <NA>            <NA>
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths