get_chemical_image {ccdR}R Documentation

Get image file by DTXSID or DTXCID

Description

Get image file by DTXSID or DTXCID

Usage

get_chemical_image(
  DTXSID = NULL,
  DTXCID = NULL,
  format = "",
  API_key = NULL,
  Server = chemical_api_server,
  verbose = FALSE
)

Arguments

DTXSID

Chemical identifier DTXSID

DTXCID

Chemical identifier DTXCID

format

The image type, either "png" or "svg". If left blank, will default to "png".

API_key

The user-specific API key

Server

The root address for the API endpoint

verbose

A logical indicating if some “progress report” should be given.

Value

A Large array of three dimensions representing an image. For displaying this, one may use png::writePNG() or countcolors::plotArrayAsImage() among many such functions.

Examples


# Pull chemical image for BPA by dtxsid
bpa_image_matrix <- get_chemical_image(DTXSID = 'DTXSID7020182')
if (requireNamespace("countcolors", quietly = TRUE)){
  countcolors::plotArrayAsImage(bpa_image_matrix)
}
# Pull chemical image for BPA by dtxcid
bpa_image_matrix <- get_chemical_image(DTXCID = 'DTXCID30182')
if (requireNamespace("countcolors", quietly = TRUE)){
  countcolors::plotArrayAsImage(bpa_image_matrix)
}


[Package ccdR version 1.0.0 Index]