getPubchemCompound: Retrieve PubChem compound information

View source: R/pubchem_rest.R

getPubchemCompoundR Documentation

Retrieve PubChem compound information

Description

This function retrieves compound information from PubChem using the PubChem REST API. Used by other functions to retrieve compound information.

Usage

getPubchemCompound(
  ids,
  from = "cid",
  to = "property",
  properties = c("Title", "InChIKey"),
  raw = FALSE,
  query_only = FALSE,
  output = "JSON",
  ...
)

Arguments

ids

A vector of compound identifiers.

from

The source namespace of the compound identifiers. Default is 'cid'.

to

The target namespace for the compound information. Default is 'property'.

properties

A character vector specifying the properties to retrieve.

raw

Logical indicating whether to return the raw query results. Default is FALSE.

query_only

Logical indicating whether to only perform the query without retrieving the results. Default is FALSE.

output

The format of the query results. Default is 'JSON'.

...

Additional arguments to be passed to the query_pubchem_rest function.

Value

A data.table containing the retrieved compound information.

Examples

properties <- c("Title", "MolecularFormula", "InChIKey", "CanonicalSMILES")
getPubchemCompound(c(3672, 176870), from = "cid", to = "property", properties = properties)


bhklab/AnnotationGx documentation built on April 3, 2025, 4:27 p.m.