Learn R Programming

PubChemR (version 2.1.3)

get_pug_view: 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
)

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.

Arguments

annotation

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.

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 annotations with a heading, the identifier can be NULL.

domain

A character string specifying the domain for the request.

Possible values include:

compound (default)

substance

- Other domains as specified in the API documentation.

output

A character string specifying the output format.

Possible values include:

JSON (default)

XML

CSV

TXT

PNG

SVG

heading

An optional character string specifying a heading to filter the data. Used with annotations when identifier is NULL.

headingType

An optional character string specifying a heading type to filter the data. Possible values include Compound, Substance, etc.

page

An optional integer specifying a page number for pagination.

qrSize

A character string specifying the size of the QR code. Possible values are short (default) and long. Used when annotation is qr.

save

A logical value indicating whether to save the output to a file. Default is FALSE.

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.

Examples

Run this code
# \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