Skip to contents

Pure. The batch /query POST returns a flat array where each element echoes its input query. An ambiguous query yields several elements, best _score first, and an unmatched one yields an element with notfound = true.

Usage

mygene_parse_batch(body, symbols)

Arguments

body

A parsed MyGene batch response, a flat list of hit records.

symbols

The identifiers that were queried, in the order asked.

Value

A tibble with one row per entry in symbols, same order.

Details

Hits are grouped by the echoed query and resolved through mygene_pick_hit(), then mapped back onto symbols in input order, so a caller zips the result onto its input by position. An unmatched or invalid token yields a row of NA rather than being dropped, because a shorter table would silently shift every row after it.

Examples

body <- list(
  list(query = "TP53", symbol = "TP53", entrezgene = "7157"),
  list(query = "NOPE", notfound = TRUE)
)
mygene_parse_batch(body, c("TP53", "NOPE"))
#> # A tibble: 2 × 8
#>   symbol name  summary entrez ensembl_gene uniprot hgnc  type_of_gene
#>   <chr>  <chr> <chr>   <chr>  <chr>        <chr>   <chr> <chr>       
#> 1 TP53   NA    NA      7157   NA           NA      NA    NA          
#> 2 NOPE   NA    NA      NA     NA           NA      NA    NA