## ----setup-options, include = FALSE-------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  crop = NULL ## Related to https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016656.html
)

run_chembl_example <- function(expr) {
  tryCatch(
    expr,
    httr2_failure = function(error) {
      message("ChEMBL example could not complete: ", conditionMessage(error))
      NULL
    },
    annotationgx_chembl_unavailable = function(error) {
      message("ChEMBL example could not complete: ", conditionMessage(error))
      NULL
    }
  )
}

## ----setup-package------------------------------------------------------------
library(AnnotationGx)

## ----single-query-------------------------------------------------------------
mechs <- run_chembl_example(getChemblMechanism("CHEMBL1413"))
mechs

## ----custom-query-------------------------------------------------------------
run_chembl_example(
  queryChemblAPI("mechanism", "molecule_chembl_id", "in", "CHEMBL1413")
)

## ----chembl-resources---------------------------------------------------------
getChemblResources()

## ----resource-fields----------------------------------------------------------
run_chembl_example(getChemblResourceFields("mechanism"))

## ----filter-types-------------------------------------------------------------
getChemblFilterTypes()

## ----session-info-------------------------------------------------------------
sessionInfo()

