Skip to contents

Pure. The flat, one-row form of a variant record, for a variant table that wants a frequency per row. gnomad_parse_frequency() is the nested form with the per-ancestry table.

Usage

gnomad_parse_variant(body, variant_id = NA_character_)

Arguments

body

A parsed gnomAD GraphQL response body.

variant_id

The id that was queried, carried through to the row.

Value

A one-row tibble of variant_id, rsid, exome_af, exome_ac, exome_an, exome_nhomalt, genome_af, genome_ac, genome_an, genome_nhomalt, grpmax_af, grpmax_an, grpmax_id, faf95, faf95_pop, and filters. NULL when the body carries no variant, which is how gnomAD answers for a variant it has never seen.

grpmax is derived

The API does not serve a group maximum. It is computed here from the per-group counts, exome and genome summed, leaving out the bottlenecked groups and the remaining bucket the same way gnomAD does. See GNOMAD_GRPMAX_EXCLUDED.

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

body <- list(data = list(variant = list(
  variant_id = "17-7676154-G-C",
  rsids = list("rs1042522"),
  exome = list(af = 0.72, ac = 1046941, an = 1461558, homozygote_count = 380188)
)))
gnomad_parse_variant(body, "17-7676154-G-C")
#> # A tibble: 1 × 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.72  1046941  1461558        380188        NA        NA
#> # ℹ 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>