Skip to contents

Pure.

Usage

opentargets_parse_drugs(body)

Arguments

body

A parsed Open Targets GraphQL response body.

Value

A tibble of drug, drug_id, drug_type, max_phase, diseases, disease_ids, and source_url. NULL when the target has no known drugs.

Every disease, not just the first

A drug row carries the whole list of diseases it has been tried against, and the first entry is often the least useful one. In the stored BRAF response, BELVARAFENIB lists five, and the first has no mapped disease at all. So the diseases arrive as list columns rather than as one picked value.

diseases prefers the mapped disease name and falls back to diseaseFromSource, which is the label the trial registry used. disease_ids is NA in the positions Open Targets could not map.

max_phase is the raw maxClinicalStage, for example "PHASE_2". Turning that into "Phase 2" is presentation and belongs to whatever is presenting it.

Examples

body <- list(data = list(target = list(
  drugAndClinicalCandidates = list(count = 1, rows = list(
    list(
      maxClinicalStage = "PHASE_2",
      drug = list(id = "CHEMBL1", name = "DRUGX", drugType = "Small molecule"),
      diseases = list(list(
        diseaseFromSource = "melanoma",
        disease = list(id = "MONDO_0005105", name = "melanoma")
      ))
    )
  ))
)))
opentargets_parse_drugs(body)
#> # A tibble: 1 × 7
#>   drug  drug_id drug_type      max_phase diseases  disease_ids source_url       
#>   <chr> <chr>   <chr>          <chr>     <list>    <list>      <chr>            
#> 1 DRUGX CHEMBL1 Small molecule PHASE_2   <chr [1]> <chr [1]>   https://platform…