Turn an aliased gnomAD constraint response into a table
Source:R/gnomad.R
gnomad_parse_constraints.RdPure. The batched query uses GraphQL aliases g1, g2, and so on, so the
response is keyed by alias rather than by symbol. Rows are mapped back by
alias index rather than by the echoed symbol, so the result stays aligned
even for a gene gnomAD does not return a symbol for.
Value
A tibble with one row per entry in symbols, same order. A gene with
no constraint block gets a row of NA rather than being dropped.
Examples
body <- list(data = list(
g1 = list(symbol = "BRAF", gnomad_constraint = list(oe_lof_upper = 0.23)),
g2 = list(symbol = "TP53", gnomad_constraint = NULL)
))
gnomad_parse_constraints(body, c("BRAF", "TP53"))
#> # A tibble: 2 × 8
#> symbol pli loeuf oe_lof oe_mis mis_z syn_z lof_z
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 BRAF NA 0.23 NA NA NA NA NA
#> 2 TP53 NA NA NA NA NA NA NA