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.
get_pug_view(
annotation = NULL,
identifier = NULL,
domain = "compound",
output = "JSON",
heading = NULL,
headingType = NULL,
page = NULL,
qrSize = "short",
save = FALSE
)
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.
A character string specifying the type of annotation to retrieve.
Valid values are:
annotations
(default): Retrieve annotations across all of PubChem’s primary databases.
categories
: List all PubChem depositors and their SIDs for a given compound, including categorization.
literature
: Retrieve URLs into PubMed for literature associated with a compound, organized by subheading.
image
: Display biologic images associated with compounds.
qr
: Generate QR codes that link to the LCSS page for a compound.
linkout
: Retrieve all the NCBI LinkOut records present for a substance, compound, or assay.
structure
: Retrieve 3D protein structures associated with a compound.
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 annotations
with a heading
, the identifier
can be NULL
.
A character string specifying the domain for the request.
Possible values include:
compound
(default)
substance
- Other domains as specified in the API documentation.
A character string specifying the output format.
Possible values include:
JSON
(default)
XML
CSV
TXT
PNG
SVG
An optional character string specifying a heading to filter the data.
Used with annotations
when identifier
is NULL
.
An optional character string specifying a heading type to filter the data.
Possible values include Compound
, Substance
, etc.
An optional integer specifying a page number for pagination.
A character string specifying the size of the QR code.
Possible values are short
(default) and long
. Used when annotation
is qr
.
A logical value indicating whether to save the output to a file. Default is FALSE
.
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.
# \donttest{
result <- get_pug_view(identifier = "2244", annotation = "linkout", domain = "compound")
retrieve(result, .slot = "ObjUrl", .to.data.frame = FALSE)
# }
Run the code above in your browser using DataLab