View source: R/get_compounds.R
get_compounds | R Documentation |
This function sends a request to the PubChem database to retrieve compound data based on specified parameters.
get_compounds(
identifier,
namespace = "cid",
operation = NULL,
searchtype = NULL,
options = NULL
)
identifier |
A vector of positive integers (e.g., cid, sid, aid) or identifier strings (source, inchikey, formula).
In some cases, a single identifier string (e.g., name, smiles, xref; inchi, sdf by POST only) is sufficient.
**Note**: |
namespace |
A character string specifying the namespace of the identifier. Possible values include: - - - - - - For more details, see the Input section of the PUG REST API. |
operation |
A character string specifying the operation to perform. Possible values include: - - - - - - If For a full list of operations, see the Operations section of the PUG REST API. |
searchtype |
An optional character string specifying the search type. Possible values include: - - - - If For more details, see the Input section of the PUG REST API. |
options |
A list of additional options for the request. Available options depend on the specific request and the API. Examples include: - For similarity searches: - For substructure searches: If For more details, see the Structure Search Operations section of the PUG REST API. |
For more detailed information, please refer to the PubChem PUG REST API documentation.
An object of class 'PubChemInstanceList' and 'PC_Compounds' containing compound information from the PubChem database.
retrieve, instance
compound <- get_compounds(
identifier = c("aspirin", "ibuprofen", "rstudio"),
namespace = "name"
)
print(compound)
# Return results for selected compound.
instance(compound, "aspirin")
instance(compound, "rstudio")
# instance(compound, "unknown"). # returns error.
# Extract compound properties for the compound "aspirin".
# Use the 'retrieve()' function to extract specific slots from the compound list.
retrieve(instance(compound, "aspirin"), "props")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.