Title: | ToxCast Data Analysis Pipeline |
---|---|
Description: | The ToxCast Data Analysis Pipeline ('tcpl') is an R package that manages, curve-fits, plots, and stores ToxCast data to populate its linked MySQL database, 'invitrodb'. The package was developed for the chemical screening data curated by the US EPA's Toxicity Forecaster (ToxCast) program, but 'tcpl' can be used to support diverse chemical screening efforts. |
Authors: | Richard S Judson [ctb, ths] , Dayne L Filer [aut], Jason Brown [cre] , Sarah E Davidson-Fritz [ctb] , Madison Feshuk [ctb] , Carter Thunes [ctb], Ashley Ko [ctb], Kelly Carstens [ctb] , Todd Zurlinden [ctb] , Lori Kolaczkowski [ctb], Kurt Dunham [ctb], Parth Kothiya [ctb], Woodrow R Setzer [ctb], Matthew T Martin [ctb, ths], Katie Paul Friedman [ctb] |
Maintainer: | Jason Brown <[email protected]> |
License: | MIT + file LICENSE |
Version: | 3.2.0.9000 |
Built: | 2024-11-06 19:16:14 UTC |
Source: | https://github.com/usepa/comptox-toxcast-tcpl |
.buildAssayQ
generates a query string to load assay information
.buildAssayQ(out, tblo, fld = NULL, val = NULL, add.fld = NULL)
.buildAssayQ(out, tblo, fld = NULL, val = NULL, add.fld = NULL)
out |
Character, the default fields to include |
tblo |
Integer, the order to send the fields to prepOutput |
fld |
Character, the field(s) to query/subset on |
val |
List, vectors of values for each field to query/subset on. Must be in the same order as 'fld'. |
add.fld |
Character, additional field(s) to include, but not query/ subset on |
A character containing the query to send to tcplQuery
.convertNames
converts the assay names as they appear in the tcpl
database to their respective abbreviations
.convertNames(names)
.convertNames(names)
names |
Character, strings to convert |
The same character vector given with any name strings converted to the abbreviated version
.load6DR
loads dose-response data for tcpl6.
.load6DR(ae)
.load6DR(ae)
ae |
String aeid to query on |
Plot plate heatmap, to be used with tcplPlotPlate
.plateHeat(vals, rowi, coli, wllt, wllq, rown, coln, main, arng)
.plateHeat(vals, rowi, coli, wllt, wllq, rown, coln, main, arng)
vals |
Numeric, the well values |
rowi |
Integer, the row index |
coli |
Integer, the column index |
wllt |
Character, the well type |
wllq |
Logical, the well quality |
rown |
Integer, the number of rows on the plate |
coln |
Integer, the number of columns on the plate |
main |
Character of length 1, the title/main |
arng |
Numeric of length 2, the minimum and maximum values to constrain the color scale |
Optimized for an output with height = 20/3, width = 10, and pointsize = 10
Paste appropriate table name to field name
.prepField(fld, tbl, db)
.prepField(fld, tbl, db)
fld |
Character, the table fields |
tbl |
Character, the possible tables |
db |
Character, the database containing the tables |
The function loops through the given tables, and for each field i it assigns the last table containing i to i. ORDER OF FLD MATTERS!!
blineShift
Takes in dose-response data and shifts the baseline
to 0 based on the window.
blineShift(resp, conc, wndw)
blineShift(resp, conc, wndw)
resp |
Numeric, the response values |
conc |
Numeric, the concentration values |
wndw |
Numeric, the threshold window |
A numeric vector containing the shifted response values
This function is not exported and is not intended to be used by the user.
Function that checks if the most recent v3 table schema is used in the database schema
check_tcpl_db_schema()
check_tcpl_db_schema()
boolean TRUE if param tables are listed in schema FALSE otherwise
## Not run: #connect to database first with tcplConf tcplConf(user=user, pass= pass, db=dbname, drvr='MySQL', host=hostname) #check if it is part of the new schema new_schema <- check_tcpl_db_schema() ## End(Not run)
## Not run: #connect to database first with tcplConf tcplConf(user=user, pass= pass, db=dbname, drvr='MySQL', host=hostname) #check if it is part of the new schema new_schema <- check_tcpl_db_schema() ## End(Not run)
These functions are used to configure the tcpl settings.
tcplConf(drvr = NULL, user = NULL, pass = NULL, host = NULL, db = NULL, ...) tcplConfDefault() tcplConfList(show.pass = FALSE) tcplConfLoad(list.new = TRUE) tcplConfReset() tcplConfSave()
tcplConf(drvr = NULL, user = NULL, pass = NULL, host = NULL, db = NULL, ...) tcplConfDefault() tcplConfList(show.pass = FALSE) tcplConfLoad(list.new = TRUE) tcplConfReset() tcplConfSave()
drvr |
Character of length 1, which database driver to use |
user |
Character of length 1, the database server username |
pass |
Character of length 1, the database server password |
host |
Character of length 1, the database server |
db |
Character of length 1, the name of the tcpl database |
... |
Additional arguments that should be passed to dbConnect function |
show.pass |
Logical, should the password be returned |
list.new |
Logical of length 1, should the new settings be printed? |
Currently, the tcpl package supports the "MySQL", "example", and "API" database drivers.
The settings can be stored in a configuration file to make the using the
package more user-friendly. To create the configuration file, the user must
first create a system environment variable ('TCPL_CONF') that points to to
the file. There is more information about system environment variables in
Startup
and Sys.getenv
. Briefly, the user
needs to modify the '.Renviron' file in their home directory. If the file
does not exist, create it, and add the following line:
TCPL_CONF=path/to/confFile.conf
Here 'path/to/confFile.conf' can be any path to a file. One suggestion would
be to include .tcplConf in the home directory, e.g. TCPL_CONF=~/.tcplConf.
Note, '~' may not indicate the home directory on every operating system.
Once the environment variable is added, the user can change the settings
using tcplConf
, then save the settings to the file given by the
TCPL_CONF environment variable running tcplConfSave()
.
tcplConf
changes options
to set the tcpl-specific options,
most importantly to configure the connection to the tcpl databases.
tcplConf
will only change non-null values, and can be used to
change a single value if needed.
tcplConfSave
modifies the configuration file to reflect the current
tcpl settings.
tcplConfList
lists the values assigned to the tcpl global options.
tcplConfLoad
updates the tcpl settings to reflect the current
configuration file.
tcplConfDefault
changes the options
to reflect the default
settings for the API connection, but does not alter the configuration file.
tcplConfReset
is used to generate the initial configuration script,
and can be used to reset or regenerate the configuration script by the user.
flareFunc
calculates the weighted mean of square regions to detect
plate flares.
flareFunc(val, coli, rowi, apid, r)
flareFunc(val, coli, rowi, apid, r)
val |
Numeric, the well values |
coli |
Integer, the well column index |
rowi |
Integer, the well row index |
apid |
Character, the assay plate id |
r |
Integer, the number of wells from the center well (in one direction) to make the square |
MC6_Methods
, Method functions
,
mc6
These functions solve for Hill model parameters.
tcplHillACXX(XX, tp, ga, gw, bt = 0) tcplHillConc(val, tp, ga, gw, bt = 0) tcplHillVal(logc, tp, ga, gw, bt = 0)
tcplHillACXX(XX, tp, ga, gw, bt = 0) tcplHillConc(val, tp, ga, gw, bt = 0) tcplHillVal(logc, tp, ga, gw, bt = 0)
XX |
Numeric, the activity level (percentage of the top value) |
tp |
Numeric, the top value from the Hill model |
ga |
Numeric, the logAC50 value from the Hill model |
gw |
Numeric, the Hill coefficient from the Hill model |
bt |
Numeric, the bottom value from the Hill model |
val |
Numeric, the activity value |
logc |
Numeric, the log concentration |
tcplHillVal
computes the value of the Hill model for a given log
concentration.
tcplHillACXX
computes the activity concentration for a Hill model for
a given activity level.
tcplHillConc
computes the Hill model concentration for a
given value.
## The following code gives examples for a Hill model with a top of 50, ## bottom of 0, AC50 of 1 and Hill coefficient of 1. ## tcplHillVal calculates activity value given a concentration. tcplHillVal ## will return the tp/2 when logc equals ga: tcplHillVal(logc = 1, tp = 50, ga = 1, gw = 1, bt = 0) ## Here, tcplHillConc returns the concentration where the value equals 20 tcplHillConc(val = 20, tp = 50, ga = 1, gw = 1, bt = 0) ## Note how this differs from tcplHillACXX: tcplHillACXX(XX = 20, tp = 50, ga = 1, gw = 1, bt = 0) ## tcplHillACXX is based on the top value and allows the user to calculate ## specifc activity concentrations based on a percentage of the top value ## For example, we can calculate the value for the concentration 0.25, then ## use that value to check the other two functions. value <- tcplHillVal(logc = 0.25, tp = 50, ga = 1, gw = 1, bt = 0) c1 <- tcplHillConc(val = value, tp = 50, ga = 1, gw = 1, bt = 0) c2 <- tcplHillACXX(XX = value/50*100, tp = 50, ga = 1, gw = 1, bt = 0) all.equal(0.25, c1, c2) ## Notice, the value had to be transformed to a percentage of the top value ## when using tcplHillACXX
## The following code gives examples for a Hill model with a top of 50, ## bottom of 0, AC50 of 1 and Hill coefficient of 1. ## tcplHillVal calculates activity value given a concentration. tcplHillVal ## will return the tp/2 when logc equals ga: tcplHillVal(logc = 1, tp = 50, ga = 1, gw = 1, bt = 0) ## Here, tcplHillConc returns the concentration where the value equals 20 tcplHillConc(val = 20, tp = 50, ga = 1, gw = 1, bt = 0) ## Note how this differs from tcplHillACXX: tcplHillACXX(XX = 20, tp = 50, ga = 1, gw = 1, bt = 0) ## tcplHillACXX is based on the top value and allows the user to calculate ## specifc activity concentrations based on a percentage of the top value ## For example, we can calculate the value for the concentration 0.25, then ## use that value to check the other two functions. value <- tcplHillVal(logc = 0.25, tp = 50, ga = 1, gw = 1, bt = 0) c1 <- tcplHillConc(val = value, tp = 50, ga = 1, gw = 1, bt = 0) c2 <- tcplHillACXX(XX = value/50*100, tp = 50, ga = 1, gw = 1, bt = 0) all.equal(0.25, c1, c2) ## Notice, the value had to be transformed to a percentage of the top value ## when using tcplHillACXX
interlaceFunc
calculates the distance weighted mean of square regions
from a 384-well plate that is interlaced onto a 1536 well plate to detect
non-random signals coming from the source plate
interlaceFunc(val, intq, coli, rowi, apid, r)
interlaceFunc(val, intq, coli, rowi, apid, r)
val |
Numeric, the well values |
intq |
Numeric, interlace quadrant |
coli |
Integer, the well column index |
rowi |
Integer, the well row index |
apid |
Character, the assay plate id |
r |
Integer, the number of wells from the center well (in one direction) to make the square |
MC6_Methods
, Method functions
,
mc6
Short descriptions of fields for different tables are stored in a data dictionary.
invitrodb_dd
invitrodb_dd
A data frame with 44 rows and 3 variables:
Table of the data dictionary
Field of the data dictionary
Description
ToxCast database
is.odd
takes an integer vector, x
, and returns TRUE for odd
integers.
is.odd(x)
is.odd(x)
x |
An integer |
TRUE
for odd integers and FALSE
for even integers.
Other tcpl abbreviations:
lu()
,
lw()
,
sink.reset()
These functions query the tcpl databases and returns a data.table with assay ID and name information. More information about the assay hierarchy is available in the overview vignette.
tcplLoadAcid(fld = NULL, val = NULL, add.fld = NULL) tcplLoadAeid(fld = NULL, val = NULL, add.fld = NULL) tcplLoadAid(fld = NULL, val = NULL, add.fld = NULL) tcplLoadAsid(fld = NULL, val = NULL, add.fld = NULL)
tcplLoadAcid(fld = NULL, val = NULL, add.fld = NULL) tcplLoadAeid(fld = NULL, val = NULL, add.fld = NULL) tcplLoadAid(fld = NULL, val = NULL, add.fld = NULL) tcplLoadAsid(fld = NULL, val = NULL, add.fld = NULL)
fld |
Character, the field(s) to query/subset on |
val |
List, vectors of values for each field to query/subset on. Must be in the same order as 'fld'. |
add.fld |
Character, additional field(s) to include, but not query/ subset on |
Each element in the assay hierarchy has its own function, loading the ID and
name for the given assay element. For example, tcplLoadAsid
will
return the assay source ID (asid) and assay source name (asnm).
A data.table containing the ID, name, and any additional fields.
## Not run: ## The load assay functions can be used without any parameters to list the ## full list of registered assay elements: tcplLoadAsid() tcplLoadAeid() ## Similarly, the user can add fields without doing any element selection: tcplLoadAeid(add.fld = c("asid", "aid", "acid")) ## Or, the user can look only at a subset: tcplLoadAeid(fld = "aeid", val = 1, add.fld = "asid") ## The field can be any value in one of the corresponding assay element ## tables, but the functions also recognize the abbreviated version of ## the name fields. tcplListFlds("assay") a1 <- tcplLoadAeid(fld = "anm", val = "Steroidogenesis") a2 <- tcplLoadAeid(fld = "assay_name", val = "Steroidogenesis") identical(a1, a2) ## End(Not run)
## Not run: ## The load assay functions can be used without any parameters to list the ## full list of registered assay elements: tcplLoadAsid() tcplLoadAeid() ## Similarly, the user can add fields without doing any element selection: tcplLoadAeid(add.fld = c("asid", "aid", "acid")) ## Or, the user can look only at a subset: tcplLoadAeid(fld = "aeid", val = 1, add.fld = "asid") ## The field can be any value in one of the corresponding assay element ## tables, but the functions also recognize the abbreviated version of ## the name fields. tcplListFlds("assay") a1 <- tcplLoadAeid(fld = "anm", val = "Steroidogenesis") a2 <- tcplLoadAeid(fld = "assay_name", val = "Steroidogenesis") identical(a1, a2) ## End(Not run)
Lists of column names returned from tcplLoadData invitrodb v4.1 (same as CCTE Bioactivity API version).
load_data_columns
load_data_columns
A list with 12 items:
Column names returned requesting mc lvl 0 data
Column names returned requesting mc lvl 1 data
Column names returned requesting mc lvl 2 data
Column names returned requesting mc lvl 3 data
Column names returned requesting mc lvl 4 data
Column names returned requesting mc lvl 5 data
Column names returned requesting mc lvl 6 data
Column names returned requesting mc lvl "agg" data
Column names returned requesting sc lvl 0 data
Column names returned requesting sc lvl 1 data
Column names returned requesting sc lvl 2 data
Column names returned requesting sc lvl "agg" data
ToxCast database
length(unique(x))
lu
takes a logical vector, x
, and returns
length(unique(x))
.
lu
takes a logical vector, x
, and returns
length(unique(x))
.
lu(x) lu(x)
lu(x) lu(x)
x |
A logical |
The unique of the TRUE
values in x
The unique of the TRUE
values in x
Other tcpl abbreviations:
is.odd()
,
lw()
,
sink.reset()
Other tcpl abbreviations:
is.odd()
,
lw()
,
sink.reset()
length(which(x))
lw
takes a logical vector, x
, and returns
length(which(x))
.
lw
takes a logical vector, x
, and returns
length(which(x))
.
lw(x) lw(x)
lw(x) lw(x)
x |
A logical |
The length of the TRUE
values in x
The length of the TRUE
values in x
Other tcpl abbreviations:
is.odd()
,
lu()
,
sink.reset()
Other tcpl abbreviations:
is.odd()
,
lu()
,
sink.reset()
List of lists containing queries sent to tcplQuery associated with each test case. Each list also contains the associated ids with each case. Only meant to be used with automated testing with mocking for mc data.
mc_test
mc_test
A list with 30 items:
Data table with 1 row and 2 columns used for each test case for establishing connection using tcplConf. This data table mocks the response one would get from connecting with invitrodb.
List containing the queries used for loading mc0 data by m0id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm0id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc0 data by acid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'acid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc1 data by m1id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm1id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc1 data by acid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'acid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc2 data by m2id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm2id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc2 data by acid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'acid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc3 data by m3id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm3id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc3 data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc4 data by m4id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm4id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc4 data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc5 data by m5id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm5id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc5 data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc6 data by m6id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm6id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc6 data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc7 data by m7id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'm7id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc7 data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading mc 'agg' data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading and plotting mc data by m4id via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 'm4id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading and plotting mc data by multiple m4ids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 'm4id' labeled item storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting mc data by aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading and plotting mc data by multiple aeids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting mc data by spid/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid' and 'aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting mc data by multiple spids/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid' and 'aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared mc data by m4id via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'm4id' and 'compare.m4id' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared mc data by multiple m4ids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'm4id' and 'compare.m4id' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared mc data by aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'aeid' and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared mc data by multiple aeids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'aeid' and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared mc data by spid/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid', 'compare.spid', 'aeid', and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared mc data by multiple spids/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid', 'compare.spid', 'aeid', and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
ToxCast database
This dataset is a list with 6 data.tables (mc0,mc1,mc2,mc3,mc4,mc5).
mc_vignette
mc_vignette
mc0 A data frame with 78 rows and 18 columns containing level 0 formatted raw data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component ID
Assay Component Name
Level 0 (mc0) ID
Assay plate ID
Row Index
Column Index
Well Type
Well Quality (0 or 1)
Concentration in micromolar
Raw assay component readout value
Source file containing the raw data
Concentration Units
mc1 A data frame with 78 rows and 21 columns containing level 1 replicate and concentration level indicated data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component ID
Assay Component Name
Level 0 (mc0) ID
Level 1 (mc1) ID
Assay plate ID
Row Index
Column Index
Well Type
Well Quality (0 or 1)
Concentration in micromolar
Raw assay component readout value
Concentration index defined by ranking the unique concentrations, with the lowest concentration starting at 1.
Temporary replicate ID is defined, the data are scanned from top to bottom and increment the replicate index every time a replicate ID is duplicated
Source file containing the raw data
Concentration Units
mc2 A data frame with 78 rows and 20 columns containing level 2 assay component-specific corrections.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component ID
Assay Component Name
Level 0 (mc0) ID
Level 1 (mc1) ID
Level 2 (mc2) ID
Assay plate ID
Row Index
Column Index
Well Type
Concentration in micromolar
Corrected Value
Concentration index defined by ranking the unique concentrations, with the lowest concentration starting at 1.
Temporary replicate ID is defined, the data are scanned from top to bottom and increment the replicate index every time a replicate ID is duplicated
Concentration Units
mc3 A data frame with 78 rows and 22 columns containing level 3 assay endpoint normalized data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component Endpoint ID
Assay endpoint name (i.e., assay_component_endpoint_name)
Level 0 (mc0) ID
Level 1 (mc1) ID
Level 2 (mc2) ID
Level 3 (mc3) ID
Log base 10 concentration
Normalized response value
Concentration index defined by ranking the unique concentrations, with the lowest concentration starting at 1.
Well Type
Assay plate ID
Row Index
Column Index
Temporary replicate ID is defined, the data are scanned from top to bottom and increment the replicate index every time a replicate ID is duplicated
Response Units
Concentration Units
mc4 A data frame with 5 rows and 149 columns containing level 4 concentration-response fitting data (all fits).
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component Endpoint ID
Assay endpoint name (i.e., assay_component_endpoint_name)
Level 4 (mc4) ID
The median absolute deviation of all treatment wells (default option) or blank wells
Maximum observed response
Minimum observed response
Maximum mean response
Concentration of the maximum mean response
Maximum median response
Concentration of the maximum median response
Maximum concentration on the log scale
Minimum concentration on the log scale
The total number of concentration groups
Total number of observed responses (i.e. data points in the concentration series)
Number of replicates in concentration groups
The number of median responses greater than 3BMAD
Success indicator for the Constant model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Constant model
Root mean square error for the Constant model
Error term for the Constant model
Success indicator for the Hill model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Hill model
Success indicator for the Hill model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Hill model
The top parameter indicating the maximal estimated response
The gain parameter for the Hill model, gain AC50
The power parameter for the Hill model
Error term for the Hill model
Standard deviation of the Hill model top parameter
Standard deviation of the Hill model gain parameter
Standard deviation of the Hill model power parameter
Standard deviation of the Hill model error term
The maximal response on the resulting Hill model fit
Concentration at 50% of the maximal response on the Hill model fit
Success indicator for the Gain-loss model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Gain-loss model
Success indicator for the Gain-loss model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Gain-loss model
The top parameter indicating the maximal estimated response
The gain parameter for the Gain-loss model, gain AC50
The gain power parameter for the Gain-loss model
The loss parameter for the Gain-loss model, loss AC50
The loss power parameter for the Gain-loss model
Error term for the Gain-loss model
Standard deviation of the Gain-loss model top parameter
Standard deviation of the Gain-loss model gain parameter
Standard deviation of the Gain-loss model gain power parameter
Standard deviation of the Gain-loss model loss parameter
Standard deviation of the Gain-loss model loss power parameter
Standard deviation of the Gain-loss model error term
The maximal response on the resulting Gain-loss model fit
Concentration at 50% of the maximal response on the Gain-loss model fit, gain AC50
Concentration at 50% of the maximal response on the Gain-loss model fit, loss AC50
Success indicator for the Polynomial 1 model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Polynomial 1 model
Success indicator for the Polynomial 1 model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Polynomial 1 model
The y-scale parameter for the Polynomial 1 model
Error term for the Polynomial 1 model
Standard deviation of the Polynomial 1 model y-scale parameter
Standard deviation of the Polynomial 1 model error term
The maximal response on the resulting Polynomial 1 model fit
Concentration at 50% of the maximal response on the Polynomial 1 model fit
Success indicator for the Polynomial 2 model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Polynomial 2 model
Success indicator for the Polynomial 2 model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Polynomial 2 model
The y-scale parameter for the Polynomial 2 model
The x-scale parameter for the Polynomial 2 model
Error term for the Polynomial 2 model
Standard deviation of the Polynomial 2 model y-scale parameter
Standard deviation of the Polynomial 2 model x-scale parameter
Standard deviation of the Polynomial 2 model error term
The maximal response on the resulting Polynomial 2 model fit
Concentration at 50% of the maximal response on the Polynomial 2 model fit
Success indicator for the Power model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Power model
Success indicator for the Power model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Power model
The y-scale parameter for the Power model
The power parameter for the Power model
Error term for the Power model
Standard deviation of the Power model y-scale parameter
Standard deviation of the Power model power parameter
Standard deviation of the Power model error term
The maximal response on the resulting Power model fit
Concentration at 50% of the maximal response on the Power model fit
Success indicator for the Exponential 2 model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Exponential 2 model
Success indicator for the Exponential 2 model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Exponential 2 model
The y-scale parameter for the Exponential 2 model
The x-scale parameter for the Exponential 2 model
Error term for the Exponential 2 model
Standard deviation of the Exponential 2 model y-scale parameter
Standard deviation of the Exponential 2 model x-scale parameter
Standard deviation of the Exponential 2 model error term
The maximal response on the resulting Exponential 2 model fit
Concentration at 50% of the maximal response on the Exponential 2 model fit
Success indicator for the Exponential 3 model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Exponential 3 model
Success indicator for the Exponential 3 model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Exponential 3 model
The y-scale parameter for the Exponential 3 model
The x-scale parameter for the Exponential 3 model
The power parameter for the Exponential 3 model
Error term for the Exponential 3 model
Standard deviation of the Exponential 3 model y-scale parameter
Standard deviation of the Exponential 3 model x-scale parameter
Standard deviation of the Exponential 3 model power parameter
Standard deviation of the Exponential 3 model error term
The maximal response on the resulting Exponential 3 model fit
Concentration at 50% of the maximal response on the Exponential 3 model fit
Success indicator for the Exponential 4 model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Exponential 4 model
Success indicator for the Exponential 4 model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Exponential 4 model
The top parameter indicating the maximal estimated response
The gain parameter for the Exponential 4 model, gain AC50
Error term for the Exponential 4 model
Standard deviation of the Exponential 4 model top parameter
Standard deviation of the Exponential 4 model gain parameter
Standard deviation of the Exponential 4 model error term
The maximal response on the resulting Exponential 4 model fit
Concentration at 50% of the maximal response on the Exponential 4 model fit
Success indicator for the Exponential 5 model; 1 if the optimization was successful, otherwise 0
Akaike Information Criteria (AIC) for the Exponential 5 model
Success indicator for the Exponential 5 model covariance calculation; 1 if the Hessian matrix inversion is successful, otherwise 0
Root mean square erro for the Exponential 5 model
The top parameter indicating the maximal estimated response
The gain parameter for the Exponential 5 model, gain AC50
The power parameter for the Exponential 5 model
Error term for the Exponential 5 model
Standard deviation of the Exponential 5 model top parameter
Standard deviation of the Exponential 5 model gain parameter
Standard deviation of the Exponential 5 model power parameter
Standard deviation of the Exponential 5 model error term
The maximal response on the resulting Exponential 5 model fit
Concentration at 50% of the maximal response on the Exponential 5 model fit
Standard deviation of the baseline response for all models
Median noise estimation of the baseline response for all models
Response Units
Concentration Units
mc5 A data frame with 5 rows and 54 columns containing level 5 best curve-fit and hitcall data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component Endpoint ID
Assay endpoint name (i.e., assay_component_endpoint_name)
Level 5 (mc5) ID
Level 4 (mc4) ID
The median absolute deviation of all treatment wells (default option) or blank wells
Maximum observed response
Minimum observed response
Maximum mean response
Concentration of the maximum mean response
Maximum median response
Concentration of the maximum median response
Maximum concentration on the log scale
Minimum concentration on the log scale
The total number of concentration groups
Total number of observed responses (i.e. data points in the concentration series)
Number of replicates in concentration groups
The number of median responses greater than 3BMAD
Hitcall
Best model fit from tcplFit2 curve-fitting
Fit category
Cutoff
Ratio of the top of the best model fit curve and the cutoff
Root mean squared error
The y-scale parameter for poly1, poly2, pow, exp2, or exp3 model
Error term
Benchmark response
Lower 95% confidence bound on the benchmark dose/concentration estimate
Akaike Information Criteria weight of constant model relative to the best model fit
Maximum log-likelihood of the best model fit
Continuous hitcall
Concentration where 50% of the maximal response occurs - if 'modl' is the Hill or Gain-loss model this is for the "gain" side of the response
The maximal response on the best model curve fit - i.e. top of the curve fit
Concentration where 5% of the maximal response occurs
Concentration where 10% of the maximal response occurs
Concentration where 20% of the maximal response occurs
Concentration where the efficacy cutoff response occurs
Concentration where one standard deviation of the background response occurs
Benchmark response/concentration estimate - concentration where the benchmark response occurs
Upper 95% confidence bound on the benchmark dose/concentration estimate
The top curve parameter for the exp4, exp5, hill, or gnls model
The gain parameter for the hill or gnls model - gain AC50
The power parameter for the pow, exp3, exp5, gnls, or hill model - for gnls this is the gain power parameter
The loss power parameter for the gnls model
The loss parameter for the gnls model, loss AC50
Concentration where 50% of the maximal response occurs - if 'modl' is the Hill or Gain-loss model this is for the "loss" side of the response
The x-scale parameter for poly2, exp2, or exp3 model
Response Units
Concentration Units
mc1
loads level 0 data from the tcpl
database for the given id and performs level 1
multiple-concentration processing.
The processed data is then loaded into the mc1 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
mc1(ac, wr = FALSE)
mc1(ac, wr = FALSE)
ac |
Integer of length 1, assay component id (acid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 1 processing includes defining the concentration and replicate index, cndx and repi, respectively.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other multiple-concentration:
mc2()
,
mc3()
,
mc4()
,
mc5()
,
mc6()
mc2
loads level 1 data from the tcpl
database for the given id and performs level 2
multiple-concentration processing.
The processed data is then loaded into the mc2 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
mc2(ac, wr = FALSE)
mc2(ac, wr = FALSE)
ac |
Integer of length 1, assay component id (acid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 2 multiple-concentration processing includes defining the corrected value, cval, based on the correction methods listed in the mc2_acid and mc2_methods tables.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other multiple-concentration:
mc1()
,
mc3()
,
mc4()
,
mc5()
,
mc6()
mc2_mthds
returns a list of correction/transformation functions
to be used during level 2 multiple-concentration processing.
mc2_mthds()
mc2_mthds()
The functions contained in the list returned by mc2_mthds
return
a list of expressions to be executed in the mc2
(not exported)
function environment. The functions are described here for reference
purposes, The mc2_mthds
function is not exported, nor is it
intended for use.
All available methods are described in the Available Methods section, listed by the function/method name.
A list functions
More information about the level 2 multiple-concentration processing is available in the package vignette, "Data_processing."
Transform the corrected response value (cval) to log-scale (base 2).
Transform the corrected response value (cval) to log-scale (base 10).
Exclude wells with negative corrected response values (cval) and downgrading
their well quality (wllq); if .
Exclude wells with corrected response values (cval) equal to zero and
downgrading their well quality (wllq); if .
Multiply corrected response value (cval) by 25; .
Multiply corrected response value (cval) by 100; .
Shift corrected response values (cval) by subtracting the minimum cval and
adding 1, such that the new minimum is 1; .
Multiply corrected response value (cval) by 2.5; .
Multiply corrected response value (cval) by 3; .
Multiply corrected response value (cval) by 6; .
Center data around zero by subtracting the corrected response value (cval) from
100; . Typically used if data was pre-normalized around 100 with responses
decreasing to 0.
Convert the corrected response value (cval) to an absolute Z-Score based on the neutral and positive control wells (wllts = n and p), by assay plate ID (apid)
Center data around zero by subtracting the corrected response value (cval) from 1;
. Typically used if data was pre-normalized around 1 with responses decreasing to 0.
Aggregate technical test replicates (wllt=t) by taking the plate-wise mean per sample id (spid), assay plate (apid), and concentration index (cndx).
Aggregate technical test replicates (wllt=t) by taking the plate-wise median per sample id (spid), assay plate (apid), and concentration index (cndx).
Use for binary data. Aggregate technical replicates as percentage by taking the sum of rval (raw values) relative to total replicates per sample id (spid) and concentration index (cndx); .
Use for binary data with variable number of replicates. Aggregate technical replicates as percentage by taking the sum of rval (raw values) relative to total replicates per per sample id (spid) and concentration index (cndx), where there is more than one replicate; .
Rvals are collapsed to one value per cndx.
This function is not exported and is not intended to be used by the user.
mc2
, Method functions
to query what
methods get applied to each acid
mc3
loads level 2 data from the tcpl
database for the given id and performs level 3
multiple-concentration processing.
The processed data is then loaded into the mc3 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
mc3(ac, wr = FALSE)
mc3(ac, wr = FALSE)
ac |
Integer of length 1, assay component id (acid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 3 multiple-concentration processing includes mapping assay component to assay endpoint, duplicating the data when the assay component has multiple assay endpoints, and any normalization of the data. Data normalization based on methods listed in mc3_aeid and mc3_methods tables.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other multiple-concentration:
mc1()
,
mc2()
,
mc4()
,
mc5()
,
mc6()
mc3_mthds
returns a list of normalization methods to be used
during level 3 multiple-concentration processing.
mc3_mthds()
mc3_mthds()
The functions contained in the list returned by mc3_mthds
take
aeids
(a numeric vector of aeid values) and returns a list of expressions
to be executed in the mc3
(not exported) function environment. The
functions are described here for reference purposes, The
mc3_mthds
function is not exported, nor is it intended for use.
All available methods are described in the Available Methods section, listed by the type of function and the function/method name.
A list of functions
The methods are broken into three types, based on what fields they define. Different methods are used to define "bval" (the baseline value), "pval" (the positive control value), and "resp" (the final response value).
Although it does not say so specifically in each description, all methods are applied by aeid.
More information about the level 3 multiple-concentration processing is available in the package vignette, "Data_processing."
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for neutral control wells (wllt = n).
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2.
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) of test compound wells (wllt = t).
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for test compound wells (wllt = t) and neutral control wells (wllt = n).
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) of test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2 or neutral control wells (wllt = n).
Calculate the baseline value (bval) as the sample-wise median, by sample ID (spid), of the corrected values (cval) of the three lowest concentration test compound wells (wllt = t and cndx = 1, 2, & 3).
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for neutral control wells (wllt = n) or wells with a concentration index (cndx) of 1 or 2 and well type of test compound (wllt = t) or gain-of-signal control in multiple concentrations (wllt = c).
Calculate the baseline value (bval) as the endpoint-wise median, by assay component endpoint ID (aeid), corrected value (cval) for neutral control wells (wllt = n).
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for single-concentration gain-of-signal positive control wells (wllt = p).
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for multiple-concentration loss-of-signal negative control wells (wllt = m).
Calculate the positive control value (pval) as the plate-wise maximum, by assay plate ID (apid), of the medians of the corrected values (cval) for gain-of-signal single- or multiple-concentration negative control wells (wllt = m or o) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of corrected value (cval) of gain-of-signal single- or multiple-concentration positive control wells (wllt = p or c) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of the corrected values (cval) for gain-of-signal single- or multiple-concentration negative control wells (wllt = m or o) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of the corrected values (cval) for single-concentration gain-of-signal, multiple-concentration loss-of-signal, or viability control wells (wllt = p, m, or v) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise maximum, by assay plate ID (apid), of the medians of the corrected values (cval) for single-concentration gain-of-signal, multiple-concentration loss-of-signal, or viability control wells (wllt = p, m, or v) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise maximum, by assay plate ID (apid), of the medians of important reference wells (wllt = f) values by apid and concentration.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of important reference wells (wllt = f) values by apid and concentration.
Calculate the positive control value (pval) as the plate-wise maximum, by assay plate ID (apid), of the medians of the corrected values (cval) for single-concentration gain-of-signal control wells (wllt = p) by apid.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of corrected values (cval) for single-concentration gain-of-signal control wells (wllt = p) by apid.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of the corrected values (cval) for viability control wells (wllt = v) by apid and concentration.
Set the positive control value (pval) to 0; .
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for single-concentration negative control wells (wllt = o).
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for neutral control wells (wllt = n) multiplied by 2.
Calculate the positive control value (pval) as the endpoint-wise maximum, by assay component ID (aeid), of the corrected values for single-concentration gain-of-signal wells (wllt = p).
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the corrected values (cval) for blank wells (wllt= b).
Calculate positive control value (pval) as the 99th percentile of all corrected value (cvals) of the test compound wells (wllt = t).
Calculate positive control value (pval) as -100 for endpoints in the
down direction; .
Calculate the normalized response (resp) as a percent of control, i.e. the
ratio of the difference between the corrected (cval) and baseline (bval) values divided the
difference between the positive control (pval) and baseline (bval) values multiplied by 100;
.
Calculate the normalized response (resp) as a percent of control,
i.e. the ratio of the difference between the corrected (cval) and baseline (bval) values
divided the positive control (pval) value multiplied by 100;
.
Calculate the normalized response (resp) as the fold change, i.e. the ratio
of the corrected (cval) and baseline (bval) values; .
Calculate the normalized response (resp) as the fold change of logged, i.e. the difference between corrected (cval) and baseline (bval) log-scale values.
Transform the response values to log-scale (base 2).
Multiply the normalized response value (resp) by 25;
.
Scale the normalized response value (resp) by the ratio of
log2(1.2) and 3 multiplied by the baseline median absolute deviation (bmad) of the unscaled
normalized response values (resp); .
Scale the normalized response value (resp). First, determine
the maximum difference (md) by finding the maximum between the absolute difference of the
1st percentile minus the 50th percentile and the absolute difference of the 99th percentile
minus the 50th percentile. Then multiply resp by log2(1.2) divided by 20 percent of md;
.
Multiply the normalized response value (resp) by -1;
.
Shift all the normalized response values (resp) less than -3
multiplied by the baseline median absolute deviation (bmad) to 0; if
.
Shift all the normalized response values (resp) less than -6
multiplied by the baseline median absolute deviation (bmad) to 0; if
.
Shift all the normalized response values (resp) less than 10
multiplied by the baseline median absolute deviation (bmad) to 0; if
.
Shift the normalized response value (resp) with a baseline correction, by replicate index (repi), with a window of 3 multiplied by the baseline median absolute deviation (bmad).
Shift the normalized response value (resp) with a baseline correction, by replicate index (repi), with a window of 50.
Shift the normalized response value (resp) with a baseline correction, by sample ID (spid), with a window of 3 multiplied by the baseline median absolute deviation (bmad).
Shift the normalized response value (resp) with a baseline correction, by sample ID (spid), with a window of 50.
Set the corrected response value (cval) as the normalized response value (resp);
. No additional mc3 methods needed for endpoint-specific
normalization.
Calculate the normalized response (resp) as a zero center fold
change, i.e. 1 minus the ratio of corrected (cval) and baseline (bval) values;
. Typically used for increasing responses.
Calculate the normalized response (resp) as a zero center
fold change, i.e. the ratio of the the corrected (cval) and baseline (bval) values minus 1;
. Typically used for increasing responses.
Multiply the normalized response value (resp) by 100;
.
'
Censor (remove) response values from concentrations which median falls below -25.
This function is not exported and is not intended to be used by the user.
mc3
, Method functions
to query what
methods get applied to each aeid
mc4
loads level 3 data from the tcpl
database for the given id and performs level 4
multiple-concentration processing.
The processed data is then loaded into the mc4 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
mc4(ae, wr = FALSE)
mc4(ae, wr = FALSE)
ae |
Integer of length 1, assay endpoint id (aeid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 4 multiple-concentration modeling takes the dose-response data for
chemical-assay pairs, and fits three models to the data: constant, hill,
and gain-loss. For more information about the models see
Models
. When a chemical has more than one sample, the function
fits each sample separately.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other multiple-concentration:
mc1()
,
mc2()
,
mc3()
,
mc5()
,
mc6()
mc4_mthds
returns a list of methods to be used
during level 4 multiple-concentration processing for calculating bmad
mc4_mthds()
mc4_mthds()
The functions contained in the list returned by mc4_mthds
take
aeids
(a numeric vector of aeid values) and returns a list of expressions
to be executed in the mc4
(not exported) function environment. The
functions are described here for reference purposes, The
mc4_mthds
function is not exported, nor is it intended for use.
All available methods are described in the Available Methods section, listed by the type of function and the function/method name.
A list of functions
Although it does not say so specifically in each description, all methods are applied by aeid.
More information about the level 4 multiple-concentration processing is available in the package vignette, "Data_processing."
Calculate the baseline median absolute value (bmad) as the median absolute deviation of normalized response values (rep) for test compound wells (wllt = t) with concentration index (cndx) equal to 1 or 2. Calculate one standard deviation of the normalized response for test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2; onesd = sqrt(sum((resp - mean resp)^2)/sample size - 1). Onesd is used to establish BMR and therefore required for tcplfit2 processing.
Calculate the baseline median absolute value (bmad) as the median absolute deviation of normalized response values (resp) for neutral control wells (wllt = n). Calculate one standard deviation of the normalized response for neutral control wells (wllt = n); onesd = sqrt(sum((resp - mean resp)^2)/sample size - 1). Onesd is used to establish BMR and therefore required for tcplfit2 processing.
Limits bidirectional fitting and processes data in positive analysis direction only. Use for gain-of-signal or inverted data.
Replace baseline median absolute deviation (bmad) with 5 and one standard deviation (osd) of the normalized response for test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2 with 16. Typically used for binary data where values would otherwise be 0; non-zero values are required for tcplfit2 processing.
Exclude unbounded models and only fit data to bounded models (hill, gnls, exp4 and exp5).
This function is not exported and is not intended to be used by the user.
mc4
, Method functions
to query what
methods get applied to each aeid
mc5
loads level 4 data from the tcpl
database for the given id and performs level 5
multiple-concentration processing.
The processed data is then loaded into the mc5 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
ae |
Integer of length 1, assay endpoint id (aeid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 5 multiple-concentration hit-calling uses the fit parameters and the activity cutoff methods from mc5_aeid and mc5_methods to make an activity call and identify the winning model for each fit.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other multiple-concentration:
mc1()
,
mc2()
,
mc3()
,
mc4()
,
mc6()
mc5_mthds
returns a list of additional activity cutoff methods to be used during level 5
multiple-concentration processing.
mc5_mthds(ae)
mc5_mthds(ae)
ae |
Integer of length 1, the assay endpoint id |
The functions contained in the list returned by mc5_mthds
take aeids
(a numeric vector of aeid values) and returns a list of expressions to be executed in the
mc5
(not exported) function environment. The functions are described here for reference
purposes, The mc5_mthds
function is not exported, nor is it intended for use.
All available methods are described in the "Available Methods" section, listed by the cutoff type in ascending order of cutoff value.
A list of functions
The methods are broken down into five categories based on the type of cutoff they assign.
Different methods are used to define cutoffs for "bmad" (baseline median absolute value), "fc"
(fold change), "log" ( or
), "pc" (percent of
control), and "other" (uncategorized cutoffs).
All methods are applied by aeid.
Although there are method exceptions (notably within the “other” category), only highest calculated cutoff value based on assigned methods will be selected for hitcalling. Therefore, only the largest cutoff method per method type should be assigned.
More information about the level 5 multiple-concentration processing is available in the package vignette, "Data_processing."
Add a cutoff value of 1 multiplied by baseline median absolute value (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 2 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 3 multiplied by the baseline median absolute deviation (bmad) as defined at Level 4.
Add a cutoff value of 4 multiplied the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 5 multiplied the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 6 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 10 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 0.2. Typically for zero centered fold change data.
Add a cutoff value of 0.25. Typically for zero centered fold change data.
Add a cutoff value of 0.3. Typically for zero centered fold change data.
Add a cutoff value of 0.5. Typically for zero centered fold change data.
Log Base 2
Add a cutoff value of .
Add a cutoff value of . Typically for fold
change data.
Add a cutoff value . Typically for fold change data.
Log Base 10
Add a cutoff value of . Typically for fold
change data.
Add a cutoff value of . Typically for fold change
data.
Add a cutoff value of 5. Typically for percent of control data.
Add a cutoff value of 10. Typically for percent of control data.
Add a cutoff value of 16. Typically for percent of control data.
Add a cutoff value of 20. Typically for percent of control data.
Add a cutoff value of 25. Typically for percent of control data.
Add a cutoff value of 30. Typically for percent of control data.
Add a cutoff value of 40. Typically for percent of control data.
Add a cutoff value of 50. Typically for percent of control data.
Add a cutoff value of 70. Typically for percent of control data.
Add a cutoff value of 95. Typically for percent of control data.
Add a cutoff value of 20 percent of the maximum of all endpoint maximal average response values (max_med).
Add a cutoff value of 2.32.
Method not yet updated for tcpl implementation. Identify the lowest observed effective concentration (loec) compared to baseline.
Multiply winning model hitcall (hitc) by -1 for models fit in the positive analysis direction. Typically used for endpoints where only negative responses are biologically relevant.
Multiply winning model hitcall (hitc) by -1 for models fit in the negative analysis direction. Typically used for endpoints where only positive responses are biologically relevant.
Overwrite the osd value so that bmr equals cutoff.
This function is not exported and is not intended to be used by the user.
mc5
, Method functions
to query what methods get applied to
each aeid.
mc6
loads level 5 data from the tcpl
database for the given id and performs level 6
multiple-concentration processing.
The processed data is then loaded into the mc6 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
mc6(ae, wr = FALSE)
mc6(ae, wr = FALSE)
ae |
Integer of length 1, assay endpoint id (aeid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 6 multiple-concentration flagging uses both the plate level concentration-response data and the modeled parameters to flag potential false positives and false negative results.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other multiple-concentration:
mc1()
,
mc2()
,
mc3()
,
mc4()
,
mc5()
mc6_mthds
returns a list of flag methods to be used
during level 6 multiple-concentration processing.
mc6_mthds()
mc6_mthds()
A list functions
More information about the level 6 multiple-concentration processing is available in the package vignette, "Data_processing."
Flag series if model directionality is questionable, i.e. if
the winning model direction was opposite, more responses (resp) would have exceeded the cutoff
(coff). If loss was winning directionality (top < 0), flag if
.
If gain was winning directionality (top > 0), flag if
.
Flag series if the average number of replicates per concentration is less than
2; .
Flag series if 4 concentrations or less were tested; .
Flag series if modeled benchmark dose (BMD) is greater than AC50 (concentration at 50 percent maximal response). This is indicates high variability in baseline response in excess of more than half of the maximal response.
Flag single-point hit that's only at the highest conc tested, where series is an active hit call (hitc >= 0.9) with the median response observed above baseline occurring only at the highest tested concentration tested.
Flag single-point hit that's not at the highest conc tested, where series is an active hit call (hitc >= 0.9) with the median response observed above baseline occurring only at one concentration and not the highest concentration tested.
Flag multi-point miss, where series is an inactive hit call (hitc < 0.9) with multiple median responses observed above baseline.
Flag series where winning model is gain-loss (gnls) and the gain AC50 is less than the minimum tested concentration, and the loss AC50 is less than the mean tested concentration.
Flag series as noisy if the quality of fit as calculated by the root mean square
error (rmse) for the series is greater than the cutoff (coff); .
Flag series if borderline activity is suspected based on modeled top parameter
(top) relative to cutoff (coff); .
Method not yet updated for tcpl implementation. Flag hit-calls that would get changed after doing the small N correction to the aic values.
Flag low efficacy hits if series has an active hit call (hitc >= 0.9) and
efficacy values (e.g. top and maximum median response) less than 50 percent; intended for
biochemical assays. If and
, then flag when
or
. If
and
, then flag when
or
.
Flag series with an active hit call (hitc >= 0.9) if AC50 (concentration
at 50 percent maximal response) is less than the lowest concentration tested; if
and
, then flag.
Flag series with an active hit call (hitc >= 0.9) if denoted as cell viability assay with winning model is gain-loss (gnls); if hitc >= 0.9, modl = "gnls" and cell_viability_assay = 1, then flag.
Flag series where no median response values are greater than baseline as defined by 3 times the baseline median absolute deviation (bmad); nmed_gtbl_pos and nmed_gtbl_neg both = 0, where nmed_gtbl_pos/_neg is the number of medians greater than 3 * bmad/less than -3 * bmad.
This function is not exported and is not intended to be used by the user.
mc6
, Method functions
to query what
methods get applied to each aeid.
The example dataset is used to illustrate how the user can pipeline multiple-concentration data from chemical screening using tcpl.
mcdat
mcdat
A data frame with 14183 rows and 10 variables:
sample ID
assay plate ID
well-plate row number
well-plate column number
well type
well quality
concentration in micromolar
raw assay component readout value
source file containing the data
assay component source name
ToxCast database
These functions are used to manage which methods are used to process data.
They include methods for assigning, clearing, and loading the assigned
methods. Also, tcplMthdList
lists the available methods.
tcplMthdAssign(lvl, id, mthd_id, ordr = NULL, type) tcplMthdClear(lvl, id, mthd_id = NULL, type) tcplMthdList(lvl, type = "mc") tcplMthdLoad(lvl, id = NULL, type = "mc")
tcplMthdAssign(lvl, id, mthd_id, ordr = NULL, type) tcplMthdClear(lvl, id, mthd_id = NULL, type) tcplMthdList(lvl, type = "mc") tcplMthdLoad(lvl, id = NULL, type = "mc")
lvl |
Integer of length 1, the method level |
id |
Integer, the assay component or assay endpoint id(s) |
mthd_id |
Integer, the method id(s) |
ordr |
Integer, the order in which to execute the analysis methods, must be the same length as mthd_id, does not apply to levels 5 or 6 |
type |
Character of length 1, the data type, "sc" or "mc" |
tcplMthdLoad
loads the assigned methods for the given level and
ID(s). Similarly, tcplMthdList
displays the available methods for
the given level. These two functions do not make any changes to the
database.
Unlike the -Load
and -List
functions, the -Assign
and
-Clear
functions alter the database and trigger a delete cascade.
tcplMthdAssign
assigns methods to the given ID(s), and
tcplMthdClear
removes methods. In addition to the method ID
('mthd_id'), assigning methods at some levels require an order ('ordr').
The 'ordr' parameter is necessary to allow progression of methods at level
one for single-concentration processing, and levels two and three for
multiple-concentration processing. More information about method assignments
and the delete cascade are available in the package vignette.
## Not run: ## tcplListMthd allows the user to display the available methods for ## a given level and data type head(tcplMthdList(lvl = 2, type = "mc")) ## tcplLoadMthd shows which methods are assigned for the given ID, level, ## and data type. Here we will show how to register, load, and clear methods ## using an acid not in the example database. Note: There is no check for ## whether an ID exists before assigning/clearing methods. tcplMthdLoad(lvl = 2, id = 55, type = "mc") ## ACID 55 does not have any methods. Assign methods from the list above. tcplMthdAssign(lvl = 2, id = 55, mthd_id = c(3, 4, 2), ordr = 1:3, type = "mc") ## Method assignment can be done for multiple assays, too. tcplMthdAssign(lvl = 2, id = 53:54, mthd_id = c(3, 4, 2), ordr = 1:3, type = "mc") ## Cleanup example method assigments tcplMthdClear(lvl = 2, id = 53:55, type = "mc") ## End(Not run)
## Not run: ## tcplListMthd allows the user to display the available methods for ## a given level and data type head(tcplMthdList(lvl = 2, type = "mc")) ## tcplLoadMthd shows which methods are assigned for the given ID, level, ## and data type. Here we will show how to register, load, and clear methods ## using an acid not in the example database. Note: There is no check for ## whether an ID exists before assigning/clearing methods. tcplMthdLoad(lvl = 2, id = 55, type = "mc") ## ACID 55 does not have any methods. Assign methods from the list above. tcplMthdAssign(lvl = 2, id = 55, mthd_id = c(3, 4, 2), ordr = 1:3, type = "mc") ## Method assignment can be done for multiple assays, too. tcplMthdAssign(lvl = 2, id = 53:54, mthd_id = c(3, 4, 2), ordr = 1:3, type = "mc") ## Cleanup example method assigments tcplMthdClear(lvl = 2, id = 53:55, type = "mc") ## End(Not run)
These functions take in the dose-response data and the model parameters, and
return a likelihood value. They are intended to be optimized using
constrOptim
in the tcplFit
function.
tcplObjCnst(p, resp) tcplObjGnls(p, lconc, resp) tcplObjHill(p, lconc, resp) tcplObjCnst(p, resp) tcplObjGnls(p, lconc, resp) tcplObjHill(p, lconc, resp)
tcplObjCnst(p, resp) tcplObjGnls(p, lconc, resp) tcplObjHill(p, lconc, resp) tcplObjCnst(p, resp) tcplObjGnls(p, lconc, resp) tcplObjHill(p, lconc, resp)
p |
Numeric, the parameter values. See details for more information. |
resp |
Numeric, the response values |
lconc |
Numeric, the log10 concentration values |
These functions produce an estimated value based on the model and given parameters for each observation. Those estimated values are then used with the observed values and a scale term to calculate the log-likelihood.
Let be the Student's t-distribution with
degrees of
freedom,
be the observed response at the
observation, and
be the estimated response at the
observation. We calculate
as:
where is the scale term. Then the log-likelihood is:
Where is the number of observations.
The log-likelihood.
tcplObjCnst
calculates the likelyhood for a constant model at 0. The
only parameter passed to tcplObjCnst
by p
is the scale term
. The constant model value
for the
observation is given by:
tcplObjCnst
calculates the likelyhood for a constant model at 0. The
only parameter passed to tcplObjCnst
by p
is the scale term
. The constant model value
for the
observation is given by:
tcplObjGnls
calculates the likelyhood for a 5 parameter model as the
product of two Hill models with the same top and both bottoms equal to 0.
The parameters passed to tcplObjGnls
by p
are (in order) top
(), gain log AC50 (
), gain hill coefficient (
),
loss log AC50
, loss hill coefficient
, and the scale
term (
). The gain-loss model value
for the
observation is given by:
where is the log concentration for the
observation.
tcplObjGnls
calculates the likelyhood for a 5 parameter model as the
product of two Hill models with the same top and both bottoms equal to 0.
The parameters passed to tcplObjGnls
by p
are (in order) top
(), gain log AC50 (
), gain hill coefficient (
),
loss log AC50
, loss hill coefficient
, and the scale
term (
). The gain-loss model value
for the
observation is given by:
where is the log concentration for the
observation.
tcplObjHill
calculates the likelyhood for a 3 parameter Hill model
with the bottom equal to 0. The parameters passed to tcplObjHill
by
p
are (in order) top (), log AC50 (
), hill
coefficient (
), and the scale term (
). The hill model
value
for the
observation is given
by:
where is the log concentration for the
observation.
tcplObjHill
calculates the likelyhood for a 3 parameter Hill model
with the bottom equal to 0. The parameters passed to tcplObjHill
by
p
are (in order) top (), log AC50 (
), hill
coefficient (
), and the scale term (
). The hill model
value
for the
observation is given
by:
where is the log concentration for the
observation.
Lists of data frames returned from tcplMthdList invitrodb v4.2
mthd_list_defaults
mthd_list_defaults
A list with 7 items:
displays the available methods for mc lvl 2 data
displays the available methods for mc lvl 3 data
displays the available methods for mc lvl 4 data
displays the available methods for mc lvl 5 data
displays the available methods for mc lvl 6 data
displays the available methods for sc lvl 1 data
displays the available methods for sc lvl 2 data
ToxCast database
These functions send a query to the given database, and are the access point for all tcpl functions that query or update the tcpl database.
tcplQuery( query, db = getOption("TCPL_DB"), drvr = getOption("TCPL_DRVR"), tbl = NULL ) tcplQueryAPI(resource = "data", fld = NULL, val = NULL, return_flds = NULL) tcplSendQuery( query, db = getOption("TCPL_DB"), drvr = getOption("TCPL_DRVR"), tbl = NULL, delete = F )
tcplQuery( query, db = getOption("TCPL_DB"), drvr = getOption("TCPL_DRVR"), tbl = NULL ) tcplQueryAPI(resource = "data", fld = NULL, val = NULL, return_flds = NULL) tcplSendQuery( query, db = getOption("TCPL_DB"), drvr = getOption("TCPL_DRVR"), tbl = NULL, delete = F )
query |
Character of length 1, the query string |
db |
Character of length 1, the name of the tcpl database |
drvr |
Character of length 1, which database driver to use |
tbl |
Tables to be read queried |
resource |
must be either data or assay to determine which api endpoint to hit |
fld |
field that should be used to query the api |
val |
value for specified field to query on |
return_flds |
optional list of fields that should be returned |
delete |
Logical of length 1, execute delete on queried table |
Currently, the tcpl package supports the "MySQL", "example", and "API" database drivers.
tcplQuery
returns a data.table object with the query results.
tcplSendQuery
sends a query, but does not fetch any results, and
returns 'TRUE' or the error message given by the database.
tcplQueryAPI
returns a data.table object with the query results when
connected using "API" as driver.
## Not run: # only with MySQL driver tcplQuery("SELECT 'Hello World';") # only with API driver tcplConfDefault() tcplQueryAPI(resource = "data", fld = "aeid", val = 2) ## End(Not run)
## Not run: # only with MySQL driver tcplQuery("SELECT 'Hello World';") # only with API driver tcplConfDefault() tcplQueryAPI(resource = "data", fld = "aeid", val = 2) ## End(Not run)
These functions are used to register and update the chemical and assay annotation information.
tcplRegister(what, flds) tcplUpdate(what, id, flds)
tcplRegister(what, flds) tcplUpdate(what, id, flds)
what |
Character of length 1, the name of the ID to register or update |
flds |
Named list, the other fields and their values |
id |
Integer, the ID value(s) to update |
These functions are used to populate the tcpl database with the necessary annotation information to complete the processing. As shown in the package vignette, the package requires some information about the samples and assays before data can be loaded into the tcpl database.
Depending on what is being registered, different information is required. The following table lists the fields that can be registered/updated by these functions, and the minimal fields required for registering a new ID. (The database table affected is in parentheses.)
asid (assay_source): assay_source_name
aid (assay): asid, assay_name, assay_footprint
acid (assay_component): aid, assay_component_name
aeid (assay_component_endpoint): acid, assay_component_endpoint_name, normalized_data_type
acsn (assay_component_map): acid, acsn
spid (sample): spid, chid
chid (chemical): chid, casn
clib (chemical_library): chid, clib
Note: The functions accept the abbreviated forms of the names, ie. "aenm" rather than the full "assay_component_endpoint_name." More information about the registration process and all of the fields is available in the vignette.
## Not run: ## Load current ASID information tcplLoadAsid() ## Register a new assay source tcplRegister(what = "asid", flds = list(asnm = "example_asid")) ## Show the newly registered ASID tcplLoadAsid(add.fld = "assay_source_desc") ## Notice that the newly created ASID does not have an assay_source_desc. ## The field could have been defined during the registration process, but ## can also be updated using tcplUpdate i1 <- tcplLoadAsid()[asnm == "example_asid", asid] tcplUpdate(what = "asid", id = i1, flds = list(assay_source_desc = "example asid description")) tcplLoadAsid(add.fld = "assay_source_desc") ## Remove the created ASID. Note: Manually deleting primary keys can cause ## serious database problems and should not generally be done. ## End(Not run)
## Not run: ## Load current ASID information tcplLoadAsid() ## Register a new assay source tcplRegister(what = "asid", flds = list(asnm = "example_asid")) ## Show the newly registered ASID tcplLoadAsid(add.fld = "assay_source_desc") ## Notice that the newly created ASID does not have an assay_source_desc. ## The field could have been defined during the registration process, but ## can also be updated using tcplUpdate i1 <- tcplLoadAsid()[asnm == "example_asid", asid] tcplUpdate(what = "asid", id = i1, flds = list(assay_source_desc = "example asid description")) tcplLoadAsid(add.fld = "assay_source_desc") ## Remove the created ASID. Note: Manually deleting primary keys can cause ## serious database problems and should not generally be done. ## End(Not run)
registerMthd
registers a new analysis method to the tcpl
databases.
registerMthd(lvl, mthd, desc, nddr = 0L, type)
registerMthd(lvl, mthd, desc, nddr = 0L, type)
lvl |
Integer of length 1, the level for the analysis method |
mthd |
Character, the name of the method |
desc |
Character, same length as mthd, the method description |
nddr |
Integer, 0 or 1, 1 if the method requires loading the dose- response data |
type |
Character of length 1, the data type, "sc" or "mc" |
'mthd' must match a corresponding function name in the functions that load
the methods, ie. mc2_mthds
. 'nddr' only applies to level 6
methods.
List of lists containing queries sent to tcplQuery associated with each test case. Each list also contains the associated ids with each case. Only meant to be used with automated testing with mocking for sc data.
sc_test
sc_test
A list with 20 items:
Data table with 1 row and 2 columns used for each test case for establishing connection using tcplConf. This data table mocks the response one would get from connecting with invitrodb.
List containing the queries used for loading sc0 data by s0id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 's0id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading sc0 data by acid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'acid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading sc1 data by s1id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 's1id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading sc1 data by acid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'acid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading sc2 data by s2id via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 's2id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading sc2 data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading sc 'agg' data by aeid via tcplLoadData. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading and plotting sc data by s2id via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 's2id' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading and plotting sc data by multiple s2ids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 's2id' labeled item storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting sc data by aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the id used to load the data, for use in tests.
List containing the queries used for loading and plotting sc data by multiple aeids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains one 'aeid' labeled item storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting sc data by spid/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid' and 'aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting sc data by multiple spids/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid' and 'aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared sc data by s2id via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 's2id' and 'compare.s2id' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared sc data by multiple s2ids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 's2id' and 'compare.s2id' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared sc data by aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'aeid' and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared sc data by multiple aeids via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'aeid' and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared sc data by spid/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid', 'compare.spid', 'aeid', and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
List containing the queries used for loading and plotting compared sc data by multiple spids/aeid via tcplPlot. Each query has an associated data table response for mocking an actual connection. Contains 'spid', 'compare.spid', 'aeid', and 'compare.aeid' labeled items storing the ids used to load the data, for use in tests.
ToxCast database
This dataset is a list with 3 data.tables (sc0,sc1,sc2).
sc_vignette
sc_vignette
sc0 A data frame with 10 rows and 18 columns containing level 0 formatted raw data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component ID
Assay Component Name
Level 0 (sc0) ID
Assay plate ID
Row Index
Column Index
Well Type
Well Quality (0 or 1)
Concentration in micromolar
Raw assay component readout value
Source file containing the raw data
Concentration Units
sc1 A data frame with 10 rows and 20 columns containing level 1 normalized data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component Endpoint ID
Assay endpoint name (i.e., assay_component_endpoint_name)
Assay Component ID
Assay Component Name
Level 0 (sc0) ID
Level 1 (sc1) ID
Assay plate ID
Row Index
Column Index
Well Type
Log base 10 concentration
Normalized response value
Response Units
Concentration Units
sc2 A data frame with 10 rows and 15 columns containing level 2 efficacy/hit designation data.
Sample ID
Unique chemical ID number for tcpl
Chemical Abstract Service(CAS) number
Chemical name
Chemical-specific DTXSID
CAS number compressed into numeric string
Assay Component Endpoint ID
Assay endpoint name (i.e., assay_component_endpoint_name)
Level 2 (sc2) ID
The median absolute deviation of all treatment wells (default option) or blank wells
Maximum median response
Hitcall
Cutoff
Response Units
Concentration Units
sc1
loads level 0 data from the tcpl
database for the given id and performs level 1
single-concentration processing.
The processed data is then loaded into the sc1 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
sc1(ac, wr = FALSE)
sc1(ac, wr = FALSE)
ac |
Integer of length 1, assay component id (acid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 1 single-concentration processing includes mapping assay component to assay endpoint, duplicating the data when the assay component has multiple assay endpoints, and any normalization of the data. Data normalization based on methods listed in sc1_aeid and sc1_methods tables.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other single-concentration:
sc2()
sc1_mthds
returns a list of functions to be used during level 1
single-concentration processing.
sc1_mthds()
sc1_mthds()
The functions contained in the list returned by sc1_mthds
return
a list of expressions to be executed in the sc2
(not exported)
function environment. The functions are described here for reference
purposes, The sc1_mthds
function is not exported, nor is it
intended for use.
All available methods are described in the Available Methods section, listed by the function/method name.
A list functions
The methods are broken into three types, based on what fields they define. Different methods are used to define "bval" (the baseline value), "pval" (the positive control value), and "resp" (the final response value).
Although it does not say so specifically in each description, all methods are applied by acid.
More information about the level 3 single-concentration processing is available in the package vignette, "Data_processing."
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the raw values (rval) for neutral control wells (wllt = n).
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the raw values (rval) for test compound wells (wllt = t).
Calculate the baseline value (bval) as the plate-wise median, by assay plate ID (apid), of the raw values (rval) for test compound wells (wllt = t) and neutral control wells (wllt = n).
Calculate the baseline value (bval) as the median of the raw values (rval) for neutral control wells (wllt = n) by assay endpoint id (aeid).
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the raw values (rval) for single-concentration gain-of-signal positive control wells (wllt = p).
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the raw values (rval) for multiple-concentration loss-of-signal negative control wells (wllt = m).
Calculate the positive control value (pval) as the plate-wise maximum, by assay plate ID (apid), of the medians of the raw values (rval) for gain-of-signal single- or multiple-concentration positive control wells (wllt = p or c) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of the raw values (rval) for gain-of-signal single- or multiple-concentration positive control wells (wllt = p or c) by apid, well type, and concentration.
Calculate the positive control value (pval) as the plate-wise minimum, by assay plate ID (apid), of the medians of the raw values (rval) for gain-of-signal single- or multiple-concentration negative control wells (wllt = m or o) by apid, well type, and concentration.
Set the positive control value (pval) to 0; pval = 0.
Calculate the positive control value (pval) as the plate-wise median, by assay plate ID (apid), of the raw values (rval) for single-concentration gain-of-signal positive control wells (wllt = p). For plates without p wells, set the pval as the median pval calculated from all plates.
Calculate the normalized response (resp) as a percent of control, i.e. the
ratio of the difference between the raw (rval) and baseline (bval) values divided by the
difference between positive control (pval) and baseline (bval) values multiplied by 100;
.
Calculate the normalized response (resp) as fold change, i.e. the ratio of
the raw (rval) and baseline (bval) values; .
Calculate the normalized response (resp) as the fold change of logged, i.e. the difference between raw (rval) and baseline (bval) log-scale values.
Transform the response values to log-scale (base 2).
Multiply the normalized response value (resp) by -1;
.
Use raw value (rval) as is. This may be necessary for additional endpoint-specific adjustments, or where no additional sc1 methods are needed.
Calculate the normalized response (resp) as a zero center
fold change, i.e. the ratio of the raw (rval) and baseline (bval) values minus 1;
. Typically used for increasing responses.
This function is not exported and is not intended to be used by the user.
sc1
, Method functions
to query what
methods get applied to each acid
sc2
loads level 1 data from the tcpl
database for the given id and performs level 2
single-concentration processing.
The processed data is then loaded into the sc2 table and
all subsequent data is deleted with tcplCascade
. See details
for more information.
The individual processing functions are no longer exported, as it is
typically more convenient and suggested to use the tcplRun
wrapper function.
sc2(ae, wr = FALSE)
sc2(ae, wr = FALSE)
ae |
Integer of length 1, assay endpoint id (aeid) for processing. |
wr |
Logical, whether the processed data should be written to the tcpl database |
Level 2 single-concentration processing defines the bmad value, and uses the activity cutoff methods from sc2_aeid and sc2_methods to make an activity call.
A boolean of length 1, indicating the success of the processing, or when 'wr' is FALSE, a list where the first element is a boolean indicating the success of processing and the second element is a data.table containing the processed data
Other single-concentration:
sc1()
sc2_mthds
returns a list of functions to be used during level 2
single-concentration processing.
sc2_mthds()
sc2_mthds()
The functions contained in the list returned by sc2_mthds
return
a list of expressions to be executed in the sc2
(not exported)
function environment. The functions are described here for reference
purposes, The sc2_mthds
function is not exported, nor is it
intended for use.
All available methods are described in the Available Methods section, listed by the function/method name.
A list functions
The methods are broken down into four categories based on the type of cutoff they assign.
Different methods are used to define cutoffs for "bmad" (baseline median absolute value), "pc"
(percent of control), "pc or bmad", "log" ( or
), and
"other" (uncategorized methods).
All methods are applied by aeid.
Although there are method exceptions (notably within the “other” category), only highest calculated cutoff value based on assigned methods will be selected for hitcalling. Therefore, only the largest cutoff method per method type should be assigned.
More information about the level 2 single-concentration processing is available in the package vignette, "Data_processing."
Add a cutoff value of 1 multiplied by baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 1.5 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 2 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 3 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 5 multiplied the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 6 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 10 multiplied by the baseline median absolute deviation (bmad). By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Add a cutoff value of 0.88. Typically for percent of control data.
Add a cutoff value of 16. Typically for percent of control data.
Add a cutoff value of 20. Typically for percent of control data.
Add a cutoff value of 25. Typically for percent of control data.
Add a cutoff value of 30. Typically for percent of control data.
Add a cutoff value of either 30 or 3 multiplied by the baseline median absolute deviation (bmad), whichever is less. By default, bmad is calculated using test compound wells (wllt = t) for the endpoint.
Log Base 2
Add a cutoff value of 0.76 for log2-transformed data. This was a custom threshold value set for endpoint id 1690 (formerly aeid 1691).
Add a cutoff value of . Typically for fold change
data.
Add a cutoff value of . Typically for fold change
data.
Log Base 10
Add a cutoff value of . Typically for fold
change data.
Overwrite the default baseline median absolute value (bmad) with a bmad calculated using neutral control wells (wllt = n).
Where responses only in the positive direction are biologically relevant, overwrite the max_med and max_tmp values, which were calculated using absolute value, to a calculation using a true maximum for uni-directional data.
Where responses only in the negative direction are biologically relevant, overwrite the max_med and max_tmp values, which were calculated using absolute value, to a calculation using a true minimum for uni-directional data.
This function is not exported and is not intended to be used by the user.
sc2
, Method functions
to query what
methods get applied to each acid
The example dataset is used to illustrate how the user can pipeline single-concentration data from chemical screening using tcpl.
scdat
scdat
A data frame with 320 rows and 10 variables:
sample ID
assay plate ID
well-plate row number (N/A)
well-plate column number (N/A)
well type (N/A)
well quality (N/A)
concentration in micromolar
raw assay component readout value
source file containing the data
assay component source name
ToxCast database
sink.reset
resets all sinks and returns all output to the console.
sink.reset()
sink.reset()
sink.reset
identifies all sinks with sink.number
then returns
all output and messages back to the console.
Other tcpl abbreviations:
is.odd()
,
lu()
,
lw()
tcplAddModel
draws a a line for one of the tcpl Models (see
Models
for more information) onto an existing plot.
tcplAddModel(pars, modl = NULL, adj = NULL, ...)
tcplAddModel(pars, modl = NULL, adj = NULL, ...)
pars |
List of parameters from level 4 or 5 output |
modl |
Character of length 1, the model to plot: 'cnst,' 'hill,' or 'gnls' |
adj |
Numeric of length 1, an adjustment factor, see details for more information |
... |
Additional arguments passed to |
tcplAddModel
draws the model line assuming the x-axis represents log
base 10 concentration.
If modl
is NULL, the function checks pars$modl
and will return
an error if pars$modl
is also NULL.
adj
is intended to scale the models, so that models with different
response units can be visualized on a single plot. The recommended value for
adl
is 1/(3*bmad)
for level 4 data and 1/coff
for level
5 data. If adj
is NULL the function will check pars$adj
and
set adj
to 1 if pars$adj
is also NULL.
## Create some dummy data to plot logc <- 1:10 r1 <- sapply(logc, tcplHillVal, ga = 5, tp = 50, gw = 0.5) r2 <- log2(sapply(logc, tcplHillVal, ga = 4, tp = 30, gw = 0.5)) p1 <- tcplFit(logc = logc, resp = r1, bmad = 10) p2 <- tcplFit(logc = logc, resp = r2, bmad = log2(1.5)) ## In the dummy data above, the two plots are on very different scales plot(r1 ~ logc, pch = 16, ylab = "raw response") tcplAddModel(pars = p1, modl = "hill") points(r2 ~ logc) tcplAddModel(pars = p2, modl = "hill", lty = "dashed") ## To visualize the two curves on the same plot for comparison, we can ## scale the values to the bmad, such that a scaled response of 1 will equal ## the bmad for each curve. plot(r1/10 ~ logc, pch = 16, ylab = "scaled response") tcplAddModel(pars = p1, modl = "hill", adj = 1/10) points(r2/log2(5) ~ logc) tcplAddModel(pars = p2, modl = "hill", adj = 1/log2(5), lty = "dashed")
## Create some dummy data to plot logc <- 1:10 r1 <- sapply(logc, tcplHillVal, ga = 5, tp = 50, gw = 0.5) r2 <- log2(sapply(logc, tcplHillVal, ga = 4, tp = 30, gw = 0.5)) p1 <- tcplFit(logc = logc, resp = r1, bmad = 10) p2 <- tcplFit(logc = logc, resp = r2, bmad = log2(1.5)) ## In the dummy data above, the two plots are on very different scales plot(r1 ~ logc, pch = 16, ylab = "raw response") tcplAddModel(pars = p1, modl = "hill") points(r2 ~ logc) tcplAddModel(pars = p2, modl = "hill", lty = "dashed") ## To visualize the two curves on the same plot for comparison, we can ## scale the values to the bmad, such that a scaled response of 1 will equal ## the bmad for each curve. plot(r1/10 ~ logc, pch = 16, ylab = "scaled response") tcplAddModel(pars = p1, modl = "hill", adj = 1/10) points(r2/log2(5) ~ logc) tcplAddModel(pars = p2, modl = "hill", adj = 1/log2(5), lty = "dashed")
tcplAICProb
Calculates the probability that the model best represents
the data based on the AIC value for each model.
tcplAICProb(...)
tcplAICProb(...)
... |
Numeric vectors of AIC values |
The function takes vectors of AIC values. Each vector represents the model AIC values for multiple observation sets. Each vector must contain the same number and order of observation sets. The calculation assumes every possible model is accounted for, and the results should be interpreted accordingly.
A vector of probability values for each model given, as a list.
tcplFit
, AIC
for more information
about AIC values.
## Returns the probability for each model, given models with AIC values ## ranging from 80 to 100 tcplAICProb(80, 85, 90, 95, 100) ## Also works for vectors m1 <- c(95, 195, 300) ## model 1 for three different observations m2 <- c(100, 200, 295) ## model 2 for three different observations tcplAICProb(m1, m2)
## Returns the probability for each model, given models with AIC values ## ranging from 80 to 100 tcplAICProb(80, 85, 90, 95, 100) ## Also works for vectors m1 <- c(95, 195, 300) ## model 1 for three different observations m2 <- c(100, 200, 295) ## model 2 for three different observations tcplAICProb(m1, m2)
tcplAppend
takes a data.table (dat) and appends the data.table into
a database table.
tcplAppend(dat, tbl, db, lvl = NULL)
tcplAppend(dat, tbl, db, lvl = NULL)
dat |
data.table, the data to append to a table |
tbl |
Character of length 1, the table to append to |
db |
Character of length 1, the database containing |
lvl |
Usually Integer to indicate what level to auto-increment |
This function is not exported and not intended to be used by the user.
tcplCascade
deletes the data for the given id(s) starting at
the processing level given. The delete will cascade through all subsequent
tables.
tcplCascade(lvl, type, id)
tcplCascade(lvl, type, id)
lvl |
Integer of length 1, the first level to delete from |
type |
Character of length 1, the data type, "sc" or "mc" |
id |
Integer, the id(s) to delete. See details for more information. |
The data type can be either 'mc' for multiple concentration data, or 'sc' for single concentration data. Multiple concentration data will be loaded into the level tables, whereas the single concentration will be loaded into the single tables.
If lvl is less than 3, id is interpreted as acid(s) and if lvl is greater than or equal to 3, id is interpreted as aeid(s).
This function is not exported and not intended to be used by the user.
tcplCode2CASN
takes a code and converts it CAS Registry Number.
tcplCode2CASN(code)
tcplCode2CASN(code)
code |
Character of length 1, a chemical code |
The function checks for the validity of the CAS Registry Number. Also, the ToxCast data includes chemicals for which there is no CASRN. The convention for these chemicals is to give them a CASRN as NOCAS_chid; the code for these compounds is CNOCASchid. The function handles the NOCAS compounds as they are stored in the database, as shown in the example below.
A CAS Registry Number.
tcplCode2CASN("C80057") tcplCode2CASN("C09812420") ## Invalid CASRN will give a warning tcplCode2CASN("CNOCAS0015") ## The underscore is reinserted for NOCAS codes
tcplCode2CASN("C80057") tcplCode2CASN("C09812420") ## Invalid CASRN will give a warning tcplCode2CASN("CNOCAS0015") ## The underscore is reinserted for NOCAS codes
tcplCytoPt
calculates the cytotoxicity point and average cytotoxicity
distribution based on the activity in the "burst" assay endpoints.
tcplCytoPt( chid = NULL, aeid = NULL, flag = TRUE, min.test = TRUE, default.pt = 3 )
tcplCytoPt( chid = NULL, aeid = NULL, flag = TRUE, min.test = TRUE, default.pt = 3 )
chid |
Integer, chemical ID values to subset on |
aeid |
Integer, assay endpoint ID values to override the "burst assay" definitions |
flag |
Integer, mc6_mthd_id values to be passed to
|
min.test |
Integer or Boolean, the number of tested assay endpoints required for a chemical to be used in calculating the "global MAD." |
default.pt |
Numeric of length 1, the default cytotoxicity point value |
tcplCytoPt
provides estimates for chemical-specific cytotoxicity
distributions (more information available in the vignette.) Before
calculating the cytotoxicity distributions, the level 5 data is subsetted
by the tcplSubsetChid
function.
The 'chid' parameter specifies a subset of chemicals to use in the
calculations, given by chemical ID (chid). The 'aeid' parameter specifies
which assays to use in calculating the cytotoxicity point and distribution.
By default tcplCytoPt
will use all available chemicals and the
assay endpoints defined by the 'burst_assay' field in the
"assay_component_endpoint" table. The examples show how to identify the
"burst" endpoints.
tcplCytoPt
returns the cytotoxicity point (the AC50 values of the
active "burst" endpoints), the corresponding MAD, and the global MAD (median
of the calculated MAD values). Not every chemical must be tested in every
"burst" endpoint. The 'min.test' parameter allows the user to specify a
minimum number of tested assay endpoints as a requirement for MAD values to
be included in the global MAD calculation. For example, suppose the user
supplies 10 "burst" assays. The user can choose to require a chemical to be
tested in at least 5 of those assays for it's MAD value to be included in
the global MAD calculation. Having chemicals with many less "burst" endpoints
tested may inflate or deflate the global MAD calculation. By default (values
of TRUE
or NULL
), tcplCytoPt
requires a chemical to be
tested in at least 80% of the given "burst" assays. The user can also
provide 'min.test' values of FALSE
(indicating to include all MAD
values), or a number (indicating a specific number of endpoints).
Chemicals without at least 2 active "burst" assays do not have a MAD value, and the cytotoxicity point is defined by the 'default.pt' parameter. The default value for 'default.pt' is 3.
The resulting data.table has the following fields:
"chid" – The chemical ID.
"code" – The chemical code.
"chnm" – The chemical name.
"casn" – The chemical CASRN.
"med" – The median of the "burst" endpoint log(AC50)
"mad" – The MAD of the "burst" endpoint log(AC50) values.
"ntst" – The number of "burst" endpoints tested.
"nhit" – The number of active "burst" endpoints.
"used_in_global_mad_calc" – TRUE/FALSE, whether the mad value was used in the global MAD calculation.
"global_mad" – The median of the "mad" values where "used_in_global_mad_calc" is TRUE.
"cyto_pt" – The cytotoxicity point, or the value in "med" when "nhit" is at least 2.
"cyto_pt_um" –
"lower_bnd_um" –
A data.table with the cytotoxicity distribution for each chemical. The definition of the field names are listed under "details."
## Not run: ## Can only calculate the cytotox burst if using the MySQL database and ## TCPL_DRVR == 'MySQL' if (getOption("TCPL_DRVR") == "MySQL") { ## Load the "burst" endpoints -- none are defined in the example dataset tcplLoadAeid(fld = "burst_assay", val = 1) ## Calculate the cytotoxicity distributions using both example endpoints tcplCytoPt(aeid = 1:2) ## The above example does not calculate a global MAD, because no chemical ## hit both endpoints. (This makes sense, because both endpoints are ## derived from one component, where one endpoint is acitivity in the ## up direction, and the other is activity in the down direction.) ## Note, the cyto_pt is also 3 for all chemicals, because the function ## requires at least two endpoints to calculate a cytotoxicity point. If ## the user wishes to use one assay, this function is not necessary. ## Changing 'default.pt' will change cyto_pt in the resulting data.table tcplCytoPt(aeid = 1:2, default.pt = 6) } ## End(Not run)
## Not run: ## Can only calculate the cytotox burst if using the MySQL database and ## TCPL_DRVR == 'MySQL' if (getOption("TCPL_DRVR") == "MySQL") { ## Load the "burst" endpoints -- none are defined in the example dataset tcplLoadAeid(fld = "burst_assay", val = 1) ## Calculate the cytotoxicity distributions using both example endpoints tcplCytoPt(aeid = 1:2) ## The above example does not calculate a global MAD, because no chemical ## hit both endpoints. (This makes sense, because both endpoints are ## derived from one component, where one endpoint is acitivity in the ## up direction, and the other is activity in the down direction.) ## Note, the cyto_pt is also 3 for all chemicals, because the function ## requires at least two endpoints to calculate a cytotoxicity point. If ## the user wishes to use one assay, this function is not necessary. ## Changing 'default.pt' will change cyto_pt in the resulting data.table tcplCytoPt(aeid = 1:2, default.pt = 6) } ## End(Not run)
tcpldbStats
takes a string(type) and an optional parameter(val) to return the summary statistics on the entire tcpl database
When type = "all" the val is ignored. the function returns the number of distinct spid and aeids in the database at each level
When type = "aeid", the val parameter has to be a valid aeid in the database. The function returns a
table consisting of the number of distinct spids at each level of processing for the aeid given in 'val'
When type = "spid", the val parameter has to be a valid spid in the database. The function returns a
table consisting of the number of distinct aeids at each level of processing for the given spid in 'val'
tcpldbStats(type = "all", val = NULL)
tcpldbStats(type = "all", val = NULL)
type |
String either "all", "aeid" or "spid" |
val |
integer if type = "aeid" , string if type = "spid" |
tcplDefine
queries the tcpl databases and returns field descriptions
from the data dictionary.
tcplDefine(val = NULL)
tcplDefine(val = NULL)
val |
The values to query on. Can be any combination of table names (to return all of its field descriptions) and field names |
Short descriptions of fields for different tables are stored in a data dictionary. Query by table name to retrieve descriptions of each field in the given table, and/or query by field name to retrieve descriptions on every field with the given name, regardless of which table they belong to.
A data.table with the data dictionary information for the given parameters.
## Store the current config settings, so they can be reloaded at the end ## of the examples conf_store <- tcplConfList() tcplConf(drvr = "example") ## Passing no parameters returns all of the fields described in the data ## dictionary tcplDefine() ## Specifying table names of 'chemical' and 'sample' yields all of the ## fields from the 'chemical' and 'sample' tables tcplDefine(c("chemical", "sample")) ## Specifying a field of 'wllt' yields all of the fields from any table that ## contains 'wllt' as a field tcplDefine("wllt") ## Specifying a combination of table and field names results in all of the ## fields which are contained in the given tables and all of the given fields ## found in any table tcplDefine(c("chemical", "spid", "wllt")) ## Reset configuration options(conf_store)
## Store the current config settings, so they can be reloaded at the end ## of the examples conf_store <- tcplConfList() tcplConf(drvr = "example") ## Passing no parameters returns all of the fields described in the data ## dictionary tcplDefine() ## Specifying table names of 'chemical' and 'sample' yields all of the ## fields from the 'chemical' and 'sample' tables tcplDefine(c("chemical", "sample")) ## Specifying a field of 'wllt' yields all of the fields from any table that ## contains 'wllt' as a field tcplDefine("wllt") ## Specifying a combination of table and field names results in all of the ## fields which are contained in the given tables and all of the given fields ## found in any table tcplDefine(c("chemical", "spid", "wllt")) ## Reset configuration options(conf_store)
tcplDelete
deletes rows from the given table and database.
tcplDelete(tbl, fld, val, db)
tcplDelete(tbl, fld, val, db)
tbl |
Character, length 1, the table to delete from |
fld |
Character, the field(s) to query on |
val |
List, vectors of values for each field to query on. Must be in the same order as 'fld'. |
db |
Character, the database containing the table |
This function is not exported and not intended to be used by the user.
tcplFit
fits the constant, hill, and gain-loss models to the given data
and returns some summary statistics and the fit parameters in a list.
tcplFit( logc, resp, bmad, force.fit = FALSE, bidirectional = FALSE, verbose = FALSE, ... )
tcplFit( logc, resp, bmad, force.fit = FALSE, bidirectional = FALSE, verbose = FALSE, ... )
logc |
Numeric, log concentration values |
resp |
Numeric, normalized response values |
bmad |
Numeric, the baseline median absolute deviation for the entire assay |
force.fit |
Logical, TRUE indicates to attempt fitting every concentration series |
bidirectional |
Boolean If TRUE, bidirectional negative data before fitting (default=FALSE) The original version of the code required the data to start at small values and rise, so that negative curves had to be bidirectionalped outside the function, and TOP was always positive. Setting bidirectional to TRUE allows both rising and falling curves |
verbose |
Boolean If TRUE print warning messages |
... |
Any other data to be included in list output. |
when at least one median value is greater than 3*bmad.
List of summary values and fit parameters for the given data.
tcplObjCnst
, tcplObjHill
,
tcplObjGnls
, constrOptim
logc <- 1:10 resp <- sapply(1:10, tcplHillVal, ga = 5, tp = 50, gw = 0.5) params <- tcplFit(logc = logc, resp = resp, bmad = 10) plot(resp ~ logc) tcplAddModel(pars = params, modl = "hill")
logc <- 1:10 resp <- sapply(1:10, tcplHillVal, ga = 5, tp = 50, gw = 0.5) params <- tcplFit(logc = logc, resp = resp, bmad = 10) plot(resp ~ logc) tcplAddModel(pars = params, modl = "hill")
tcpl Wrapper for tcplfit2_core including additional calculations to fit into new schema
tcplFit2( dat, fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5"), bmed = NULL )
tcplFit2( dat, fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5"), bmed = NULL )
dat |
output from level 3 processing |
fitmodels |
list of the models that should be fit with the data |
bmed |
baseline value, typically should be 0 |
Data.table with an additional column fitparams that includes all of the fitting parameters
Nest dataframe into a list that is readable by tcplfit2
tcplFit2_nest(dat)
tcplFit2_nest(dat)
dat |
a dataframe that has all of the fitting parameters in the style of tcplloaddata |
a list of fitting parameters that can be consumed by tcplfit2
Unnest tcplfit2 parameters into a dataframe
tcplFit2_unnest(output)
tcplFit2_unnest(output)
output |
list of output from tcplfit2 |
list of parameters unnested and compiled into a dataframe
tcplGetAeid
takes a string(name) and finds the assay component endpoint names that match the string and the
aeids associated with those names.The function performs a regular expression like matching for strings in the
assay component endpoint name column in the assay component endpoint table.
tcplGetAeid(name)
tcplGetAeid(name)
name |
A string that will be matched to the assay component endpoint name |
## Not run: ## Search for aenm (assay name) case insensitive tcplGetAeid("TOX21") tcplGetAeid("tox21") ## End(Not run)
## Not run: ## Search for aenm (assay name) case insensitive tcplGetAeid("TOX21") tcplGetAeid("tox21") ## End(Not run)
tcplggplot
tcplggplot(dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA, NA))
tcplggplot(dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA, NA))
dat |
data table with all required conc/resp data |
lvl |
integer level of data that should be plotted level 2 - for 'sc' plotting level 5 - for 'mc' plotting, all fit models and winning model with hitcall |
verbose |
boolean should plotting include table of values next to the plot |
flags |
boolean should plotting include level 6 flags in plot caption |
yrange |
Integer of length 2, for overriding the y-axis range, c(<min>,<max>). By default, c(NA,NA). |
A ggplot object or grob with accompanied table depending on verbose option
tcplggplotCompare
tcplggplotCompare( dat, compare.dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA, NA) )
tcplggplotCompare( dat, compare.dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA, NA) )
dat |
data table with all required conc/resp data |
compare.dat |
data table with all required conc/resp data for comparison overlay |
lvl |
integer level of data that should be plotted level 2 - for 'sc' plotting level 5 - for 'mc' plotting, all fit models and winning model with hitcall |
verbose |
boolean should plotting include table of values next to the plot |
flags |
boolean should plotting include level 6 flags in plot caption |
yrange |
Integer of length 2, for overriding the y-axis range, c(<min>,<max>). By default, c(NA,NA). |
A ggplot object or grob with accompanied table depending on verbose option
Hitcalling with tcplfit2
tcplHit2(mc4, coff)
tcplHit2(mc4, coff)
mc4 |
data.table with level 4 data |
coff |
cutoff value for hitcalling |
Data.table with key value pairs of hitcalling parameters
tcplLegacyPlot
tcplLegacyPlot()
tcplLegacyPlot()
a ggplot based on old plotting methodology
tcplListFlds
loads the column names for the given table and database.
tcplListFlds(tbl, db = getOption("TCPL_DB"))
tcplListFlds(tbl, db = getOption("TCPL_DB"))
tbl |
Character of length 1, the tcpl database table |
db |
Character of length 1, the tcpl database |
This function can be particularly useful in defining the 'fld' param in the tcplLoad- functions.
A string of field names for the given table.
## Not run: ## Gives the fields in the mc1 table tcplListFlds("mc1") ## End(Not run)
## Not run: ## Gives the fields in the mc1 table tcplListFlds("mc1") ## End(Not run)
tcplLoadChem
queries the tcpl database and returns the chemical
information for the given field and values.
tcplLoadChem(field = NULL, val = NULL, exact = TRUE, include.spid = TRUE)
tcplLoadChem(field = NULL, val = NULL, exact = TRUE, include.spid = TRUE)
field |
Character of length 1, the field to query on |
val |
Vector of values to subset on |
exact |
Logical, should chemical names be considered exact? |
include.spid |
Logical, should spid be included? |
The 'field' parameter is named differently from the 'fld' parameter seen in other functions because it only takes one input.
In the MySQL environment the user should be able to give partial
chemical name strings, to find chemicals with similar names. For example,
setting 'val' to "phenol" when 'field' is "chnm" and 'exact' is
FALSE
might pull up the chemicals "Bisphenol A" and
"4-Butylphenol". More technically, setting 'exact' to FALSE
passes
the string in 'val' to an RLIKE statement within the MySQL query.
A data.table with the chemical information for the given parameters
## Not run: ## Passing no parameters gives all of the registered chemicals with their ## sample IDs tcplLoadChem() ## Or the user can exclude spid and get a unique list of chemicals tcplLoadChem(include.spid = FALSE) ## In addition, the user can retrieve only the registered chemicals from the chemical table tcplLoadChem(field = 'chem.only') ## Other examples: tcplLoadChem(field = "chnm", val = "Bisphenol A") tcplLoadChem(field = "chid", val = 20182) ## End(Not run)
## Not run: ## Passing no parameters gives all of the registered chemicals with their ## sample IDs tcplLoadChem() ## Or the user can exclude spid and get a unique list of chemicals tcplLoadChem(include.spid = FALSE) ## In addition, the user can retrieve only the registered chemicals from the chemical table tcplLoadChem(field = 'chem.only') ## Other examples: tcplLoadChem(field = "chnm", val = "Bisphenol A") tcplLoadChem(field = "chid", val = 20182) ## End(Not run)
tcplLoadChemList
queries the tcpl databases and returns information
about the chemical lists.
tcplLoadChemList(field = NULL, val = NULL)
tcplLoadChemList(field = NULL, val = NULL)
field |
Character of length 1, |
val |
The values to query on |
Chemicals are stored in different lists by chemical ID. Therefore, it is not possible to delineate samples with the same chemical ID into two distinct chemical lists. However, it is possible for a chemical ID to belong to more than one (or no) chemical lists.
When chemicals belong to more than one list, the chemical is listed multiple times (one for each distinct list).
A data.table with the chemical list information for the given parameters.
## Not run: ## Passing no parameters gives all of the chemical IDs that have a chemical ## list registered clist <- tcplLoadChemList() ## Notice there are different number of rows in tcplLoadChemList than in tcplLoadChem, ## indicating some chemicals must belong to more than list (or no lists). chem <- tcplLoadChem(include.spid = TRUE) nrow(chem) nrow(clist) ## Show the unique chemical lists clist[ , unique(list_acronym)] ## Specifying a chemical list will not show what other libraries a ## chemical might belong to. tcplLoadChemList(field = "list_acronym", val = "CPDBAS") tcplLoadChemList(field = "chid", val = 20182) tcplLoadChemList(field = "dsstox_substance_id", val = "DTXSID7020182") ## End(Not run)
## Not run: ## Passing no parameters gives all of the chemical IDs that have a chemical ## list registered clist <- tcplLoadChemList() ## Notice there are different number of rows in tcplLoadChemList than in tcplLoadChem, ## indicating some chemicals must belong to more than list (or no lists). chem <- tcplLoadChem(include.spid = TRUE) nrow(chem) nrow(clist) ## Show the unique chemical lists clist[ , unique(list_acronym)] ## Specifying a chemical list will not show what other libraries a ## chemical might belong to. tcplLoadChemList(field = "list_acronym", val = "CPDBAS") tcplLoadChemList(field = "chid", val = 20182) tcplLoadChemList(field = "dsstox_substance_id", val = "DTXSID7020182") ## End(Not run)
tcplLoadUnit
queries the tcpl databases and returns a data.table
with the concentration units for the given assay endpoint ids (spid).
tcplLoadConcUnit(spid)
tcplLoadConcUnit(spid)
spid |
Integer, assay endpoint ids |
A data.table containing level 3 correction methods for the given spids.
tcplLoadData
queries the tcpl databases and returns a data.table with
data for the given level and data type.
tcplLoadData(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRUE)
tcplLoadData(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRUE)
lvl |
Integer of length 1, the level of data to load |
fld |
Character, the field(s) to query on |
val |
List, vectors of values for each field to query on. Must be in the same order as 'fld'. |
type |
Character of length 1, the data type, "sc" or "mc" |
add.fld |
Boolean if true we want to return the additional parameters fit with tcplfit2 |
The data type can be either 'mc' for mutliple concentration data, or 'sc' for single concentration data. Multiple concentration data will be loaded into the 'mc' tables, whereas the single concentration will be loaded into the 'sc' tables.
Setting 'lvl' to "agg" will return an aggregate table containing the m4id with the concentration-response data and m3id to map back to well-level information.
If tcplConf()
was set with "API" as the driver, then tcplLoadData
will return data from the CCTE Bioactivity API. API data is available for
type = 'mc'
and lvl = c(3,4,5,6) and 'agg'. Only fields relating to the
requested level are returned, but not all fields that usually return from
invitrodb are available from the API. To have all fields available from the
API return, regardless of what lvl is set to, set add.fld
to
TRUE
. API query-able fields include "aeid", "spid", "m4id", and
"dtxsid".
Leaving fld
NULL will return all data.
Valid fld
inputs are based on the data level and type:
type | lvl | Queried tables |
sc | 0 | sc0 |
sc | 1 | sc0, sc1 |
sc | agg | sc1, sc2_agg |
sc | 2 | sc2 |
mc | 0 | mc0 |
mc | 1 | mc0, mc1 |
mc | 2 | mc0, mc1, mc2 |
mc | 3 | mc0, mc1, mc3 |
mc | agg | mc3, mc4_agg |
mc | 4 | mc4 |
mc | 5 | mc4, mc5 |
mc | 6 | mc4, mc6 |
mc | 7 | mc4, mc7 |
A data.table containing data for the given fields.
## Not run: ## Load all of level 0 for multiple-concentration data, note 'mc' is the ## default value for type tcplLoadData(lvl = 0) ## Load all of level 1 for single-concentration tcplLoadData(lvl = 1, type = "sc") ## List the fields available for level 1, coming from tables mc0 and mc1 tcplListFlds(tbl = "mc0") tcplListFlds(tbl = "mc1") ## Load level 0 data where the well type is "t" and the concentration ## index is 3 or 4 tcplLoadData(lvl = 1, fld = c("wllt", "cndx"), val = list("t", c(3:4))) ## End(Not run)
## Not run: ## Load all of level 0 for multiple-concentration data, note 'mc' is the ## default value for type tcplLoadData(lvl = 0) ## Load all of level 1 for single-concentration tcplLoadData(lvl = 1, type = "sc") ## List the fields available for level 1, coming from tables mc0 and mc1 tcplListFlds(tbl = "mc0") tcplListFlds(tbl = "mc1") ## Load level 0 data where the well type is "t" and the concentration ## index is 3 or 4 tcplLoadData(lvl = 1, fld = c("wllt", "cndx"), val = list("t", c(3:4))) ## End(Not run)
tcplLoadUnit
queries the tcpl databases and returns a data.table
with the response units for the given assay endpoint ids (aeid).
tcplLoadUnit(aeid)
tcplLoadUnit(aeid)
aeid |
Integer, assay endpoint ids |
A data.table containing level 3 correction methods for the given aeids.
tcplLvlCount
queries the tcpl databases and returns a data frame with
count totals for the given levels and data type.
tcplLvlCount(lvls = NULL, type = "mc")
tcplLvlCount(lvls = NULL, type = "mc")
lvls |
Integer or list of Integers, The levels of data to load |
type |
Character of length 1, the data type, "sc" or "mc" |
The data type can be either 'mc' for mutliple concentration data, or 'sc' for single concentration data.
Leaving lvls
NULL will return all data.
A data.table containing data for the given fields.
## Not run: ## Get all counts for level 1 for multiple-concentration tcplLvlCount(lvls = 1) ## Get all counts for levels 4 through 7 for multiple-concentration tcplLvlCount(lvls = 4:7) ## Get all counts for multiple-concentration data, note 'mc' is the ## default value for type tcplLvlCount() ## End(Not run)
## Not run: ## Get all counts for level 1 for multiple-concentration tcplLvlCount(lvls = 1) ## Get all counts for levels 4 through 7 for multiple-concentration tcplLvlCount(lvls = 4:7) ## Get all counts for multiple-concentration data, note 'mc' is the ## default value for type tcplLvlCount() ## End(Not run)
tcplMakeAeidMultiPlts
Create a .pdf with all dose-response plots for a given aeid
tcplMakeAeidMultiPlts( aeid, lvl = 4L, fname = NULL, odir = getwd(), hitc.all = TRUE )
tcplMakeAeidMultiPlts( aeid, lvl = 4L, fname = NULL, odir = getwd(), hitc.all = TRUE )
aeid |
Integer of length 1, the assay endpoint id |
lvl |
Integer of length 1, the data level to use (4-7) |
fname |
Character, the filename |
odir |
The directory to save the .pdf file in |
hitc.all |
If FALSE, only plots with hitc==1 will be displayed |
tcplMakeAeidMultiPlts
provides a wrapper for tcplMultiplot
,
allowing the user to produce PDFs with the curve plots without having to
separately load all of the data and establish the PDF device.
If 'fname' is NULL
, a default name is given by concatenating together
assay information.
tcplMakeAeidPlts
creates a .pdf file with the dose-response plots for
the given aeid.
tcplMakeAeidPlts( aeid, compare = F, lvl = 4L, fname = NULL, odir = getwd(), ordr.fitc = TRUE, cnst = NULL )
tcplMakeAeidPlts( aeid, compare = F, lvl = 4L, fname = NULL, odir = getwd(), ordr.fitc = TRUE, cnst = NULL )
aeid |
Integer of length 1 or 2, the assay endpoint id |
compare |
Boolean to for comparison of aeids if length(aeid)>1 |
lvl |
Integer of length 1, the data level to use (4-7). Only level 5-6 valid for compare aeids. |
fname |
Character, the filename |
odir |
The directory to save the .pdf file in |
ordr.fitc |
Logical, should the fits be ordered by fit category? |
cnst |
Constant hline to draw on plot |
tcplMakeAeidPlts
provides a wrapper for tcplPlotFits
,
allowing the user to produce PDFs with the curve plots without having to
separately load all of the data and establish the PDF device.
If 'fname' is NULL
, a default name is given by concatenating together
assay information.
Note, the default value for ordr.fitc is TRUE
in
tcplMakeAeidPlts
, but FALSE
in tcplPlotFits
Note, only level 5 or level 6 is valid for comparing 2 aeids.
## Not run: ## Will produce the same result as the example for tcplPlotFits tcplMakeAeidPlts(aeid = 1, lvl = 6, ordr.fitc = FALSE) ## End(Not run) ## Not run: ## Compare two aeids on same plots tcplMakeAeidPlts(aeid = c(1,2), compare=T, lvl = 6) ## End(Not run)
## Not run: ## Will produce the same result as the example for tcplPlotFits tcplMakeAeidPlts(aeid = 1, lvl = 6, ordr.fitc = FALSE) ## End(Not run) ## Not run: ## Compare two aeids on same plots tcplMakeAeidPlts(aeid = c(1,2), compare=T, lvl = 6) ## End(Not run)
tcplMakeChidMultiPlts
Create a .pdf with all dose-response plots for a given chid
tcplMakeChidMultiPlts( chid, lvl = 4L, fname = NULL, odir = getwd(), hitc.all = TRUE )
tcplMakeChidMultiPlts( chid, lvl = 4L, fname = NULL, odir = getwd(), hitc.all = TRUE )
chid |
Integer of length 1, the chemical id |
lvl |
Integer of length 1, the data level to use (4-7) |
fname |
Character, the filename |
odir |
The directory to save the .pdf file in |
hitc.all |
If FALSE, only plots with hitc==1 will be displayed |
tcplMakeChidMultiPlts
provides a wrapper for tcplMultiplot
,
allowing the user to produce PDFs with the curve plots without having to
separately load all of the data and establish the PDF device.
If 'fname' is NULL
, a default name is given by concatenating together
assay information.
tcplMultiplot
takes the dose-response and fit data and produces
summary plot figures.
tcplMultiplot(dat, agg, flg = NULL, boot = NULL, browse = FALSE, hitc.all)
tcplMultiplot(dat, agg, flg = NULL, boot = NULL, browse = FALSE, hitc.all)
dat |
data.table, level 4 or level 5 data, see details. |
agg |
data.table, concentration-response aggregate data, see details. |
flg |
data.table, level 6 data, see details. |
boot |
data.table, level 7 data, see details. |
browse |
Logical, should |
hitc.all |
Logical, if FALSE, only plots with hitc==1 will be displayed |
The data for 'dat', 'agg', and 'flg' should be loaded using the
tcplLoadData
function with the appropriate 'lvl' parameter.
See help page for tcplLoadData
for more information.
If dat contains only one aeid, plots will be ordered by chemical name (chnm). Otherwise, plots are ordered by assay endpoint name (aenm). ## While it is most likely the user will want to just save all of the plots ## to view in a PDF, the 'browse' parameter can be used to quickly view ## some plots.
tcplPlot
queries the tcpl databases and returns a plot
for the given level and data type.
tcplPlot( dat = NULL, type = "mc", fld = "m4id", val = NULL, compare.val = NULL, by = NULL, output = c("console", "pdf", "png", "jpg", "svg", "tiff"), fileprefix = paste0("tcplPlot_", Sys.Date()), multi = NULL, verbose = FALSE, nrow = NULL, ncol = NULL, dpi = 600, flags = FALSE, yuniform = FALSE, yrange = c(NA, NA) )
tcplPlot( dat = NULL, type = "mc", fld = "m4id", val = NULL, compare.val = NULL, by = NULL, output = c("console", "pdf", "png", "jpg", "svg", "tiff"), fileprefix = paste0("tcplPlot_", Sys.Date()), multi = NULL, verbose = FALSE, nrow = NULL, ncol = NULL, dpi = 600, flags = FALSE, yuniform = FALSE, yrange = c(NA, NA) )
dat |
data.table containing plot-prepared data, used for stand-alone
(non-ToxCast data like other tcplfit2-fit data) or advanced plotting
(generating comparison plots across multiple database configurations) and not
required. See |
type |
Character of length 1, the data type, "sc" or "mc". |
fld |
Character, the field(s) to query on. |
val |
List, vectors of values for each field to query on. Must be in the same order as 'fld'. |
compare.val |
List, vectors of values for each field to query on to compare with val. Must be in the same order as 'fld'. Must have the same length as val (1:1 comparison). Must be set to compare plots; otherwise leave NULL |
by |
Parameter to divide files into e.g. "aeid". |
output |
How should the plot be presented. To work with the plot in environment, use "ggplot"; to interact with the plot in application, use "console"; or to save as a file type, use "pdf", "jpg", "png", "svg", or "tiff". |
fileprefix |
Prefix of file when saving. |
multi |
Boolean, by default TRUE for "pdf". If multi is TRUE, output by default 4 plots per page for 'verbose' = TRUE and 6 plots per page for 'verbose' = FALSE. |
verbose |
Boolean, by default FALSE. If TRUE, a table with fitting parameters is included with the plot. |
nrow |
Integer, number of rows in multiplot. By default 2. |
ncol |
Integer, number of columns in multiplot. By default 3, 2 if verbose. |
dpi |
Integer, image print resolution. By default 600. |
flags |
Boolean, by default FALSE. If TRUE, level 6 flags are displayed below annotations on plot |
yuniform |
Boolean, by default FALSE. If TRUE, all plots will have uniform y axis scaling, automatically determined. |
yrange |
Integer of length 2, for directly setting the y-axis range, c(<min>,<max>). By default, c(NA,NA). |
The data type can be either 'mc' for multiple concentration data, or 'sc' for single concentration data. Multiple concentration data will be loaded into the 'mc' tables, whereas the single concentration will be loaded into the 'sc' tables.
Leaving fld
NULL will return all data.
## Not run: tcplPlot(fld = "m4id", val = c(18609966)) ## Create a level 4 plot ## End(Not run)
## Not run: tcplPlot(fld = "m4id", val = c(18609966)) ## Create a level 4 plot ## End(Not run)
tcplPlotFitc
makes a plot showing the level 5 fit categories.
tcplPlotFitc(fitc = NULL, main = NULL, fitc_sub = NULL)
tcplPlotFitc(fitc = NULL, main = NULL, fitc_sub = NULL)
fitc |
Integer, the fit categories |
main |
Character of length 1, the title (optional) |
fitc_sub |
Integer, a subset of fit categories to plot |
Suggested device size (inches): width = 10, height = 7.5, pointsize = 9
## Not run: ## Plot visualization of fit categories for all level 5 data tcplPlotFitc(fitc = tcplLoadData(5)$fitc) ## End(Not run)
## Not run: ## Plot visualization of fit categories for all level 5 data tcplPlotFitc(fitc = tcplLoadData(5)$fitc) ## End(Not run)
tcplPlotFits
takes the dose-response and fit data and produces
summary plot figures.
tcplPlotFits( dat, agg, flg = NULL, boot = NULL, ordr.fitc = FALSE, browse = FALSE, cnst = NULL, orig.aeid = NULL, compare = F )
tcplPlotFits( dat, agg, flg = NULL, boot = NULL, ordr.fitc = FALSE, browse = FALSE, cnst = NULL, orig.aeid = NULL, compare = F )
dat |
data.table, level 4 or level 5 data, see details. |
agg |
data.table, concentration-response aggregate data, see details. |
flg |
data.table, level 6 data, see details. |
boot |
data.table, level 7 data, see details. |
ordr.fitc |
Logical, should the fits be ordered by fit category? |
browse |
Logical, should |
cnst |
Constant hline to draw on plot |
orig.aeid |
Original aeid list from tcplMakeAeidPlts to maintain order |
compare |
boolean to determine if aeids should be compared on same plot |
The data for 'dat', 'agg', and 'flg' should be loaded using the
tcplLoadData
function with the appropriate 'lvl' parameter.
See help page for tcplLoadData
for more information.
Supplying level 4 data for the 'dat' parameter will result in level 4 plots. Similarly, supp
If fits are not ordered by fit category, they will be ordered by chemical ID. Inputs with multiple assay endpoints will first be ordered by assay endpoint ID.
## Not run: ## tcplPlotFits needs data.tables supplying the concentration/response ## data stored in mc4_agg, as well as the fit information from mc4 or mc5. ## Additionally, tcplPlotFits can take level 6 data from mc6 and add the ## flag information to the plots. The following shows how to make level 5 ## plots. Adding the 'flg' parameter would result in level 6 plots, and ## loading level 4, rather than level 5 data, would result in level 4 plots. l5 <- tcplLoadData(lvl = 5, fld = "m4id", val = 18609966) l4_agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = 18609966) pdf(file = "tcplPlotFits.pdf", height = 6, width = 10, pointsize = 10) tcplPlotFits(dat = l5, agg = l4_agg) graphics.off() ## While it is most likely the user will want to just save all of the plots ## to view in a PDF, the 'browse' parameter can be used to quickly view ## some plots. ## Start by identifying some sample IDs to plot, then call tcplPlotFits with ## a subset of the data. This browse function is admittedly clunky. bpa <- tcplLoadChem(field = "chnm", val = "Bisphenol A")[ , spid] l5_sub <- l5[spid %in% bpa] tcplPlotFits(dat = l5_sub, agg = l4_agg[m4id %in% l5_sub$m4id], browse = TRUE) ## End(Not run)
## Not run: ## tcplPlotFits needs data.tables supplying the concentration/response ## data stored in mc4_agg, as well as the fit information from mc4 or mc5. ## Additionally, tcplPlotFits can take level 6 data from mc6 and add the ## flag information to the plots. The following shows how to make level 5 ## plots. Adding the 'flg' parameter would result in level 6 plots, and ## loading level 4, rather than level 5 data, would result in level 4 plots. l5 <- tcplLoadData(lvl = 5, fld = "m4id", val = 18609966) l4_agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = 18609966) pdf(file = "tcplPlotFits.pdf", height = 6, width = 10, pointsize = 10) tcplPlotFits(dat = l5, agg = l4_agg) graphics.off() ## While it is most likely the user will want to just save all of the plots ## to view in a PDF, the 'browse' parameter can be used to quickly view ## some plots. ## Start by identifying some sample IDs to plot, then call tcplPlotFits with ## a subset of the data. This browse function is admittedly clunky. bpa <- tcplLoadChem(field = "chnm", val = "Bisphenol A")[ , spid] l5_sub <- l5[spid %in% bpa] tcplPlotFits(dat = l5_sub, agg = l4_agg[m4id %in% l5_sub$m4id], browse = TRUE) ## End(Not run)
tcplPlotLoadData
queries the tcpl databases and returns a data.table
with data for the given field, value, level, and data type prepared in a
format tcplPlot can use to generate plots.
tcplPlotLoadData(type = "mc", fld = "m4id", val, flags = FALSE)
tcplPlotLoadData(type = "mc", fld = "m4id", val, flags = FALSE)
type |
Character of length 1, the data type, "sc" or "mc" |
fld |
Character, the field(s) to query on. |
val |
List, vectors of values for each field to query on. Must be in the same order as 'fld'. |
flags |
Boolean, by default FALSE. If TRUE, level 6 flags are loaded for use in tcplPlot. Must be set to TRUE if tcplPlot 'flags' also is/will be set to TRUE |
This utility function is used by tcplPlot
to load and prepare data from
tcplLoadData
for use in generating plots. It is exported for use in
advanced comparison plots where users create plots using multiple data sources.
After saving the response from tcplPlotLoadData
, switch data source
config and pass the data to tcplPlot
dat
parameter.
The data type
can be either 'mc' for multiple concentration data, or
'sc' for single concentration data.
A data.table containing plot-ready data for the given fields.
## Not run: ## load mc plot data for an entire endpoint dat <- tcplPlotLoadData(fld = "aeid", val = 703) ## load sc plot data for an entire endpoint dat <- tcplPlotLoadData(type = "sc", fld = "aeid", val = 703) ## load plot data for two endpoint-samples and include loading of flags ## flags must equal TRUE if tcplPlot will/does dat <- tcplPlotLoadData(fld = c("spid", "aeid"), val = list(c("TP0000269F11", "TP0000395A09"),703), flags = TRUE) ## if desired, switch connections tcplConf() ## use dat in tcplPlot tcplPlot(dat = dat, fld = c("spid", "aeid"), val = list(c("TP0000269F11", "TP0000395A09"),703), compare.val = list(c("LEGTV002B01", "LEGTV003A06"),703), output = "pdf", flags = TRUE, fileprefix="example") ## End(Not run)
## Not run: ## load mc plot data for an entire endpoint dat <- tcplPlotLoadData(fld = "aeid", val = 703) ## load sc plot data for an entire endpoint dat <- tcplPlotLoadData(type = "sc", fld = "aeid", val = 703) ## load plot data for two endpoint-samples and include loading of flags ## flags must equal TRUE if tcplPlot will/does dat <- tcplPlotLoadData(fld = c("spid", "aeid"), val = list(c("TP0000269F11", "TP0000395A09"),703), flags = TRUE) ## if desired, switch connections tcplConf() ## use dat in tcplPlot tcplPlot(dat = dat, fld = c("spid", "aeid"), val = list(c("TP0000269F11", "TP0000395A09"),703), compare.val = list(c("LEGTV002B01", "LEGTV003A06"),703), output = "pdf", flags = TRUE, fileprefix="example") ## End(Not run)
tcplPlotlyPlot
tcplPlotlyPlot(dat, lvl = 5)
tcplPlotlyPlot(dat, lvl = 5)
dat |
data table with all required conc/resp data |
lvl |
integer level of data that should be plotted level 2 - for 'sc' plotting level 5 - for 'mc' plotting, all fit models and winning model with hitcall |
A plotly plot
tcplPlotM4ID
creates a summary plots for the given m4id(s) by loading
the appropriate data from the tcpl databases and sending it to
tcplPlotFits
tcplPlotM4ID(m4id, lvl = 4L)
tcplPlotM4ID(m4id, lvl = 4L)
m4id |
Integer, m4id(s) to plot |
lvl |
Integer, the level of data to plot |
A level 4 plot ('lvl' = 4) will plot the concentration series and the applicable curves, without an indication of the activity call or the winning model. Level 4 plots can be created without having done subsequent processing.
Level 5 plots include the level 4 information with the activity call and model selection. The winning model will be highlighted red in the side panel containing the summary statistics. Level 6 plots, in addition the all of the level 4 and 5 information, include the positive flag IDs. If the flag has an associated value, the value will be in parentheses following the flag ID. Level 7 plots in addition to all of the level 4, 5, and 6 information, include the AC50 confidence interval and hit percentage information from bootstrapping.
tcplPlotFits
, tcplMakeAeidPlts
## Not run: tcplPlotM4ID(m4id = 18609966, lvl = 4) ## Create a level 4 plot tcplPlotM4ID(m4id = 18609966, lvl = 5) ## Create a level 5 plot tcplPlotM4ID(m4id = 18609966, lvl = 6) ## Create a level 6 plot ## End(Not run)
## Not run: tcplPlotM4ID(m4id = 18609966, lvl = 4) ## Create a level 4 plot tcplPlotM4ID(m4id = 18609966, lvl = 5) ## Create a level 5 plot tcplPlotM4ID(m4id = 18609966, lvl = 6) ## Create a level 6 plot ## End(Not run)
tcplPlotPlate
generates a heatmap of assay plate data
tcplPlotPlate(dat, apid, id = NULL, quant = c(0.001, 0.999))
tcplPlotPlate(dat, apid, id = NULL, quant = c(0.001, 0.999))
dat |
data.table containing tcpl data |
apid |
Character of length 1, the apid to plot |
id |
Integer of length 1, the assay component id (acid) or assay endpoint id (aeid), depending on level. Only need to specify for multiplexed assays when more than one acid/aeid share an apid. |
quant |
Numeric vector, the range of data to include in the legend |
The legend represents the range of the data supplied to dat, for the applicable ID. The additional horizontal lines on the legend indicate the range of the plotted plate, to show the relation of the plate to the assay as a whole. A plot with a legend specific for the given apid can be created by only supplying the data for the apid of interest to 'dat'.
The quant parameter, by default including 99.8 allows for extreme outliers without losing resolution. Outliers in either direction will be highlighted with a dark ring, as seen in the example. A NULL value for 'quant' will not restrict the data at all, and will use the full range for the legend.
Wells with a well quality of 0 (only applicable for level 1 plots), will have an "X" through their center.
For the optimal output size, use width = 10, height = 10*(2/3), pointsize = 10, units = "in"
## Not run: d1 <- tcplLoadData(lvl = 1, fld = "acid", val = 1) tcplPlotPlate(dat = d1, apid = "09Apr2014.Plate.17") ## End(Not run)
## Not run: d1 <- tcplLoadData(lvl = 1, fld = "acid", val = 1) tcplPlotPlate(dat = d1, apid = "09Apr2014.Plate.17") ## End(Not run)
tcplPlotSetYRange
tcplPlotSetYRange(dat, yuniform, yrange, type)
tcplPlotSetYRange(dat, yuniform, yrange, type)
dat |
dataset |
yuniform |
should the yrange be uniform |
yrange |
length 2 of the yrange |
type |
mc or sc |
yrange of the data
tcplPlotValidate
tcplPlotValidate( type = "mc", flags = NULL, output = "none", multi = NULL, verbose = FALSE )
tcplPlotValidate( type = "mc", flags = NULL, output = "none", multi = NULL, verbose = FALSE )
type |
string of mc or sc indicating if it is single or multi conc |
flags |
bool - should we return flags |
output |
how should the plot be formatted |
multi |
are there multiple plots |
verbose |
should the plot return a table with parameters |
a list of validated parameters for plotting
tcplPrepOtpt
queries the chemical and assay information from the tcpl
database, and maps the annotation information to the given data.
tcplPrepOtpt(dat, ids = NULL)
tcplPrepOtpt(dat, ids = NULL)
dat |
data.table, output from |
ids |
Character, (optional) a subset of ID fields to map |
tcplPrepOtpt
is used to map chemical and assay identifiers to their
respective names and annotation information to create a human-readable table
that is more suitable for an export/output.
By default the function will map sample ID (spid), assay component id (acid), and assay endpoint ID (aeid) values. However, if 'ids' is not null, the function will only attempt to map the ID fields given by 'ids.'
The given data.table with chemical and assay information mapped
## Not run: ## Load some example data d1 <- tcplLoadData(1) ## Check for chemical name in 'dat' "chnm" %in% names(d1) ## FALSE #' ## Map all annotations d2 <- tcplPrepOtpt(d1) ## "chnm" %in% names(d2) ## TRUE "acnm" %in% names(d2) ## TRUE ## Map chemical annotation only d3 <- tcplPrepOtpt(d1, ids = "spid") "chnm" %in% names(d3) ## TRUE "acnm" %in% names(d3) ## FALSE ## End(Not run)
## Not run: ## Load some example data d1 <- tcplLoadData(1) ## Check for chemical name in 'dat' "chnm" %in% names(d1) ## FALSE #' ## Map all annotations d2 <- tcplPrepOtpt(d1) ## "chnm" %in% names(d2) ## TRUE "acnm" %in% names(d2) ## TRUE ## Map chemical annotation only d3 <- tcplPrepOtpt(d1, ids = "spid") "chnm" %in% names(d3) ## TRUE "acnm" %in% names(d3) ## FALSE ## End(Not run)
tcplRun
is the function for performing the data processing, for both
single-concentration and multiple-concentration formats.
tcplRun( asid = NULL, slvl, elvl, id = NULL, type = "mc", mc.cores = NULL, outfile = NULL, runname = NULL )
tcplRun( asid = NULL, slvl, elvl, id = NULL, type = "mc", mc.cores = NULL, outfile = NULL, runname = NULL )
asid |
Integer, assay source id |
slvl |
Integer of length 1, the starting level to process |
elvl |
Integer of length 1, the ending level to process |
id |
Integer, rather than assay source id, the specific assay component or assay endpoint id(s) (optional) |
type |
Character of length 1, the data type, "sc" or "mc" |
mc.cores |
Integer of length 1, the number of cores to use, set to 1 when using Windows operating system |
outfile |
Character of length 1, the name of the log file (optional) |
runname |
Character of length 1, the name of the run to be used in the outfile (optional) |
The tcplRun
function is the core processing function within the
package. The function acts as a wrapper for individual processing functions,
(ie. mc1
, sc1
, etc.) that are not exported. If possible, the
processing is done in parallel by 'id' by utilizing the
mclapply
function within the parallel package.
If slvl is less than 4, 'id' is interpreted as acid and if slvl is 4 or greater 'id' is interpreted as aeid. Must give either 'asid' or 'id'. If an id fails no results get loaded into the database, and the id does not get placed into the cue for subsequent level processing.
The 'type' parameter specifies what type of processing to complete: "mc" for multiple-concentration processing, and "sc" for single-concentration processing.
A list containing the results from each level of processing. Each level processed will return a named logical vector, indicating the success of the processing for the id.
tcplSubsetChid
subsets level 5 data to a single tested sample per
chemical. In other words, if a chemical is tested more than once (a chid
has more than one spid) for a given assay endpoint, the function uses a
series of logic to select a single "representative" sample.
tcplSubsetChid(dat, flag = TRUE, type = "mc", export_ready = FALSE)
tcplSubsetChid(dat, flag = TRUE, type = "mc", export_ready = FALSE)
dat |
data.table, a data.table with level 5 data |
flag |
Integer, the mc6_mthd_id values to go into the flag count, see details for more information |
type |
Character of length 1, the data type, "sc" or "mc" |
export_ready |
Boolean, default FALSE, should only export ready 1 values be included in calculation |
tcplSubsetChid
is intended to work with level 5 data that has
chemical and assay information mapped with tcplPrepOtpt
.
To select a single sample, first a "consensus hit-call" is made by majority rule, with ties defaulting to active. After the chemical-wise hit call is made, the samples corresponding to to chemical-wise hit call are logically ordered using the fit category, the number of the flags, and AC50 (or modl_ga), then the first sample for every chemical is selected.
The flag
param can be used to specify a subset of flags to be used in
the flag count. Leaving flag
TRUE utilize all the available flags.
Setting flag
to FALSE
will do the subsetting without
considering any flags.
A data.table with a single sample for every given chemical-assay pair.
## Not run: ## Load the example level 5 data d1 <- tcplLoadData(lvl = 5, fld = "aeid", val = 797) d1 <- tcplPrepOtpt(d1) ## Subset to an example of a duplicated chid d2 <- d1[chid == 20182] d2[, list(m4id, hitc, fitc, modl_ga)] ## Here the consensus hit-call is 1 (active), and the fit categories are ## all equal. Therefore, if the flags are ignored, the selected sample will ## be the sample with the lowest modl_ga. tcplSubsetChid(dat = d2, flag = FALSE)[, list(m4id, modl_ga)] ## End(Not run)
## Not run: ## Load the example level 5 data d1 <- tcplLoadData(lvl = 5, fld = "aeid", val = 797) d1 <- tcplPrepOtpt(d1) ## Subset to an example of a duplicated chid d2 <- d1[chid == 20182] d2[, list(m4id, hitc, fitc, modl_ga)] ## Here the consensus hit-call is 1 (active), and the fit categories are ## all equal. Therefore, if the flags are ignored, the selected sample will ## be the sample with the lowest modl_ga. tcplSubsetChid(dat = d2, flag = FALSE)[, list(m4id, modl_ga)] ## End(Not run)
tcplVarMat
creates chemical by assay matrices.
tcplVarMat( dsstox_substance_id = NULL, aeid = NULL, add.vars = NULL, flag = TRUE )
tcplVarMat( dsstox_substance_id = NULL, aeid = NULL, add.vars = NULL, flag = TRUE )
dsstox_substance_id |
Integer, chemical ID values to subset on |
aeid |
Integer, assay endpoint ID values to subset on |
add.vars |
Character, mc4 or mc5 field(s) not included in the standard list to add additional matrices |
flag |
Integer or Logical of length 1, passed to
|
The tcplVarMat
function is used to create chemical by assay matrices
for different parameters. The standard list of matrices returned includes:
"ac50" – The active concentration at 50 the winning model.
"ac50_verbose" – The AC50 for the winning model, with text describing some situations.
"acc" – The active concentration at user-defined cutoff for the winning model.
"acc_verbose" – The ACC for the winning model, with text describing some situations.
"mc_hitc" – The hit-call for the winning model in multiple-concentration (mc) screening.
"sc_hitc" – The hit-call in single concentration (sc) screening.
tcplVarMat
produces matrices of combined sc-mc output. For the ac50
and acc matrices specifically, values are inserted in place to show complete
views of what was tested and what the results were. ac50 and acc values are:
set to 1e6 when the chemical is tested but negative in mc. In _verbose matrices, these are indicated as "MC neg".
set to 1e7 when the chemical is not tested in mc but was screened in sc with a positive hitcall for the same aeid. In _verbose matrices, these are indicated as "SC pos, No MC".
set to 1e8 when the chemical is not tested in mc but was screened in sc with a negative hitcall for the same aeid. In _verbose matrices, these are indicated as "SC neg, No MC"
not changed when chemical is tested in mc and positive, or not tested in either mc or sc
sc and mc data both are currently required to be included for these calculations. As a result, the "API" driver is not currently supported since it does not return sc data.
To add additional matrices, the 'add.vars' parameter can be used to specify the fields from the mc4 or mc5 tables to create matrices for.
When more than one sample is included for a chemical/assay pair,
tcplVarMat
aggregates multiple samples to a chemical level call
utilizing tcplSubsetChid
. The input
for the tcplVarMat
'flag' parameter is passed to the
tcplSubsetChid
call and used to parse down the data to create the
matrices.
A list of chemical by assay matrices (data.tables) where the rows are given by the dsstox_substance_id and corresponding chnm (chemical name) columns and the colnames are given by assay endpoint name (aenm).
## Not run: ## Demonstrate the returned values. varmat <- tcplVarMat() ## Other changes can be made aeids <- c(80) dtxsid <- c("DTXSID4034653", "DTXSID2032683", "DTXSID6032358", "DTXSID0032651", "DTXSID8034401") varmat <- tcplVarMat(aeid = aeids, dsstox_substance_id = dtxsid) varmat <- tcplVarMat(aeid = aeids, add.vars = c("m4id", "resp_max", "max_med")) ## To save output to file library(writexl) write_xlsx(varmat, path = "varmat_output.xlsx") ## End(Not run)
## Not run: ## Demonstrate the returned values. varmat <- tcplVarMat() ## Other changes can be made aeids <- c(80) dtxsid <- c("DTXSID4034653", "DTXSID2032683", "DTXSID6032358", "DTXSID0032651", "DTXSID8034401") varmat <- tcplVarMat(aeid = aeids, dsstox_substance_id = dtxsid) varmat <- tcplVarMat(aeid = aeids, add.vars = c("m4id", "resp_max", "max_med")) ## To save output to file library(writexl) write_xlsx(varmat, path = "varmat_output.xlsx") ## End(Not run)
tcplWriteData
takes a data.table with screening data and writes the
data into the given level table in the tcpl databases.
tcplWriteData(dat, lvl, type)
tcplWriteData(dat, lvl, type)
dat |
data.table, the screening data to load |
lvl |
Integer of length 1, the data processing level |
type |
Character of length 1, the data type, "sc" or "mc" |
This function appends data onto the existing table. It also deletes all the data for any acids or aeids dat contains from the given and all downstream tables.
The data type can be either 'mc' for mutliple concentration data, or 'sc' for single concentration data. Multiple concentration data will be loaded into the level tables, whereas the single concentration will be loaded into the single tables.
This function is not exported and is not intended to be used by the user.
The user should only write level 0 data, which is written with
tcplWriteLvl0
.
tcplCascade
, tcplAppend
,
tcplWriteLvl0
tcplWriteLvl0
takes a data.table with level 0 screening data and
writes the data into the level 0 tables in the tcpl databases.
tcplWriteLvl0(dat, type)
tcplWriteLvl0(dat, type)
dat |
data.table, the screening data to load |
type |
Character of length 1, the data type, "sc" or "mc" |
This function appends data onto the existing table. It also deletes all the data for any acids or aeids dat contains from the given and all downstream tables.
Before writing any data the function maps the assay component source name(s) (acsn) to assay component id (acid), ensures the proper class on each field and checks for every test compound sample id (spid where wllt == "t") in the tcpl chemical database. If field types get changed a warning is given listing the affected fields and they type they were coerced to. If the acsn(s) or spid(s) do not map to the tcpl databases the function will return an error and the data will not be written.
The data type can be either 'mc' for mutliple concentration data, or 'sc' for single concentration data. Multiple concentration data will be loaded into the level tables, whereas the single concentration will be loaded into the single tables.
This function should only be used to load level 0 data.
List containing ids used for different automated tests of tcpl integration with the CTX APIs, randomly selected from what is available via API.
test_api
test_api
A list with 7 items:
Randomly selected assay component endpoint id
Assay component id associated with the above aeid
Assay id associated with the above aeid
Assay source id associated with the above aeid
dsstox substance id of one sample from the above aeid
Sample id of one (the same) sample from the above aeid
Level 4 id of one (the same) sample from the above aeid
CTX Bioactivity API
Write level 4 with updated schema
write_lvl_4(dat)
write_lvl_4(dat)
dat |
output of tcplfit2 that has been unnested into a data.table |