Skip to contents

Extract the per-variant posterior fine-mapping payload as either a data.frame (default) or a GRanges. Returns identity columns (variant_id, chrom, pos, A1, A2), context (N, MAF), the posterior effect columns (beta = posterior_mean, se = posterior_sd), pip, and credible-set membership columns (cs_95, etc.). Rows are filtered by PIP by default – set signalCutoff = 0 to return every variant.

Usage

topLoci(x, signalCutoff = 0.025, ...)

# S4 method for class 'FineMappingResultBase'
topLoci(
  x,
  signalCutoff = 0.025,
  studyName = NULL,
  context = NULL,
  trait = NULL,
  method = NULL,
  region = NULL,
  minPurity = NULL,
  raw = FALSE
)

Arguments

x

A QtlFineMappingResult or GwasFineMappingResult.

signalCutoff

Numeric (length 1). Drop rows where pip <= signalCutoff. Default 0.025. Use signalCutoff = 0 to keep every variant.

...

Class-specific selection arguments.

studyName

Character (length 1) or NULL. Restrict the selection to this study; NULL matches all studies.

context

Character (length 1) or NULL. Restrict the selection to this context; NULL matches all contexts.

trait

Character (length 1) or NULL. Restrict the selection to this trait; NULL matches all traits.

method

Character (length 1) or NULL. Restrict the selection to this fine-mapping / weight method; NULL matches all methods.

region

Character (length 1, "chr:start-end") or NULL. Restrict variants to this region; NULL uses the full cis window / all regions.

minPurity

Numeric or NULL. Minimum credible-set purity to retain; NULL applies no purity filter.

raw

Logical (length 1). FALSE (default) returns the posterior view described above. TRUE hands back the stored canonical table verbatim – a data.frame, not a GRanges – so neither the projection nor signalCutoff applies.

Value

A GRanges, one range per retained variant, carrying the per-variant columns in mcols(); when the selectors match more than one entry the row-identity columns are carried there too. Take a table with as.data.frame() (which adds the standard seqnames/start/... columns) or as.data.frame(S4Vectors::mcols(.)) for the per-variant columns alone. raw = TRUE returns the stored data.frame instead.

Examples

