Skip to contents

This function sends a request to PubChem to retrieve Assay IDs (AIDs) for a given identifier. It returns either a tibble (data frame) with the provided identifier and the corresponding AIDs or a list of AIDs, depending on the `as_data_frame` parameter.

Usage

get_aids(
  identifier,
  namespace = "cid",
  domain = "compound",
  searchtype = NULL,
  as_data_frame = TRUE,
  options = NULL
)

Arguments

identifier

A vector of positive integers (e.g. cid, sid, aid) or identifier strings (source, inchikey, formula). In some cases, only a single identifier string (name, smiles, xref; inchi, sdf by POST only).

namespace

Specifies the namespace for the query. For the 'compound' domain, possible values include 'cid', 'name', 'smiles', 'inchi', 'sdf', 'inchikey', 'formula', 'substructure', 'superstructure', 'similarity', 'identity', 'xref', 'listkey', 'fastidentity', 'fastsimilarity_2d', 'fastsimilarity_3d', 'fastsubstructure', 'fastsuperstructure', and 'fastformula'. For other domains, the possible namespaces are domain-specific.

domain

Specifies the domain of the query. Possible values are 'substance', 'compound', 'assay', 'gene', 'protein', 'pathway', 'taxonomy', 'cell', 'sources', 'sourcetable', 'conformers', 'annotations', 'classification', and 'standardize'.

searchtype

Specifies the type of search to be performed. For structure searches, possible values are combinations of 'substructure', 'superstructure', 'similarity', 'identity' with 'smiles', 'inchi', 'sdf', 'cid'. For fast searches, possible values are combinations of 'fastidentity', 'fastsimilarity_2d', 'fastsimilarity_3d', 'fastsubstructure', 'fastsuperstructure' with 'smiles', 'smarts', 'inchi', 'sdf', 'cid', or 'fastformula'.

as_data_frame

A logical value indicating whether to return the results as a tibble (data frame). Default is TRUE.

options

Additional arguments passed to get_json

Value

If `as_data_frame` is TRUE, a tibble (data frame) where each row corresponds to a provided identifier and its AID. The tibble has columns 'CID' and 'AID'. If `as_data_frame` is FALSE, a list of AIDs is returned.

Examples

get_aids(
  identifier = "aspirin",
  namespace = "name"
)
#> # A tibble: 3,033 × 3
#>    Compound   CID   AID
#>    <chr>    <dbl> <dbl>
#>  1 aspirin   2244     1
#>  2 aspirin   2244     3
#>  3 aspirin   2244     9
#>  4 aspirin   2244    15
#>  5 aspirin   2244    19
#>  6 aspirin   2244    21
#>  7 aspirin   2244    23
#>  8 aspirin   2244    25
#>  9 aspirin   2244    29
#> 10 aspirin   2244    31
#> # ℹ 3,023 more rows