--- title: "Compound-to-Assay Workflow With pc_* API" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Compound-to-Assay Workflow With pc_* API} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ``` This vignette demonstrates an end-to-end compound-to-assay flow: 1. Map names to CIDs. 2. Retrieve AIDs from CIDs. 3. Pull assay summaries. ```{r setup} library(PubChemR) library(dplyr) library(tibble) ``` ## Step 1: Name to CID ```{r eval=TRUE} cid_map <- pc_identifier_map( identifier = c("aspirin", "ibuprofen", "caffeine"), namespace = "name", to = "cids", domain = "compound", cache = TRUE ) as_tibble(cid_map) ``` ## Step 2: CID to AID ```{r eval=TRUE} aid_map <- pc_identifier_map( identifier = c(2244, 3672, 2519), namespace = "cid", to = "aids", domain = "compound", cache = TRUE ) aid_tbl <- as_tibble(aid_map) aid_tbl ``` ## Step 3: Assay summary retrieval ```{r eval=TRUE} # Select a subset of AIDs for demonstration sel_aids <- unique(na.omit(unlist(aid_tbl$AID))) sel_aids <- head(sel_aids, 10) assay_res <- pc_assay( identifier = sel_aids, namespace = "aid", operation = "summary", cache = TRUE ) as_tibble(assay_res) ``` This pattern composes into larger pipelines with `pc_batch()` for throughput.