Retrieve SDF Data from PubChem and Save as File
get_sdf.Rd
This function sends a request to PubChem to retrieve data in SDF format based on the specified parameters. It then saves the retrieved data as an SDF file in the current working directory.
Usage
get_sdf(
identifier,
namespace = "cid",
domain = "compound",
operation = NULL,
searchtype = NULL,
path = NULL,
file_name = NULL,
options = NULL
)
Arguments
- identifier
A character or numeric value specifying the identifier for the request.
- namespace
A character string specifying the namespace for the request. Default is 'cid'.
- domain
A character string specifying the domain for the request. Default is 'compound'.
- operation
An optional character string specifying the operation for the request.
- searchtype
An optional character string specifying the search type.
- path
A string indicating the path to the folder where the SDF files will be saved. Default is NULL (i.e., saves the file into a temporary folder).
- file_name
A string. File name for downloaded SDF file. If NULL, "file" is used as the file name. Default is NULL.
- options
Additional parameters to be passed to the
request
.
Value
NULL. The function saves the retrieved data as an SDF file in the current working directory and prints a message indicating the file's location.
Examples
get_sdf(
identifier = "aspirin",
namespace = "name",
path = NULL
)
#> 'path' is not specified. Saving files into a temporary folder.
#> SDF file to save --> 'aspirin_2023-12-19_13_29_42.sdf'
#> Saved into folder --> /var/folders/dr/pwksczrd3gg7sxbphrjs5twh0000gn/T//RtmpfYQRgC
#> Completed options