Skip to contents

Batched through GraphQL aliases and chunked at chunk_size to stay under gnomAD's query cost cap of 25, which was verified for this query. See GNOMAD_CHUNK. Dispatched through biohttp::post_json_many(), so only the chunks the cache is missing go over the wire.

Usage

gnomad_frequencies(
  variant_ids,
  dataset = GNOMAD_DATASET,
  reference_genome = "GRCh38",
  chunk_size = GNOMAD_CHUNK,
  ...
)

Arguments

variant_ids

gnomAD variant ids, see gnomad_variant_id().

dataset

The gnomAD dataset. gnomad_r4 is GRCh38; the gnomad_r2 datasets are GRCh37.

reference_genome

The assembly the id is on. The variant query is keyed by dataset alone, so this is checked against dataset and a mismatch is refused rather than sent, because gnomAD would answer with whatever sits at those coordinates on the other assembly.

chunk_size

Variants per request.

...

Passed to biohttp::post_json_many().

Value

A biohttp envelope whose data is a tibble with one row per entry in variant_ids, in the same order. See gnomad_parse_variant().

Details

A failed chunk yields a row of NA per variant rather than taking the whole call down, following gnomad_constraints(). A variant gnomAD has no record of is a row of NA too, because that is an answer.

References

Chen et al. (2024). A genomic mutational constraint map using variation in 76,156 human genomes. Nature 625(7993), 92-100. doi:10.1038/s41586-023-06045-0

Service documentation: https://gnomad.broadinstitute.org/

Examples

# \donttest{
biohttp::body_or_null(gnomad_frequencies(
  c("17-7676154-G-C", "7-117559590-ATCT-A")
))
#> # A tibble: 2 × 16
#>   variant_id  rsid  exome_af exome_ac exome_an exome_nhomalt genome_af genome_ac
#>   <chr>       <chr>    <dbl>    <dbl>    <dbl>         <dbl>     <dbl>     <dbl>
#> 1 17-7676154… rs10…   0.716   1046941  1461558        380188   0.627       95285
#> 2 7-11755959… rs11…   0.0124    18037  1460114            57   0.00788      1200
#> # ℹ 8 more variables: genome_an <dbl>, genome_nhomalt <dbl>, grpmax_af <dbl>,
#> #   grpmax_an <dbl>, grpmax_id <chr>, faf95 <dbl>, faf95_pop <chr>,
#> #   filters <chr>
# }