R Packages
# Primary Packages #
library(tcpl)
library(tcplfit2)
# Data Formatting Packages #
library(dplyr)
library(magrittr)
# Plotting Packages #
library(ggplot2)
library(RColorBrewer)
library(colorspace)
library(viridis)
# Table Packages #
library(htmlTable)
library(kableExtra)
Introduction
This vignette describes how the user can retrieve data from the ToxCast database, known as invitrodb, using tcpl. The MySQL version of the ToxCast database containing all the publicly available ToxCast data is available for download at: https://www.epa.gov/chemical-research/exploring-toxcast-data-downloadable-data.
NOTE:
Users must be connected to the ToxCast database (invitrodb), or a replicate of the database, to utilize many of these functions and execute the examples in this vignette. Please see the introductory vignette in this package for more details.
Overview of Key Functions
To support different data retrieval needs within tcpl, there are a number of functions which query the database and return information to the local R session.
Overview of Data Nomenclature
Throughout this vignette we will use abbreviated designations for data retrieved from the database or to refer to processing steps within tcpl. For data from single concentration assays we use ‘SC.’ ‘MC’ is used for assay data with multiple concentrations. A particular data or processing level is indicated by appending the level id/number to the end of the ‘SC’ or ‘MC’ designation. For example, if we are discussing single concentration data from level 2 processing, then we will use the abbreviation ‘SC2.’
Assay Elements
The tcplLoadAsid, tcplLoadAid, tcplLoadAcid, and tcplLoadAeid functions load relevant assay ids and names for the respective assay elements based on the user specified parameters.
# List all assay source IDs
tcplLoadAsid()
# Create table of all assay endpoint ids (aeids) per assay source
<- tcplLoadAeid(fld="asid", # field to query on
aeids val=14, # value for each field
# values should match their corresponding 'fld'
add.fld = c("aid", "anm", "acid", "acnm")) # additional fields to return
Data
The tcplQuery function allows a user to provide an SQL query to load data from the MySQL database into the R session. In the following chunk we provide an example, but any valid SQL query can replace the one provided in our example.
# Load sample table using a MySQL query.
<- tcplQuery("SELECT * FROM sample;") samples
The tcplLoadData function can be used to load the data from the MySQL database into the R session. Further, the tcplPrepOtpt function can be used in combination with tcplLoadData to add useful chemical and assay annotation information, mapped to the retrieved data.
# Load single concentration data from level 1,
# and map only the chemical annotation information.
<- tcplPrepOtpt(
mc1_fmtd tcplLoadData(
lvl = 2, # data level
fld = 'acid', # field to query on
val = 49, # value for each field
# values should match their corresponding 'fld'
type = 'mc' # data type
),ids = 'spid' # additional annotation fields to add - just chemical info
# - (Default): map assay and chemical annotation
# - 'acid' OR 'aeid': map only assay annotation
# - 'spid': map only chemical annotation
)# Print the first 6 rows of 'sc1_fmtd'
head(mc1_fmtd)
When loading data, the user must indicate the applicable fields and ids for the corresponding data level of interest. Loading level 0 (SC0 and MC0), MC1, and MC2 data the assay component id (\(\mathit{acid}\)) will always be used. As described in Table 1 of the tcpl Data Processing vignette, SC1 and MC3 processing levels perform data normalization where assay component ids (\(\mathit{acid}\)) are converted to assay endpoint ids (\(\mathit{aeid}\)). Thus, the SC1 and MC3 data tables contain both \(\mathit{acid}\) and (\(\mathit{aeid}\)) ID’s. Data can be loaded using either id as long as it is properly specified. Loading SC2, MC4, and MC5 one should always use the assay endpoint id (\(\mathit{aeid}\)). Selected id(s) are based on the primary key within each table containing data. Examples of loading data are detailed in later sections.
Chemical Information
The tcplLoadChem function returns chemical information for user specified parameters, e.g. the chemical name (chnm) and chemical id (chid). The tcplLoadClib function provides more information about the ToxCast chemical library used for sample generation.
Methods
The tcplMthdList function returns methods available for processing at a specified level (i.e. step in the tcpl pipeline). The user defined function in the following code chunk utilizes the tcplMthdList function to retrieve and output all available methods for both the SC and MC data levels.
# Create a function to list all available methods function (SC & MC).
<- function() {
method_list # Single Concentration
## Level 1
<- tcplMthdList(1, 'sc')
sc1 := "sc1"]
sc1[, lvl setnames(sc1, c("sc1_mthd", "sc1_mthd_id"), c("mthd", "mthd_id"))
## Level 2
<- tcplMthdList(2, 'sc')
sc2 := "sc2"]
sc2[, lvl setnames(sc2, c("sc2_mthd", "sc2_mthd_id"), c("mthd", "mthd_id"))
# Multiple Concentration
## Level 2
<- tcplMthdList(2, 'mc')
mc2 := "mc2"]
mc2[, lvl setnames(mc2, c("mc2_mthd", "mc2_mthd_id"), c("mthd", "mthd_id"))
## Level 3
<- tcplMthdList(3, 'mc')
mc3 := "mc3"]
mc3[, lvl setnames(mc3, c("mc3_mthd", "mc3_mthd_id"), c("mthd", "mthd_id"))
## Level 4
<- tcplMthdList(4, 'mc')
mc4 := "mc4"]
mc4[, lvl setnames(mc4, c("mc4_mthd", "mc4_mthd_id"), c("mthd", "mthd_id"))
## Level 5
<- tcplMthdList(5, 'mc')
mc5 := "mc5"]
mc5[, lvl setnames(mc5, c("mc5_mthd", "mc5_mthd_id"), c("mthd", "mthd_id"))
# Compile the Output
<- rbind(sc1, sc2, mc2, mc3, mc4, mc5)
mthd.list <- mthd.list[, c("lvl", "mthd_id", "mthd", "desc")]
mthd.list # Return the Results
return(mthd.list)
}
# Run the 'method_list' functions and store output.
<- method_list()
amthds # Print the available methods list.
amthds
The tcplMthdLoad function returns the method assignments for specified id(s). Later sections provide more detailed examples for utilizing the tcplMthdLoad function for individuals ids.
Retrieving Level 0 Data
Prior to the pipeline processing provided in this package, all the data must go through pre-processing, i.e. raw data to database level 0 data. Pre-processing the data should transform data from heterogeneous assays into a uniform format. This is executed using dataset specific R scripts. After pre-processing is complete and the formatted data matches the level 0 format, it can be loaded into the database using tcplWriteLvl0, as described in the tcpl Data Processing vignette. The standard level 0 format is identical for both testing paradigms, SC or MC. Users can inspect the level 0 data and calculate assay quality metrics prior to running the processing pipeline.
Load SC0 Data
# Load Level 0 single concentration data for a single acid to R.
<- tcplLoadData(lvl=0, # data level
sc0 fld="acid", # field to query on
val=1, # value for each field
# values should match their corresponding 'fld'
type = "sc") # data type - single concentration
# Alternatively, load data in and format with tcplPrepOtpt.
<- tcplPrepOtpt(tcplLoadData(lvl=0, fld="acid", val=1, type = "sc")) sc0
Since we are not able to connect to the database directly in this vignette, we have provided a sample dataset in the package to illustrate what the results should look like.
# Load the example data from the package.
data(sc_vignette,package = 'tcpl')
# Save the single concentration level 0 data in the 'sc0' object.
<- sc_vignette[["sc0"]]
sc0 # Print the first 6 rows of the data.
head(sc0) %>%
# format output into a table
kbl() %>%
# format the output rendering to allow horizontal scrolling
scroll_box(width = "100%") %>%
# reduce the size of the table text to improve readability
kable_styling(font_size = 10)
spid | chid | casn | chnm | dsstox_substance_id | code | acid | acnm | s0id | apid | rowi | coli | wllt | wllq | conc | rval | srcf | conc_unit |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TP0000073D03 | 34212 | 118134-30-8 | Spiroxamine | DTXSID1034212 | C118134308 | 111 | ATG_RXRb_TRANS | 9940119 | NA | NA | NA | t | 1 | 45.8 | 1.0599632 | CLIN11 PlateTP0000049.xls | uM |
TP0000073G09 | 20122 | 86-50-0 | Azinphos-methyl | DTXSID3020122 | C86500 | 111 | ATG_RXRb_TRANS | 9970455 | NA | NA | NA | t | 1 | 50.0 | 0.9581900 | CLIN11 PlateTP0000049.xls | uM |
TP0000075H04 | 21166 | 51-03-6 | Piperonyl butoxide | DTXSID1021166 | C51036 | 111 | ATG_RXRb_TRANS | 10045157 | NA | NA | NA | t | 1 | 50.0 | 0.9531718 | CLIN11 PlateTP0000050.xls | uM |
TP0000077B04 | 24102 | 22224-92-6 | Fenamiphos | DTXSID3024102 | C22224926 | 111 | ATG_RXRb_TRANS | 10062416 | NA | NA | NA | t | 1 | 50.0 | 1.1310499 | CLIN11 PlateTP0000051.xls | uM |
TP0000077B09 | 24195 | 94-74-6 | 2-(4-Chloro-2-methylphenoxy)acetic acid | DTXSID4024195 | C94746 | 111 | ATG_RXRb_TRANS | 10066027 | NA | NA | NA | t | 1 | 50.0 | 0.8759538 | CLIN11 PlateTP0000051.xls | uM |
TP0000077B10 | 32398 | 131341-86-1 | Fludioxonil | DTXSID2032398 | C131341861 | 111 | ATG_RXRb_TRANS | 10066756 | NA | NA | NA | t | 1 | 19.3 | 12.7624120 | CLIN11 PlateTP0000051.xls | uM |
Load MC0 Data
# Load Level 0 multiple concentration data.
<- tcplPrepOtpt(
mc0 tcplLoadData(lvl=0, # data level
fld="acid", # field to query on
val=1, # value for each field
# values should match their corresponding 'fld'
type = "mc") # data type - multiple concentrations
)
We again can use one of the provided datasets in this package to demonstrate what the above results should look like.
# Load the example data from the package.
data(mc_vignette,package = 'tcpl')
# Save the multiple concentration level 0 data in the 'mc0' object.
<- mc_vignette[["mc0"]]
mc0 # Print the first 6 rows of the data.
head(mc0) %>%
# format output into a table
kbl() %>%
# format the output rendering to allow horizontal scrolling
scroll_box(width = "100%") %>%
# reduce the size of the table text to improve readability
kable_styling(font_size = 10)
spid | chid | casn | chnm | dsstox_substance_id | code | acid | acnm | m0id | apid | rowi | coli | wllt | wllq | conc | rval | srcf | conc_unit |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
01504209 | 379721 | 2264-01-9 | 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate | DTXSID80379721 | C2264019 | 49 | ATG_GLI_CIS | 626391856 | TO-17-1CD | NA | NA | t | 1 | 0.412 | 1.0183150 | EPA-TO17-Part2-ATTAGENE-CIS-FACTORIAL-DATA-May-10-2019.xlsx | uM |
01504209 | 379721 | 2264-01-9 | 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate | DTXSID80379721 | C2264019 | 49 | ATG_GLI_CIS | 626391857 | TO-17-1CD | NA | NA | t | 1 | 11.100 | 0.9848485 | EPA-TO17-Part2-ATTAGENE-CIS-FACTORIAL-DATA-May-10-2019.xlsx | uM |
01504209 | 379721 | 2264-01-9 | 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate | DTXSID80379721 | C2264019 | 49 | ATG_GLI_CIS | 626391850 | TO-17-1CD | NA | NA | t | 1 | 33.300 | 1.0134680 | EPA-TO17-Part2-ATTAGENE-CIS-FACTORIAL-DATA-May-10-2019.xlsx | uM |
01504209 | 379721 | 2264-01-9 | 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate | DTXSID80379721 | C2264019 | 49 | ATG_GLI_CIS | 626391858 | TO-17-1CD | NA | NA | t | 1 | 1.230 | 0.9882155 | EPA-TO17-Part2-ATTAGENE-CIS-FACTORIAL-DATA-May-10-2019.xlsx | uM |
01504209 | 379721 | 2264-01-9 | 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate | DTXSID80379721 | C2264019 | 49 | ATG_GLI_CIS | 626391851 | TO-17-1CD | NA | NA | t | 1 | 0.412 | 1.0860806 | EPA-TO17-Part2-ATTAGENE-CIS-FACTORIAL-DATA-May-10-2019.xlsx | uM |
01504209 | 379721 | 2264-01-9 | 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate | DTXSID80379721 | C2264019 | 49 | ATG_GLI_CIS | 626391859 | TO-17-1CD | NA | NA | t | 1 | 11.100 | 1.0858586 | EPA-TO17-Part2-ATTAGENE-CIS-FACTORIAL-DATA-May-10-2019.xlsx | uM |
Review MC assay quality
# Create a function to review assay quality metrics using indexed Level 0 data.
<- function(ac){
aq # obtain level 1 multiple concentration data for specified acids
<- tcplPrepOtpt(tcplLoadData(1L, "acid", aeids$acid, type="mc"))
dat
# keep only observations with good well quality (wllq = 1)
<- dat[wllq==1]
dat
# obtain summary values for data and remove missing data (i.e. NA's)
<- dat[ ,
agg list(
# median response values (rval) of neutral wells (wllt = n)
nmed = median(rval[wllt=="n"], na.rm=TRUE),
# median absolute deviation (mad) of neutral wells (wllt = n)
nmad = mad(rval[wllt=="n"], na.rm=TRUE),
# median response values of positive control wells (wllt = p)
pmed = median(rval[wllt=="p"], na.rm=TRUE),
# median absolute deviation of positive control wells (wllt = p)
pmad = mad(rval[wllt=="p"], na.rm=TRUE),
# median response values of negative control wells (wllt = m)
mmed = median(rval[wllt=="m"], na.rm=TRUE),
# median absolute deviation of negative control wells (wllt = m)
mmad = mad(rval[wllt=="m"], na.rm=TRUE)
),# aggregate on assay component id, assay component name,
# and assay plate id
= list(acid, acnm, apid)]
by
# Z prime factor: separation between positive and negative controls,
# indicative of likelihood of false positives or negatives.
# - Between 0.5 - 1 are excellent,
# - Between 0 and 0.5 may be acceptable,
# - Less than 0 not good
# obtain the z-prime factor for positive controls and neutral
:= 1 - ((3 * (pmad + nmad)) / abs(pmed - nmed))]
agg[ , zprm.p # obtain the z-prime factor for negative controls and neutral
:= 1 - ((3 * (mmad + nmad)) / abs(mmed - nmed))]
agg[ , zprm.m
:= (pmed - nmed) / sqrt(pmad^2 + nmad^2 )]
agg[ , ssmd.p := (mmed - nmed) / sqrt(mmad^2 + nmad^2 )]
agg[ , ssmd.m
# Coefficient of Variation (cv) of neutral control
# - Ideally should be under 25%
:= nmad / nmed]
agg[ , cv
:= (pmed - nmed) / nmad]
agg[ , sn.p := (mmed - nmed) / nmad]
agg[ , sn.m := pmed / nmed]
agg[ , sb.p := mmed / nmed]
agg[ , sb.m
<0, zprm.p := 0]
agg[zprm.p<0, zprm.m := 0]
agg[zprm.m
<- agg[ , list( nmed = signif(median(nmed, na.rm = TRUE)),
acqu nmad = signif(median(nmad, na.rm = TRUE)),
pmed = signif(median(pmed, na.rm = TRUE)),
pmad = signif(median(pmad, na.rm = TRUE)),
mmed = signif(median(mmed, na.rm = TRUE)),
mmad = signif(median(mmad, na.rm = TRUE)),
zprm.p = round(median(zprm.p, na.rm=TRUE),2),
zprm.m = round(median(zprm.m, na.rm=TRUE),2),
ssmd.p = round(median(ssmd.p, na.rm=TRUE),0),
ssmd.m = round(median(ssmd.m, na.rm=TRUE),0),
cv = round(median(cv, na.rm=TRUE),2),
sn.p = round(median(sn.p, na.rm=TRUE),2),
sn.m = round(median(sn.m, na.rm=TRUE),2),
sb.p = round(median(sb.p, na.rm=TRUE),2),
sb.m = round(median(sb.m, na.rm=TRUE),2)
= list(acid, acnm)]
), by # Return the Results.
return(acqu)
#per acid
}
# Run the 'aq' function & store the output.
<- aq(ac)
assayq # Print the first 6 rows of the assay quality results.
head(assayq)
Retrieving Processed Single-Concentration (SC) Data and Methods
The goal of SC processing is to identify potentially active compounds from a large screen at a single concentration. After processing, users can inspect SC activity hit calls and the applied methods.
Load SC2 Data
# Load Level 2 single concentration data for a single aeid.
<- tcplPrepOtpt(
sc2 tcplLoadData(lvl=2, # data level
fld="aeid", # id field to query on
val=3, # value for the id field
type = "sc") # data type - single concentration
)# Alternatively, data for a set of aeids can be loaded with a vector of ids.
<- tcplPrepOtpt(
sc2 tcplLoadData(lvl=2, fld="aeid", val=aeids$aeid, type = "sc")
)
Load SC Methods
# Create a function to load methods for single concentration data processing
# steps for given aeids.
<- function(aeids) {
sc_methods # load the level 1 methods assigned for the single concentration aeid's
<- tcplMthdLoad(lvl=1, type ="sc", id=aeids$aeid)
sc1_mthds # aggregate the method id's by aeid
<- aggregate(mthd_id ~ aeid, sc1_mthds, toString)
sc1_mthds# reset the names of the sc1_mthds object
setnames(sc1_mthds, "mthd_id", "sc1_mthd_id")
# load the level 2 methods assigned for the single concentration aeid's
<- tcplMthdLoad(lvl=2, type ="sc", id=aeids$aeid)
sc2_mthds # aggregate the method id's by aeid
<- aggregate(mthd_id ~ aeid, sc2_mthds, toString)
sc2_mthds# reset the names of the sc2_mthds object
setnames(sc2_mthds, "mthd_id", "sc2_mthd_id")
# Compile the Output
<- merge( merge(aeids, sc1_mthds, by = "aeid", all = TRUE),
methods by = "aeid", all = TRUE )
sc2_mthds, # Return the Results
return(methods)
}
# Run the 'sc_methods' function and store the output.
<- sc_methods(aeids)
smthds
# Print the assigned sc methods.
smthds
Retrieving Processed Multi-Concentration (MC) Data, Methods, and Plots
The goal of MC processing is to estimate the hitcall, potency, efficacy, and other curve-fitting parameters for sample-assay endpoint pairs. After processing, users can inspect the activity hitcalls, model parameters, concentration-response plots, and the applied methods for the multiple concentration data.
Load MC5 Data
# Load Level 5 MC data summary values for a set of aeids.
# (NOTE: As before, the user can obtain data for individual aeids.)
<- tcplPrepOtpt(
mc5 tcplLoadData(lvl=5, # data level
fld="aeid", # fields to query on
val=aeids$aeid, # value for each field
# values should match their corresponding 'fld'
type = "mc") # data type - MC
)
# For tcpl v3.0.0 and future releases, to output mc5_param information with
# the default mc5 results then 'add.fld' must be set to TRUE.
# (NOTE: Default for add.fld is FALSE, unless otherwise specified.)
<- tcplPrepOtpt(
mc5 tcplLoadData(lvl=5, # data level
fld="aeid", # fields to query on
val=aeids$aeid, # value for each field
# values should match their corresponding 'fld'
type = "mc", # data type - multiple concentration
add.fld=TRUE) # return additional parameters from mc5_param
)
Load MC Methods
# Create a function to load methods for MC data processing
# for select aeids.
<- function(aeids) {
mc_methods # acid
## load the methods assigned to level 2 for given acids
<- tcplMthdLoad(2,aeids$acid)
mc2_mthds ## aggregate the assigned methods by acid
<- aggregate(mthd_id ~ acid, mc2_mthds, toString)
mc2_mthds## rename the columns for the 'mc2_mthds' object
setnames(mc2_mthds, "mthd_id", "mc2_mthd_id")
# aeid
## load the methods assigned to level 3 for given aeids
<- tcplMthdLoad(3,aeids$aeid)
mc3_mthds ## aggregate the assigned methods by aeid
<- aggregate(mthd_id ~ aeid, mc3_mthds, toString)
mc3_mthds## rename the columns for the 'mc3_mthds' object
setnames(mc3_mthds, "mthd_id", "mc3_mthd_id")
## load the methods assigned to level 4 for given aeids
<- tcplMthdLoad(4,aeids$aeid)
mc4_mthds ## aggregate the assigned methods by aeid
<- aggregate(mthd_id ~ aeid, mc4_mthds, toString)
mc4_mthds## rename the columns for 'mc4_mthds' object
setnames(mc4_mthds, "mthd_id", "mc4_mthd_id")
## load the methods assigned to level 5 for given aeids
<- tcplMthdLoad(5,aeids$aeid)
mc5_mthds ## aggregate the assigned methods by aeid
<- aggregate(mthd_id ~ aeid, mc5_mthds, toString)
mc5_mthds## rename the columns for 'mc5_mthds' object
setnames(mc5_mthds, "mthd_id", "mc5_mthd_id")
# Compile the Results.
## merge the aeid information with the level 2 methods by acid
<- merge(aeids, mc2_mthds,by.x = "acid", by.y = "acid")
acid.methods ## merge the level 3, 4, and 5 methods by aeid
<- merge(
mthd35 merge(mc3_mthds, mc4_mthds, by = "aeid", all = TRUE),
by = "aeid", all = TRUE
mc5_mthds,
)## merge all methods information by aeid
<- merge(acid.methods, mthd35,by.x = "aeid", by.y = "aeid")
methods # Print the Results.
print(methods)
# Return the Results.
return(methods)
}
# Run the 'methods' function and store the output.
<- mc_methods(aeids)
mmthds
# Print the assigned mc methods.
mmthds
Plot MC Data
The tcplPlot function is the generic plotting function that returns a plot for the given sample-assay endpoint combination(s), level, and parameters.
# Create Level 4 plot for a single m4id.
tcplPlot(lvl = 4, # data level
fld = "m4id", # field to query on
val = c(18609966), # value for each field
# values should match their corresponding 'fld'
multi = FALSE, # single plot per page - output 6 per page if TRUE
verbose = FALSE, # output all details if TRUE
output = "console") # output in R console
# Plot Level 5 MC data for select aeids.
tcplPlot(lvl = 5, # data level
fld = "aeid", # field to query on
val = 3157:3159, # value for each field
# values should match their corresponding 'fld'
by = "aeid", # parameter to divide files
multi = TRUE, # multiple plots per page - output 6 per page if TRUE
verbose = TRUE, # output all details if TRUE
output = "pdf", # output as pdf
fileprefix = "output/") # prefix of the filename
Additional Examples
Below are a few case examples for retrieving various bits of information from the database.
Load Data for a Specific Chemical
In this example, we illustrate the necessary steps for extracting information about the compound Bisphenol A found within the database. The user will define the chemical of interest, isolate all associated sample ids (\(\mathit{spids}\)), and then load all data for the given chemical.
# Provide the chemical name and assign to 'chnm'.
<- 'Bisphenol A'
chnm # Load the chemical data from the database.
<- tcplLoadChem(field = 'chnm',val = chnm)
chem # Load mc5 data from the database for the specified chemical.
<- tcplLoadData(lvl = 5, # data level
BPA.mc5 fld = 'spid', # field to query on
val = chem[,spid], # value for each field (fld)
type = 'mc') # data type - MC
Plot Sample Subset
In this example, we illustrate how to plot by endpoint for a sample subset, as opposed to plotting all samples tested within an endpoint. The user will load data for the select endpoints, isolate the samples of interest, and then plot by endpoint for the sample subset.
# Load Level 5 multiple concentration data summary values for select aeids.
<- tcplPrepOtpt(
mc5 tcplLoadData(lvl=5, # data level
fld='aeid', # id field to query on
val=tcplLoadAeid(fld="asid",val = 25)$aeid, # value for each field
type='mc', # data type - MC
add.fld=TRUE) # return additional parameters from mc5_param
)
# Identify sample subset.
<- mc5[spid %in% c("EPAPLT0018N08", "EPAPLT0023A16", "EPAPLT0020C11",
spid.mc5 "EPAPLT0018B13","EPAPLT0018B14","EPAPLT0018B15"),]
# Plot by endpoint for sample subset.
tcplPlot(lvl = 5, # data level
fld = c("spid","aeid"), # fields to query on
val = list( # value for each field, must be same order as 'fld'
$spid, # sample id's
spid.mc5$aeid # assay endpoint id's
spid.mc5
),by = "aeid", # parameter to divide files
multi = TRUE, # multiple plots per page - output 6 per page if TRUE
verbose = TRUE, # output all details if TRUE
output = "pdf", # output as pdf
fileprefix = "output/upitt") # prefix of the filename