This function sends a request to PubChem to retrieve substance data based on the specified parameters.
get_substances(identifier, namespace = "sid", operation = NULL, options = NULL)
An object of class 'PubChemInstanceList' containing all the substance information of requested compounds.
A vector of substance identifiers, either numeric or character.
The type of identifier depends on the namespace
parameter.
**Note**: identifier
must be provided; it cannot be NULL
.
A character string specifying the namespace of the identifier.
Possible values include:
- sid
: PubChem Substance Identifier (default)
- sourceid/<source id>
: Source-specific substance ID
- sourceall/<source name>
: Source name
- name
: Substance name
- <xref>
: Cross-reference
- listkey
: A list key obtained from a previous query
For more details, see the Input section of the PUG REST API.
A character string specifying the operation to perform.
Possible values include:
- record
: Retrieve the full substance record (default)
- synonyms
: Retrieve synonyms for the substances
- sids
: Retrieve Substance IDs
- cids
: Retrieve Compound IDs related to the substances
- aids
: Retrieve Assay IDs related to the substances
- assaysummary
: Retrieve assay summary
- classification
: Retrieve substance classification
- <xrefs>
: Retrieve cross-references
- description
: Retrieve substance descriptions
If NULL
(default), the operation defaults to record
.
For a full list of operations, see the Operations section of the PUG REST API.
A list of additional options for the request.
Available options depend on the specific request and the API.
Examples include:
- For similarity searches: list(Threshold = 95)
- For substructure searches: list(MaxRecords = 100)
If NULL
(default), no additional options are included.
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.
# \donttest{
subs <- get_substances(
identifier = c("aspirin", "ibuprofen"),
namespace = "name"
)
instance(subs, "aspirin")
retrieve(instance(subs, "aspirin"), "source")
# }
Run the code above in your browser using DataLab