Summarize Data from PubChem Based on Identifier
pubchem_summary.Rd
This function provides a comprehensive summary of data from the PubChem database for a given identifier. It can retrieve information about compounds, substances, assays, and additional properties, including synonyms and SDF files.
Usage
pubchem_summary(
identifier,
namespace = "cid",
type = c("compound", "substance", "assay"),
properties = NULL,
include_synonyms = FALSE,
include_sdf = FALSE,
sdf_path = NULL,
sdf_file_name = NULL,
options = NULL
)
Arguments
- identifier
A character string or numeric value representing the identifier for which the summary is required. It can be a compound ID (CID), substance ID (SID), assay ID (AID), or a name.
- namespace
A character string specifying the namespace of the identifier. Possible values include 'cid' for compound ID, 'sid' for substance ID, 'aid' for assay ID, and 'name' for common names or synonyms.
- type
A character vector indicating the type of data to retrieve. Possible values are "compound", "substance", and "assay". This parameter determines the kind of information fetched from PubChem.
- properties
An optional vector of property names to retrieve for the given identifier. If specified, the function fetches these properties from PubChem.
- include_synonyms
Logical; if TRUE, the function also retrieves synonyms for the given identifier.
- include_sdf
Logical; if TRUE, the function downloads the Structure-Data File (SDF) for the given identifier.
- sdf_path
An optional file path for saving the downloaded SDF file. If NULL and `include_sdf` is TRUE, the file is saved into a temporary folder with the identifier as its name.
- sdf_file_name
a character indicating the name of SDF file withoud ".sdf" extension. If NULL, default name is retrieved from
identifier
argument.- options
Additional arguments passed to internal functions.
Value
A list containing the requested data. The structure of the list depends on the parameters provided. It may include compound data, substance data, assay data, CIDs, SIDs, AIDs, synonyms, properties, and an SDF file path.
Examples
# \donttest{
summary_data <- pubchem_summary(
identifier = "aspirin",
namespace = 'name',
type = c("compound", "substance", "assay"),
properties = "IsomericSMILES",
include_synonyms = TRUE,
include_sdf = TRUE
)
#> Failed to retrieve compound data.
#> Successfully retrieved CIDs.
#> Failed to retrieve substance data.
#> Successfully retrieved SIDs
#> Successfully retrieved synonyms data.
#> Successfully retrieved properties data.
#> SDF file to save --> 'aspirin.sdf'
#> Saved into folder --> /var/folders/dr/pwksczrd3gg7sxbphrjs5twh0000gn/T//RtmpfYQRgC
#> Completed options
#> Successfully downloaded SDF file.
# }