data(qtlFineMappingExample)
topLoci(qtlFineMappingExample)
#> GRanges object with 15 ranges and 31 metadata columns:
#>        seqnames    ranges strand |       study     context       trait
#>           <Rle> <IRanges>  <Rle> | <character> <character> <character>
#>    [1]    chr22  32596246      * |     study_1   context_1      gene_1
#>    [2]    chr22  32724254      * |     study_1   context_1      gene_1
#>    [3]    chr22  32724508      * |     study_1   context_1      gene_1
#>    [4]    chr22  32728910      * |     study_1   context_1      gene_1
#>    [5]    chr22  32729588      * |     study_1   context_1      gene_1
#>    ...      ...       ...    ... .         ...         ...         ...
#>   [11]    chr22  32743285      * |     study_1   context_1      gene_1
#>   [12]    chr22  32745710      * |     study_1   context_1      gene_1
#>   [13]    chr22  32745749      * |     study_1   context_1      gene_1
#>   [14]    chr22  32752021      * |     study_1   context_1      gene_1
#>   [15]    chr22  32755495      * |     study_1   context_1      gene_1
#>            blockId      method    dataType  dataSource 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>
#>    ...         ...         ...         ...         ...          ...
#>   [11]        <NA>       susie        <NA>        <NA>         <NA>
#>   [12]        <NA>       susie        <NA>        <NA>         <NA>
#>   [13]        <NA>       susie        <NA>        <NA>         <NA>
#>   [14]        <NA>       susie        <NA>        <NA>         <NA>
#>   [15]        <NA>       susie        <NA>        <NA>         <NA>
#>                variant_id       chrom       pos          A1          A2
#>               <character> <character> <integer> <character> <character>
#>    [1] chr22:32596246:T:C       chr22  32596246           C           T
#>    [2] chr22:32724254:T:C       chr22  32724254           C           T
#>    [3] chr22:32724508:C:A       chr22  32724508           A           C
#>    [4] chr22:32728910:G:A       chr22  32728910           A           G
#>    [5] chr22:32729588:T:C       chr22  32729588           C           T
#>    ...                ...         ...       ...         ...         ...
#>   [11] chr22:32743285:A:C       chr22  32743285           C           A
#>   [12] chr22:32745710:T:C       chr22  32745710           C           T
#>   [13] chr22:32745749:T:C       chr22  32745749           C           T
#>   [14] chr22:32752021:A:G       chr22  32752021           G           A
#>   [15] chr22:32755495:C:T       chr22  32755495           T           C
#>                N        af posterior_effect posterior_se     theta       pip
#>        <numeric> <numeric>        <numeric>    <numeric> <numeric> <numeric>
#>    [1]       415        NA      -0.01284643    0.0324407         0 0.1444970
#>    [2]       415        NA       0.00601338    0.0283820         0 0.0442663
#>    [3]       415        NA       0.00601338    0.0283820         0 0.0442663
#>    [4]       415        NA       0.00534990    0.0268018         0 0.0394963
#>    [5]       415        NA       0.00464131    0.0249437         0 0.0345102
#>    ...       ...       ...              ...          ...       ...       ...
#>   [11]       415        NA       0.00893074    0.0340197         0 0.0663491
#>   [12]       415        NA       0.01059700    0.0372659         0 0.0769631
#>   [13]       415        NA       0.00480686    0.0251396         0 0.0363655
#>   [14]       415        NA       0.00480683    0.0251392         0 0.0363659
#>   [15]       415        NA       0.00490735    0.0255981         0 0.0365497
#>            logBF       cs_95       cs_70       cs_50 cs_95_purity cs_70_purity
#>        <numeric> <character> <character> <character>    <numeric>    <numeric>
#>    [1]   6.53015     susie_0     susie_0     susie_0     0.000000     0.000000
#>    [2]  15.67566     susie_1     susie_1     susie_1     0.625503     0.938229
#>    [3]  15.67566     susie_1     susie_1     susie_1     0.625503     0.938229
#>    [4]  15.56140     susie_1     susie_1     susie_0     0.625503     0.938229
#>    [5]  15.42615     susie_1     susie_1     susie_0     0.625503     0.938229
#>    ...       ...         ...         ...         ...          ...          ...
#>   [11]   16.0811     susie_1     susie_1     susie_1     0.625503     0.938229
#>   [12]   16.2296     susie_1     susie_1     susie_1     0.625503     0.938229
#>   [13]   15.4787     susie_1     susie_1     susie_0     0.625503     0.938229
#>   [14]   15.4787     susie_1     susie_1     susie_0     0.625503     0.938229
#>   [15]   15.4837     susie_1     susie_1     susie_0     0.625503     0.938229
#>        cs_50_purity within_cs_pip        gene       event grange_start
#>           <numeric>     <numeric> <character> <character>    <integer>
#>    [1]     0.000000            NA        <NA>        <NA>         <NA>
#>    [2]     0.940595     0.0441714        <NA>        <NA>         <NA>
#>    [3]     0.940595     0.0441714        <NA>        <NA>         <NA>
#>    [4]     0.000000     0.0394021        <NA>        <NA>         <NA>
#>    [5]     0.000000     0.0344176        <NA>        <NA>         <NA>
#>    ...          ...           ...         ...         ...          ...
#>   [11]     0.940595     0.0662558        <NA>        <NA>         <NA>
#>   [12]     0.940595     0.0768644        <NA>        <NA>         <NA>
#>   [13]     0.000000     0.0362743        <NA>        <NA>         <NA>
#>   [14]     0.000000     0.0362754        <NA>        <NA>         <NA>
#>   [15]     0.000000     0.0364562        <NA>        <NA>         <NA>
#>        grange_end
#>         <integer>
#>    [1]       <NA>
#>    [2]       <NA>
#>    [3]       <NA>
#>    [4]       <NA>
#>    [5]       <NA>
#>    ...        ...
#>   [11]       <NA>
#>   [12]       <NA>
#>   [13]       <NA>
#>   [14]       <NA>
#>   [15]       <NA>
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths