Skip to contents

Pure.

Usage

opentargets_parse_pgx(body)

Arguments

body

A parsed Open Targets GraphQL response body.

Value

A tibble of rsid, genotype_id, drugs, phenotype, annotation, and evidence_level. NULL when the target has none, which is the normal case for most genes.

Details

drugs is a list column because one annotation can name several. rsid is NA where the annotation is keyed on a genotype rather than a variant, which is common.

Examples

body <- list(data = list(target = list(pharmacogenomics = list(
  list(
    variantRsId = "rs4244285",
    drugs = list(list(drugFromSource = "venlafaxine")),
    phenotypeText = "decreased metabolism of venlafaxine",
    evidenceLevel = "3"
  )
))))
opentargets_parse_pgx(body)
#> # A tibble: 1 × 6
#>   rsid      genotype_id drugs     phenotype            annotation evidence_level
#>   <chr>     <chr>       <list>    <chr>                <chr>      <chr>         
#> 1 rs4244285 NA          <chr [1]> decreased metabolis… NA         3