Learn R Programming

PubChemR (version 3.0.0)

pc_sdq_bioactivity: Retrieve Full Biological Test Results from PubChem SDQ

Description

Queries the PubChem SDQ (Structured Data Query) agent to retrieve the full biological test results table for a compound. Uses the download query mode to return all available columns for each record. The number and names of columns vary by compound depending on available data (e.g. baid, aid, sid, cid, activityid, aidtypeid, aidname, targetname, cmpdname, acvalue, geneid, etc.).

Usage

pc_sdq_bioactivity(
  identifier = NULL,
  namespace = "cid",
  collection = "bioactivity",
  limit = 10000000L,
  order = "activity,asc",
  rate_limit = TRUE,
  cache = FALSE,
  cache_dir = NULL,
  cache_ttl = NULL,
  force_refresh = FALSE,
  timeout = NULL,
  retries = NULL,
  pause_base = NULL,
  pause_cap = NULL,
  user_agent = NULL,
  offline = NULL,
  error_mode = c("stop", "result")
)

Value

A tibble of class PubChemTable containing the full bioactivity results.

Arguments

identifier

A single compound identifier (CID, name, or InChIKey depending on namespace).

namespace

Character. The namespace for identifier. Default "cid". If not "cid", the identifier is first resolved to a CID via pc_request.

collection

Character. SDQ collection to query. Default "bioactivity".

limit

Integer. Maximum number of rows to return. Default 10000000L.

order

Character. Column and direction for sorting results. Default "activity,asc".

rate_limit

Logical or numeric. If TRUE (default), applies the global rate limit from pc_config. If numeric, uses that value as requests per second.

cache

Logical. If TRUE, cache results to disk. Default FALSE.

cache_dir

Character. Directory for disk cache. Defaults to the value from pc_config.

cache_ttl

Numeric. Cache time-to-live in seconds. Defaults to the value from pc_config.

force_refresh

Logical. If TRUE, bypass any cached result. Default FALSE.

timeout

Timeout in seconds for SDQ HTTP calls. Defaults to pc_config()$timeout.

retries

Retry attempts for SDQ HTTP calls. Defaults to pc_config()$retries.

pause_base

Base retry pause in seconds. Defaults to pc_config()$pause_base.

pause_cap

Maximum retry pause in seconds. Defaults to pc_config()$pause_cap.

user_agent

User-agent string. Defaults to pc_config()$user_agent.

offline

Logical. If TRUE, use cache-only mode and never hit the network.

error_mode

Error behavior. "stop" (default) throws on failure. "result" returns a typed PubChemResult failure object.

Details

When namespace != "cid", the identifier is first resolved to CID via pc_request before querying SDQ. Returned columns depend on source availability for the requested compound.

Examples

Run this code
names(formals(pc_sdq_bioactivity))

if (FALSE) {
  # Retrieve bioactivity data for aspirin (CID 2244)
  bio <- pc_sdq_bioactivity(2244)
  head(bio)
}

Run the code above in your browser using DataLab