get_pug_view {PubChemR} | R Documentation |
Retrieve PUG View Data from PubChem
Description
This function sends a request to the PubChem PUG View API to retrieve various types of data for a given identifier. It supports fetching annotations, QR codes, and more, with options for different output formats including JSON and SVG.
Usage
get_pug_view(
annotation = NULL,
identifier = NULL,
domain = "compound",
output = "JSON",
heading = NULL,
headingType = NULL,
page = NULL,
qrSize = "short",
save = FALSE
)
Arguments
annotation |
A character string specifying the type of annotation to retrieve. Valid values are:
|
identifier |
A single identifier for the query, either numeric or character.
**Note:** Only one identifier is allowed per request for certain annotations.
For some annotations like |
domain |
A character string specifying the domain for the request. Possible values include:
- Other domains as specified in the API documentation. |
output |
A character string specifying the output format. Possible values include:
|
heading |
An optional character string specifying a heading to filter the data.
Used with |
headingType |
An optional character string specifying a heading type to filter the data.
Possible values include |
page |
An optional integer specifying a page number for pagination. |
qrSize |
A character string specifying the size of the QR code.
Possible values are |
save |
A logical value indicating whether to save the output to a file. Default is |
Details
The PubChem PUG View API allows users to retrieve detailed information about compounds, substances, and assays. This function constructs the appropriate API call based on the provided parameters. For more detailed information, please refer to the PubChem PUG View API documentation.
Value
Depending on the output format, this function returns different types of content: JSON or JSONP format returns parsed JSON content. SVG format returns an image object. For QR codes, it returns an image object or saves a PNG file.
Examples
result <- get_pug_view(identifier = "2244", annotation = "linkout", domain = "compound")
retrieve(result, .slot = "ObjUrl", .to.data.frame = FALSE)