Skip to contents

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",
  savePNG = FALSE
)

Arguments

annotation

A character string specifying the type of annotation to retrieve.

identifier

A single identifier for the query, either numeric or character.

domain

A character string specifying the domain for the request. Default is 'compound'.

output

A character string specifying the output format. Possible values are 'JSON', 'JSONP', and 'SVG'. Default is 'JSON'.

heading

An optional character string for specifying a heading in the request.

headingType

An optional character string for specifying a heading type in the request.

page

An optional character string for specifying a page number in the request.

qrSize

A character string specifying the size of the QR code. Possible values are 'short' and 'long'. Default is 'short'.

savePNG

A logical value indicating whether to save the output as a PNG file. Default is 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.

Examples

  get_pug_view(identifier = "2244", annotation = "linkout", domain = "compound")
#> $Linkout
#> $Linkout$RecordType
#> [1] "compound"
#> 
#> $Linkout$RecordNumber
#> [1] 2244
#> 
#> $Linkout$ObjUrl
#> $Linkout$ObjUrl[[1]]
#> $Linkout$ObjUrl[[1]]$Url
#> [1] "http://partnersolution.ingenuity.com/?cid=97ae3f91eab87a&p1=EntrezPubChem&p2=GV&s=&ipaUri=%2Fpa%2Fapi%2Fv2%2Fgeneview%3Fapplicationname%3DEntrezPubChem%26geneId%3DING:ohn%26geneidtype%3Dingenuity"
#> 
#> $Linkout$ObjUrl[[1]]$SubjectType
#> [1] "molecular interactions"
#> 
#> $Linkout$ObjUrl[[1]]$Category
#> [1] "Chemical Information"
#> 
#> $Linkout$ObjUrl[[1]]$Attribute
#> [1] "subscription/membership/fee required"
#> 
#> $Linkout$ObjUrl[[1]]$Provider
#>                          Name                      NameAbbr 
#> "Ingenuity Pathways Analysis"                   "Ingenuity" 
#>                            Id                           Url 
#>                        "5628"    "http://www.ingenuity.com" 
#> 
#> 
#> $Linkout$ObjUrl[[2]]
#> $Linkout$ObjUrl[[2]]$Url
#> [1] "http://sideeffects.embl.de/drugs/2244/"
#> 
#> $Linkout$ObjUrl[[2]]$LinkName
#> [1] "Side effects of aspirin"
#> 
#> $Linkout$ObjUrl[[2]]$SubjectType
#> [1] "biological properties"
#> 
#> $Linkout$ObjUrl[[2]]$Category
#> [1] "Chemical Information"
#> 
#> $Linkout$ObjUrl[[2]]$Attribute
#> [1] "free resource"
#> 
#> $Linkout$ObjUrl[[2]]$Provider
#>                         Name                     NameAbbr 
#> "SIDER Side Effect Resource"                      "SIDER" 
#>                           Id                          Url 
#>                       "9337" "http://sideeffects.embl.de" 
#> 
#> 
#> 
#>