diff --git a/.Rbuildignore b/.Rbuildignore index de8ac21e..8db777e5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,7 +6,7 @@ ^inst/sql/create_sql_files\.R$ man-roxygen tcpl.Rcheck -README.md +^README\.Rmd$ CONTRIBUTING.md cran-comments.md ^CRAN-RELEASE$ diff --git a/.github/workflows/test-on-PR.yaml b/.github/workflows/test-on-PR.yaml index e9549a97..6a991b0d 100644 --- a/.github/workflows/test-on-PR.yaml +++ b/.github/workflows/test-on-PR.yaml @@ -2,7 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: pull_request: - branches: [main] + branches: [main, dev] name: test-coverage diff --git a/DESCRIPTION b/DESCRIPTION index 1491030d..e75ce24e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,31 +1,29 @@ Package: tcpl Title: ToxCast Data Analysis Pipeline -Version: 3.1.0 +Version: 3.2.0 Authors@R: c( - person("Richard S", "Judson",role = c("ctb","ths"), email = "Judson.Richard@epa.gov"), - person("Dayne L", "Filer", role = "aut",email = "dayne.filer@gmail.com"), - person("Jason","Brown",role = "cre", email = "brown.jason@epa.gov"), - person("Sarah E","Davidson-Fritz",role = "ctb",email = "davidsonfritz.sarah@epa.gov", comment = c(ORCID = "0000-0002-2891-9380")), + person("Richard S", "Judson",role = c("ctb","ths"), comment = c(ORCID = "0000-0002-2348-9633")), + person("Dayne L", "Filer", role = "aut"), + person("Jason","Brown", role = "cre", email = "brown.jason@epa.gov", comment = c(ORCID = "0009-0000-2294-641X")), + person("Sarah E","Davidson-Fritz", role = "ctb",email = "davidsonfritz.sarah@epa.gov", comment = c(ORCID = "0000-0002-2891-9380")), person("Madison","Feshuk",role = "ctb",email = "feshuk.madison@epa.gov", comment = c(ORCID = "0000-0002-1390-6405")), - person("Lori","Kolaczkowski",role = "ctb",email = "kolaczkowski.lori@epa.gov"), - person("Kurt", "Dunham", role = "ctb", email = "dunham.kurt@epa.gov"), person("Carter", "Thunes", role = "ctb", email = "thunes.carter@epa.gov"), person("Ashley", "Ko", role = "ctb", email = "ko.ashley@epa.gov"), - person("Todd", "Zurlinden", role="ctb"), + person("Kelly", "Carstens", role = "ctb", email = "carstens.kelly@epa.gov", comment = c(ORCID = "0000-0002-1746-5379")), + person("Todd", "Zurlinden", role="ctb", comment = c(ORCID = "0000-0003-1372-3913")), + person("Lori","Kolaczkowski",role = "ctb"), + person("Kurt", "Dunham", role = "ctb"), person("Parth", "Kothiya", role = "ctb"), person("Woodrow R", "Setzer", role = "ctb"), person("Matthew T", "Martin", role = c("ctb", "ths")), person("Katie", "Paul Friedman", role=c("ctb"), email = "paul-friedman.katie@epa.gov", comment = c(ORCID = "0000-0002-2710-1691")) ) -Description: A set of tools for processing and modeling high-throughput and - high-content chemical screening data. The package was developed for the - the chemical screening data generated by the US EPA ToxCast program, but - can be used for diverse chemical screening efforts. -URL: https://github.com/USEPA/CompTox-ToxCast-tcpl +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. +URL: https://github.com/USEPA/CompTox-ToxCast-tcpl, https://www.epa.gov/comptox-tools/toxicity-forecasting-toxcast Depends: R (>= 3.5.0) Imports: - data.table (>= 1.9.4), + data.table (>= 1.15.0), DBI, RMariaDB, numDeriv, @@ -42,7 +40,9 @@ Imports: tcplfit2, ggplot2, gridExtra, - stringr + stringr, + rlang, + ctxR Suggests: roxygen2, knitr, @@ -55,10 +55,13 @@ Suggests: kableExtra, colorspace, magrittr, - vdiffr + vdiffr, + httptest, + rmdformats License: MIT + file LICENSE LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 VignetteBuilder: knitr Encoding: UTF-8 Config/testthat/edition: 3 +BugReports: https://github.com/USEPA/CompTox-ToxCast-tcpl/issues diff --git a/NAMESPACE b/NAMESPACE index 522d9aff..99c13b9a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,7 +8,6 @@ export(tcplAddModel) export(tcplCode2CASN) export(tcplConf) export(tcplConfDefault) -export(tcplConfExample) export(tcplConfList) export(tcplConfLoad) export(tcplConfReset) @@ -26,8 +25,10 @@ export(tcplLoadAeid) export(tcplLoadAid) export(tcplLoadAsid) export(tcplLoadChem) -export(tcplLoadClib) +export(tcplLoadChemList) +export(tcplLoadConcUnit) export(tcplLoadData) +export(tcplLoadUnit) export(tcplLvlCount) export(tcplMakeAeidMultiPlts) export(tcplMakeAeidPlts) @@ -43,10 +44,12 @@ export(tcplObjHill) export(tcplPlot) export(tcplPlotFitc) export(tcplPlotFits) +export(tcplPlotLoadData) export(tcplPlotM4ID) export(tcplPlotPlate) export(tcplPrepOtpt) export(tcplQuery) +export(tcplQueryAPI) export(tcplRegister) export(tcplRun) export(tcplSendQuery) @@ -61,8 +64,12 @@ import(gridExtra) import(stringr) importFrom(RColorBrewer,brewer.pal) importFrom(RMariaDB,MariaDB) +importFrom(ctxR,get_all_assays) +importFrom(ctxR,get_bioactivity_details_batch) +importFrom(ctxR,register_ctx_api_key) importFrom(dplyr,"%>%") importFrom(dplyr,.data) +importFrom(dplyr,across) importFrom(dplyr,all_of) importFrom(dplyr,arrange) importFrom(dplyr,as_tibble) @@ -71,9 +78,11 @@ importFrom(dplyr,contains) importFrom(dplyr,ends_with) importFrom(dplyr,everything) importFrom(dplyr,filter) +importFrom(dplyr,full_join) importFrom(dplyr,group_by) importFrom(dplyr,inner_join) importFrom(dplyr,left_join) +importFrom(dplyr,matches) importFrom(dplyr,mutate) importFrom(dplyr,mutate_if) importFrom(dplyr,pull) @@ -96,9 +105,11 @@ importFrom(ggplot2,ggsave) importFrom(ggplot2,guide_legend) importFrom(ggplot2,labs) importFrom(ggplot2,margin) +importFrom(ggplot2,scale_color_manual) importFrom(ggplot2,scale_color_viridis_d) importFrom(ggplot2,scale_linetype_manual) importFrom(ggplot2,scale_x_continuous) +importFrom(ggplot2,scale_y_continuous) importFrom(ggplot2,theme) importFrom(ggplot2,unit) importFrom(ggplot2,xlab) @@ -107,6 +118,7 @@ importFrom(grDevices,col2rgb) importFrom(grDevices,colorRampPalette) importFrom(grDevices,graphics.off) importFrom(grDevices,pdf) +importFrom(grDevices,pdf.options) importFrom(grDevices,rgb) importFrom(graphics,abline) importFrom(graphics,arrows) @@ -133,6 +145,8 @@ importFrom(parallel,mclapply) importFrom(plotly,add_annotations) importFrom(plotly,add_trace) importFrom(plotly,plot_ly) +importFrom(rlang,exec) +importFrom(rlang,sym) importFrom(sqldf,sqldf) importFrom(stats,constrOptim) importFrom(stats,dist) @@ -142,15 +156,16 @@ importFrom(stats,mad) importFrom(stats,median) importFrom(stats,optim) importFrom(stats,quantile) -importFrom(stats,reformulate) importFrom(stats,setNames) importFrom(tcplfit2,tcplfit2_core) importFrom(tcplfit2,tcplhit2_core) importFrom(tidyr,pivot_longer) importFrom(tidyr,pivot_wider) +importFrom(tidyr,separate_wider_delim) +importFrom(tidyr,unnest) +importFrom(tidyr,unnest_longer) importFrom(utils,data) importFrom(utils,read.csv) importFrom(utils,read.table) importFrom(utils,tail) -importFrom(utils,write.csv) importFrom(utils,write.table) diff --git a/NEWS b/NEWS.md similarity index 81% rename from NEWS rename to NEWS.md index 2a9ba09a..b8b93b56 100644 --- a/NEWS +++ b/NEWS.md @@ -1,36 +1,50 @@ -tcpl v3.1.0 -============== -*updated vignettes for tcplfit2 fitting -*bidirectional fitting by default -*this is the version used to create invitrodb v4.1 - -tcpl v3.0.1 -============== -*fixes error from ggplot2 -*minor bug fixes - -tcpl v3.0.0 -============== -*add functionality for additional model fitting with tcplfit2 -*updated vignettes for new fitting -*created updated plotting function - -tcpl v2.1.0 -============== -*updated for release with toxcast invitrodb data -*added option to allow change in single conc bmad calculation - -tcpl v2.0.3 -============== -*Created tcplPlot a generic plotting function with call similar to tcplLoadData -*added option for concentration units to be different during plotting. -*fixed tcpllite bug for schema change -*filtered gnls from tcplCytopt -*updated to Rmariadb -*various bugfixes - -tcpl v2.0.2 -============== +# tcpl 3.2.0 + +* Added a `NEWS.md` file to track changes to the package. +* updated vignettes +* Updated plotting including standalone and comparisons +* Added bidirectional summary stats and updated functions to work with newest version of invitrodb +* Added level 6 flags +* Implemented API functionality +* Removed tcplLite + +# tcpl 3.1.0 + +* updated vignettes for tcplfit2 fitting +* bidirectional fitting by default +* this is the version used to create invitrodb v4.1 + +# tcpl 3.0.1 + +* fixes error from ggplot2 + +* minor bug fixes + +# tcpl 3.0.0 + +* add functionality for additional model fitting with tcplfit2 + +* updated vignettes for new fitting + +* created updated plotting function + +# tcpl 2.1.0 + +* updated for release with toxcast invitrodb data + +* added option to allow change in single conc bmad calculation + +# tcpl 2.0.3 + +* Created tcplPlot a generic plotting function with call similar to tcplLoadData +* added option for concentration units to be different during plotting. +* fixed tcpllite bug for schema change +* filtered gnls from tcplCytopt +* updated to Rmariadb +* various bugfixes + +# tcpl 2.0.2 + * Updated tcplLoadChem to return dsstox substance ids * Moved data.table to imports instead of depends * Added new level 6 method for flagging viability gnls winners @@ -39,21 +53,24 @@ tcpl v2.0.2 * Added ability to determine lowest effective concentration (loec) as level 5 method * Added new AEID plot functionality to visualize 2 aeids on same plot through tcplMakeAeidPlts -tcpl v2.0.1 -============== -Updated vignettes to use tempdir and thus not write to install folder. +# tcpl 2.0.1 +* Updated vignettes to use tempdir and thus not write to install folder. + + +# tcpl 2.0 -tcpl v2.0 -============== Major change for tcpl v2.0: + * Incorporation of tcplLite into the package, a functionality that allows the user to work from local files formatted like invitrodb tables, rather than a MySQL database. - * Using tcplLite is ideal for handling smaller datasets. - * The SQLite driver was removed from the package. - * tcplConf() default is now for tcplLite, which uses .csv files rather than tables in a MySQL database. - * The MySQL driver is available and recommended for interacting with the entire dataset as a database. - * The package vignettes run using tcplLite. + +* Using tcplLite is ideal for handling smaller datasets. + +* The SQLite driver was removed from the package. +* tcplConf() default is now for tcplLite, which uses .csv files rather than tables in a MySQL database. +* The MySQL driver is available and recommended for interacting with the entire dataset as a database. +* The package vignettes run using tcplLite. Additional updates for tcpl v2.0 * tcplLvlCount: function added to count the samples at each level of processing for each aeid. * Addition of mc4 methods: the baseline median absolute deviation can now be calculated based on the lowest two concentrations or on the neutral control wells. An mc4 method must now be assigned for analysis. @@ -63,8 +80,8 @@ Additional updates for tcpl v2.0 * Vignettes are now posted as html from RMarkdown files for Introduction and appendices, data retrieval, and data processing. * Various bug fixes and additions to the methods tables. -tcpl v1.4.0 -============== +# tcpl 1.4.0 + Changes from v1.2.2 @@ -93,8 +110,8 @@ Changes from v1.2.2 -tcpl v1.2.3 -============== +# tcpl 1.2.3 + Changes from v1.2.2 @@ -120,8 +137,8 @@ Changes from v1.2.2 imports were removed to simplify the package, as they were found unnecessary. (PR#29) -tcpl v1.2.2 -============== +# tcpl 1.2.2 + Changes from v1.2 @@ -130,8 +147,8 @@ Changes from v1.2 running the checks for the package. -tcpl v1.2 -============== +# tcpl 1.2 + Changes from beta versions: diff --git a/R/assay_funcs.R b/R/assay_funcs.R index de69daae..f5c1020f 100644 --- a/R/assay_funcs.R +++ b/R/assay_funcs.R @@ -19,12 +19,7 @@ #' return the assay source ID (asid) and assay source name (asnm). #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' TCPLlite <- file.path(system.file(package = "tcpl"), "example") -#' tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") -#' +#' \dontrun{ #' ## The load assay functions can be used without any parameters to list the #' ## full list of registered assay elements: #' tcplLoadAsid() @@ -43,9 +38,7 @@ #' a1 <- tcplLoadAeid(fld = "anm", val = "Steroidogenesis") #' a2 <- tcplLoadAeid(fld = "assay_name", val = "Steroidogenesis") #' identical(a1, a2) -#' -#' ## Reset configuration -#' options(conf_store) +#' } #' #' @return A data.table containing the ID, name, and any additional fields. NULL \ No newline at end of file diff --git a/R/blineShift.R b/R/blineShift.R index 766bf2a3..4ffa88bf 100644 --- a/R/blineShift.R +++ b/R/blineShift.R @@ -10,7 +10,7 @@ #' to 0 based on the window. #' #' @param resp Numeric, the response values -#' @param logc Numeric, the log10 concentration values +#' @param conc Numeric, the concentration values #' @param wndw Numeric, the threshold window #' #' @note @@ -22,22 +22,22 @@ #' #' @importFrom stats median lm -blineShift <- function(resp, logc, wndw) { +blineShift <- function(resp, conc, wndw) { if (any(is.na(resp))) return(resp) - if (length(unique(logc)) < 4) return(resp) + if (length(unique(conc)) < 4) return(resp) wndw <- unique(wndw)[1] - ordr <- order(logc) + ordr <- order(conc) resp <- resp[ordr] - logc <- logc[ordr] + conc <- conc[ordr] - uconc <- unique(logc) + uconc <- unique(conc) nconc <- length(uconc) low <- 1:max(ceiling(nconc/4), 2) - rsub <- resp[which(logc %in% uconc[low])] - csub <- logc[which(logc %in% uconc[low])] + rsub <- resp[which(conc %in% uconc[low])] + csub <- log10(conc[which(conc %in% uconc[low])]) low_med <- median(rsub) m <- lm(rsub ~ csub)$coefficients["csub"] if (is.na(m)) m <- 0 diff --git a/R/chemQueries.R b/R/chemQueries.R index c941f023..b31d6245 100755 --- a/R/chemQueries.R +++ b/R/chemQueries.R @@ -61,18 +61,19 @@ #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- -# .ClibQ: Create tcplLoadClib query string +# .ChemListQ: Create tcplLoadChemList query string #------------------------------------------------------------------------------- -.ClibQ <- function(field, val) { +.ChemListQ <- function(field, val) { - qformat <- "SELECT chid, clib FROM chemical_library" + qformat <- "SELECT * FROM chemical_lists" if (!is.null(field)) { nfld <- switch(field, chid = "chid", - clib = "clib") + dsstox_substance_id = "dsstox_substance_id", + list_acronym = "list_acronym") qformat <- paste(qformat, "WHERE %s IN (%s);") qstring <- sprintf(qformat, nfld, paste0("\"", val, "\"", collapse = ",")) @@ -88,6 +89,6 @@ } #------------------------------------------------------------------------------- -# END .ClibQ +# END .ChemListQ #------------------------------------------------------------------------------- diff --git a/R/config_funcs.R b/R/config_funcs.R index 2d33bd72..8bb755d4 100644 --- a/R/config_funcs.R +++ b/R/config_funcs.R @@ -14,8 +14,8 @@ #' @param ... Additional arguments that should be passed to dbConnect function #' #' @details -#' Currently, the tcpl package only supports the "MySQL" and "tcplLite" database -#' drivers. +#' 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 @@ -48,8 +48,7 @@ #' configuration file. #' #' \code{tcplConfDefault} changes the \code{options} to reflect the default -#' settings for the example tcplLite database, i.e. local directory, but does -#' not alter the configuration file. +#' settings for the API connection, but does not alter the configuration file. #' #' \code{tcplConfReset} is used to generate the initial configuration script, #' and can be used to reset or regenerate the configuration script by the user. diff --git a/R/data.R b/R/data.R index f602d436..b3d08154 100644 --- a/R/data.R +++ b/R/data.R @@ -1,7 +1,7 @@ #' A subset of ToxCast data showing changes in transcription factor activity for multiple targets. #' #' The example dataset is used to illustrate how the user can pipeline single-concentration -#' data from chemical screening using tcplLite. +#' data from chemical screening using tcpl. #' #' @format A data frame with 320 rows and 10 variables: #' \describe{ @@ -22,7 +22,7 @@ #' A subset of ToxCast data showing changes in the activity of the intracellular estrogen receptor. #' #' The example dataset is used to illustrate how the user can pipeline multiple-concentration -#' data from chemical screening using tcplLite. +#' data from chemical screening using tcpl. #' #' @format A data frame with 14183 rows and 10 variables: #' \describe{ @@ -39,21 +39,6 @@ #' } #' @source ToxCast database "mcdat" -#' Chemical library of tested chemicals in the example datasets with the corresponding sample IDs. -#' -#' -#' @format A data frame with 6 rows and 6 variables: -#' \describe{ -#' \item{spid}{sample ID} -#' \item{casn}{Chemical Abstract Service(CAS) number} -#' \item{chnm}{chemical name} -#' \item{dsstox_substance_id}{chemical-specific DTXSID} -#' \item{code}{CAS number compressed into numeric string} -#' \item{chid}{unique chemical ID number for tcpl} -#' -#' } -#' @source ToxCast database -"chdat" #' List with multi-concentration data for the vignette @@ -470,3 +455,292 @@ #' } #' @source ToxCast database "invitrodb_dd" + + +#' Lists of column names returned from tcplLoadData invitrodb v4.1 (same as CCTE +#' Bioactivity API version). +#' @format A list with 12 items: +#' \describe{ +#' \item{mc0}{Column names returned requesting mc lvl 0 data} +#' \item{mc1}{Column names returned requesting mc lvl 1 data} +#' \item{mc2}{Column names returned requesting mc lvl 2 data} +#' \item{mc3}{Column names returned requesting mc lvl 3 data} +#' \item{mc4}{Column names returned requesting mc lvl 4 data} +#' \item{mc5}{Column names returned requesting mc lvl 5 data} +#' \item{mc6}{Column names returned requesting mc lvl 6 data} +#' \item{mcagg}{Column names returned requesting mc lvl "agg" data} +#' \item{sc0}{Column names returned requesting sc lvl 0 data} +#' \item{sc1}{Column names returned requesting sc lvl 1 data} +#' \item{sc2}{Column names returned requesting sc lvl 2 data} +#' \item{scagg}{Column names returned requesting sc lvl "agg" data} +#' } +#' @source ToxCast database +"load_data_columns" + + +#' 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. +#' @format A list with 30 items: +#' \describe{ +#' \item{tcplConfQuery}{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.} +#' \item{mc0_by_m0id}{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.} +#' \item{mc0_by_acid}{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.} +#' \item{mc1_by_m1id}{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.} +#' \item{mc1_by_acid}{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.} +#' \item{mc2_by_m2id}{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.} +#' \item{mc2_by_acid}{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.} +#' \item{mc3_by_m3id}{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.} +#' \item{mc3_by_aeid}{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.} +#' \item{mc4_by_m4id}{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.} +#' \item{mc4_by_aeid}{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.} +#' \item{mc5_by_m5id}{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.} +#' \item{mc5_by_aeid}{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.} +#' \item{mc6_by_m6id}{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.} +#' \item{mc6_by_aeid}{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.} +#' \item{mc7_by_m7id}{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.} +#' \item{mc7_by_aeid}{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.} +#' \item{mcagg_by_aeid}{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.} +#' \item{plot_single_m4id}{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.} +#' \item{plot_multiple_m4id}{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.} +#' \item{plot_single_aeid}{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.} +#' \item{plot_multiple_aeid}{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.} +#' \item{plot_single_spid}{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.} +#' \item{plot_multiple_spid}{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.} +#' \item{plot_single_m4id_compare}{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.} +#' \item{plot_multiple_m4id_compare}{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.} +#' \item{plot_single_aeid_compare}{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.} +#' \item{plot_multiple_aeid_compare}{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.} +#' \item{plot_single_spid_compare}{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.} +#' \item{plot_multiple_spid_compare}{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.} +#' } +#' @source ToxCast database +"mc_test" + + +#' 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. +#' @format A list with 20 items: +#' \describe{ +#' \item{tcplConfQuery}{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.} +#' \item{sc0_by_s0id}{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.} +#' \item{sc0_by_acid}{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.} +#' \item{sc1_by_s1id}{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.} +#' \item{sc1_by_acid}{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.} +#' \item{sc2_by_s2id}{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.} +#' \item{sc2_by_aeid}{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.} +#' \item{scagg_by_aeid}{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.} +#' \item{plot_single_s2id}{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.} +#' \item{plot_multiple_s2id}{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.} +#' \item{plot_single_aeid}{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.} +#' \item{plot_multiple_aeid}{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.} +#' \item{plot_single_spid}{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.} +#' \item{plot_multiple_spid}{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.} +#' \item{plot_single_s2id_compare}{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.} +#' \item{plot_multiple_s2id_compare}{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.} +#' \item{plot_single_aeid_compare}{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.} +#' \item{plot_multiple_aeid_compare}{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.} +#' \item{plot_single_spid_compare}{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.} +#' \item{plot_multiple_spid_compare}{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.} +#' } +#' @source ToxCast database +"sc_test" + + +#' List containing ids used for different automated tests of tcpl integration +#' with the CTX APIs, randomly selected from what is available via API. +#' @format A list with 7 items: +#' \describe{ +#' \item{aeid}{Randomly selected assay component endpoint id} +#' \item{acid}{Assay component id associated with the above aeid} +#' \item{aid}{Assay id associated with the above aeid} +#' \item{asid}{Assay source id associated with the above aeid} +#' \item{dtxsid}{dsstox substance id of one sample from the above aeid} +#' \item{spid}{Sample id of one (the same) sample from the above aeid} +#' \item{m4id}{Level 4 id of one (the same) sample from the above aeid} +#' } +#' @source CTX Bioactivity API +"test_api" + +#' Lists of data frames returned from tcplMthdList invitrodb v4.2 +#' @format A list with 7 items: +#' \describe{ +#' \item{mc2}{displays the available methods for mc lvl 2 data} +#' \item{mc3}{displays the available methods for mc lvl 3 data} +#' \item{mc4}{displays the available methods for mc lvl 4 data} +#' \item{mc5}{displays the available methods for mc lvl 5 data} +#' \item{mc6}{displays the available methods for mc lvl 6 data} +#' \item{sc1}{displays the available methods for sc lvl 1 data} +#' \item{sc2}{displays the available methods for sc lvl 2 data} +#' } +#' @source ToxCast database +"mthd_list_defaults" \ No newline at end of file diff --git a/R/load6DR.R b/R/load6DR.R index 17c6e1f6..bde1f260 100644 --- a/R/load6DR.R +++ b/R/load6DR.R @@ -18,7 +18,7 @@ mc4_agg.m4id, mc4_agg.m3id, spid, - logc, + mc3.conc, rval, resp, apid, diff --git a/R/mc2_mthds.R b/R/mc2_mthds.R index 46576818..a1227778 100644 --- a/R/mc2_mthds.R +++ b/R/mc2_mthds.R @@ -36,7 +36,7 @@ #' \item{rmneg}{Exclude wells with negative corrected response values (cval) and downgrading #' their well quality (wllq); if \eqn{cval<0, wllq=0}{cval<0, wllq=0}.} #' \item{rmzero}{Exclude wells with corrected response values (cval) equal to zero and -#' downgrading their well quality (wllq); if \eqn{cval=0, wllq=0}{cval=0, wllq=0}.} +#' downgrading their well quality (wllq); if \eqn{cval=0, wllq=0}{cval=0, wllq=0}.} #' \item{mult25}{Multiply corrected response value (cval) by 25; \eqn{25*cval}{25*cval}.} #' \item{mult100}{Multiply corrected response value (cval) by 100; \eqn{100*cval}{100*cval}.} #' \item{negshift}{Shift corrected response values (cval) by subtracting the minimum cval and @@ -45,15 +45,12 @@ #' \item{mult3}{Multiply corrected response value (cval) by 3; \eqn{3*cval}{3*cval}.} #' \item{mult6}{Multiply corrected response value (cval) by 6; \eqn{6*cval}{6*cval}.} #' \item{sub100}{Center data around zero by subtracting the corrected response value (cval) from -#' 100; \eqn{100-cval}{100-cval}. Typically used if data was pre-normalized around 100 with -#' responses decreasing to 0.} +#' 100; \eqn{100-cval}{100-cval}. Typically used if data was pre-normalized around 100 with responses +#' decreasing to 0.} #' \item{zscore.npwlls}{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); -#' \eqn{cval=|(cval-mean(cval~for~wllt~=~n~and~p)/sd(cval~for~wllt~=~n~and~p)|}{cval= -#' |(cval-mean(cval for wllt = n and p)/sd(cval for wllt = n and p)|}.} +#' on the neutral and positive control wells (wllts = n and p), by assay plate ID (apid)} #' \item{sub1}{Center data around zero by subtracting the corrected response value (cval) from 1; -#' \eqn{1-cval}{1-cval}. Typically used if data was pre-normalized around 1 with responses -#' decreasing to 0.} +#' \eqn{1-cval}{1-cval}. Typically used if data was pre-normalized around 1 with responses decreasing to 0.} #' } #' } #' @@ -61,21 +58,9 @@ #' \describe{ #' \item{agg.mean.rep.apid}{Aggregate technical test replicates (wllt=t) by taking the plate-wise mean per sample id (spid), assay plate (apid), and concentration index (cndx).} #' \item{agg.median.rep.apid}{Aggregate technical test replicates (wllt=t) by taking the plate-wise median per sample id (spid), assay plate (apid), and concentration index (cndx).} -#' \item{agg.percent.rep.spid}{Use for binary data. Aggregate technical replicates as percentage by taking the sum of hits relative to total replicates per sample id (spid) and concentration index (cndx); cval = (sum(rval)/.N)*100.} -#' \item{agg.percent.rep.spid.min1}{Use for binary data. Aggregate technical replicates as percentage by taking the sum of hits relative to total replicates per per sample id (spid) and concentration index (cndx), where there is more than one replicate; cval = (sum(rval)/.N)*100, where .N>1.} -#' \item{agg.mean.rep.apid}{Aggregate technical replicates by taking the plate-wise mean per -#' sample id (spid), assay plate (apid), and concentration index (cndx).} -#' \item{agg.median.rep.apid}{Aggregate technical replicates by taking the plate-wise median per -#' sample id (spid), assay plate (apid), and concentration index (cndx).} -#' \item{agg.percent.rep.spid}{Use for binary data. Aggregate technical replicates as percentage -#' by taking the sum of hits relative to total replicates per sample id (spid) and concentration -#' index (cndx); \eqn{cval = (sum(rval)/.N)*100}{cval = (sum(rval)/.N)*100}.} -#' \item{agg.percent.rep.spid.min1}{Use for binary data. Aggregate technical replicates as -#' percentage by taking the sum of hits relative to total replicates per per sample id (spid) and -#' concentration index (cndx), where there is more than one replicate; -#' \eqn{cval=(sum(rval)/.N)*100,~where~.N>1}{cval = (sum(rval)/.N)*100, where .N>1}.} +#' \item{agg.percent.rep.spid}{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); \eqn{cval = (sum(rval)/.N)*100}{cval = (sum(rval)/.N)*100}.} +#' \item{agg.percent.rep.spid.min1}{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; \eqn{cval=(sum(rval)/.N)*100,~where~.N>1}{cval = (sum(rval)/.N)*100, where .N>1}.} Rvals are collapsed to one value per cndx.} #' } -#' } #' #' @note #' This function is not exported and is not intended to be used by the user. @@ -202,11 +187,13 @@ mc2_mthds <- function() { agg.percent.rep.spid.min1 = function() { - e1 <- bquote(dat[.N>1, cval := sum(cval)/.N * 100, - by = list(acid, spid, cndx)]) + e1 <- bquote( dat[.N>1,cval := sum(cval)/.N * 100, + by = list(acid, spid, cndx)][,repi:=rowid(conc), + by= list(acid, spid, wllt, srcf, apid)][repi>1, wllq := 0, + by = list(acid, spid, cndx)]) + list(e1) } - ) } diff --git a/R/mc3.R b/R/mc3.R index e6dac253..6e7e9d5f 100644 --- a/R/mc3.R +++ b/R/mc3.R @@ -21,7 +21,7 @@ mc3 <- function(ac, wr = FALSE) { ## Variable-binding to pass R CMD Check - conc <- logc <- acid <- aeid <- mthd <- ordr <- nassays <- resp <- NULL + conc <- acid <- aeid <- mthd <- ordr <- nassays <- resp <- NULL pval <- bval <- NULL owarn <- getOption("warn") @@ -58,9 +58,6 @@ mc3 <- function(ac, wr = FALSE) { ## Force all concentrations to 1 significant figure dat[ , conc := signif(conc, 1)] - ## Add column for log10 concentration - dat[ , logc := log10(conc)] - ## Load aeid mapping information. aeid_info <- tcplLoadAeid("acid", ac)[ , list(acid, aeid)] setkey(aeid_info, acid) @@ -140,7 +137,7 @@ mc3 <- function(ac, wr = FALSE) { res <- TRUE outcols <- c("m0id", "m1id", "m2id", "acid", "aeid", - "bval", "pval", "logc", "resp") + "bval", "pval", "conc", "resp") dat <- dat[ , .SD, .SDcols = outcols] ## Load into mc3 table -- else return results diff --git a/R/mc3_mthds.R b/R/mc3_mthds.R index ca7d8e47..983776b0 100644 --- a/R/mc3_mthds.R +++ b/R/mc3_mthds.R @@ -532,11 +532,11 @@ mc3_mthds <- function() { resp.blineshift.3bmad.repi = function(aeids) { e1 <- bquote(dat[J(.(aeids)), - wndw := mad(resp[cndx %in% 1:2 & wllt == "t"], + wndw := mad(resp[cndx %in% 1:2], na.rm = TRUE) * 3, by = aeid]) - e2 <- bquote(dat[aeid %in% .(aeids) & wllt %in% c("t", "c", "o"), - resp := blineShift(resp, logc, wndw), + e2 <- bquote(dat[aeid %in% .(aeids), + resp := blineShift(resp, conc, wndw), by = list(aeid, spid, repi)]) e3 <- bquote(dat[ , wndw := NULL]) list(e1, e2, e3) @@ -545,8 +545,8 @@ mc3_mthds <- function() { resp.blineshift.50.repi = function(aeids) { - e1 <- bquote(dat[aeid %in% .(aeids) & wllt %in% c("t", "c", "o"), - resp := blineShift(resp, logc, wndw = 50), + e1 <- bquote(dat[aeid %in% .(aeids), + resp := blineShift(resp, conc, wndw = 50), by = list(aeid, spid, repi)]) list(e1) @@ -555,11 +555,11 @@ mc3_mthds <- function() { resp.blineshift.3bmad.spid = function(aeids) { e1 <- bquote(dat[J(.(aeids)), - wndw := mad(resp[cndx %in% 1:2 & wllt == "t"], + wndw := mad(resp[cndx %in% 1:2], na.rm = TRUE) * 3, by = aeid]) - e2 <- bquote(dat[aeid %in% .(aeids) & wllt %in% c("t", "c", "o"), - resp := blineShift(resp, logc, wndw), + e2 <- bquote(dat[aeid %in% .(aeids), + resp := blineShift(resp, conc, wndw), by = list(aeid, spid)]) e3 <- bquote(dat[ , wndw := NULL]) list(e1, e2, e3) @@ -568,8 +568,8 @@ mc3_mthds <- function() { resp.blineshift.50.spid = function(aeids) { - e1 <- bquote(dat[aeid %in% .(aeids) & wllt %in% c("t", "c", "o"), - resp := blineShift(resp, logc, wndw = 50), + e1 <- bquote(dat[aeid %in% .(aeids), + resp := blineShift(resp, conc, wndw = 50), by = list(aeid, spid)]) list(e1) diff --git a/R/mc4.R b/R/mc4.R index ae5af06e..55080464 100644 --- a/R/mc4.R +++ b/R/mc4.R @@ -25,7 +25,7 @@ mc4 <- function(ae, wr = FALSE) { ## Variable-binding to pass R CMD Check - bmad <- resp <- cndx <- wllt <- logc <- spid <- cnst_aic <- hill_aic <- NULL + bmad <- resp <- cndx <- wllt <- logc <- conc <- spid <- cnst_aic <- hill_aic <- NULL gnls_aic <- NULL owarn <- getOption("warn") @@ -50,7 +50,12 @@ mc4 <- function(ae, wr = FALSE) { ## Load level 3 data dat <- tcplLoadData(lvl = 3L, type = "mc", fld = "aeid", val = ae) - dat <- dat[wllt %in% c("t", "c", "o", "n","z")] + + ## filter out na concentration data + if (nrow(dat[is.na(conc)]>0)){ + warning("SPID(s): ",unique(dat[is.na(conc)]$spid)," removed from further processing due to null concentration data") + } + dat <- dat[!is.na(conc)] ## Check if any level 3 data was loaded if (nrow(dat) == 0) { @@ -99,19 +104,15 @@ mc4 <- function(ae, wr = FALSE) { if (check_tcpl_db_schema()) { # if we're using v3 schema we want to tcplfit2 - # check to see if we specified fit models or bidirectional for tcplfit2 + # check to see if we specified fit models for tcplfit2 fitmodels <- c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5") - bidirectional <- TRUE if ("fitmodels" %in% names(dat)) { #extract the fitmodels from dat and pass to fitting fitmodels <- unique(dat$fitmodels)[[1]] } - if("bidirectional" %in% names(dat)){ - bidirectional <- unique(dat$bidirectional)[[1]] - } - dat <- tcplFit2(dat, fitmodels = fitmodels,bidirectional = bidirectional ) + dat <- tcplFit2(dat, fitmodels = fitmodels) diff --git a/R/mc4_mthds.R b/R/mc4_mthds.R index a680e43a..9d4e81e4 100644 --- a/R/mc4_mthds.R +++ b/R/mc4_mthds.R @@ -35,16 +35,14 @@ #' #' \describe{ #' \item{bmad.aeid.lowconc.twells}{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.} +#' 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.} #' \item{bmad.aeid.lowconc.nwells}{Calculate the baseline median absolute value (bmad) as the -#' median absolute deviation of normalized response values (resp) for neutral control wells -#' (wllt = n).} -#' \item{onesd.aeid.lowconc.twells}{Calculate one standard deviation of the normalized response -#' for test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2; -#' \eqn{onesd=\sqrt{\sum{(resp-mean(resp))^{2}}/(n-1)}}{onesd = sqrt(sum((resp - mean -#' resp)^2)/sample size - 1)}. Used to establish BMR and therefore required for tcplfit2 -#' processing.} +#' 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.} #' \item{bidirectional.false}{Limits bidirectional fitting and processes data in positive #' analysis direction only. Use for gain-of-signal or inverted data.} #' \item{bmad5.onesd16.static}{Replace baseline median absolute deviation @@ -52,6 +50,7 @@ #' 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.} +#' \item{no.unbounded.models}{Exclude unbounded models and only fit data to bounded models (hill, gnls, exp4 and exp5).} #' } #' #' @note @@ -64,21 +63,16 @@ mc4_mthds <- function() { bmad.aeid.lowconc.twells = function() { e1 <- bquote(dat[ , bmad := mad(resp[cndx %in% 1:2 & wllt == "t"], na.rm = TRUE)]) - list(e1) + e2 <- bquote(dat[ , osd := sd(resp[cndx %in% 1:2 & wllt == "t"], na.rm = TRUE)]) + list(e1, e2) }, bmad.aeid.lowconc.nwells = function() { e1 <- bquote(dat[ , bmad := mad(resp[wllt == "n"], na.rm = TRUE)]) - list(e1) - - }, - - onesd.aeid.lowconc.twells = function() { - - e1 <- bquote(dat[ , osd := sd(resp[cndx %in% 1:2 & wllt == "t"], na.rm = TRUE)]) - list(e1) + e2 <- bquote(dat[ , osd := sd(resp[wllt == "n"], na.rm = TRUE)]) + list(e1, e2) }, @@ -95,6 +89,12 @@ mc4_mthds <- function() { e2 <- bquote(dat[ , osd := 16]) list(e1, e2) + }, + no.unbounded.models = function() { + + e1 <- bquote(dat[ ,fitmodels := list(c("cnst", "hill","gnls" ,"exp4", "exp5"))]) + list(e1) + } ) diff --git a/R/mc5.R b/R/mc5.R index ec8da5a8..2d3b6273 100644 --- a/R/mc5.R +++ b/R/mc5.R @@ -35,6 +35,8 @@ mc5 <- function(ae, wr = FALSE) { gnls_la <- modl_lw <- gnls_lw <- gnls_rmse <- gnls_prob <- actp <- NULL modl_ac10 <- model_type <- NULL + overwrite_osd <- FALSE + owarn <- getOption("warn") options(warn = 1) on.exit(options(warn = owarn)) @@ -82,6 +84,18 @@ mc5 <- function(ae, wr = FALSE) { ms <- ms[!mthd=='loec.coff'] } + #special case where osd needs to be overwritten + if ('osd_coff_bmr' %in% ms$mthd) { + overwrite_osd <- TRUE + ms_osd_coff_bmr = ms[mthd=='osd_coff_bmr'] + ms <- ms[!mthd=='osd_coff_bmr'] + } + + ## Extract methods that need to overwrite hitc and hit_val + ms_overwrite <- ms[grepl("ow_",mthd),] + ## Extract methods that don't overwrite + ms <- ms[!grepl("ow_",mthd),] + if (nrow(ms) == 0) { warning("No level 5 methods for AEID", ae, " -- cutoff will be 0.") @@ -95,16 +109,19 @@ mc5 <- function(ae, wr = FALSE) { ## Determine final cutoff dat[ , coff := max(coff)] + ## Check to see if we are using the v3 schema # currently can only use one coff if (check_tcpl_db_schema()) { cutoff <- max(dat$coff) - #can remove this once loading of data is working correctly - dat <- tcplQuery(paste0("SELECT - `mc4`.`m4id`, `mc4`.`aeid`, `mc4`.`spid`, `mc4`.`bmad`, `mc4`.`resp_max`, `mc4`.`resp_min`, `mc4`.`max_mean`, `mc4`.`max_mean_conc`, - `mc4`.`max_med`, `mc4`.`max_med_conc`, `mc4`.`logc_max`, `mc4`.`logc_min`, `mc4`.`nconc`, `mc4`.`npts`, `mc4`.`nrep`, `mc4`.`nmed_gtbl`, - `mc4`.`tmpi`, `mc4_param`.`model`, `mc4_param`.`model_param`, `mc4_param`.`model_val` - FROM mc4 inner join mc4_param on mc4.m4id = mc4_param.m4id where mc4.aeid = ",ae,";")) + + # before hitcalling overwrite osd value + if(overwrite_osd){ + exprs <- lapply(mthd_funcs[ms_osd_coff_bmr$mthd], do.call, args = list()) + fenv <- environment() + invisible(rapply(exprs, eval, envir = fenv)) + } + # if we're using v3 schema we want to tcplfit2 dat <- tcplHit2(dat, coff = cutoff) } else { @@ -346,6 +363,15 @@ mc5 <- function(ae, wr = FALSE) { dat <- dat[ , .SD, .SDcols = outcols] } + + # apply overwrite methods + if (nrow(ms_overwrite) > 0) { + exprs <- lapply(mthd_funcs[ms_overwrite$mthd], do.call, args = list()) + fenv <- environment() + invisible(rapply(exprs, eval, envir = fenv)) + } + + ttime <- round(difftime(Sys.time(), stime, units = "sec"), 2) ttime <- paste(unclass(ttime), units(ttime)) cat("Processed L5 AEID", ae, " (", nrow(dat), diff --git a/R/mc5_mthds.R b/R/mc5_mthds.R index b0ac15c1..ff27271e 100644 --- a/R/mc5_mthds.R +++ b/R/mc5_mthds.R @@ -8,36 +8,36 @@ #' @description #' \code{mc5_mthds} returns a list of additional activity cutoff methods to be used during level 5 #' multiple-concentration processing. -#' +#' #' @param ae Integer of length 1, the assay endpoint id #' #' @return A list of functions #' #' @seealso \code{\link{mc5}}, \code{\link{Method functions}} to query what methods get applied to #' each aeid. -#' +#' #' @details #' The functions contained in the list returned by \code{mc5_mthds} take \code{aeids} #' (a numeric vector of aeid values) and returns a list of expressions to be executed in the #' \code{mc5} (not exported) function environment. The functions are described here for reference #' purposes, The \code{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. -#' +#' #' @section Available Methods: -#' +#' #' 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" (\eqn{\log_{2}}{log2} or \eqn{\log_{10}}{log10}), "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." #' @@ -63,7 +63,9 @@ #' \subsection{Fold Change Methods}{ #' \describe{ #' \item{fc0.2}{Add a cutoff value of 0.2. Typically for zero centered fold change data.} +#' \item{fc0.25}{Add a cutoff value of 0.25. Typically for zero centered fold change data.} #' \item{fc0.3}{Add a cutoff value of 0.3. Typically for zero centered fold change data.} +#' \item{fc0.5}{Add a cutoff value of 0.5. Typically for zero centered fold change data.} #' } #' } #' @@ -88,9 +90,11 @@ #' \describe{ #' \item{pc05}{Add a cutoff value of 5. Typically for percent of control data.} #' \item{pc10}{Add a cutoff value of 10. Typically for percent of control data.} +#' \item{pc16}{Add a cutoff value of 16. Typically for percent of control data.} #' \item{pc20}{Add a cutoff value of 20. Typically for percent of control data.} #' \item{pc25}{Add a cutoff value of 25. Typically for percent of control data.} #' \item{pc30}{Add a cutoff value of 30. Typically for percent of control data.} +#' \item{pc40}{Add a cutoff value of 40. Typically for percent of control data.} #' \item{pc50}{Add a cutoff value of 50. Typically for percent of control data.} #' \item{pc70}{Add a cutoff value of 70. Typically for percent of control data.} #' \item{pc95}{Add a cutoff value of 95. Typically for percent of control data.} @@ -104,6 +108,13 @@ #' \item{coff_2.32}{Add a cutoff value of 2.32.} #' \item{loec.coff}{Method not yet updated for tcpl implementation. Identify the lowest observed #' effective concentration (loec) compared to baseline.} +#' \item{ow_bidirectional_loss}{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.} +#' \item{ow_bidirectional_gain}{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.} +#' \item{osd_coff_bmr}{Overwrite the osd value so that bmr equals cutoff.} #' } #' } #' @@ -197,90 +208,150 @@ mc5_mthds <- function(ae) { list(e1) }, - + neglog2_0.88 = function() { - + e1 <- bquote(coff <- c(coff, -1*log2(0.88))) list(e1) - + }, - + coff_2.32 = function() { - + e1 <- bquote(coff <- c(coff, 2.32)) list(e1) - + }, - + fc0.2 = function() { e1 <- bquote(coff <- c(coff, 0.2)) list(e1) }, - + fc0.3 = function() { e1 <- bquote(coff <- c(coff, 0.3)) list(e1) }, + pc25 = function() { e1 <- bquote(coff <- c(coff, 25)) list(e1) }, - - pc30 = function() { + + pc30 = function() { e1 <- bquote(coff <- c(coff, 30)) list(e1) + }, - - bmad1 = function() { - + + bmad1 = function() { + e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)])) list(e1) + + }, + + bmad2 = function() { + + e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)*2])) + list(e1) + + }, + + pc10 = function() { + + e1 <- bquote(coff <- c(coff, 10)) + list(e1) + + }, + + pc05 = function() { + + e1 <- bquote(coff <- c(coff, 5)) + list(e1) + + }, + + pc95 = function() { + + e1 <- bquote(coff <- c(coff, 95)) + list(e1) + + }, + + bmad4 = function() { + + e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)*4])) + list(e1) + + }, + + fc0.5 = function() { + + e1 <- bquote(coff <- c(coff, 0.5)) + list(e1) + }, - - bmad2 = function() { - - e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)*2])) - list(e1) - }, - - pc10 = function() { - - e1 <- bquote(coff <- c(coff, 10)) - list(e1) - }, - - pc05 = function() { - - e1 <- bquote(coff <- c(coff, 5)) - list(e1) - }, - - pc95 = function() { - - e1 <- bquote(coff <- c(coff, 95)) - list(e1) - }, - - bmad4 = function() { - - e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)*4])) - list(e1) - - }, - - fc0.5 = function() { - - e1 <- bquote(coff <- c(coff, 0.5)) - list(e1) - - } - + + pc16 = function() { + + e1 <- bquote(coff <- c(coff, 16)) + list(e1) + + }, + + ow_bidirectional_loss = function() { + + # get all endpoint sample m4ids where the top param is greater than 0 + e1 <- bquote(top.gt0.m4ids <- dat[(hit_param %in% c("tp", "top")) & hit_val > 0, unique(m4id)]) + # set hitcall param and hitc to -1 if found in m4id list + e2 <- bquote(dat$hit_val[dat$m4id %in% top.gt0.m4ids & dat$hit_param == "hitcall"] <- dat$hit_val[dat$m4id %in% top.gt0.m4ids & dat$hit_param == "hitcall"] * -1) + e3 <- bquote(dat$hitc[dat$m4id %in% top.gt0.m4ids] <- dat$hitc[dat$m4id %in% top.gt0.m4ids] * -1) + e4 <- bquote(dat$model_type <- 4) + list(e1, e2, e3, e4) + + }, + + ow_bidirectional_gain = function() { + + # get all endpoint sample m4ids where the top param is less than 0 + e1 <- bquote(top.lt0.m4ids <- dat[(hit_param %in% c("tp", "top")) & hit_val < 0, unique(m4id)]) + # set hitcall param and hitc to -1 if found in m4id list + e2 <- bquote(dat$hit_val[dat$m4id %in% top.lt0.m4ids & dat$hit_param == "hitcall"] <- dat$hit_val[dat$m4id %in% top.lt0.m4ids & dat$hit_param == "hitcall"] * -1) + e3 <- bquote(dat$hitc[dat$m4id %in% top.lt0.m4ids] <- dat$hitc[dat$m4id %in% top.lt0.m4ids] * -1) + e4 <- bquote(dat$model_type <- 3) + list(e1, e2, e3, e4) + + }, + + osd_coff_bmr = function() { + + # set the osd param so that bmr == coff + e1 <- bquote(dat[ , all_onesd := coff/1.349 ]) + list(e1) + + }, + + fc0.25 = function() { + + e1 <- bquote(coff <- c(coff, 0.25)) + list(e1) + + }, + + pc40 = function() { + + e1 <- bquote(coff <- c(coff, 40)) + list(e1) + + } + ) } diff --git a/R/mc6.R b/R/mc6.R index 7c4ba0d9..9ebb774d 100644 --- a/R/mc6.R +++ b/R/mc6.R @@ -76,11 +76,7 @@ mc6 <- function(ae, wr = FALSE) { ## Load assay information to check for cell viability. Fill with 0 if unavailable. tbl <- "assay_component_endpoint" drvr = getOption("TCPL_DRVR") - if (drvr == "MySQL") { - flds <- tcplQuery(paste0("DESCRIBE ", tbl, ";"))$Field - } else if (drvr == "tcplLite") { - flds <- tcplQuery(paste0("PRAGMA table_info(", tbl, ");"),tbl=c(tbl))$name - } + flds <- tcplQuery(paste0("DESCRIBE ", tbl, ";"))$Field if("cell_viability_assay" %in% flds){ cell_viability <- tcplLoadAeid(fld = "aeid",val = ae,add.fld = "cell_viability_assay") diff --git a/R/mc6_mthds.R b/R/mc6_mthds.R index b486e718..eb997c17 100644 --- a/R/mc6_mthds.R +++ b/R/mc6_mthds.R @@ -64,8 +64,9 @@ #' viability assay with winning model is gain-loss (gnls); if hitc >= 0.9, modl = "gnls" and #' cell_viability_assay = 1, then flag.} #' \item{no.med.gt.3bmad}{Flag series where no median response values are greater than baseline as -#' defined by 3 times the baseline median absolute deviation (bmad); nmed_gtbl = 0, where -#' nmed_gtbl is the number of medians greater than 3 * bmad.} +#' 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.} #' } #' #' @note @@ -99,7 +100,7 @@ mc6_mthds <- function() { low.nrep = function(mthd) { - flag <- "Average number of replicates per conc is less than 2" + flag <- "Average number of replicates per conc < 2" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) @@ -114,7 +115,7 @@ mc6_mthds <- function() { low.nconc = function(mthd) { - flag <- "Number of concentrations tested is less than 4" + flag <- "Number of concentrations tested < 4" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) @@ -144,13 +145,16 @@ mc6_mthds <- function() { singlept.hit.high = function(mthd) { - flag <- "Only highest conc above baseline, active" + flag <- "Active with only highest conc above baseline (3*bmad)" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) - e2 <- bquote(ft[ , lstc := max_med_conc == logc_max]) - e3 <- bquote(ft[ , test := nmed_gtbl == 1 & hitc >= 0.9 & lstc]) + e2 <- bquote(ft[ , lstc := max_med_diff_conc == conc_max]) + e3 <- bquote(ft[ , test := ((nmed_gtbl_pos == 1 & model_type == 2 & top >= 0) | + (nmed_gtbl_neg == 1 & model_type == 2 & top <= 0) | + (nmed_gtbl_pos == 1 & model_type == 3) | + (nmed_gtbl_neg == 1 & model_type == 4)) & hitc >= 0.9 & lstc]) e4 <- bquote(f[[.(mthd)]] <- ft[which(test), .SD, .SDcols = .(out)]) cr <- c("mc6_mthd_id", "flag", "test", "lstc") e5 <- bquote(ft[ , .(cr) := NULL]) @@ -160,13 +164,16 @@ mc6_mthds <- function() { singlept.hit.mid = function(mthd) { - flag <- "Only one conc above baseline, active" + flag <- "Active with one conc (not highest) above baseline (3*bmad)" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) - e2 <- bquote(ft[ , lstc := max_med_conc == logc_max]) - e3 <- bquote(ft[ , test := nmed_gtbl == 1 & hitc >= 0.9 & !lstc]) + e2 <- bquote(ft[ , lstc := max_med_diff_conc == conc_max]) + e3 <- bquote(ft[ , test := ((nmed_gtbl_pos == 1 & model_type == 2 & top >= 0) | + (nmed_gtbl_neg == 1 & model_type == 2 & top <= 0) | + (nmed_gtbl_pos == 1 & model_type == 3) | + (nmed_gtbl_neg == 1 & model_type == 4)) & hitc >= 0.9 & !lstc]) e4 <- bquote(f[[.(mthd)]] <- ft[which(test), .SD, .SDcols = .(out)]) cr <- c("mc6_mthd_id", "flag", "test", "lstc") e5 <- bquote(ft[ , .(cr) := NULL]) @@ -176,12 +183,15 @@ mc6_mthds <- function() { multipoint.neg = function(mthd) { - flag <- "Multiple points above baseline, inactive" + flag <- "Inactive with multiple concs above baseline (3*bmad)" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) - e2 <- bquote(ft[ , test := nmed_gtbl > 1 & hitc < 0.9]) + e2 <- bquote(ft[ , test := ((nmed_gtbl_pos > 1 & model_type == 2 & top >= 0) | + (nmed_gtbl_neg > 1 & model_type == 2 & top <= 0) | + (nmed_gtbl_pos > 1 & model_type == 3) | + (nmed_gtbl_neg > 1 & model_type == 4)) & hitc < 0.9 & hitc >= 0]) e3 <- bquote(f[[.(mthd)]] <- ft[which(test), .SD, .SDcols = .(out)]) cr <- c("mc6_mthd_id", "flag", "test") e4 <- bquote(ft[ , .(cr) := NULL]) @@ -196,8 +206,8 @@ mc6_mthds <- function() { "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) - e2 <- bquote(ft[ , c_min := 10^logc_min]) - e3 <- bquote(ft[ , c_max := 10^logc_max]) + e2 <- bquote(ft[ , c_min := conc_min]) + e3 <- bquote(ft[ , c_max := conc_max]) conc_cols <- c("c_min", "c_max") e4 <- bquote(ft[ , cmen := rowMeans(.SD), .SDcols = .(conc_cols)]) e5 <- bquote(ifelse("ac50_loss" %in% names(ft), ft[ , test := modl == "gnls" & ac50 < c_min & ac50_loss < cmen], ft)) @@ -271,15 +281,15 @@ mc6_mthds <- function() { efficacy.50 = function(mthd) { - flag <- "Less than 50% efficacy" + flag <- "Efficacy < 50%" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) e2 <- bquote(ft[hitc >= 0.9 & coff >= 5, - test := top < 50 | max_med < 50]) + test := abs(top) < 50 | abs(max_med_diff) < 50]) e3 <- bquote(ft[hitc >= 0.9 & coff < 5, - test := top < log2(1.5) | max_med < log2(1.5)]) + test := abs(top) < log2(1.5) | abs(max_med_diff) < log2(1.5)]) e4 <- bquote(f[[.(mthd)]] <- ft[which(test), .SD, .SDcols = .(out)]) cr <- c("mc6_mthd_id", "flag", "test") e5 <- bquote(ft[ , .(cr) := NULL]) @@ -289,12 +299,12 @@ mc6_mthds <- function() { ac50.lowconc = function(mthd) { - flag <- "AC50 less than lowest concentration tested" + flag <- "AC50 < lowest concentration tested" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) - e2 <- bquote(ft[hitc >= 0.9, test := ac50 < 10^logc_min]) + e2 <- bquote(ft[hitc >= 0.9, test := ac50 < conc_min]) e3 <- bquote(f[[.(mthd)]] <- ft[which(test), .SD, .SDcols = .(out)]) cr <- c("mc6_mthd_id", "flag", "test") e4 <- bquote(ft[ , .(cr) := NULL]) @@ -319,12 +329,15 @@ mc6_mthds <- function() { no.med.gt.3bmad = function(mthd) { - flag <- "Flag series where no median response values are greater than baseline as defined by 3 times the baseline median absolute deviation (bmad)" + flag <- "No median responses above baseline (3*bmad)" out <- c("m5id", "m4id", "aeid", "mc6_mthd_id", "flag") init <- bquote(list(.(mthd), .(flag), FALSE)) e1 <- bquote(ft[ , .(c(out[4:5], "test")) := .(init)]) - e2 <- bquote(ft[ , test := nmed_gtbl == 0]) + e2 <- bquote(ft[ , test := (model_type == 2 & top > 0 & nmed_gtbl_pos == 0) | + (model_type == 2 & top < 0 & nmed_gtbl_neg == 0) | + (model_type == 3 & nmed_gtbl_pos == 0) | + (model_type == 4 & nmed_gtbl_neg == 0)]) e3 <- bquote(f[[.(mthd)]] <- ft[which(test), .SD, .SDcols = .(out)]) cr <- c("mc6_mthd_id", "flag", "test") e4 <- bquote(ft[ , .(cr) := NULL]) diff --git a/R/mthd_funcs.R b/R/mthd_funcs.R index cc99d51d..a7f1729a 100644 --- a/R/mthd_funcs.R +++ b/R/mthd_funcs.R @@ -31,11 +31,7 @@ #' and the delete cascade are available in the package vignette. #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfDefault() -#' +#' \dontrun{ #' ## tcplListMthd allows the user to display the available methods for #' ## a given level and data type #' head(tcplMthdList(lvl = 2, type = "mc")) @@ -46,7 +42,6 @@ #' ## whether an ID exists before assigning/clearing methods. #' tcplMthdLoad(lvl = 2, id = 55, type = "mc") #' -#' \dontrun{ #' ## ACID 55 does not have any methods. Assign methods from the list above. #' tcplMthdAssign(lvl = 2, #' id = 55, @@ -63,6 +58,4 @@ #' ## Cleanup example method assigments #' tcplMthdClear(lvl = 2, id = 53:55, type = "mc") #' } -#' ## Reset configuration -#' options(conf_store) NULL diff --git a/R/query_funcs.R b/R/query_funcs.R index 9380340c..449c5886 100644 --- a/R/query_funcs.R +++ b/R/query_funcs.R @@ -10,31 +10,23 @@ #' @inheritParams tcplConf #' #' @details -#' Currently, the tcpl package only supports the "MySQL" and "tcplLite" database -#' drivers. +#' Currently, the tcpl package supports the "MySQL", "example", and "API" +#' database drivers. #' #' \code{tcplQuery} returns a data.table object with the query results. #' \code{tcplSendQuery} sends a query, but does not fetch any results, and #' returns 'TRUE' or the error message given by the database. +#' \code{tcplQueryAPI} returns a data.table object with the query results when +#' connected using "API" as driver. #' #' @examples -#' -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' TCPLlite <- file.path(system.file(package = "tcpl"), "example") -#' tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") -#' +#' \dontrun{ +#' # only with MySQL driver #' tcplQuery("SELECT 'Hello World';") #' -#' ## When using tcplLite, name of table must be passed into tcplQuery -#' if (conf_store$TCPL_DRVR == 'MySQL') { -#' tcplQuery("SELECT * FROM assay;") -#' } else { -#' tcplQuery("SELECT * FROM assay;", tbl='assay') +#' # only with API driver +#' tcplConfDefault() +#' tcplQueryAPI(resource = "data", fld = "aeid", val = 2) #' } -#' -#' ## Reset configuration -#' options(conf_store) #' NULL \ No newline at end of file diff --git a/R/rgstr_funcs.R b/R/rgstr_funcs.R index b6a7a164..1ab1cff6 100644 --- a/R/rgstr_funcs.R +++ b/R/rgstr_funcs.R @@ -39,13 +39,7 @@ #' the registration process and all of the fields is available in the vignette. #' #' @examples -#' #' \dontrun{ -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfDefault() -#' #' ## Load current ASID information #' tcplLoadAsid() #' @@ -66,17 +60,6 @@ #' #' ## Remove the created ASID. Note: Manually deleting primary keys can cause #' ## serious database problems and should not generally be done. -#' -#' ## If using the tcplLite DRVR, must specify table name -#' if (conf_store$TCPL_DRVR == 'MySQL') { -#' tcplSendQuery(paste0("DELETE FROM assay_source WHERE asid = ", i1, ";")) -#' } else { -#' qy <- paste0("SELECT * FROM assay_source WHERE NOT asid = ", i1, ";") -#' tcplSendQuery(qy, tbl='assay_source', delete=TRUE) -#' } -#' -#' ## Reset configuration -#' options(conf_store) #' } #' NULL \ No newline at end of file diff --git a/R/sc1.R b/R/sc1.R index a9052846..2a910f1c 100644 --- a/R/sc1.R +++ b/R/sc1.R @@ -23,7 +23,7 @@ sc1 <- function(ac, wr = FALSE) { ## Variable binding to pass R CMD Check - wllq <- conc <- logc <- acid <- aeid <- mthd <- ordr <- nassays <- NULL + wllq <- conc <- conc <- acid <- aeid <- mthd <- ordr <- nassays <- NULL mthd <- aeid <- pval <- bval <- resp <- NULL owarn <- getOption("warn") @@ -62,8 +62,6 @@ sc1 <- function(ac, wr = FALSE) { ## Force all concentrations to 1 significant figure dat[ , conc := signif(conc, 1)] - ## Add column for log10 concentration - dat[ , logc := log10(conc)] ## Load aeid mapping information. aeid_info <- tcplLoadAeid("acid", ac)[ , list(acid, aeid)] @@ -142,7 +140,7 @@ sc1 <- function(ac, wr = FALSE) { res <- TRUE - outcols <- c("s0id", "acid", "aeid", "logc", "bval", "pval", "resp") + outcols <- c("s0id", "acid", "aeid", "conc", "bval", "pval", "resp") dat <- dat[ , .SD, .SDcols = outcols] ## Load into sc1 table -- else return results diff --git a/R/sc1_mthds.R b/R/sc1_mthds.R index 613d6dce..aebf76a2 100644 --- a/R/sc1_mthds.R +++ b/R/sc1_mthds.R @@ -45,6 +45,8 @@ #' \item{bval.apid.tn.med}{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).} +#' \item{bval.nwlls.med}{Calculate the baseline value (bval) as the median of the raw values +#' (rval) for neutral control wells (wllt = n) by assay endpoint id (aeid).} #' } #' } #' @@ -131,6 +133,14 @@ sc1_mthds <- function() { by = list(aeid, apid)]) list(e1) + }, + bval.nwlls.med = function(aeids) { + + e1 <- bquote(dat[J(.(aeids)), + bval := median(rval[wllt == "n"], na.rm = TRUE), + by = list(aeid)]) + list(e1) + }, pval.apid.pwlls.med = function(aeids) { diff --git a/R/sc2.R b/R/sc2.R index e440e010..e302b0a1 100644 --- a/R/sc2.R +++ b/R/sc2.R @@ -23,7 +23,7 @@ sc2 <- function(ae, wr = FALSE) { ## Variable-binding to pass R CMD Check - max_tmp <- bmad <- resp <- wllt <- tmp <- spid <- logc <- hitc <- max_med <- NULL + max_tmp <- bmad <- resp <- wllt <- tmp <- spid <- conc <- hitc <- max_med <- NULL owarn <- getOption("warn") options(warn = 1) @@ -59,10 +59,10 @@ sc2 <- function(ae, wr = FALSE) { dat[ , bmad := mad(resp[wllt == "t"])] ## Collapse by spid - dat[ , tmp := median(resp), by = list(spid, wllt, logc)] + dat[ , tmp := median(resp), by = list(spid, wllt, conc)] ## take absolute value for bidirectional fitting. - dat[ , c("tmpi", "max_med","max_tmp") := list(.GRP, max(abs(tmp)), tmp[which.max(abs(tmp))]), by = spid] + dat[ , c("tmpi", "max_med","max_tmp") := list(.GRP, max(abs(tmp)), tmp[which.max(abs(tmp))]), by = c("spid")] ## Initialize coff vector coff <- 0 @@ -81,11 +81,11 @@ sc2 <- function(ae, wr = FALSE) { ## ignore any other methods ms <- ms[!grepl("ow_",mthd),] - ## Apply bmad overwrite methods first if needed + ## Apply bmad/max_med overwrite methods first if needed if (nrow(ms_overwrite) > 0) { - exprs <- lapply(mthd_funcs[ms_overwrite$mthd], do.call, args = list()) - fenv <- environment() - invisible(rapply(exprs, eval, envir = fenv)) + exprs <- lapply(mthd_funcs[ms_overwrite$mthd], do.call, args = list()) + fenv <- environment() + invisible(rapply(exprs, eval, envir = fenv)) } ## Apply cutoff methods @@ -98,9 +98,19 @@ sc2 <- function(ae, wr = FALSE) { ## Determine hit-call dat[ , hitc := as.integer(max_med >= coff)] - + ## set max med back to the tmp value so we conserve directionality. dat[ , max_med := max_tmp] + + ## overwrite hitc for gain direction endpoints + if ("ow_bidirectional_gain" %in% ms_overwrite$mthd) { + dat <- dat[max_med < 0, hitc := hitc*-1] + } + + ## overwrite hitc for loss direction endpoints + if ("ow_bidirectional_loss" %in% ms_overwrite$mthd) { + dat <- dat[max_med > 0, hitc := hitc*-1] + } ttime <- round(difftime(Sys.time(), stime, units = "sec"), 2) ttime <- paste(unclass(ttime), units(ttime)) diff --git a/R/sc2_mthds.R b/R/sc2_mthds.R index ac879fca..9b251255 100644 --- a/R/sc2_mthds.R +++ b/R/sc2_mthds.R @@ -61,6 +61,7 @@ #' \subsection{Percent of Control Methods}{ #' \describe{ #' \item{pc0.88}{Add a cutoff value of 0.88. Typically for percent of control data.} +#' \item{pc16}{Add a cutoff value of 16. Typically for percent of control data.} #' \item{pc20}{Add a cutoff value of 20. Typically for percent of control data.} #' \item{pc25}{Add a cutoff value of 25. Typically for percent of control data.} #' \item{pc30}{Add a cutoff value of 30. Typically for percent of control data.} @@ -96,8 +97,12 @@ #' \describe{ #' \item{ow_bmad_nwells}{Overwrite the default baseline median absolute value (bmad) with a bmad #' calculated using neutral control wells (wllt = n).} -#' \item{ow_bidirectional_false}{Overwrite the max_med and max_tmp values, which were calculated -#' using absolute value, to a calculation not using absolute value for non-bidirectional data.} +#' \item{ow_bidirectional_gain}{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.} +#' \item{ow_bidirectional_loss}{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.} #' } #' } #' @@ -193,13 +198,20 @@ sc2_mthds <- function() { }, - ow_bidirectional_false = function() { + ow_bidirectional_gain = function() { e1 <- bquote(dat[ , c("max_med","max_tmp") := list(max(tmp), tmp[which.max(tmp)]), by = spid]) list(e1) }, + ow_bidirectional_loss = function() { + + e1 <- bquote(dat[ , c("max_med","max_tmp") := list(abs(min(tmp)), tmp[which.min(tmp)]), by = spid]) + list(e1) + + }, + bmad2 = function() { e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)*2])) @@ -232,8 +244,14 @@ sc2_mthds <- function() { e1 <- bquote(coff <- c(coff, dat[ , unique(bmad)*1.5])) list(e1) + }, + + pc16 = function() { + + e1 <- bquote(coff <- c(coff, 16)) + list(e1) + } - ) } diff --git a/R/tcplAppend.R b/R/tcplAppend.R index e532c2e4..3f75de12 100644 --- a/R/tcplAppend.R +++ b/R/tcplAppend.R @@ -28,6 +28,9 @@ tcplAppend <- function(dat, tbl, db, lvl=NULL) { db_pars <- NULL + if (getOption("TCPL_DRVR") == "API") { + stop("'API' driver not supported in tcplAppend.") + } if (getOption("TCPL_DRVR") == "MySQL") { @@ -46,6 +49,11 @@ tcplAppend <- function(dat, tbl, db, lvl=NULL) { names(additional_pars) <- tolower(gsub("TCPL_","",names(additional_pars))) db_pars <- append(db_pars,additional_pars) + if("RMySQL" %in% loadedNamespaces()){ + unloadNamespace("RMySQL") + warning("'RMySQL' package is not supported with tcpl and has been detached.") + } + dbcon <- do.call(dbConnect, db_pars) @@ -61,63 +69,6 @@ tcplAppend <- function(dat, tbl, db, lvl=NULL) { } - if (getOption("TCPL_DRVR") == "tcplLite") { - # Rather than write to db, write to appropriate csv in db dir - db_pars <- db - fpath <- paste(db, tbl, sep='/') # Stitch together the dir path and the level table we're working on - fpath <- paste(fpath, 'csv', sep='.') - - tbl_cols <- colnames(read.table(fpath, header=T, sep=',', fill=T)) - if (length(setdiff(tbl_cols,names(dat)))>0){ - setDT(dat)[, setdiff(tbl_cols, names(dat)) := NA] - }else{ - setDT(dat) - } - - setcolorder(dat, tbl_cols) - - - # Need to set the "id" column. Don't have the luxury of the sql auto increment schema - autoFlag <- T - if (!is.null(lvl)) { - if (lvl %in% 0L:6L) { - if (startsWith(tbl, "mc")) { - autoIncr <- paste0("m",lvl,"id") - } else if (startsWith(tbl, "sc")) { - autoIncr <- paste0("s", lvl, "id") - } - } else if (lvl == "acid") { - autoIncr <- "acid" - } else if (lvl == "aeid") { - autoIncr <- "aeid" - } else if (lvl == "aid") { - autoIncr <- "aid" - } else if (lvl == "asid") { - autoIncr <- "asid" - } else { - autoFlag <- F - } - - if (autoFlag == T){ - temp_dt <- read.csv(fpath, sep=',', header=T) - if (length(temp_dt[,eval(autoIncr)]) == 0) { - start = 1 - } else { - start = tail(temp_dt[,eval(autoIncr)], 1) + 1 - } - - end <- nrow(dat)+start-1 - dat[, eval(autoIncr)] <- seq.int(start,end) - } - } - - - - write.table(dat, file=fpath, append=T, row.names=F, sep=',', col.names=F) - - return(TRUE) - } - if (is.null(db_pars)) { stop(getOption("TCPL_DRVR"), " is not a supported database system. See ", diff --git a/R/tcplConf.R b/R/tcplConf.R index db744508..6a95d64c 100644 --- a/R/tcplConf.R +++ b/R/tcplConf.R @@ -3,17 +3,13 @@ #------------------------------------------------------------------------------- #' @rdname config_funcs +#' @importFrom ctxR register_ctx_api_key #' @export tcplConf <- function (drvr = NULL, user = NULL, pass = NULL, host = NULL, db = NULL,...) { #tcplConf(user='_dataminer', pass='pass', host='au.epa.gov', drvr = 'MySQL',db = 'invitrodb') - # Notes for tcplLite - # ================== - # Allow drvr='tcplLite' for writing flat files for each level of analysis - # db= - # Notes for example # ================== # Allow drvr='example' for loading example data from data directory in tcpl package @@ -46,9 +42,9 @@ tcplConf <- function (drvr = NULL, user = NULL, pass = NULL, host = NULL, if (!is.null(drvr)) { - if (!drvr %in% c( "MySQL", "tcplLite", "example")) { + if (!drvr %in% c( "MySQL", "example", "API")) { stop(drvr, " is not a supported database driver. Must be ", - "'MySQL', 'tcplLite', or 'example'.") + "'MySQL', 'API', or 'example'.") } if (drvr == "example"){ @@ -66,10 +62,14 @@ tcplConf <- function (drvr = NULL, user = NULL, pass = NULL, host = NULL, } } - if (drvr == "tcplLite") { - tcplLiteInit() - options("TCPL_DRVR" = "tcplLite") - } + if (drvr == "API") { + options("TCPL_DRVR" = "API") + if (is.null(pass)) stop("'API' driver requires an API-key, supply it to ", + "the 'pass' parameter. To request a key, send an ", + "email to ccte_api@epa.gov.") + if (is.null(host)) options("TCPL_HOST" = "https://api-ccte.epa.gov/bioactivity") + register_ctx_api_key(key = pass) + } } diff --git a/R/tcplConfDefault.R b/R/tcplConfDefault.R index a2254b22..4f3f94f5 100644 --- a/R/tcplConfDefault.R +++ b/R/tcplConfDefault.R @@ -7,8 +7,8 @@ tcplConfDefault <- function () { - TCPLlite <- file.path(system.file(package = "tcpl"), "csv") - tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") + tcpl_key <- "01cbaf22-904f-11ee-954e-325096b39f47" + tcplConf(db = NA, user = NA, pass = tcpl_key, host = NULL, drvr = "API") } diff --git a/R/tcplConfExample.R b/R/tcplConfExample.R deleted file mode 100644 index 8e03d1bd..00000000 --- a/R/tcplConfExample.R +++ /dev/null @@ -1,15 +0,0 @@ -#------------------------------------------------------------------------------- -# tcplConfExample: Generate default example location -#------------------------------------------------------------------------------- - -#' @rdname config_funcs -#' @export - -tcplConfExample <- function () { - - TCPLlite <- file.path(system.file(package = "tcpl"), "example") - tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") - -} - -#------------------------------------------------------------------------------- diff --git a/R/tcplConfReset.R b/R/tcplConfReset.R index 17a482b3..5ba2c61d 100644 --- a/R/tcplConfReset.R +++ b/R/tcplConfReset.R @@ -14,12 +14,11 @@ tcplConfReset <- function () { "## Detailed information about this file available in the help file for", "## tcplConf (?tcplConf).", "", - "DRVR <- \"tcplLite\"", + "DRVR <- \"API\"", "HOST <- NA_character_", "USER <- NA_character_", - "PASS <- NA_character_", - "DB <- file.path(system.file(package = \"tcpl\"),", - " \"csv\")", + "PASS <- \"01cbaf22-904f-11ee-954e-325096b39f47\"", + "DB <- NA_character_", "", "###################################################################", sep = "\n", diff --git a/R/tcplConfSave.R b/R/tcplConfSave.R index b001d565..83e88c5d 100644 --- a/R/tcplConfSave.R +++ b/R/tcplConfSave.R @@ -16,8 +16,8 @@ tcplConfSave <- function () { } drvr <- getOption("TCPL_DRVR") - if (!drvr %in% c("MySQL", "tcplLite")) { - stop(drvr, " is not a supported database driver. Must be 'tcplLite' or ", + if (!drvr %in% c("MySQL", "API")) { + stop(drvr, " is not a supported database driver. Must be 'API' or ", "'MySQL'.") } drvr <- shQuote(drvr) diff --git a/R/tcplCytoPt.R b/R/tcplCytoPt.R index 4a054b1e..76035874 100644 --- a/R/tcplCytoPt.R +++ b/R/tcplCytoPt.R @@ -72,11 +72,7 @@ #' #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfDefault() -#' +#' \dontrun{ #' ## Can only calculate the cytotox burst if using the MySQL database and #' ## TCPL_DRVR == 'MySQL' #' @@ -99,9 +95,7 @@ #' ## Changing 'default.pt' will change cyto_pt in the resulting data.table #' tcplCytoPt(aeid = 1:2, default.pt = 6) #' } -#' -#' ## Reset configuration -#' options(conf_store) +#' } #' #' @return A data.table with the cytotoxicity distribution for each chemical. #' The definition of the field names are listed under "details." @@ -160,13 +154,17 @@ tcplCytoPt <- function(chid = NULL, aeid = NULL, flag = TRUE, zdat <- zdat[chid %in% ch] } - #for bidirectional burst endpoints only consider down response (BSK and APR aeids below) - zdat <- zdat[!(aeid %in% c(26, 46, 158, 160, 178, 198, 222, 226, 252, 254, 270, 292, 316, 318, 2873, 2929, 2931) & top>0),] + # set list of assays where we should only consider negative direction + burst_down <- c(26, 46, 158, 160, 178, 198, 222, 226, 252, 254, 270, 292, 316, 318,1091, 2873, 2929, 2931) + # set down burst to -1 hitc but do not filter so it is still included in Ntested. + zdat[aeid %in% burst_down & top>0,hitc:=-1] + cat("8: Determining representative sample\n") zdat <- tcplSubsetChid(dat = zdat, flag = flag) - #filter out gnls curves - zdat <- zdat[modl != "gnls",] + + #filter out null chids + zdat <- zdat[!is.na(chid)] cat("9: Calculating intermediate summary statistics\n") # prior to version 4.0 modl_ga was used as ac50 variable # check schema and if using new schema use ac50 instead. @@ -180,11 +178,16 @@ tcplCytoPt <- function(chid = NULL, aeid = NULL, flag = TRUE, by = list(chid,code, chnm, casn)] cat("10: Calculating the cytotoxicity point based on the 'burst' endpoints\n") + #add chems that are not tested in the burst + total_chem <- tcplLoadChem() |> select(chid,code,chnm,casn) |> as.data.table() |> unique() + total_chem <- total_chem[!chid %in% zdst$chid,][,`:=`(ntst = 0, nhit = 0, burstpct = 0)] + zdst <- rbindlist(list(zdst,total_chem), fill = TRUE) + zdst[, `:=`(used_in_global_mad_calc, burstpct > 0.05 & ntst>=60)] gb_mad <- median(zdst[used_in_global_mad_calc=='TRUE', mad]) #calculate global mad zdst[,global_mad := gb_mad] # add column for global mad zdst[, cyto_pt := med] - zdst[burstpct < 0.05, `:=`(cyto_pt, default.pt)] # if the burst percent is less than .05 use the default pt instead + zdst[burstpct < 0.05 | nhit < 2, `:=`(cyto_pt, default.pt)] # if the burst percent is less than .05 and at least 2 hits use the default pt instead zdst[, `:=`(cyto_pt_um, 10^cyto_pt)] zdst[, `:=`(lower_bnd_um, 10^(cyto_pt - 3 * global_mad))] zdst[,burstpct:=NULL] # remove burstpct from final results to match previous iterations of tcplCytopt diff --git a/R/tcplDelete.R b/R/tcplDelete.R index 5b6749cc..8538834b 100644 --- a/R/tcplDelete.R +++ b/R/tcplDelete.R @@ -26,14 +26,9 @@ tcplDelete <- function(tbl, fld, val, db) { if (length(tbl) != 1 || !is(tbl,"character")) { stop("The input 'tbl' must be a character of length one.") } - - if (getOption("TCPL_DRVR") == "tcplLite") { - qformat <- paste("SELECT * FROM", tbl, "WHERE NOT ") - qformat <- paste0(qformat, "( ", paste( fld, "IN (%s)", collapse = " AND "), ")") - } else { - qformat <- paste("DELETE FROM", tbl, "WHERE") - qformat <- paste0(qformat, " ", paste(fld, "IN (%s)", collapse = " AND ")) - } + + qformat <- paste("DELETE FROM", tbl, "WHERE") + qformat <- paste0(qformat, " ", paste(fld, "IN (%s)", collapse = " AND ")) qformat <- paste0(qformat, ";") diff --git a/R/tcplFit2.R b/R/tcplFit2.R index 335adbfc..d318ac4c 100644 --- a/R/tcplFit2.R +++ b/R/tcplFit2.R @@ -3,37 +3,46 @@ #' @param dat output from level 3 processing #' @param fitmodels list of the models that should be fit with the data #' @param bmed baseline value, typically should be 0 -#' @param bidirectional boolean, default is TRUE (bidirectional fitting) #' #' @return Data.table with an additional column fitparams that includes all of the fitting parameters #' @importFrom tcplfit2 tcplfit2_core tcplFit2 <- function(dat, fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5"), - bmed = NULL, - bidirectional = TRUE) { + bmed = NULL) { #variable binding resp <-bmad <-aeid <-osd <-m3id <- concentration_unlogged <-response <- NULL + conc <- max_med <- min_med <- max_med_conc <- min_med_conc <- NULL # do all the regular fitting things that still need to be done - res <- dat[, `:=`(c("rmns", "rmds", "nconcs", "med_rmds"), { + res <- dat[, `:=`(c("rmns", "rmds", "nconcs", "med_rmds_pos", "med_rmds_neg"), { rmns <- mean(resp) rmds <- median(resp) nconcs <- .N - med_rmds <- rmds >= (3 * bmad) - .(rmns, rmds, nconcs, med_rmds) - }), keyby = .(aeid, spid, logc)][, .( - bmad = min(bmad), resp_max = max(resp), osd = min(osd), bmed = ifelse(is.null(bmed), 0, max(bmed)), - resp_min = min(resp), max_mean = max(rmns), max_mean_conc = logc[which.max(rmns)], - max_med = max(rmds), max_med_conc = logc[which.max(rmds)], - logc_max = max(logc), logc_min = min(logc), nconc = length(unique(logc)), - npts = .N, nrep = median(as.numeric(nconcs)), nmed_gtbl = sum(med_rmds) / first(nconcs), - concentration_unlogged = list(10^(logc)), response = list(resp), m3ids = list(m3id) + med_rmds_pos <- rmds >= (3 * bmad) + med_rmds_neg <- rmds <= (-3 * bmad) + .(rmns, rmds, nconcs, med_rmds_pos, med_rmds_neg) + }), keyby = .(aeid, spid, conc)][, .( + bmad = min(bmad), osd = min(osd), bmed = ifelse(is.null(bmed), 0, max(bmed)), + resp_max = max(resp), resp_min = min(resp), + max_mean = max(rmns), max_mean_conc = conc[which.max(rmns)], + max_med = max(rmds), max_med_conc = conc[which.max(rmds)], + min_mean = min(rmns), min_mean_conc = conc[which.min(rmns)], + min_med = min(rmds), min_med_conc = conc[which.min(rmds)], + conc_max = max(conc), conc_min = min(conc), nconc = length(unique(conc)), + npts = .N, nrep = median(as.numeric(nconcs)), + nmed_gtbl_pos = sum(med_rmds_pos) / first(nconcs), + nmed_gtbl_neg = sum(med_rmds_neg) / first(nconcs), + concentration_unlogged = list(conc), response = list(resp), m3ids = list(m3id) ), keyby = .(aeid, spid) - ][, `:=`(tmpi = seq_len(.N)), keyby = .(aeid)][, + ][, `:=`(c("max_med_diff", "max_med_diff_conc"), { + max_med_diff <- ifelse(abs(max_med) > abs(min_med), max_med, min_med) + max_med_diff_conc <- ifelse(abs(max_med) > abs(min_med), max_med_conc, min_med_conc) + .(max_med_diff, max_med_diff_conc) + })][, `:=`(tmpi = seq_len(.N)), keyby = .(aeid)][, `:=`(fitparams = list(tcplfit2::tcplfit2_core(unlist(concentration_unlogged), unlist(response), cutoff = bmad, - bidirectional = bidirectional, + bidirectional = TRUE, verbose = FALSE, force.fit = TRUE, fitmodels = fitmodels ))), @@ -51,40 +60,44 @@ tcplFit2 <- function(dat, #' #' #' @return Data.table with key value pairs of hitcalling parameters -#' @importFrom dplyr %>% filter group_by summarise left_join inner_join select rowwise mutate pull ungroup +#' @importFrom dplyr %>% filter group_by summarise left_join inner_join select rowwise mutate pull ungroup matches #' @importFrom tidyr pivot_longer +#' @importFrom tidyr separate_wider_delim #' @importFrom tcplfit2 tcplhit2_core tcplHit2 <- function(mc4, coff) { #variable binding - top <- a <- b <- ga <- la <- p <- tp <- logc_min <- logc_max <- fitc <- NULL + top <- a <- b <- ga <- la <- p <- tp <- conc_min <- conc_max <- fitc <- NULL model <- m4id <-model_param <-model_val <-resp <- NULL params <-conc <-bmed <-onesd <-df <-aeid <- NULL fit_method <-hitcall <-cutoff <-top_over_cutoff <-bmd <-hit_val <- NULL - nested_mc4 <- mc4 %>% + + long_mc4 <- mc4 |> tidyr::pivot_longer(cols = matches("cnst|hill|gnls|poly1|poly2|pow|exp2|exp3|exp4|exp5|all|errfun"), names_to = "model", values_to = "model_val") |> tidyr::separate_wider_delim(col = "model",delim = "_", names = c("model","model_param"), too_many = "merge") + + nested_mc4 <- long_mc4 %>% filter(model != "all") %>% group_by(m4id) %>% summarise(params = list(tcplFit2_nest(data.table(model = model, model_param = model_param, model_val = model_val)))) # get lvl 3 conc/resp information l4_agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = nested_mc4$m4id) - l3_dat <- l4_agg %>% left_join(tcplLoadData(lvl = 3, fld = "m3id", val = l4_agg$m3id), by = c("aeid", "m3id", "m2id", "m1id", "m0id", "spid", "logc", "resp")) + l3_dat <- l4_agg %>% left_join(tcplLoadData(lvl = 3, fld = "m3id", val = l4_agg$m3id), by = c("aeid", "m3id", "m2id", "m1id", "m0id", "spid", "conc", "resp")) # unlog and plug into nested - nested_mc4 <- nested_mc4 %>% left_join(l3_dat %>% group_by(m4id) %>% summarise(conc = list(10^(logc)), resp = list(resp)), by = "m4id") + nested_mc4 <- nested_mc4 %>% left_join(l3_dat %>% group_by(m4id) %>% summarise(conc = list(conc), resp = list(resp)), by = "m4id") # rejoin the onesd for tcplfit2 - nested_mc4 <- nested_mc4 %>% inner_join(mc4 %>% filter(model_param == "onesd") %>% select(m4id, onesd = model_val), by = "m4id") + nested_mc4 <- nested_mc4 %>% inner_join(long_mc4 %>% filter(model_param == "onesd") %>% select(m4id, onesd = model_val), by = "m4id") # rejoin for bmed - nested_mc4 <- nested_mc4 %>% inner_join(mc4 %>% filter(model_param == "bmed") %>% select(m4id, bmed = model_val), by = "m4id") + nested_mc4 <- nested_mc4 %>% inner_join(long_mc4 %>% filter(model_param == "bmed") %>% select(m4id, bmed = model_val), by = "m4id") # add the cutoff # nested_mc4$cutoff <- coff # browser() test <- nested_mc4 %>% dplyr::rowwise() %>% - mutate(df = list(tcplhit2_core(params = params, conc = unlist(conc), resp = unlist(resp), bmed = bmed, cutoff = coff, onesd = onesd))) %>% + mutate(df = list(tcplhit2_core(params = params, conc = unlist(conc), resp = unlist(resp), bmed = bmed, cutoff = coff, onesd = onesd, bmd_low_bnd = .1, bmd_up_bnd = 10))) %>% select(-conc, -resp) # test <- NULL # for(id in nested_mc4$m4id){ @@ -107,14 +120,14 @@ tcplHit2 <- function(mc4, coff) { dplyr::ungroup() res <- res %>% mutate(coff_upper = 1.2 * cutoff, coff_lower = .8 * cutoff) res <- res %>% - left_join(mc4 %>% select(m4id, logc_min, logc_max) %>% unique(), by = "m4id") %>% + left_join(long_mc4 %>% select(m4id, conc_min, conc_max) %>% unique(), by = "m4id") %>% mutate(fitc = case_when( - hitcall >= .9 & abs(top) <= coff_upper & ac50 <= logc_min ~ 36L, - hitcall >= .9 & abs(top) <= coff_upper & ac50 > logc_min & ac95 < logc_max ~ 37L, - hitcall >= .9 & abs(top) <= coff_upper & ac50 > logc_min & ac95 >= logc_max ~ 38L, - hitcall >= .9 & abs(top) > coff_upper & ac50 <= logc_min ~ 40L, - hitcall >= .9 & abs(top) > coff_upper & ac50 > logc_min & ac95 < logc_max ~ 41L, - hitcall >= .9 & abs(top) > coff_upper & ac50 > logc_min & ac95 >= logc_max ~ 42L, + hitcall >= .9 & abs(top) <= coff_upper & ac50 <= conc_min ~ 36L, + hitcall >= .9 & abs(top) <= coff_upper & ac50 > conc_min & ac95 < conc_max ~ 37L, + hitcall >= .9 & abs(top) <= coff_upper & ac50 > conc_min & ac95 >= conc_max ~ 38L, + hitcall >= .9 & abs(top) > coff_upper & ac50 <= conc_min ~ 40L, + hitcall >= .9 & abs(top) > coff_upper & ac50 > conc_min & ac95 < conc_max ~ 41L, + hitcall >= .9 & abs(top) > coff_upper & ac50 > conc_min & ac95 >= conc_max ~ 42L, hitcall < .9 & abs(top) < coff_lower ~ 13L, hitcall < .9 & abs(top) >= coff_lower ~ 15L, fit_method == "none" ~ 2L, @@ -124,13 +137,13 @@ tcplHit2 <- function(mc4, coff) { # mc5 table mc5 <- res %>% - left_join(mc4 %>% select(m4id, aeid) %>% unique(), by = "m4id") %>% + left_join(long_mc4 %>% select(m4id, aeid) %>% unique(), by = "m4id") %>% select(m4id, aeid, modl = fit_method, hitc = hitcall,fitc, coff = cutoff) %>% mutate(model_type = 2) # mc5 param table mc5_param <- res %>% - left_join(mc4 %>% select(m4id, aeid) %>% unique(), by = "m4id") %>% + left_join(long_mc4 %>% select(m4id, aeid) %>% unique(), by = "m4id") %>% select(m4id, aeid, top_over_cutoff:bmd) mc5_param <- mc5_param %>% tidyr::pivot_longer(cols = top_over_cutoff:bmd, names_to = "hit_param", values_to = "hit_val") %>% @@ -161,7 +174,9 @@ tcplFit2_unnest <- function(output) { lst <- lapply(res[[m]], function(x){ if(length(x) < 1) { x <- NA }; x }) test <- rbind(test, data.frame(model = m, model_param = names(lst), model_val = unlist(lst), stringsAsFactors = FALSE, row.names = NULL)) } - test + # include error function and return + errfun <- if (is.null(output$errfun)) "dt4" else output$errfun + rbind(test, list(model = "errfun", model_param = errfun, model_val = NA)) } @@ -171,6 +186,12 @@ tcplFit2_unnest <- function(output) { #' #' @return a list of fitting parameters that can be consumed by tcplfit2 tcplFit2_nest <- function(dat) { + #variable binding + model <- NULL + # get errfun and filter it out + errfun <- filter(dat, model == "errfun")$model_param + dat <- filter(dat, model != "errfun") + # renest modelnames <- unique(dat$model) for (m in modelnames) { @@ -194,7 +215,8 @@ tcplFit2_nest <- function(dat) { out1 <- c( mget(modelnames), - list(modelnames = modelnames) + list(modelnames = modelnames), + errfun = errfun ) } diff --git a/R/tcplGetAeid.R b/R/tcplGetAeid.R index 03cba1aa..504db244 100644 --- a/R/tcplGetAeid.R +++ b/R/tcplGetAeid.R @@ -12,17 +12,11 @@ #' @param name A string that will be matched to the assay component endpoint name #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' +#' \dontrun{ #' ## Search for aenm (assay name) case insensitive #' tcplGetAeid("TOX21") #' tcplGetAeid("tox21") -#' -#' ## Reset configuration -#' options(conf_store) +#' } #' #' @export diff --git a/R/tcplListFlds.R b/R/tcplListFlds.R index fb5d5da0..853397c3 100644 --- a/R/tcplListFlds.R +++ b/R/tcplListFlds.R @@ -14,8 +14,10 @@ #' tcplLoad- functions. #' #' @examples +#' \dontrun{ #' ## Gives the fields in the mc1 table #' tcplListFlds("mc1") +#' } #' #' @return A string of field names for the given table. #' @@ -28,6 +30,9 @@ tcplListFlds <- function(tbl, db = getOption("TCPL_DB")) { ## Variable-binding to pass R CMD Check name <- COLUMN_NAME <- NULL + if (getOption("TCPL_DRVR") == "API") { + stop("'API' driver not supported in tcplListFlds.") + } if (length(tbl) > 1 | length(db) > 1) { stop("tbl and db must both be of length 1.") } @@ -51,16 +56,6 @@ tcplListFlds <- function(tbl, db = getOption("TCPL_DB")) { } - if (getOption("TCPL_DRVR") == "tcplLite") { - # return the data table by reading the file. No need to run tcplQuery, simply return data.table columns here - fpath <- paste(db, tbl, sep='/') - fpath <- paste(fpath, 'csv', sep='.') - DT <- read.table(fpath, header=T, sep=',', fill=T) - return(colnames(DT)) - - - } - stop(getOption("TCPL_DRVR"), " is not a supported database system. See ", "?tcplConf for more details.") diff --git a/R/tcplLiteInit.R b/R/tcplLiteInit.R deleted file mode 100644 index 35ccbeea..00000000 --- a/R/tcplLiteInit.R +++ /dev/null @@ -1,71 +0,0 @@ -tcplLiteInit <- function () { - # Create initial flat files with appropriate fields - db = getOption("TCPL_DB") - all_files <- list('assay_source'= c('asid', 'assay_source_name', 'assay_source_long_name', 'assay_source_desc'), - 'assay'= c('aid', 'asid', 'assay_name', 'assay_desc', 'timepoint_hr', 'organism_id', 'organism', 'tissue', 'cell_format', 'cell_free_component_source', 'cell_short_name', 'cell_growth_mode', 'assay_footprint', 'assay_format_type', 'assay_format_type_sub', 'content_readout_type', 'dilution_solvent', 'dilution_solvent_percent_max'), - 'assay_component'= c('acid', 'aid', 'assay_component_name', 'assay_component_desc', 'assay_component_target_desc', 'parameter_readout_type', 'assay_design_type', 'assay_design_type_sub', 'biological_process_target', 'detection_technology_type', 'detection_technology_type_sub', 'detection_technology', 'signal_direction_type', 'key_assay_reagent_type', 'key_assay_reagent', 'technological_target_type', 'technological_target_type_sub'), - 'assay_component_endpoint'=c('aeid', 'acid', 'assay_component_endpoint_name', 'export_ready', 'internal_ready', 'assay_component_endpoint_desc', 'assay_function_type', 'normalized_data_type', 'analysis_direction', 'burst_assay', 'key_positive_control', 'signal_direction', 'intended_target_type', 'intended_target_type_sub', 'intended_target_family', 'intended_target_family_sub', 'fit_all', 'cell_viability_assay', 'data_usability'), - 'assay_component_map'= c('acid', 'acsn'), - 'sample'= c('spid', 'chid', 'stkc', 'stkc_unit', 'tested_conc_unit', 'spid_legacy'), - 'chemical_library'= c('chid', 'clib'), - 'chemical' = c('chid', 'casn', 'chnm', 'dsstox_substance_id', 'code'), - - 'mc0'= c('m0id', 'acid', 'spid', 'apid', 'rowi', 'coli', 'wllt', 'wllq', 'conc', 'rval', 'srcf', 'created_date', 'modified_date', 'modified_by'), - 'mc1' = c('m1id', 'm0id', 'acid', 'cndx', 'repi', 'created_date', 'modified_date', 'modified_by'), - 'mc2' = c('m2id', 'm0id', 'acid', 'm1id', 'cval', 'created_date', 'modified_date', 'modified_by'), - - 'mc3' = c('m3id', 'aeid', 'm0id', 'acid', 'm1id', 'm2id', 'bval', 'pval', 'logc', 'resp', 'created_date', 'modified_date', 'modified_by'), - 'mc4' = c('m4id', 'aeid', 'spid', 'bmad', 'resp_max', 'resp_min', 'max_mean', 'max_mean_conc', 'max_med', 'max_med_conc', 'logc_max', 'logc_min', 'cnst', 'hill', 'hcov', 'gnls', 'gcov', 'cnst_er', 'cnst_aic', 'cnst_rmse', 'cnst_prob', 'hill_tp', 'hill_tp_sd', 'hill_ga', 'hill_ga_sd', 'hill_gw', 'hill_gw_sd', 'hill_er', 'hill_er_sd', 'hill_aic', 'hill_rmse', 'hill_prob', 'gnls_tp', 'gnls_tp_sd', 'gnls_ga', 'gnls_ga_sd', 'gnls_gw', 'gnls_gw_sd', 'gnls_la', 'gnls_la_sd', 'gnls_lw', 'gnls_lw_sd', 'gnls_er', 'gnls_er_sd', 'gnls_aic', 'gnls_rmse', 'gnls_prob', 'nconc', 'npts', 'nrep', 'nmed_gtbl', 'tmpi', 'created_date', 'modified_date', 'modified_by'), - 'mc4_agg' = c('aeid', 'm0id', 'm1id', 'm2id', 'm3id', 'm4id'), - 'mc5' = c('m5id', 'm4id', 'aeid', 'modl', 'hitc', 'fitc', 'coff', 'actp', 'modl_er', 'modl_tp', 'modl_ga', 'modl_gw', 'modl_la', 'modl_lw', 'modl_prob', 'modl_rmse', 'modl_acc', 'modl_acb', 'modl_ac10', 'model_type', 'created_date', 'modified_date', 'modified_by'), - 'mc6' = c('m6id', 'm5id', 'm4id', 'aeid', 'mc6_mthd_id', 'flag', 'fval', 'fval_unit', 'created_date', 'modified_date', 'modified_by'), - - 'mc2_acid' = c('mc2_mthd_id', 'acid', 'exec_ordr', 'created_date', 'modified_date', 'modified_by'), - 'mc3_aeid' = c('mc3_mthd_id', 'aeid', 'exec_ordr', 'created_date', 'modified_date', 'modified_by'), - 'mc4_aeid' = c('mc4_mthd_id', 'aeid', 'created_date', 'modified_date', 'modified_by'), - 'mc5_aeid' = c('aeid', 'mc5_mthd_id', 'created_date', 'modified_date', 'modified_by'), - 'mc6_aeid' = c('aeid', 'mc6_mthd_id', 'created_date', 'modified_date', 'modified_by'), - - 'sc0' = c('s0id', 'acid', 'spid', 'apid', 'rowi', 'coli', 'wllt', 'wllq', 'conc', 'rval', 'srcf', 'created_date', 'modified_date', 'modified_by'), - 'sc1' = c('s1id', 's0id', 'acid', 'aeid', 'logc', 'bval', 'pval', 'resp', 'created_date', 'modified_date', 'modified_by'), - 'sc2' = c('s2id', 'aeid', 'spid', 'bmad', 'max_med', 'coff', 'hitc', 'tmpi', 'created_date', 'modified_date', 'modified_by'), - 'sc2_agg' = c('aeid', 's0id', 's1id', 's2id'), - 'sc1_aeid' = c('sc1_mthd_id', 'aeid', 'exec_ordr', 'created_date', 'modified_date', 'modified_by'), - 'sc2_aeid' = c('sc2_mthd_id', 'aeid', 'created_date', 'modified_date', 'modified_by') - ) - for (k in names(all_files)) { - v = all_files[[k]] - fpath <- paste(db, k, sep='/') - fpath <- paste(fpath, 'csv', sep='.') - if (!file.exists(fpath)) { - df <- data.frame(matrix(ncol=length(v), nrow=0)) - colnames(df) <- v - print(sprintf("Writing local %s table for future referencing.", k)) - write.table(df, file=fpath, append=F, row.names=F, sep=',', col.names=T) - } - } - - methods = c("mc2_methods", "mc3_methods","mc4_methods", "mc5_methods","mc5_fit_categories", "mc6_methods", "sc1_methods", "sc2_methods")#, "chemical") - - for (m in methods) { - tcpl_fpath <- file.path(system.file(package = "tcpl"), "csv") - tcpl_fpath <- paste(tcpl_fpath, m, sep='/') - tcpl_fpath <- paste(tcpl_fpath, 'csv', sep='.') - fpath <- paste(db, m, sep='/') - fpath <- paste(fpath, 'csv', sep='.') - if (!file.exists(fpath)) { - print(sprintf("Writing local %s table for future referencing.", m)) - file.copy(tcpl_fpath, db) - } - - - } - - - - - - - - -} \ No newline at end of file diff --git a/R/tcplLoadAcid.R b/R/tcplLoadAcid.R index 3aab297c..0629bac0 100644 --- a/R/tcplLoadAcid.R +++ b/R/tcplLoadAcid.R @@ -7,6 +7,14 @@ #' @export tcplLoadAcid <- function(fld = NULL, val = NULL, add.fld = NULL) { + + if (getOption("TCPL_DRVR") == "API") { + dat <- tcplQueryAPI(resource = "assay", fld = fld, val = val, return_flds = c("acid", "assay_component_name", add.fld)) + setnames(dat, "assay_component_name", "acnm") + setorder(dat, "acid") + return(unique(dat, by = c(fld, "acid", "acnm"))) + } + tbl = c("assay_component", "assay_component_map", "assay") out <- c("assay_component.acid", "assay_component.assay_component_name") diff --git a/R/tcplLoadAeid.R b/R/tcplLoadAeid.R index 19031426..50e5e800 100644 --- a/R/tcplLoadAeid.R +++ b/R/tcplLoadAeid.R @@ -7,6 +7,14 @@ #' @export tcplLoadAeid <- function(fld = NULL, val = NULL, add.fld = NULL) { + + if (getOption("TCPL_DRVR") == "API") { + dat <- tcplQueryAPI(resource = "assay", fld = fld, val = val, return_flds = c("aeid", "assay_component_endpoint_name", add.fld)) + setnames(dat, "assay_component_endpoint_name", "aenm") + setorder(dat, "aeid") + return(unique(dat, by = c(fld, "aeid", "aenm"))) + } + tbl = c("assay_component_endpoint", "assay", "assay_component") out <- c("assay_component_endpoint.aeid", "assay_component_endpoint.assay_component_endpoint_name") diff --git a/R/tcplLoadAid.R b/R/tcplLoadAid.R index 054d231d..1a4d855f 100644 --- a/R/tcplLoadAid.R +++ b/R/tcplLoadAid.R @@ -7,6 +7,14 @@ #' @export tcplLoadAid <- function(fld = NULL, val = NULL, add.fld = NULL) { + + if (getOption("TCPL_DRVR") == "API") { + dat <- tcplQueryAPI(resource = "assay", fld = fld, val = val, return_flds = c("aid", "assay_name", add.fld)) + setnames(dat, "assay_name", "anm") + setorder(dat, "aid") + return(unique(dat, by = c(fld, "aid", "anm"))) + } + tbl=c("assay") out <- c("assay.aid", "assay.assay_name") diff --git a/R/tcplLoadAsid.R b/R/tcplLoadAsid.R index 0b3b4edc..8e277ce5 100644 --- a/R/tcplLoadAsid.R +++ b/R/tcplLoadAsid.R @@ -7,6 +7,14 @@ #' @export tcplLoadAsid <- function(fld = NULL, val = NULL, add.fld = NULL) { + + if (getOption("TCPL_DRVR") == "API") { + dat <- tcplQueryAPI(resource = "assay", fld = fld, val = val, return_flds = c("asid", "assay_source_name", add.fld)) + setnames(dat, "assay_source_name", "asnm") + setorder(dat, "asid") + return(unique(dat, by = c(fld, "asid", "asnm"))) + } + tbl = "assay_source" out <- c("assay_source.asid", "assay_source.assay_source_name") diff --git a/R/tcplLoadChem.R b/R/tcplLoadChem.R index 356761f0..3a7d2c28 100644 --- a/R/tcplLoadChem.R +++ b/R/tcplLoadChem.R @@ -25,11 +25,7 @@ #' the string in 'val' to an RLIKE statement within the MySQL query. #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' +#' \dontrun{ #' ## Passing no parameters gives all of the registered chemicals with their #' ## sample IDs #' tcplLoadChem() @@ -43,9 +39,7 @@ #' ## Other examples: #' tcplLoadChem(field = "chnm", val = "Bisphenol A") #' tcplLoadChem(field = "chid", val = 20182) -#' -#' ## Reset configuration -#' options(conf_store) +#' } #' #' @return A data.table with the chemical information for the given parameters #' @@ -54,24 +48,35 @@ tcplLoadChem <- function(field = NULL, val = NULL, exact = TRUE, include.spid = TRUE) { - tbl <- c("chemical", "sample") - ## Variable-binding to pass R CMD Check - code <- casn <- chid <- chnm <- dsstox_substance_id <- NULL - - if (!is.null(field)) { - vfield <- c("chid", "spid", "chnm", "casn", "code", "chem.only","dsstox_substance_id") - if (!field %in% vfield) stop("Invalid 'field' value.") - } - - qstring <- .ChemQ(field = field, val = val, exact = exact) - - dat <- tcplQuery(query = qstring, tbl=tbl) - dat <- as.data.table(dat) - - if (nrow(dat) == 0) { - warning("The given ", field,"(s) are not in the tcpl database.") - return(dat[]) + if (getOption("TCPL_DRVR") == "API") { + if (tolower(field) != "spid") stop("When drvr option is set to 'API', only 'spid' is a valid 'field' value.") + if (!exact) exact <- TRUE + dat <- tcplQueryAPI(resource = "data", fld = "spid", val = val, return_flds = c("spid", "chid", "casn", "chnm", "dsstox_substance_id")) + if (!length(colnames(dat))) { + return(dat) + } + setorder(dat, "spid") + } else { + tbl <- c("chemical", "sample") + ## Variable-binding to pass R CMD Check + code <- casn <- chid <- chnm <- dsstox_substance_id <- NULL + + if (!is.null(field)) { + vfield <- c("chid", "spid", "chnm", "casn", "code", "chem.only","dsstox_substance_id") + if (!field %in% vfield) stop("Invalid 'field' value.") + } + + + qstring <- .ChemQ(field = field, val = val, exact = exact) + + dat <- tcplQuery(query = qstring, tbl=tbl) + dat <- as.data.table(dat) + + if (nrow(dat) == 0) { + warning("The given ", field,"(s) are not in the tcpl database.") + return(dat[]) + } } dat[ , code := NA_character_] @@ -79,11 +84,11 @@ tcplLoadChem <- function(field = NULL, val = NULL, exact = TRUE, dat[ , chid := as.integer(chid)] dat <- unique(dat) - if (include.spid) return (dat) + if (include.spid) return(unique(dat, by = c("spid", "chid"))) dat <- unique(dat[ , list(chid, chnm, casn, code, dsstox_substance_id)]) - dat[] + unique(dat, by = c("spid", "chid"))[] } diff --git a/R/tcplLoadChemList.R b/R/tcplLoadChemList.R new file mode 100644 index 00000000..06e288a3 --- /dev/null +++ b/R/tcplLoadChemList.R @@ -0,0 +1,79 @@ +#------------------------------------------------------------------------------- +# tcplLoadChemList: Load chemical list information +#------------------------------------------------------------------------------- + +#' @title Load chemical list information +#' +#' @description +#' \code{tcplLoadChemList} queries the tcpl databases and returns information +#' about the chemical lists. +#' +#' @param field Character of length 1, \code{'chid'}, \code{'dsstox_substance_id'} +#' or \code{'list_acronym'}, whether to search by chemical id (chid), +#' dsstox_substance_id, or list_acronym +#' @param val The values to query on +#' +#' @details +#' 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). +#' +#' @examples +#' \dontrun{ +#' ## 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") +#' } +#' +#' @return A data.table with the chemical list information for the given +#' parameters. +#' +#' @import data.table +#' @export + +tcplLoadChemList <- function(field = NULL, val = NULL) { + tbl = c("chemical_library") + if (!is.null(field)) { + vfield <- c("chid", "dsstox_substance_id","list_acronym") + if (!field %in% vfield) stop("Invalid 'field' value.") + } + + qstring <- .ChemListQ(field = field, val = val) + + dat <- tcplQuery(query = qstring, db = getOption("TCPL_DB"), tbl=tbl) + + + if (!is.null(field)) { + + if (nrow(dat) == 0) { + warning("The given ", field,"(s) do not have chemical list(s) assigned.") + return(dat[]) + } + + } + + dat[] + +} + +#------------------------------------------------------------------------------- diff --git a/R/tcplLoadClib.R b/R/tcplLoadClib.R deleted file mode 100644 index 702bbc92..00000000 --- a/R/tcplLoadClib.R +++ /dev/null @@ -1,86 +0,0 @@ -#------------------------------------------------------------------------------- -# tcplLoadClib: Load chemical library information -#------------------------------------------------------------------------------- - -#' @title Load chemical library information -#' -#' @description -#' \code{tcplLoadClib} queries the tcpl databases and returns information -#' about the chemical library. -#' -#' @param field Character of length 1, \code{'chid'} or \code{'clib'}, whether -#' to search by chemical id (chid), or chemical library (clib) -#' @param val The values to query on -#' -#' @details -#' Chemicals are stored in different libraries by chemical ID. Therefore, it -#' is not possible to delineate samples with the same chemical ID into two -#' distinct chemical libraries. However, it is possible for a chemical ID to -#' belong to more than one (or no) chemical libraries. -#' -#' When chemicals belong to more than one library, the chemical is listed -#' multiple times (one for each distinct library). -#' -#' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' -#' ## Passing no parameters gives all of the chemical ISs that have a chemical -#' ## library registered -#' clib <- tcplLoadClib() -#' -#' ## Notice there are more rows in tcplLoadClib than in tcplLoadChem, -#' ## indicating some chemicals must belong to more than library. -#' chem <- tcplLoadChem(include.spid = FALSE) -#' nrow(chem) -#' nrow(clib) -#' -#' ## It is possible that some chemicals do not have a chemical library -#' ## registered, although this is not the case in the example data. -#' all(chem$chid %in% clib$chid) -#' -#' ## Show the unique chemical libraries -#' clib[ , unique(clib)] -#' -#' ## Specifying a chemical library will not show what other libraries a -#' ## chemical might belong to. -#' tcplLoadClib(field = "clib", val = "TOXCAST") -#' tcplLoadClib(field = "chid", val = 20182) -#' -#' ## Reset configuration -#' options(conf_store) -#' -#' @return A data.table with the chemical library information for the given -#' parameters. -#' -#' @import data.table -#' @export - -tcplLoadClib <- function(field = NULL, val = NULL) { - tbl = c("chemical_library") - if (!is.null(field)) { - vfield <- c("chid", "clib") - if (!field %in% vfield) stop("Invalid 'field' value.") - } - - qstring <- .ClibQ(field = field, val = val) - - dat <- tcplQuery(query = qstring, db = getOption("TCPL_DB"), tbl=tbl) - - - if (!is.null(field)) { - - if (nrow(dat) == 0) { - warning("The given ", field,"(s) do not have chemical library assigned.") - return(dat[]) - } - - } - - dat[] - -} - -#------------------------------------------------------------------------------- diff --git a/R/tcplLoadConcUnit.R b/R/tcplLoadConcUnit.R index 42016475..5e8c2e86 100644 --- a/R/tcplLoadConcUnit.R +++ b/R/tcplLoadConcUnit.R @@ -13,12 +13,22 @@ #' @return A data.table containing level 3 correction methods for the given #' spids. #' -#' @seealso \code{\link{tcplQuery}}, \code{\link{data.table}} +#' @seealso \code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} #' #' @import data.table +#' @export tcplLoadConcUnit <- function(spid) { + if (getOption("TCPL_DRVR") == "API") { + dat <- tcplQueryAPI(resource = "data", fld = "spid", val = spid, return_flds = c("spid", "tested_conc_unit")) + if (length(colnames(dat))) { + setnames(dat, "tested_conc_unit", "conc_unit") + setorder(dat, "spid") + } + return(unique(dat, by = c("spid", "conc_unit"))) + } + qformat <- ' SELECT diff --git a/R/tcplLoadData.R b/R/tcplLoadData.R index 2882cc7c..25820f90 100644 --- a/R/tcplLoadData.R +++ b/R/tcplLoadData.R @@ -25,6 +25,15 @@ #' 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 \code{tcplConf()} was set with "API" as the driver, then \code{tcplLoadData} +#' will return data from the CCTE Bioactivity API. API data is available for +#' \code{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 \code{add.fld} to +#' \code{TRUE}. API query-able fields include "aeid", "spid", "m4id", and +#' "dtxsid". #' #' Leaving \code{fld} NULL will return all data. #' @@ -47,11 +56,7 @@ #' } #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' +#' \dontrun{ #' ## Load all of level 0 for multiple-concentration data, note 'mc' is the #' ## default value for type #' tcplLoadData(lvl = 0) @@ -66,29 +71,27 @@ #' ## 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))) -#' -#' ## Reset configuration -#' options(conf_store) +#' } #' @return A data.table containing data for the given fields. #' -#' @seealso \code{\link{tcplQuery}}, \code{\link{data.table}} +#' @seealso \code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} #' #' @import data.table -#' @importFrom tidyr pivot_wider +#' @importFrom tidyr pivot_wider unnest_longer #' @importFrom utils data +#' @importFrom rlang exec sym #' @export tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRUE) { #variable binding model <- model_param <- model_val <- NULL hit_param <- hit_val <- sc_vignette <- mc_vignette <- NULL + conc <- resp <- flag <- tbls <- NULL if (length(lvl) > 1 | length(type) > 1) { stop("'lvl' & 'type' must be of length 1.") } - tbls <- NULL - drvr <- getOption("TCPL_DRVR") if (drvr == "example"){ if (type == "sc"){ @@ -100,7 +103,7 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU } else if (lvl == 1L) { sc1 <- sc_vignette[["sc1"]] - sc1 <- sc1[,c("s0id","s1id","spid","acid","aeid","apid","rowi","coli","wllt","logc","resp")] + sc1 <- sc1[,c("s0id","s1id","spid","acid","aeid","apid","rowi","coli","wllt","conc","resp")] return(sc1) } @@ -113,7 +116,7 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU sc1 <- sc_vignette[["sc1"]] sc2 <- sc_vignette[["sc2"]] agg <- sc1[sc2, on = c("spid","aeid")] - agg <- agg[,c("aeid","s2id","s1id","s0id","logc","resp")] + agg <- agg[,c("aeid","s2id","s1id","s0id","conc","resp")] return(agg) } else stop("example tables for sc0, sc1, sc2, agg available.") @@ -138,14 +141,17 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU } else if (lvl == 3L) { mc3 <- mc_vignette[["mc3"]] - mc3 <- mc3[,c("m0id","m1id","m2id","m3id","spid","aeid","logc","resp","cndx","wllt","apid","rowi","coli","repi")] + mc3 <- mc3[,c("m0id","m1id","m2id","m3id","spid","aeid","conc","resp","cndx","wllt","apid","rowi","coli","repi")] return(mc3) } else if (lvl == 4L) { mc4 <- mc_vignette[["mc4"]] if (!add.fld) { - mc4 <- mc4[,c("m4id","aeid","spid","bmad","resp_max","resp_min","max_mean","max_mean_conc","max_med","max_med_conc", - "logc_max","logc_min","nconc","npts","nrep","nmed_gtbl")] + mc4 <- mc4[,c("m4id", "aeid", "spid", "bmad", "resp_max", "resp_min", + "max_mean", "max_mean_conc", "min_mean", "min_mean_conc", + "max_med", "max_med_conc", "min_med", "min_med_conc", + "max_med_diff", "max_med_diff_conc", "conc_max", "conc_min", + "nconc", "npts", "nrep", "nmed_gtbl_pos", "nmed_gtbl_neg")] } else { mc4 <- mc4[,!c("chid","casn","chnm","dsstox_substance_id","code","aenm","resp_unit","conc_unit")] setcolorder(mc4, c("m4id", "aeid", "spid")) @@ -155,10 +161,15 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU else if (lvl == 5L) { mc5 <- mc_vignette[["mc5"]] if (!add.fld){ - mc5 <- mc5[,c("m5id","m4id","aeid","spid","bmad","resp_max","resp_min","max_mean","max_mean_conc","max_med", - "max_med_conc","logc_max","logc_min","nconc","npts","nrep","nmed_gtbl","hitc","modl","fitc","coff")] + mc5 <- mc5[,c("m5id","m4id", "aeid", "spid", "bmad", "resp_max", "resp_min", + "max_mean", "max_mean_conc", "min_mean", "min_mean_conc", + "max_med", "max_med_conc", "min_med", "min_med_conc", + "max_med_diff", "max_med_diff_conc", "conc_max", "conc_min", + "nconc", "npts", "nrep", "nmed_gtbl_pos", "nmed_gtbl_neg", + "hitc", "modl", "fitc", "coff")] } else { - mc5 <- mc5[,!c("chid","casn","chnm","dsstox_substance_id","code","aenm","resp_unit","conc_unit","tp","ga","q","la","ac50_loss")] + mc5 <- mc5[,!c("chid","casn","chnm","dsstox_substance_id","code","aenm", + "resp_unit","conc_unit","tp","ga","q","la","ac50_loss")] setcolorder(mc5, c("m5id", "m4id","aeid", "spid")) } return(mc5) @@ -167,7 +178,8 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU mc3 <- mc_vignette[["mc3"]] mc4 <- mc_vignette[["mc4"]] agg <- mc3[mc4, on = c("spid","aeid")] - agg <- agg[, c("aeid", "m4id", "m3id", "m2id", "m1id", "m0id", "spid", "logc", "resp")] + agg <- agg[, c("aeid", "m4id", "m3id", "m2id", "m1id", "m0id", "spid", + "conc", "resp")] return(agg) } @@ -176,549 +188,90 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU else stop("Invalid 'lvl' and 'type' combination.") } - - if (drvr != "example"){ + else if (drvr == "API") { - if (lvl == 0L && type == "mc") { - tbls <- c("mc0") - cols <- c( - "m0id", - "spid", - "acid", - "apid", - "rowi", - "coli", - "wllt", - "wllq", - "conc", - "rval", - "srcf" - ) - - if (check_tcpl_db_schema()) { - cols <- c(cols, "clowder_uid", "git_hash") - } - - col_str <- paste0(cols, collapse = ",") - qformat <- paste0("SELECT ", col_str, " FROM mc0 ") - } + # check type and lvl + if (type != "mc") stop("Only type = 'mc' is supported using API data as source.") + # if lvl is outside of 3-6 while not agg either + if ((lvl < 3 | lvl > 6) & lvl != "agg") stop("Only lvl = c(3,4,5,6) and 'agg' are supported using API data as source.") - if (lvl == 0L && type == "sc") { - tbls <- c("sc0") - - cols <- c( - "s0id", - "spid", - "acid", - "apid", - "rowi", - "coli", - "wllt", - "wllq", - "conc", - "rval", - "srcf" - ) - - if (check_tcpl_db_schema()) { - cols <- c(cols, "clowder_uid", "git_hash") - } - - col_str <- paste0(cols, collapse = ",") - qformat <- paste0("SELECT ", col_str, " FROM sc0 ") - } - - if (lvl == 1L && type == "mc") { - tbls <- c("mc0", "mc1") - - qformat <- - " - SELECT - mc1.m0id, - m1id, - spid, - mc1.acid, - apid, - rowi, - coli, - wllt, - wllq, - conc, - rval, - cndx, - repi, - srcf - FROM - mc0, - mc1 - WHERE - mc0.m0id = mc1.m0id - " + cols <- NULL + if (!add.fld) { + # load default columns returned regular connection to DB + load_data_columns <- tcpl::load_data_columns + # combine type and lvl into string, like "mc5" + table <- paste0(type, lvl) + # pull regular columns for given table + cols <- unlist(load_data_columns[table]) } - if (lvl == 1L && type == "sc") { - tbls <- c("sc0", "sc1") - - qformat <- - " - SELECT - sc1.s0id, - s1id, - spid, - sc1.acid, - aeid, - apid, - rowi, - coli, - wllt, - logc, - resp - FROM - sc0, - sc1 - WHERE - sc0.s0id = sc1.s0id - " - } - - if (lvl == 2L && type == "mc") { - tbls <- c("mc0", "mc1", "mc2") - - qformat <- - " - SELECT - mc2.m0id, - mc2.m1id, - m2id, - spid, - mc2.acid, - apid, - rowi, - coli, - wllt, - conc, - cval, - cndx, - repi - FROM - mc0, - mc1, - mc2 - WHERE - mc0.m0id = mc1.m0id - AND - mc1.m0id = mc2.m0id - " - } + # query the API + dat <- tcplQueryAPI(fld = fld, val = val, return_flds = cols) - if (lvl == 2L && type == "sc") { - tbls <- c("sc2") - - qformat <- - " - SELECT - s2id, - spid, - aeid, - bmad, - max_med, - hitc, - coff - FROM - sc2 - " - } - - if (lvl == "agg" && type == "sc") { - tbls <- c("sc1", "sc2_agg") - - qformat <- - " - SELECT - sc2_agg.aeid, - sc2_agg.s2id, - sc2_agg.s1id, - sc2_agg.s0id, - logc, - resp - FROM - sc1, - sc2_agg - WHERE - sc1.s1id = sc2_agg.s1id - " - } - - if (lvl == 3L && type == "mc") { - tbls <- c("mc0", "mc1", "mc3") - - qformat <- - " - SELECT - mc3.m0id, - mc3.m1id, - mc3.m2id, - m3id, - spid, - aeid, - logc, - resp, - cndx, - wllt, - apid, - rowi, - coli, - repi - FROM - mc0, - mc1, - mc3 - WHERE - mc0.m0id = mc1.m0id - AND - mc1.m0id = mc3.m0id - " - } - - if (lvl == "agg" && type == "mc") { - tbls <- c("mc3", "mc4_agg", "mc4") - - qformat <- - " - SELECT - mc4_agg.aeid, - mc4_agg.m4id, - mc4_agg.m3id, - mc4_agg.m2id, - mc4_agg.m1id, - mc4_agg.m0id, - mc4.spid, - logc, - resp - FROM - mc3, - mc4_agg, - mc4 - WHERE - mc3.m3id = mc4_agg.m3id - AND - mc4.m4id = mc4_agg.m4id - " - } - if (lvl == 4L && type == "mc" && check_tcpl_db_schema()) { - tbls <- c("mc4") - if (!add.fld) { - qformat <- - " - SELECT - m4id, - aeid, - spid, - bmad, - resp_max, - resp_min, - max_mean, - max_mean_conc, - max_med, - max_med_conc, - logc_max, - logc_min, - nconc, - npts, - nrep, - nmed_gtbl - FROM - mc4 - " - } else { - tbls <- c("mc4", "mc4_param") - qformat <- - " - SELECT - mc4.m4id, - mc4.aeid, - spid, - bmad, - resp_max, - resp_min, - max_mean, - max_mean_conc, - max_med, - max_med_conc, - logc_max, - logc_min, - nconc, - npts, - nrep, - nmed_gtbl, - model, - model_param, - model_val - FROM - mc4_param, - mc4 - WHERE - mc4.m4id = mc4_param.m4id - " + if (length(colnames(dat))) { + if (lvl == 3 | lvl == "agg") { + dat$resp <- lapply(dat$resp, unlist) + dat$logc <- lapply(dat$logc, unlist) + if (lvl == 3) dat <- unnest_longer(dat, c(conc, logc, resp)) %>% as.data.table() + else dat <- unnest_longer(dat, c(logc, resp)) %>% as.data.table() } - } else if (lvl == 4L && type == "mc") { - tbls <- c("mc4") - qformat <- - " - SELECT - m4id, - aeid, - spid, - bmad, - resp_max, - resp_min, - max_mean, - max_mean_conc, - max_med, - max_med_conc, - logc_max, - logc_min, - cnst, - hill, - hcov, - gnls, - gcov, - cnst_er, - cnst_aic, - cnst_rmse, - cnst_prob, - hill_tp, - hill_tp_sd, - hill_ga, - hill_ga_sd, - hill_gw, - hill_gw_sd, - hill_er, - hill_er_sd, - hill_aic, - hill_rmse, - hill_prob, - gnls_tp, - gnls_tp_sd, - gnls_ga, - gnls_ga_sd, - gnls_gw, - gnls_gw_sd, - gnls_la, - gnls_la_sd, - gnls_lw, - gnls_lw_sd, - gnls_er, - gnls_er_sd, - gnls_aic, - gnls_rmse, - gnls_prob, - nconc, - npts, - nrep, - nmed_gtbl - FROM - mc4 - " - } - - if (lvl == 5L && type == "mc" && check_tcpl_db_schema()) { - if (!add.fld) { - tbls <- c("mc4", "mc5") - - qformat <- - " - SELECT - m5id, - mc5.m4id, - mc5.aeid, - spid, - bmad, - resp_max, - resp_min, - max_mean, - max_mean_conc, - max_med, - max_med_conc, - logc_max, - logc_min, - nconc, - npts, - nrep, - nmed_gtbl, - hitc, - modl, - fitc, - coff - FROM - mc4, - mc5 - WHERE - mc4.m4id = mc5.m4id - " - } else { - tbls <- c("mc4", "mc5", "mc5_param") - qformat <- - " - SELECT - mc5.m5id, - mc5.m4id, - mc5.aeid, - spid, - bmad, - resp_max, - resp_min, - max_mean, - max_mean_conc, - max_med, - max_med_conc, - logc_max, - logc_min, - nconc, - npts, - nrep, - nmed_gtbl, - hitc, - modl, - fitc, - coff, - hit_param, - hit_val - FROM - mc4, - mc5, - mc5_param - WHERE - mc4.m4id = mc5.m4id - AND - mc5.m5id = mc5_param.m5id - " + if (lvl == 6) { + dat$flag <- lapply(dat$flag, unlist) + dat <- unnest_longer(dat, flag) %>% filter(flag != "NULL") %>% as.data.table() } - } else if (lvl == 5L && type == "mc") { - tbls <- c("mc4", "mc5") - - qformat <- - " - SELECT - m5id, - mc5.m4id, - mc5.aeid, - spid, - bmad, - resp_max, - resp_min, - max_mean, - max_mean_conc, - max_med, - max_med_conc, - logc_max, - logc_min, - cnst, - hill, - hcov, - gnls, - gcov, - cnst_er, - cnst_aic, - cnst_rmse, - cnst_prob, - hill_tp, - hill_tp_sd, - hill_ga, - hill_ga_sd, - hill_gw, - hill_gw_sd, - hill_er, - hill_er_sd, - hill_aic, - hill_rmse, - hill_prob, - gnls_tp, - gnls_tp_sd, - gnls_ga, - gnls_ga_sd, - gnls_gw, - gnls_gw_sd, - gnls_la, - gnls_la_sd, - gnls_lw, - gnls_lw_sd, - gnls_er, - gnls_er_sd, - gnls_aic, - gnls_rmse, - gnls_prob, - nconc, - npts, - nrep, - nmed_gtbl, - hitc, - modl, - fitc, - coff, - actp, - modl_er, - modl_tp, - modl_ga, - modl_gw, - modl_la, - modl_lw, - modl_rmse, - modl_prob, - modl_acc, - modl_acb, - modl_ac10 - FROM - mc4, - mc5 - WHERE - mc4.m4id = mc5.m4id - " - } - - if (lvl == 6L && type == "mc") { - tbls <- c("mc4", "mc6") - - qformat <- - " - SELECT - mc6.aeid, - m6id, - mc6.m4id, - m5id, - spid, - mc6_mthd_id, - flag - FROM - mc4, - mc6 - WHERE - mc6.m4id = mc4.m4id - " } + + return(dat) + + } + else { - if (lvl == 7L && type == "mc") { - tbls <- c("mc7") - - qformat <- - " - SELECT - mc7.* - FROM - mc4, - mc7 - WHERE - mc7.m4id = mc4.m4id - " - } + # add.fld is not possible if invitrodb version less than 4 + if (!check_tcpl_db_schema()) add.fld <- FALSE - if (is.null(tbls)) stop("Invalid 'lvl' and 'type' combination.") + table <- paste0(type, lvl) + tbls_joins <- case_when( + table == "sc0" ~ list(tbls = "sc0", + joins = NULL), + table == "sc1" ~ list(tbls = "sc0,sc1", + joins = "sc0.s0id = sc1.s0id"), + table == "sc2" ~ list(tbls = "sc2", + joins = NULL), + table == "scagg" ~ list(tbls = "sc1,sc2_agg", + joins = "sc1.s1id = sc2_agg.s1id"), + table == "mc0" ~ list(tbls = "mc0", + joins = NULL), + table == "mc1" ~ list(tbls = "mc0,mc1", + joins = "mc0.m0id = mc1.m0id"), + table == "mc2" ~ list(tbls = "mc0,mc1,mc2", + joins = "mc0.m0id = mc1.m0id AND mc1.m0id = mc2.m0id"), + table == "mc3" ~ list(tbls = "mc0,mc1,mc3", + joins = "mc0.m0id = mc1.m0id AND mc1.m0id = mc3.m0id"), + table == "mcagg" ~ list(tbls = "mc3,mc4,mc4_agg", + joins = "mc3.m3id = mc4_agg.m3id AND mc4.m4id = mc4_agg.m4id"), + table == "mc4" && add.fld == FALSE ~ list(tbls = "mc4", + joins = NULL), + table == "mc4" && add.fld == TRUE ~ list(tbls = "mc4,mc4_param", + joins = "mc4.m4id = mc4_param.m4id"), + table == "mc5" && add.fld == FALSE ~ list(tbls = "mc4,mc5", + joins = "mc4.m4id = mc5.m4id"), + table == "mc5" && add.fld == TRUE ~ list(tbls = "mc4,mc5,mc5_param", + joins = "mc4.m4id = mc5.m4id AND mc5.m5id = mc5_param.m5id"), + table == "mc6" ~ list(tbls = "mc4,mc6", + joins = "mc6.m4id = mc4.m4id"), + table == "mc7" ~ list(tbls = "mc4,mc7", + joins = "mc7.m4id = mc4.m4id"), + TRUE ~ list(tbls = NULL, joins = NULL)) + + if (is.null(tbls_joins$tbls)) stop("Invalid 'lvl' and 'type' combination.") + qformat <- paste0("SELECT * FROM ", tbls_joins$tbls, ifelse(is.null(tbls_joins$joins), "", paste(" WHERE", tbls_joins$joins))) + if (!is.null(fld)) { if (is.null(val)) stop("'val' cannot be NULL check that a valid value was provided for the specified field") - fld <- .prepField(fld = fld, tbl = tbls, db = getOption("TCPL_DB")) + fld <- .prepField(fld = fld, tbl = unlist(strsplit(tbls_joins$tbls, ",")), db = getOption("TCPL_DB")) if(add.fld) wtest <- FALSE wtest <- lvl %in% c(0) | (lvl == 2 & type == "sc") @@ -745,6 +298,11 @@ tcplLoadData <- function(lvl, fld = NULL, val = NULL, type = "mc", add.fld = TRU dat <- suppressWarnings(tcplQuery(query = qstring, db = getOption("TCPL_DB"), tbl = tbls)) + # remove duplicate columns as a result of joins + dat <- dat[, which(duplicated(names(dat))) := NULL] + # remove unnecessary columns from output + dat <- dat %>% select(-contains(c("created_date", "modified_date", "modified_by", "actp", "tmpi", "bval", "pval", ".."))) + # pivot table so 1 id per return and only return added fields if(add.fld & check_tcpl_db_schema()){ if(lvl == 4L) dat <- as.data.table(tidyr::pivot_wider(dat, names_from = c(model,model_param), values_from = model_val)) diff --git a/R/tcplLoadUnit.R b/R/tcplLoadUnit.R index 21edbeb6..9ab766fe 100644 --- a/R/tcplLoadUnit.R +++ b/R/tcplLoadUnit.R @@ -13,12 +13,20 @@ #' @return A data.table containing level 3 correction methods for the given #' aeids. #' -#' @seealso \code{\link{tcplQuery}}, \code{\link{data.table}} +#' @seealso \code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} #' #' @import data.table +#' @export tcplLoadUnit <- function(aeid) { + if (getOption("TCPL_DRVR") == "API") { + dat <- tcplQueryAPI(resource = "assay", fld = "aeid", val = aeid, return_flds = c("aeid", "normalized_data_type")) + setnames(dat, "normalized_data_type", "resp_unit") + setorder(dat, "aeid") + return(dat) + } + qformat <- " SELECT diff --git a/R/tcplLvlCount.R b/R/tcplLvlCount.R index d97c83d9..2e3cdae5 100644 --- a/R/tcplLvlCount.R +++ b/R/tcplLvlCount.R @@ -20,16 +20,10 @@ #' #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' TCPLlite <- file.path(system.file(package = "tcpl"), "example") -#' tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") -#' +#' \dontrun{ #' ## Get all counts for level 1 for multiple-concentration #' tcplLvlCount(lvls = 1) #' -#' \dontrun{ #' ## Get all counts for levels 4 through 7 for multiple-concentration #' tcplLvlCount(lvls = 4:7) #' @@ -37,13 +31,10 @@ #' ## default value for type #' tcplLvlCount() #' } -#' -#' ## Reset configuration -#' options(conf_store) #' #' @return A data.table containing data for the given fields. #' -#' @seealso \code{\link{tcplQuery}}, \code{\link{data.table}} +#' @seealso \code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} #' #' @import data.table #' @export diff --git a/R/tcplMakeAeidMultiPlts.R b/R/tcplMakeAeidMultiPlts.R index 75d19491..2f201d03 100644 --- a/R/tcplMakeAeidMultiPlts.R +++ b/R/tcplMakeAeidMultiPlts.R @@ -11,8 +11,6 @@ #' @param lvl Integer of length 1, the data level to use (4-7) #' @param fname Character, the filename #' @param odir The directory to save the .pdf file in -#' @param clib Character, the chemical library to subset on, see -#' \code{\link{tcplLoadClib}} for more information. #' @param hitc.all If FALSE, only plots with hitc==1 will be displayed #' #' @details @@ -25,7 +23,9 @@ #' @import data.table #' @importFrom grDevices graphics.off pdf #' @export -tcplMakeAeidMultiPlts <- function (aeid, lvl = 4L, fname = NULL, odir = getwd(), clib = NULL, hitc.all = TRUE) { +tcplMakeAeidMultiPlts <- function (aeid, lvl = 4L, fname = NULL, odir = getwd(), hitc.all = TRUE) { + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") spid <- m4id <- NULL on.exit(graphics.off()) if (length(aeid) > 1) @@ -40,10 +40,6 @@ tcplMakeAeidMultiPlts <- function (aeid, lvl = 4L, fname = NULL, odir = getwd(), } if (nrow(dat) == 0) stop("No data for AEID", aeid) - if (!is.null(clib)) { - csub <- tcplLoadClib(field = "clib", val = clib) - dat <- dat[spid %in% tcplLoadChem(field = "chid", val = csub$chid)$spid] - } prs <- list(type = "mc", fld = "m4id", val = dat[, unique(m4id)]) agg <- do.call(tcplLoadData, args = c(lvl = "agg", prs)) flg <- if (lvl < 6L) { diff --git a/R/tcplMakeAeidPlts.R b/R/tcplMakeAeidPlts.R index 94ea621b..67a3ec9f 100644 --- a/R/tcplMakeAeidPlts.R +++ b/R/tcplMakeAeidPlts.R @@ -13,9 +13,7 @@ #' @param lvl Integer of length 1, the data level to use (4-7). Only level 5-6 valid for compare aeids. #' @param fname Character, the filename #' @param odir The directory to save the .pdf file in -#' @param clib Character, the chemical library to subset on, see #' @param cnst Constant hline to draw on plot -#' \code{\link{tcplLoadClib}} for more information. #' @inheritParams tcplPlotFits #' #' @details @@ -47,11 +45,14 @@ #' @export tcplMakeAeidPlts <- function(aeid, compare=F, lvl = 4L, fname = NULL, odir = getwd(), - ordr.fitc = TRUE, clib = NULL, cnst=NULL) { + ordr.fitc = TRUE, cnst=NULL) { ## Variable-binding to pass R CMD Check spid <- m4id <- NULL + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") + on.exit(graphics.off()) if (length(aeid) > 2) stop("'aeid' must be of length 1 or 2.") @@ -67,10 +68,6 @@ tcplMakeAeidPlts <- function(aeid, compare=F, lvl = 4L, fname = NULL, odir = get if (nrow(dat) == 0) stop("No data for AEID", aeid) - if (!is.null(clib)) { - csub <- tcplLoadClib(field = "clib", val = clib) - dat <- dat[spid %in% tcplLoadChem(field = "chid", val = csub$chid)$spid] - } prs <- list(type = "mc", fld = "m4id", val = dat[ , unique(m4id)]) diff --git a/R/tcplMakeChidMultiPlts.R b/R/tcplMakeChidMultiPlts.R index a9c16112..f2c0dda9 100644 --- a/R/tcplMakeChidMultiPlts.R +++ b/R/tcplMakeChidMultiPlts.R @@ -11,8 +11,6 @@ #' @param lvl Integer of length 1, the data level to use (4-7) #' @param fname Character, the filename #' @param odir The directory to save the .pdf file in -#' @param clib Character, the chemical library to subset on, see -#' \code{\link{tcplLoadClib}} for more information. #' @param hitc.all If FALSE, only plots with hitc==1 will be displayed #' #' @details @@ -25,7 +23,9 @@ #' @import data.table #' @importFrom grDevices graphics.off pdf #' @export -tcplMakeChidMultiPlts <- function (chid, lvl = 4L, fname = NULL, odir = getwd(), clib = NULL, hitc.all = TRUE) { +tcplMakeChidMultiPlts <- function (chid, lvl = 4L, fname = NULL, odir = getwd(), hitc.all = TRUE) { + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") spid <- m4id <- NULL on.exit(graphics.off()) if (length(chid) > 1) @@ -41,10 +41,6 @@ tcplMakeChidMultiPlts <- function (chid, lvl = 4L, fname = NULL, odir = getwd(), } if (nrow(dat) == 0) stop("No data for chid", chid) - if (!is.null(clib)) { - csub <- tcplLoadClib(field = "clib", val = clib) - dat <- dat[spid %in% tcplLoadChem(field = "chid", val = csub$chid)$spid] - } prs <- list(type = "mc", fld = "m4id", val = dat[, unique(m4id)]) agg <- do.call(tcplLoadData, args = c(lvl = "agg", prs)) flg <- if (lvl < 6L) { diff --git a/R/tcplMthdList.R b/R/tcplMthdList.R index 16592c0e..ba924d90 100644 --- a/R/tcplMthdList.R +++ b/R/tcplMthdList.R @@ -7,6 +7,15 @@ tcplMthdList <- function(lvl, type = "mc") { + if (length(lvl) > 1) stop("'lvl' must be an integer of length 1.") + if (!type %in% c("mc", "sc")) stop("Invalid 'type' value.") + if (type == "mc" & !lvl %in% c(2, 3,4, 5, 6)) stop("Invalid 'lvl' value.") + if (type == "sc" & !lvl %in% 1:2) stop("Invalid 'lvl' value.") + + if(getOption("TCPL_DRVR") == "API"){ + return(tcpl::mthd_list_defaults[grep(paste0(type,lvl), names(tcpl::mthd_list_defaults))][[1]]) + } + tbl <- paste0(type, lvl, "_methods") qstring <- paste0("SELECT * FROM ", tbl, ";") diff --git a/R/tcplMultiplot.R b/R/tcplMultiplot.R index f6339f75..bbeb8c7b 100644 --- a/R/tcplMultiplot.R +++ b/R/tcplMultiplot.R @@ -32,6 +32,9 @@ tcplMultiplot <- function (dat, agg, flg = NULL, boot = NULL, browse = FALSE, hi chid <- chnm <- spid <- aenm <- aeid <- m4id <- fitc <- fval <- modl <- hitc <- NULL flgo <- mc6_mthd_id <- J <- NULL + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") + if (!is.null(flg) & !"m5id" %in% names(dat)) { stop("Must supply level 5 data with a non-null 'flg' input.") } diff --git a/R/tcplPlot.R b/R/tcplPlot.R index 8f118d4f..e1bfea9b 100644 --- a/R/tcplPlot.R +++ b/R/tcplPlot.R @@ -5,16 +5,24 @@ #' Generic Plotting Function for tcpl #' #' @description -#' \code{tcplLoadData} queries the tcpl databases and returns a plot +#' \code{tcplPlot} queries the tcpl databases and returns a plot #' for the given level and data type. #' -#' @param lvl Integer of length 1, the level of data to load. +#' @param 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 \code{tcplPlotLoadData}. #' @param type Character of length 1, the data type, "sc" or "mc". #' @param fld Character, the field(s) to query on. #' @param val List, vectors of values for each field to query on. Must be in #' the same order as 'fld'. -#' @param output How should the plot be presented. To view the plot in application, -#' use "console", or to save as a file type, use "pdf", "jpg", "png", "svg", or "tiff". +#' @param 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 +#' @param 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". #' @param 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. @@ -24,109 +32,112 @@ #' is included with the plot. #' @param nrow Integer, number of rows in multiplot. By default 2. #' @param ncol Integer, number of columns in multiplot. By default 3, 2 if verbose. -#' @param dpi Integer, image print resolution. By default 600. +#' @param dpi Integer, image print resolution. By default 600. +#' @param flags Boolean, by default FALSE. If TRUE, level 6 flags are displayed +#' below annotations on plot +#' @param yuniform Boolean, by default FALSE. If TRUE, all plots will have uniform +#' y axis scaling, automatically determined. +#' @param yrange Integer of length 2, for directly setting the y-axis range, +#' c(,). By default, c(NA,NA). #' #' @details -#' The data type can be either 'mc' for mutliple concentration data, or 'sc' +#' 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. #' -#' 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. -#' #' Leaving \code{fld} NULL will return all data. #' @import data.table #' @importFrom gridExtra marrangeGrob #' @importFrom ggplot2 ggsave #' @importFrom dplyr %>% all_of pull +#' @importFrom grDevices pdf.options #' @export #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' -#' tcplPlot(lvl = 4, fld = "m4id", val = c(18609966)) ## Create a level 4 plot -#' -#' ## Reset configuration -#' options(conf_store) -tcplPlot <- function(lvl = 5, fld = "m4id", val = NULL, type = "mc", 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) { +#' \dontrun{ +#' tcplPlot(fld = "m4id", val = c(18609966)) ## Create a level 4 plot +#' } +tcplPlot <- function(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)) { #variable binding - conc_unit <- bmd <- resp <- NULL + conc_unit <- bmd <- resp <- compare.dat <- lvl <- compare <- NULL + + #set pdf options + enc <- pdf.options()$encoding + pdf.options(encoding="CP1253.enc") + on.exit(pdf.options(encoding = enc)) + + # Validate vars based on some assumed properties + validated_vars <- tcplPlotValidate(type = type,flags = flags,output = output,multi = multi,verbose = verbose) + # take list of validated vars and add them to the function's environment + list2env(validated_vars, envir = environment()) + # check_tcpl_db_schema is a user-defined function found in v3_schema_functions.R file - if (check_tcpl_db_schema()) { - # check that input combination is unique - input <- tcplLoadData(lvl = lvl, fld = fld, val = val) - if (nrow(input) == 0) stop("No data for fld/val provided") - # default assign multi=TRUE for output="pdf" - if (output == "pdf" && is.null(multi)) { - multi <- TRUE + if (check_tcpl_db_schema() | !is.null(dat) | getOption("TCPL_DRVR") == "API") { + # check if user supplied data. If not, load from db connection + if(is.null(dat)){ + dat <- tcplPlotLoadData(type = type, fld = fld, val = val, flags = flags) #code defined in tcplPlotUtils.R + } + # if user supplies dat we still need to add compare indicator + dat <- dat[,compare := FALSE] + if(!is.null(compare.val)){ + compare.dat <- tcplPlotLoadData(type = type,fld = fld, val = compare.val, flags = flags)[,compare := TRUE] #code defined in tcplPlotUtils.R + if (nrow(compare.dat) == 0) stop("No compare data for fld/val provided") } - # forced assign multi=FALSE for output = c("console","png","jpg","svg","tiff"), verbose=FALSE for output="console" - if (output !="pdf") { - multi <- FALSE - if(output =="console"){ - verbose <- FALSE - } + + # join with given val/compare.val if lengths don't match + if (!is.null(compare.val) && nrow(dat) + nrow(compare.dat) != length(val) + length(compare.val)) { + val_dt <- as.data.table(val) + colnames(val_dt) <- fld + compare.val_dt <- as.data.table(compare.val) + colnames(compare.val_dt) <- fld + dat <- val_dt %>% inner_join(dat, by = fld) + compare.dat <- compare.val_dt %>% inner_join(compare.dat, by = fld) + } + + # if you have compare data, join it back to main datatable + if(!is.null(compare.dat)){ + # check that dat and compare.dat are the same length + if (nrow(dat) != nrow(compare.dat)) stop("'compare.val' must be of equal length to 'val'") + dat <- rbind(dat,compare.dat, fill = TRUE) } + + # preserve user-given order + setorder(dat, order) + + # set yrange from tcplPlotUtils.R + yrange <- tcplPlotSetYRange(dat,yuniform,yrange,type) + + # check for null bmd in dat table + if (verbose){ + dat <- dat[is.null(dat$bmd), bmd:=NA] + } + # assign nrow = ncol = 1 for output="pdf" and multi=FALSE to plot one plot per page - if(nrow(input) > 1 && output == "pdf" && multi == FALSE) { + if(nrow(dat) > 1 && output == "pdf" && multi == FALSE) { nrow = ncol = 1 } # error message for output="console" and multi=FALSE to avoid multiple plots in console - if(nrow(input) > 1 && output == "console" && multi == FALSE) stop("More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: ", nrow(input)) + if(nrow(dat[compare == FALSE]) != 1 && output == "console" && multi == FALSE) stop("More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: ", nrow(dat)) if(is.null(nrow)){ nrow <- ifelse(verbose,2,2) } if(is.null(ncol)){ - ncol <- ifelse(verbose,2,3) - } - m4id <- input$m4id - - # load dat - l4 <- tcplLoadData(lvl = 4, fld = "m4id", val = m4id, add.fld = T) - agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = m4id) - - - if (lvl >= 5L) { - l5 <- tcplLoadData(lvl = 5, fld = "m4id", val = m4id, add.fld = T) - dat <- l4[l5, on = "m4id"] + ncol <- ifelse(!verbose | type == "sc",3,2) } - dat <- tcplPrepOtpt(dat) - - # correct concentration unit label for x-axis - dat <- dat[is.na(conc_unit), conc_unit:="\u03BCM"] - dat <- dat[conc_unit=="uM", conc_unit:="\u03BCM"] - dat <- dat[conc_unit=="mg/l", conc_unit:="mg/L"] - # add normalized data type for y axis - ndt <- tcplLoadAeid(fld = "aeid", val = dat$aeid, add.fld = "normalized_data_type") - dat <- dat[ndt, on = "aeid"] - # check for null bmd in dat table - if (verbose){ - dat <- dat[is.null(dat$bmd), bmd:=NA] - } - # unlog concs - conc_resp_table <- agg %>% group_by(m4id) %>% summarise(conc = list(10^logc), resp = list(resp)) %>% as.data.table() - dat <- dat[conc_resp_table, on = "m4id"] - # dat$conc <- list(10^agg$logc) - # dat$resp <- list(agg$resp) - # added AND verbose=FALSE to nrow(input)=1 condition to avoid TableGrob error in tcplggplot - if (nrow(input) == 1 && verbose==FALSE) { + if (nrow(dat[compare == FALSE]) == 1) { # plot single graph # this needs to be fixed to be more succinct about users selected option ifelse(output[1] == "console", # tcplPlotlyplot is the user-defined function found in tcplPlot.R file used to connect tcpl and plotly packages # tcplggplot is the user-defined function found in tcplPlot.R file used to connect tcpl and ggplot2 packages - return(tcplPlotlyPlot(dat)), - return(ggsave(filename=paste0(fileprefix,"_",dat$m4id,".",output), - plot=tcplggplot(dat,verbose = verbose), width = 7, height = 5, dpi=dpi)) + return(tcplPlotlyPlot(dat, lvl)), + return(ggsave(filename=paste0(fileprefix,"_",paste0(ifelse(type=="mc",dat$m4id,dat$s2id), collapse = "_"),".",output), + plot= if(is.null(compare.val)) tcplggplot(dat,verbose = verbose, lvl = lvl, flags = flags, yrange = yrange) else tcplggplotCompare(dat[compare == FALSE],dat[compare == TRUE],verbose = verbose, lvl = lvl, flags = flags, yrange = yrange), width = 7, height = 5, dpi=dpi)) ) } else { split_dat <- list(dat) @@ -134,13 +145,20 @@ tcplPlot <- function(lvl = 5, fld = "m4id", val = NULL, type = "mc", by = NULL, split_dat <- split(dat,f = factor(dat %>% pull(all_of(by)))) } for(d in split_dat){ - plot_list <- by(d,seq(nrow(d)),tcplggplot,verbose = verbose) - # m1 <- do.call("marrangeGrob", c(plot_list, ncol=2)) + if (is.null(compare.val)) { + plot_list <- by(d,seq(nrow(d)),tcplggplot,verbose = verbose, lvl = lvl, flags = flags, yrange = yrange) + } else { + plot_list <- mapply(tcplggplotCompare, asplit(d[compare == FALSE],1), asplit(d[compare == TRUE],1), MoreArgs = list(verbose = verbose, lvl = lvl, flags = flags, yrange = yrange)) + } m1 <- marrangeGrob(plot_list, nrow = nrow, ncol = ncol) if(output=="pdf"){ - ggsave(paste0(fileprefix,ifelse(is.null(by),"",paste0("_",by,"_",d %>% pull(all_of(by)) %>% unique())), ".pdf"), m1,width = ncol*7, height = nrow*5) + w <- ifelse(type == "mc", ncol*7, ncol*5) + h <- ifelse(type == "mc", nrow*5, nrow*6) + ggsave(paste0(fileprefix,ifelse(is.null(by),"",paste0("_",by,"_",d %>% pull(all_of(by)) %>% unique())), ".pdf"), m1,width = w, height = h) } else { names(plot_list) <- d$m4id + w <- ifelse(type == "mc", 7, 4) + h <- ifelse(type == "mc", 5, 6) lapply(names(plot_list), function(x)ggsave(filename=paste0(fileprefix,"_",x,".",output), plot=arrangeGrob(grobs=plot_list[x]), width = 7, height = 5, dpi=dpi)) } @@ -148,92 +166,7 @@ tcplPlot <- function(lvl = 5, fld = "m4id", val = NULL, type = "mc", by = NULL, } } else { - if(is.null(multi)){ - multi <- FALSE - } - if (length(lvl) > 1 | !lvl %in% 4:7) stop("invalid lvl input.") - if (length(output) > 1) output <- output[1] - - prs <- list(type = "mc", fld = fld, val = val) - - if (lvl == 4L) dat <- do.call(tcplLoadData, args = c(lvl = 4L, prs)) - if (lvl >= 5L) dat <- do.call(tcplLoadData, args = c(lvl = 5L, prs)) - if (lvl >= 6L) { - flg <- do.call(tcplLoadData, args = c(lvl = 6L, prs)) - } else { - flg <- NULL - } - if (lvl == 7L) { - boot <- do.call(tcplLoadData, args = c(lvl = 7L, prs)) - } else { - boot <- NULL - } - - if (nrow(dat) == 0) stop("No data for fld/val provided") - - agg <- do.call(tcplLoadData, args = c(lvl = "agg", prs)) - - if (nrow(dat) == 1 & output == "console") { - tcplPlotFits(dat = dat, agg = agg, flg = flg, boot = boot) - } - if (nrow(dat) > 1 & output == "console") stop("More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: ", nrow(dat)) - - - if (is.null(by)) { - if (output == "pdf" & !multi) { - graphics.off() - pdf( - file = file.path( - getwd(), - paste0(fileprefix, ".", output) - ), - height = 6, - width = 10, - pointsize = 10 - ) - tcplPlotFits(dat = dat, agg = agg, flg = flg, boot = boot) - graphics.off() - } - # plotting if using multiplot function - hitc.all <- TRUE - # browser() - if (multi) { - graphics.off() - pdf(file = file.path(getwd(), paste0(fileprefix, ".", output)), height = 10, width = 6, pointsize = 10) - par(mfrow = c(3, 2)) - tcplMultiplot(dat = dat, agg = agg, flg = flg, boot = boot, hitc.all = hitc.all) - graphics.off() - } - } else { - if (!by %in% names(dat)) stop("grouping variable unavailable.") - subset <- unlist(unique(dat[, by, with = FALSE])) - for (s in subset) { - if (output == "pdf" & !multi) { - graphics.off() - pdf( - file = file.path( - getwd(), - paste0(fileprefix, "_", by, "_", s, ".", output) - ), - height = 6, - width = 10, - pointsize = 10 - ) - tcplPlotFits(dat = dat[get(by) == s], agg = agg, flg = flg, boot = boot) - graphics.off() - } - # plotting if using multiplot function - hitc.all <- TRUE - # browser() - if (multi) { - graphics.off() - pdf(file = file.path(getwd(), paste0(fileprefix, "_", by, "_", s, ".", output)), height = 10, width = 6, pointsize = 10) - par(mfrow = c(3, 2)) - tcplMultiplot(dat = dat[get(by) == s], agg = agg, flg = flg, boot = boot, hitc.all = hitc.all) - graphics.off() - } - } - } + tcplLegacyPlot() } } @@ -242,9 +175,8 @@ tcplPlot <- function(lvl = 5, fld = "m4id", val = NULL, type = "mc", by = NULL, #' #' @param dat data table with all required conc/resp data #' @param lvl integer level of data that should be plotted -#' level 4 - all fit models -#' level 5 - all fit models and winning model with hitcall -#' level 6 - include all flags +#' level 2 - for 'sc' plotting +#' level 5 - for 'mc' plotting, all fit models and winning model with hitcall #' #' @return A plotly plot #' @importFrom dplyr %>% filter group_by summarise left_join inner_join select rowwise mutate pull @@ -258,24 +190,89 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ #library(dplyr) #variable binding - model_stats <- model <- param <- value <- ac50 <- hitc <- NULL + model_stats <- model <- param <- value <- ac50 <- hitc <- compare <- NULL + + compare.dat <- dat[compare == TRUE] + dat <- dat[compare == FALSE] - l3_dat <- tibble(conc = unlist(dat$conc), resp = unlist(dat$resp)) + l3_dat_main <- tibble(conc = unlist(dat$conc), resp = unlist(dat$resp), max_med = dat$max_med, l3 = "response A") + l3_dat_compare <- tibble(conc = unlist(compare.dat$conc), resp = unlist(compare.dat$resp), max_med = compare.dat$max_med, l3 = "response B") + l3_dat_both <- rbind(l3_dat_main, l3_dat_compare) # extract range from level 3 data for creating plotting all the functions # increase resolution to get smoother curves resolution <- 100 - x_min_max <- range(l3_dat$conc) - x_range <- 10^(seq(from = log10(x_min_max[1]), to = log10(x_min_max[2]), length.out = resolution)) - + x_min_max <- range(l3_dat_both$conc, na.rm=TRUE) + #if the overall minimum conc is greater than 0 (test wells) + if (x_min_max[1] > 0) { + hline_range <- 10^(seq(from = log10(x_min_max[1]/100), to = log10(x_min_max[2]*100), length.out = resolution)) + x_range <- 10^(seq(from = log10(x_min_max[1]), to = log10(x_min_max[2]), length.out = resolution)) + use_log <- TRUE + } else if (x_min_max[2] <= 0) { #if the overall max conc is less than 0 (all concs are likely 0) -- create bounds + x_range <- hline_range <- seq(from = -10, to = 10, length.out = resolution) + use_log <- FALSE + } else { #if the minimum conc is 0 but max is greater than 0 -- can't use log scale + hline_range <- seq(from = x_min_max[1]/100, to = x_min_max[2]*100, length.out = resolution) + x_range <- seq(from = x_min_max[1], to = x_min_max[2], length.out = resolution) + use_log <- FALSE + } #check if winning model = none - if (!dat$modl == "none"){ + if (!lvl == 2 && !dat$modl == "none"){ - #check if winning model has negative top. If so coff should be negative - if(!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top)){ - if(dat$top<0){ - dat$coff <- dat$coff*-1 + # main data + # check if model_type is 3 or 4, which means an override method was assigned + if (dat$model_type == 3) { # gain direction + # leave coff but bmr should flip if top is negative + if (!is.null(dat$top) && !is.na(dat$top) && !is.null(dat$bmr)) { + if (dat$top < 0) { + dat$bmr <- dat$bmr * -1 + } + } + } else if (dat$model_type == 4) { # loss direction + # coff and bmr(if top < 0) should be negative + if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { + dat$coff <- dat$coff * -1 + if (dat$top < 0) { + dat$bmr <- dat$bmr * -1 + } + } + } else { # bidirectional + # check if winning model has negative top. If so coff,bmr should be negative + if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { + if (dat$top < 0) { + dat$coff <- dat$coff * -1 + dat$bmr <- dat$bmr * -1 + } + } + } + + # compare data + if (nrow(compare.dat) > 0) { + # check if model_type is 3 or 4, which means an override method was assigned + if (compare.dat$model_type == 3) { # gain direction + # leave coff but bmr should flip if top is negative + if (!is.null(compare.dat$top) && !is.na(compare.dat$top) && !is.null(compare.dat$bmr)) { + if (compare.dat$top < 0) { + compare.dat$bmr <- compare.dat$bmr * -1 + } + } + } else if (compare.dat$model_type == 4) { # loss direction + # coff and bmr(if top < 0) should be negative + if (!is.null(compare.dat$top) && !is.null(compare.dat$coff) && !is.na(compare.dat$top) && !is.null(compare.dat$bmr)) { + compare.dat$coff <- compare.dat$coff * -1 + if (compare.dat$top < 0) { + compare.dat$bmr <- compare.dat$bmr * -1 + } + } + } else { # bidirectional + # check if winning model has negative top. If so coff,bmr should be negative + if (!is.null(compare.dat$top) && !is.null(compare.dat$coff) && !is.na(compare.dat$top) && !is.null(compare.dat$bmr)) { + if (compare.dat$top < 0) { + compare.dat$coff <- compare.dat$coff * -1 + compare.dat$bmr <- compare.dat$bmr * -1 + } + } } } @@ -285,12 +282,9 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ #don't need loss direction ac50s ac50s <- ac50s %>% filter(!grepl("_loss",model)) models <- models[!grepl("_loss",models)] - # dat$models <- NULL - # dat$ac50 <- NULL - # l4_dat <- as_tibble(dat[3:length(dat)]) - # calculate y values for each function + # calculate y values for each function if ("hill" %in% models) y_hill <- tcplfit2::hillfn(ps = c(dat$hill_tp,dat$hill_ga,dat$hill_p), x = x_range) #tp = ps[1], ga = ps[2], p = ps[3], la = ps[4], q = ps[5] if ("gnls" %in% models) y_gnls <- tcplfit2::gnls(ps = c(dat$gnls_tp,dat$gnls_ga,dat$gnls_p,dat$gnls_la,dat$gnls_q),x = x_range) @@ -312,16 +306,17 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ if (dat$fitc == 100) { # loec is stored as modl_acc x_loec <- rep(dat$modl_acc, resolution) - l3_resp <- l3_dat %>% + l3_resp <- l3_dat_main %>% pull(.data$resp) %>% range() y_loec <- seq(from = l3_resp[1], to = l3_resp[2], length.out = resolution) } + # for model type 0 (default) add constant model - y_cnst <- x_range * 0 - ac50s <- ac50s %>% rbind(c(model = "cnst", ac50 = NA)) - models <- c(models, "cnst") + y_cnst <- x_range * 0 + ac50s <- ac50s %>% rbind(c(model = "cnst", ac50 = NA)) + models <- c(models, "cnst") model_stats <- dat %>% @@ -333,6 +328,7 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ tidyr::pivot_wider(names_from = param, values_from = value) ac50s$ac50 <- as.numeric(ac50s$ac50) + # set background opacity op <- .2 opacity <- tibble(model = models, opacity = op) %>% mutate(opacity = ifelse(.data$model == dat$modl, 1, opacity)) @@ -350,6 +346,81 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ if (!is.null(model_stats)) { m <- m %>% inner_join(model_stats, by = "model") } + + if (nrow(compare.dat) > 0) { + ac50s_compare <- tibble(model = models, ac50 = compare.dat %>% select(colnames(compare.dat)[grepl("_ac50",colnames(compare.dat))]) %>% unlist) + ac50s_compare <- ac50s_compare %>% filter(!grepl("_loss",model)) + + # calculate y values for each function + if ("hill" %in% models) y_hill_compare <- tcplfit2::hillfn(ps = c(compare.dat$hill_tp,compare.dat$hill_ga,compare.dat$hill_p), x = x_range) + #tp = ps[1], ga = ps[2], p = ps[3], la = ps[4], q = ps[5] + if ("gnls" %in% models) y_gnls_compare <- tcplfit2::gnls(ps = c(compare.dat$gnls_tp,compare.dat$gnls_ga,compare.dat$gnls_p,compare.dat$gnls_la,compare.dat$gnls_q),x = x_range) + #a = ps[1], b = ps[2] + if ("exp2" %in% models) y_exp2_compare <- tcplfit2::exp2(ps = c(compare.dat$exp2_a,compare.dat$exp2_b), x = x_range) + #a = ps[1], b = ps[2], p = ps[3] + if ("exp3" %in% models) y_exp3_compare <- tcplfit2::exp3(ps = c(compare.dat$exp3_a,compare.dat$exp3_b,compare.dat$exp3_p), x = x_range) + #tp = ps[1], ga = ps[2] + if ("exp4" %in% models) y_exp4_compare <- tcplfit2::exp4(ps = c(compare.dat$exp4_tp,compare.dat$exp4_ga), x = x_range) + #tp = ps[1], ga = ps[2], p = ps[3] + if ("exp5" %in% models) y_exp5_compare <- tcplfit2::exp5(ps = c(compare.dat$exp5_tp,compare.dat$exp5_ga,compare.dat$exp5_p), x = x_range) + #a = ps[1] + if ("poly1" %in% models) y_poly1_compare <- tcplfit2::poly1(ps = c(compare.dat$poly1_a), x = x_range) + #a = ps[1], b = ps[2] + if ("poly2" %in% models) y_poly2_compare <- tcplfit2::poly2(ps = c(compare.dat$poly2_a,compare.dat$poly2_b), x = x_range) + #a = ps[1], p = ps[2] + if ("pow" %in% models) y_pow_compare <- tcplfit2::pow(ps = c(compare.dat$pow_a,compare.dat$pow_p), x = x_range) + + if (compare.dat$fitc == 100) { + # loec is stored as modl_acc + x_loec_compare <- rep(compare.dat$modl_acc, resolution) + l3_resp_compare <- l3_dat_compare %>% + pull(.data$resp) %>% + range() + y_loec_compare <- seq(from = l3_resp[1], to = l3_resp[2], length.out = resolution) + } + + y_cnst_compare <- x_range * 0 + ac50s_compare <- ac50s_compare %>% rbind(c(model = "cnst", ac50 = NA)) + model_stats_compare <- compare.dat %>% + select(ends_with("aic"), ends_with("rme"), ends_with("_top"), ends_with("_p")) %>% + tidyr::pivot_longer(everything(), + names_to = c("model", "param"), + names_pattern = "(.*)_(.*)" + ) %>% + tidyr::pivot_wider(names_from = param, values_from = value) + ac50s_compare$ac50 <- as.numeric(ac50s_compare$ac50) + opacity.compare <- tibble(model = models, opacity = op) %>% mutate(opacity = ifelse(.data$model == compare.dat$modl, 1, opacity)) + line.fmt.compare <- tibble(model = models, dash = "dash") %>% mutate(dash = ifelse(.data$model == compare.dat$modl, "solid", .data$dash)) + m_compare <- opacity.compare %>% + inner_join(line.fmt.compare, by = "model") %>% + inner_join(ac50s_compare, by = "model") %>% + rowwise() %>% + mutate(x = ifelse(compare.dat$fitc == 100,list(x_loec_compare),list(x_range)), y = list(get(paste0("y_", .data$model, "_compare")))) %>% + tidyr::unnest(cols = c(x, y)) + # if we have model stats we want them included in the hoverover + if (!is.null(model_stats_compare)) { + m_compare <- m_compare %>% inner_join(model_stats_compare, by = "model") + } + } + + } else if (lvl == 2) { #single conc + # main data + if (!is.null(dat$coff) && dat$max_med < 0) { + dat$coff <- dat$coff * -1 + } + if (!is.null(dat$coff) && !is.null(dat$hitc) && dat$hitc < 0) { + dat$coff <- dat$coff * -1 + } + + # compare data + if (nrow(compare.dat) > 0) { + if (!is.null(compare.dat$coff) && compare.dat$max_med < 0) { + compare.dat$coff <- compare.dat$coff * -1 + } + if (!is.null(compare.dat$coff) && !is.null(compare.dat$hitc) && compare.dat$hitc < 0) { + compare.dat$coff <- compare.dat$coff * -1 + } + } } # function for truncating decimals @@ -362,12 +433,14 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ # start creation of actual plot fig <- plot_ly( - data = l3_dat, + data = if (nrow(compare.dat) > 0) l3_dat_both else l3_dat_main, x = ~conc, - y = ~resp, + y = ~resp, + color = ~l3, + colors = ifelse(nrow(compare.dat) > 0, "Set1", "red"), + opacity = ifelse(nrow(compare.dat) > 0, 0.67, 1), type = "scatter", mode = "markers", - name = "response", hoverinfo = "text", text = ~ paste( # "
Assay Plate ID: ", apid, @@ -385,7 +458,7 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ x <- list( title = paste0("Concentration ","(",dat$conc_unit,")"), # set zeroline to false so there is no vertical line at x = 0 - type = "log", + type = ifelse(use_log, "log", "linear"), zeroline = FALSE, dtick=1 ) @@ -418,133 +491,323 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ ) } - # # add cutoff annotation + # cutoff for A fig <- fig %>% add_trace( - data = tibble(x = x_range, y = dat$coff), + data = tibble(x = hline_range, y = dat$coff), x = ~x, y = ~y, type = "scatter", mode = "lines", - name = "cutoff", - line = list(dash = "dash", width = 1.5, color = NULL), + name = "cutoff A", + opacity = ifelse(nrow(compare.dat) > 0, 0.5, 1), + line = list(dash = "dash", width = 1.5, color = ifelse(nrow(compare.dat) > 0, "red", "blue")), inherit = FALSE, hoverinfo = "text", text = ~ paste( - "
", paste0("Cut Off (", specify_decimal(dat$coff,2), ")") + "
", paste0("Cut Off A (", specify_decimal(dat$coff,2), ")") ) ) - # currently only support for model types 1 and 0 but need to expand or make this generic - if (dat$fitc == 100) { - # apply axis and lines to figure - fig <- fig %>% plotly::layout(xaxis = x, yaxis = y) - - # add the loec line if hitc == 1. + if (nrow(compare.dat) > 0) { + # cutoff for B fig <- fig %>% add_trace( - data = tibble(x = x_loec, y = y_loec), + data = tibble(x = hline_range, y = compare.dat$coff), x = ~x, y = ~y, - name = "LOEC", type = "scatter", mode = "lines", - line = list(dash = "solid", width = 1.5, color = NULL), + name = "cutoff B", + opacity = ifelse(nrow(compare.dat) > 0, 0.5, 1), + line = list(dash = "dash", width = 1.5, color = "blue"), inherit = FALSE, hoverinfo = "text", text = ~ paste( - "
", "LOEC", - "
Log Concentration: ", x + "
", paste0("Cut Off B (", specify_decimal(compare.dat$coff,2), ")") ) ) - } else { - if (!dat$modl == "cnst" && !dat$modl == "none") { - dat_lines <- vline(ac50s %>% filter(model == dat$modl) %>% pull(ac50) %>% as.numeric()) - fig <- fig %>% plotly::layout(xaxis = x, yaxis = y, shapes = dat_lines) - } else { - fig <- fig %>% plotly::layout(xaxis = x, yaxis = y) } - - - # add ac50 line for appropriate models (hitc=1) - if (!dat$modl == "cnst" && !dat$modl == "none") { - fig <- fig %>% add_annotations( - yref = "paper", - xref = "x", - x = ac50s %>% filter(model == dat$modl) %>% pull(ac50) %>% as.numeric() %>% log10(), - y = 1, - text = paste0("Winning Model Log AC50 (", specify_decimal(ac50s %>% filter(model == dat$modl) %>% pull(ac50) %>% as.numeric(),2), ")"), - showarrow = F, - textangle = 90, - xanchor = "left" + + if (lvl == 2) { + # # add max median annotation + fig <- fig %>% add_trace( + data = tibble(x = hline_range, y = dat$max_med), + x = ~x, + y = ~y, + type = "scatter", + mode = "lines", + name = "max median A", + opacity = ifelse(nrow(compare.dat) > 0, 0.5, 1), + line = list(dash = ifelse(nrow(compare.dat) > 0, "solid", "dash"), width = 1.5, color = "red"), + inherit = FALSE, + hoverinfo = "text", + text = ~ paste( + "
", paste0("Max Median A(", specify_decimal(dat$max_med,2), ")") ) - } - - if (!dat$modl == "none"){ - # add all non-winning models + ) + } + + if (lvl == 2 && nrow(compare.dat) > 0) { + # # add max median annotation + fig <- fig %>% add_trace( + data = tibble(x = hline_range, y = compare.dat$max_med), + x = ~x, + y = ~y, + type = "scatter", + mode = "lines", + name = "max median B", + opacity = ifelse(nrow(compare.dat) > 0, 0.5, 1), + line = list(dash = "solid", width = 1.5, color = "blue"), + inherit = FALSE, + hoverinfo = "text", + text = ~ paste( + "
", paste0("Max Median B(", specify_decimal(compare.dat$max_med,2), ")") + ) + ) + } + + compare.fitc <- compare.dat$fitc + if (nrow(compare.dat) == 0) compare.fitc = -1 + + # currently only support for model types 1 and 0 but need to expand or make this generic + if (!lvl == 2 && (dat$fitc == 100 || compare.fitc == 100)) { + # apply axis and lines to figure + fig <- fig %>% plotly::layout(xaxis = x, yaxis = y) + if (dat$fitc == 100) { + # add the loec line if hitc == 1. fig <- fig %>% add_trace( - data = m %>% filter(.data$model != dat$modl), + data = tibble(x = x_loec, y = y_loec), x = ~x, y = ~y, + name = "LOEC A", type = "scatter", mode = "lines", - split = ~model, - opacity = ~opacity, - line = list(dash = ~dash, width = 1.5, color = NULL), + line = list(dash = "solid", width = 1.5, color = "red"), inherit = FALSE, hoverinfo = "text", text = ~ paste( - "
", model, - "
ac50: ", specify_decimal(ac50, 2), - "
Concentration: ", specify_decimal(x,2), - "
Response: ", specify_decimal(y, 2), - "
AIC: ", specify_decimal(aic, 2), - "
RME: ", specify_decimal(rme, 2), - "
TOP: ", specify_decimal(top, 2), - "
SLOPE: ", specify_decimal(p, 2) + "
", "LOEC A", + "
Log Concentration: ", x ) ) - - # add line for winning model + } + if (compare.dat$fitc == 100) { + # add the loec line if hitc == 1. fig <- fig %>% add_trace( - data = m %>% filter(.data$model == dat$modl), + data = tibble(x = x_loec_compare, y = y_loec_compare), x = ~x, y = ~y, + name = "LOEC B", type = "scatter", mode = "lines", - split = ~model, - opacity = ~opacity, - line = list(dash = ~dash, width = 1.5, color = NULL), + line = list(dash = "solid", width = 1.5, color = "blue"), inherit = FALSE, hoverinfo = "text", text = ~ paste( - "
", model, - "
ac50: ", specify_decimal(ac50, 2), - "
Concentration: ", specify_decimal(x,2), - "
Response: ", specify_decimal(y, 2), - "
AIC: ", specify_decimal(aic, 2), - "
RME: ", specify_decimal(rme, 2), - "
TOP: ", specify_decimal(top, 2), - "
SLOPE: ", specify_decimal(p, 2) + "
", "LOEC B", + "
Log Concentration: ", x ) ) } - # get hitcall - hitcall <- dat %>% pull(hitc) + } else { + if (!lvl == 2 && !dat$modl == "cnst" && !dat$modl == "none") { + dat_lines <- vline(ac50s %>% filter(model == dat$modl) %>% pull(ac50) %>% as.numeric(), color = ifelse(nrow(compare.dat) > 0, "red", "black")) + dat_lines_compare <- NULL + if (nrow(compare.dat) > 0) dat_lines_compare <- vline(ac50s_compare %>% filter(model == compare.dat$modl) %>% pull(ac50) %>% as.numeric(), color = "blue") + fig <- fig %>% plotly::layout(xaxis = x, yaxis = y, shapes = list(dat_lines, dat_lines_compare)) + } else { + fig <- fig %>% plotly::layout(xaxis = x, yaxis = y) + } + + + # add ac50 line for appropriate models (hitc=1) + if (!lvl == 2 && !dat$modl == "cnst" && !dat$modl == "none") { + fig <- fig %>% add_annotations( + yref = "paper", + xref = "x", + x = ac50s %>% filter(model == dat$modl) %>% pull(ac50) %>% as.numeric() %>% log10(), + y = 1, + text = paste0("A Winning Model Log AC50 (", specify_decimal(ac50s %>% filter(model == dat$modl) %>% pull(ac50) %>% as.numeric(),2), ")"), + showarrow = F, + textangle = 90, + xanchor = "left" + ) + if (nrow(compare.dat) > 0) { + fig <- fig %>% add_annotations( + yref = "paper", + xref = "x", + x = ac50s_compare %>% filter(model == compare.dat$modl) %>% pull(ac50) %>% as.numeric() %>% log10(), + y = 1, + text = paste0("B Winning Model Log AC50 (", specify_decimal(ac50s_compare %>% filter(model == compare.dat$modl) %>% pull(ac50) %>% as.numeric(),2), ")"), + showarrow = F, + textangle = 90, + xanchor = "left" + ) + } + + } + + if (!lvl == 2 && !dat$modl == "none"){ + if (nrow(compare.dat) == 0) { + # add all non-winning models + fig <- fig %>% add_trace( + data = m %>% filter(.data$model != dat$modl), + x = ~x, + y = ~y, + type = "scatter", + mode = "lines", + split = ~model, + opacity = ~opacity, + line = list(dash = ~dash, width = 1.5, color = NULL), + inherit = FALSE, + hoverinfo = "text", + text = ~ paste( + "
", model, + "
ac50: ", specify_decimal(ac50, 2), + "
Concentration: ", specify_decimal(x,2), + "
Response: ", specify_decimal(y, 2), + "
AIC: ", specify_decimal(aic, 2), + "
RME: ", specify_decimal(rme, 2), + "
TOP: ", specify_decimal(top, 2), + "
SLOPE: ", specify_decimal(p, 2) + ) + ) + # add line for winning model + fig <- fig %>% add_trace( + data = m %>% filter(.data$model == dat$modl), + x = ~x, + y = ~y, + type = "scatter", + mode = "lines", + name = paste0("model A(", dat$modl, ")"), + split = ~model, + opacity = ~opacity, + line = list(dash = ~dash, width = 1.5, color = "red"), + inherit = FALSE, + hoverinfo = "text", + text = ~ paste( + "
", model, + "
ac50: ", specify_decimal(ac50, 2), + "
Concentration: ", specify_decimal(x,2), + "
Response: ", specify_decimal(y, 2), + "
AIC: ", specify_decimal(aic, 2), + "
RME: ", specify_decimal(rme, 2), + "
TOP: ", specify_decimal(top, 2), + "
SLOPE: ", specify_decimal(p, 2) + ) + ) + } else { + # add line for winning model + fig <- fig %>% add_trace( + data = m %>% filter(.data$model == dat$modl), + x = ~x, + y = ~y, + type = "scatter", + mode = "lines", + name = paste0("model A(", dat$modl, ")"), + split = ~model, + opacity = ~opacity, + line = list(dash = ~dash, width = 1.5, color = "red"), + inherit = FALSE, + hoverinfo = "text", + text = ~ paste( + "
", model, + "
ac50: ", specify_decimal(ac50, 2), + "
Concentration: ", specify_decimal(x,2), + "
Response: ", specify_decimal(y, 2), + "
AIC: ", specify_decimal(aic, 2), + "
RME: ", specify_decimal(rme, 2), + "
TOP: ", specify_decimal(top, 2), + "
SLOPE: ", specify_decimal(p, 2) + ) + ) + # add line for winning model for compare data + fig <- fig %>% add_trace( + data = m_compare %>% filter(.data$model == compare.dat$modl), + x = ~x, + y = ~y, + type = "scatter", + mode = "lines", + name = paste0("model B(", compare.dat$modl, ")"), + split = ~model, + opacity = ~opacity, + line = list(dash = ~dash, width = 1.5, color = "blue"), + inherit = FALSE, + hoverinfo = "text", + text = ~ paste( + "
", model, + "
ac50: ", specify_decimal(ac50, 2), + "
Concentration: ", specify_decimal(x,2), + "
Response: ", specify_decimal(y, 2), + "
AIC: ", specify_decimal(aic, 2), + "
RME: ", specify_decimal(rme, 2), + "
TOP: ", specify_decimal(top, 2), + "
SLOPE: ", specify_decimal(p, 2) + ) + ) + } + } + + if (nrow(compare.dat) > 0) { + identical_title <- paste0(stringr::str_trunc(paste0( + ifelse(dat$dsstox_substance_id == compare.dat$dsstox_substance_id, paste0(dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm == compare.dat$chnm, paste0(dat$chnm, "\n"), "") + ), 75), + stringr::str_trunc(paste0( + ifelse(dat$spid == compare.dat$spid, paste0("SPID:", dat$spid, " "), ""), + ifelse(dat$aeid == compare.dat$aeid, paste0("AEID:", dat$aeid, " "), ""), + ifelse(dat$aenm == compare.dat$aenm, paste0("AENM:", dat$aenm), "")), 70)) + if (identical_title != "" & !endsWith(identical_title, "\n")) { + identical_title <- paste0(identical_title, "\n") + } + } # add annotations fig <- fig %>% add_annotations( - text = paste0( - dat %>% pull(.data$aenm), "
", - case_when( - #updated binary hitcall designation to three decimal rounding - #hitcall == 1 ~ "ACTIVE", - #hitcall == 0 ~ "INACTIVE", - #hitcall == -1 ~ "NO CALL", - TRUE ~ paste0("HITC: ", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3)))) - ), "
", - dat %>% pull(.data$chnm), " (", dat %>% pull(.data$casn), ")", "
", - dat %>% pull(.data$dsstox_substance_id), "
", - dat %>% pull(.data$spid), "
", - ifelse(!is.null(dat$flag), gsub("\\|\\|", "
", paste0("Flags: ", dat %>% pull(.data$flag))), "") + text = ifelse(nrow(compare.dat) > 0, + # compare + paste0( + ifelse(identical_title != "", paste0(identical_title, "\n"), ""), + paste0( + "A: ", + ifelse(dat$dsstox_substance_id != compare.dat$dsstox_substance_id, paste0(dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm != compare.dat$chnm, paste0(dat$chnm, "\n"), "") + ), + paste0( + ifelse(dat$spid != compare.dat$spid, paste0("SPID:", dat$spid, " "), ""), + ifelse(dat$aeid != compare.dat$aeid, paste0("AEID:", dat$aeid, " "), ""), + ifelse(dat$aenm != compare.dat$aenm, paste0("AENM:", dat$aenm, "\n"), "")), + ifelse(lvl != 2, paste0("M4ID:", dat$m4id),paste0("S2ID:", dat$s2id)), " ", + paste0( + "\nHITC:", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3))) + ), + ifelse(!is.null(dat$flag), gsub("\\|\\|", "
", paste0("\nFlags: ", dat %>% pull(.data$flag))), ""), + paste0("\n\n", + "B: ", + ifelse(dat$dsstox_substance_id != compare.dat$dsstox_substance_id, paste0(compare.dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm != compare.dat$chnm, paste0(compare.dat$chnm, "\n"), "") + ), + paste0( + ifelse(dat$spid != compare.dat$spid, paste0("SPID:", compare.dat$spid, " "), ""), + ifelse(dat$aeid != compare.dat$aeid, paste0("AEID:", compare.dat$aeid, " "), ""), + ifelse(dat$aenm != compare.dat$aenm, paste0("AENM:", compare.dat$aenm, "\n"), "")), + ifelse(lvl != 2, paste0("M4ID:", compare.dat$m4id),paste0("S2ID:", compare.dat$s2id)), " ", + paste0( + "\nHITC:", paste0(trimws(format(round(compare.dat$hitc, 3), nsmall = 3))) + ), + ifelse(!is.null(compare.dat$flag), gsub("\\|\\|", "
", paste0("\nFlags: ", compare.dat %>% pull(.data$flag))), "") + ), + # no compare + paste0( + dat %>% pull(.data$aenm), "
", + case_when( + TRUE ~ paste0("HITC: ", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3)))) + ), "
", + dat %>% pull(.data$chnm), " (", dat %>% pull(.data$casn), ")", "
", + dat %>% pull(.data$dsstox_substance_id), "
", + dat %>% pull(.data$spid), "
", + ifelse(lvl != 2, paste0("M4ID:", dat$m4id),paste0("S2ID:", dat$s2id)), "
", + ifelse(!is.null(dat$flag), gsub("\\|\\|", "
", paste0("Flags: ", dat %>% pull(.data$flag))), "") + ) ), xref = "paper", x = 0.05, @@ -565,93 +828,211 @@ tcplPlotlyPlot <- function(dat, lvl = 5){ #' #' @param dat data table with all required conc/resp data #' @param lvl integer level of data that should be plotted -#' level 4 - all fit models -#' level 5 - all fit models and winning model with hitcall -#' level 6 - include all flags +#' level 2 - for 'sc' plotting +#' level 5 - for 'mc' plotting, all fit models and winning model with hitcall #' @param verbose boolean should plotting include table of values next to the plot +#' @param flags boolean should plotting include level 6 flags in plot caption +#' @param yrange Integer of length 2, for overriding the y-axis range, c(,). +#' By default, c(NA,NA). #' #' @return A ggplot object or grob with accompanied table depending on verbose option #' @importFrom dplyr %>% filter group_by summarise left_join inner_join select rowwise mutate pull mutate_if #' @importFrom dplyr tibble contains everything as_tibble arrange .data -#' @importFrom ggplot2 ggplot aes geom_function geom_vline geom_hline geom_point scale_x_continuous scale_color_viridis_d +#' @importFrom ggplot2 ggplot aes geom_function geom_vline geom_hline geom_point scale_x_continuous scale_y_continuous scale_color_viridis_d #' @importFrom ggplot2 guide_legend scale_linetype_manual xlab ylab geom_text labs theme element_blank #' @importFrom ggplot2 margin unit element_text geom_segment #' @import gridExtra #' @import stringr -tcplggplot <- function(dat, lvl = 5, verbose = FALSE) { +tcplggplot <- function(dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA,NA)) { # variable binding conc <- resp <- xpos <- ypos <- hjustvar <- vjustvar <- NULL annotateText <- name <- aic <- NULL - l3_dat <- tibble(conc = unlist(dat$conc), resp = unlist(dat$resp)) + l3_dat <- tibble(conc = unlist(dat$conc), resp = unlist(dat$resp), max_med = dat$max_med) l3_range <- l3_dat %>% pull(.data$conc) %>% range() - - annotations <- data.frame( - xpos = c(l3_range[1]), - ypos = c(Inf), - annotateText = paste0( - ifelse(!is.null(dat$flag), gsub("\\|\\|", "\n", paste0("Flags: ", dat %>% pull(.data$flag))), "") - ), - hjustvar = c(0), - vjustvar = c(1) - ) #<- adjust - - # check if winning model has negative top. If so coff,bmr should be negative - if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { - if (dat$top < 0) { + + # check if model_type is 3 or 4, which means an override method was assigned + if (lvl == 5) { + if (dat$model_type == 3) { # gain direction + # leave coff but bmr should flip if top is negative + if (!is.null(dat$top) && !is.na(dat$top) && !is.null(dat$bmr)) { + if (dat$top < 0) { + dat$bmr <- dat$bmr * -1 + } + } + } else if (dat$model_type == 4) { # loss direction + # coff and bmr(if top < 0) should be negative + if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { + dat$coff <- dat$coff * -1 + if (dat$top < 0) { + dat$bmr <- dat$bmr * -1 + } + } + } else { # bidirectional + # check if winning model has negative top. If so coff,bmr should be negative + if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { + if (dat$top < 0) { + dat$coff <- dat$coff * -1 + dat$bmr <- dat$bmr * -1 + } + } + } + } else { #single conc + if (!is.null(dat$coff) && dat$max_med < 0) { + dat$coff <- dat$coff * -1 + } + if (!is.null(dat$coff) && !is.null(dat$hitc) && dat$hitc < 0) { dat$coff <- dat$coff * -1 - dat$bmr <- dat$bmr * -1 } } + + + # check if ac50 is null and assign NA if it is + dat$ac50 <- ifelse(is.null(dat$ac50), NA, dat$ac50) + + # check if dtxsid is NA, pull wllt in from lvl 3 + if (getOption("TCPL_DRVR") != "API" && (is.na(dat$dsstox_substance_id) | is.na(dat$chnm))) { + wllt <- unique(tcplLoadData(type = ifelse(lvl == 2, "sc", "mc"), lvl = 0, fld = list("spid","acid"), + list(dat$spid, tcplLoadAcid(fld = "aeid", val = dat$aeid)$acid))$wllt) + if (length(wllt) == 1) { + if (wllt == 'c' | wllt == 'p') { + dat$dsstox_substance_id <- "Gain-of-signal control" + dat$chnm <- "" + } + else if (wllt == 'm' | wllt == 'o') { + dat$dsstox_substance_id <- "Loss-of-signal control" + dat$chnm <- "" + } + else if (wllt == 'n') { + dat$dsstox_substance_id <- "Neutral/negative control" + dat$chnm <- "" + } + else if (wllt == 'b') { + dat$dsstox_substance_id <- "Blank" + dat$chnm <- "" + } + else if (wllt == 'v') { + dat$dsstox_substance_id <- "Viability control" + dat$chnm <- "" + } + else { + dat$dsstox_substance_id <- paste0("Well type: ", wllt) + dat$chnm <- "" + } + } + else { + if (length(wllt) > 1) { + dat$dsstox_substance_id <- paste0("Well type: ", paste(wllt, collapse = ", ")) + dat$chnm <- "" + } else { + warning(paste0("wllt for SPID: ", dat$spid, " is missing. + Leaving dsstox_substance_id and chnm as NA.")) + } + } + } + + # check if data is outside bounds of yrange. If so, expand yrange bounds + if (!identical(yrange, c(NA,NA))) { + yrange[1] <- min(dat$resp_min, dat$coff, yrange[1], unlist(dat$resp)) + yrange[2] <- max(dat$resp_max, dat$coff, yrange[2], unlist(dat$resp)) + } winning_model_string <- paste0("Winning Model\n(", dat$modl, ")") model_test <- function(modeltype) { ifelse(dat$modl == modeltype, winning_model_string, "Losing Models") } - gg <- ggplot(l3_dat, aes(conc, resp)) + - geom_function(aes(color = !!model_test("gnls"), linetype = !!model_test("gnls")), fun = function(x) tcplfit2::gnls(ps = c(dat$gnls_tp, dat$gnls_ga, dat$gnls_p, dat$gnls_la, dat$gnls_q), x = x)) + - geom_function(aes(color = !!model_test("exp2"), linetype = !!model_test("exp2")), fun = function(x) tcplfit2::exp2(ps = c(dat$exp2_a, dat$exp2_b), x = x)) + - geom_function(aes(color = !!model_test("exp3"), linetype = !!model_test("exp3")), fun = function(x) tcplfit2::exp3(ps = c(dat$exp3_a, dat$exp3_b, dat$exp3_p), x = x)) + - geom_function(aes(color = !!model_test("exp4"), linetype = !!model_test("exp4")), fun = function(x) tcplfit2::exp4(ps = c(dat$exp4_tp, dat$exp4_ga), x = x)) + - geom_function(aes(color = !!model_test("exp5"), linetype = !!model_test("exp5")), fun = function(x) tcplfit2::exp5(ps = c(dat$exp5_tp, dat$exp5_ga, dat$exp5_p), x = x)) + - geom_function(aes(color = !!model_test("poly1"), linetype = !!model_test("poly1")), fun = function(x) tcplfit2::poly1(ps = c(dat$poly1_a), x = x)) + - geom_function(aes(color = !!model_test("poly2"), linetype = !!model_test("poly2")), fun = function(x) tcplfit2::poly2(ps = c(dat$poly2_a, dat$poly2_b), x = x)) + - geom_function(aes(color = !!model_test("pow"), linetype = !!model_test("pow")), fun = function(x) tcplfit2::pow(ps = c(dat$pow_a, dat$pow_p), x = x)) + - geom_function(aes(color = !!model_test("hill"), linetype = !!model_test("hill")), fun = function(x) tcplfit2::hillfn(ps = c(dat$hill_tp, dat$hill_ga, dat$hill_p), x = x)) + - geom_vline(aes(xintercept = dat$ac50, color = "AC50", linetype = "AC50")) + - geom_hline(aes(yintercept = dat$coff, color = "Cutoff", linetype = "Cutoff")) + - geom_point() + - scale_x_continuous(limits = l3_range, trans = "log10") + - scale_color_viridis_d("", direction = -1, guide = guide_legend(reverse = TRUE, order = 2), end = 0.9) + - scale_linetype_manual("", guide = guide_legend(reverse = TRUE, order = 2), values = c(2, 2, 2, 3, 1)) + - xlab(paste0("Concentration ", "(", dat$conc_unit, ")")) + - ylab(stringr::str_to_title(gsub("_", " ", dat$normalized_data_type))) + - geom_text(data = annotations, aes(x = xpos, y = ypos, hjust = hjustvar, vjust = vjustvar, label = annotateText)) + - labs( - title = paste0( - stringr::str_trunc(paste0( - dat %>% pull(.data$dsstox_substance_id), " ", - dat %>% pull(.data$chnm) - ), 75), "\n", - stringr::str_trunc(paste0( + flag_count <- 0 + if (flags && dat$flag != "None") { + flag_count <- str_count(dat$flag, "\n") + 1 + } + + + if (lvl == 2) { + gg <- ggplot(l3_dat, aes(x = conc)) + + geom_hline(aes(yintercept = dat$max_med, linetype = "Max Median"), color="red") + + geom_hline(aes(yintercept = dat$coff, linetype="Cutoff"), color="blue") + + geom_point(aes(y = resp)) + + scale_x_continuous(limits = l3_range, trans = ifelse(0 %in% l3_dat$conc,"identity","log10")) + + scale_y_continuous(limits = yrange) + + scale_linetype_manual("", + guide = guide_legend(override.aes = list(color = c("blue", "red"))), + values = c(2, 2)) + + xlab(paste0("Concentration ", "(", dat$conc_unit, ")")) + + ylab(stringr::str_to_title(gsub("_", " ", dat$normalized_data_type))) + + labs( + title = paste0( + stringr::str_trunc(paste0( + dat %>% pull(.data$dsstox_substance_id), " ", + dat %>% pull(.data$chnm) + ), 75), "\n", + stringr::str_trunc(paste0( + "AEID:", dat %>% pull(.data$aeid), " ", + "AENM:", dat %>% pull(.data$aenm)), 70),"\n", "SPID:", dat %>% pull(.data$spid), " ", - "AEID:", dat %>% pull(.data$aeid), " ", - "AENM:", dat %>% pull(.data$aenm)), 70),"\n", - "M4ID:", dat %>% pull(.data$m4id), " ", - ifelse(verbose, "", paste0( - "HITC:", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3))) - )) + "S2ID:", dat %>% pull(.data$s2id), " ", + ifelse(verbose, "", paste0( + "HITC:", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3))) + )) + ) + ) + + theme( + plot.title = element_text(size = 12), + legend.title = element_blank(), + legend.margin = margin(0, 0, 0, 0), + legend.spacing.x = unit(0, "mm"), + legend.spacing.y = unit(0, "mm") ) - ) + - theme( - plot.title = element_text(size = 12), - legend.title = element_blank(), - legend.margin = margin(0, 0, 0, 0), - legend.spacing.x = unit(0, "mm"), - legend.spacing.y = unit(0, "mm") - ) + } else { + gg <- ggplot(l3_dat, aes(conc, resp)) + + geom_function(aes(color = !!model_test("gnls"), linetype = !!model_test("gnls")), fun = function(x) tcplfit2::gnls(ps = c(dat$gnls_tp, dat$gnls_ga, dat$gnls_p, dat$gnls_la, dat$gnls_q), x = x)) + + geom_function(aes(color = !!model_test("exp2"), linetype = !!model_test("exp2")), fun = function(x) tcplfit2::exp2(ps = c(dat$exp2_a, dat$exp2_b), x = x)) + + geom_function(aes(color = !!model_test("exp3"), linetype = !!model_test("exp3")), fun = function(x) tcplfit2::exp3(ps = c(dat$exp3_a, dat$exp3_b, dat$exp3_p), x = x)) + + geom_function(aes(color = !!model_test("exp4"), linetype = !!model_test("exp4")), fun = function(x) tcplfit2::exp4(ps = c(dat$exp4_tp, dat$exp4_ga), x = x)) + + geom_function(aes(color = !!model_test("exp5"), linetype = !!model_test("exp5")), fun = function(x) tcplfit2::exp5(ps = c(dat$exp5_tp, dat$exp5_ga, dat$exp5_p), x = x)) + + geom_function(aes(color = !!model_test("poly1"), linetype = !!model_test("poly1")), fun = function(x) tcplfit2::poly1(ps = c(dat$poly1_a), x = x)) + + geom_function(aes(color = !!model_test("poly2"), linetype = !!model_test("poly2")), fun = function(x) tcplfit2::poly2(ps = c(dat$poly2_a, dat$poly2_b), x = x)) + + geom_function(aes(color = !!model_test("pow"), linetype = !!model_test("pow")), fun = function(x) tcplfit2::pow(ps = c(dat$pow_a, dat$pow_p), x = x)) + + geom_function(aes(color = !!model_test("hill"), linetype = !!model_test("hill")), fun = function(x) tcplfit2::hillfn(ps = c(dat$hill_tp, dat$hill_ga, dat$hill_p), x = x)) + + geom_vline(aes(xintercept = dat$ac50, color = "AC50", linetype = "AC50")) + + geom_hline(aes(yintercept = dat$coff, color = "Cutoff", linetype = "Cutoff")) + + geom_point() + + scale_x_continuous(limits = l3_range, trans = ifelse(0 %in% l3_dat$conc,"identity","log10")) + + scale_y_continuous(limits = yrange) + + scale_color_viridis_d("", direction = -1, guide = guide_legend(reverse = TRUE, order = 2), end = 0.9) + + scale_linetype_manual("", guide = guide_legend(reverse = TRUE, order = 2), values = c(2, 2, 2, 3, 1)) + + xlab(paste0("Concentration ", "(", dat$conc_unit, ")")) + + ylab(stringr::str_to_title(gsub("_", " ", dat$normalized_data_type))) + + labs( + title = paste0( + stringr::str_trunc(paste0( + dat %>% pull(.data$dsstox_substance_id), " ", + dat %>% pull(.data$chnm) + ), 75), "\n", + stringr::str_trunc(paste0( + "SPID:", dat %>% pull(.data$spid), " ", + "AEID:", dat %>% pull(.data$aeid), " ", + "AENM:", dat %>% pull(.data$aenm)), 70),"\n", + "M4ID:", dat %>% pull(.data$m4id), " ", + ifelse(verbose, "", paste0( + "\nHITC:", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3))) + )) + ), + caption = ifelse(flags, paste0( + "\nFlags(", flag_count, "): ", paste0(trimws(format(dat$flag, nsmall = 3))) + ), "") + ) + + theme( + plot.title = element_text(size = 12), + plot.caption = element_text(hjust = 0, margin = margin(-1,0,1,0)), + axis.title.x = element_text(margin = margin(3,0,-5,0)), + legend.title = element_blank(), + legend.margin = margin(0, 0, 0, 0), + legend.spacing.x = unit(0, "mm"), + legend.spacing.y = unit(0, "mm") + ) + } if (!is.null(dat$bmd) && !is.null(dat$bmr)){ gg = gg + geom_segment(aes(x=dat$bmd, xend=dat$bmd, y=-Inf, yend=dat$bmr, color = "BMD", linetype = "BMD")) + geom_segment(x=-Inf, aes(xend=dat$bmd, y = dat$bmr, yend=dat$bmr, color = "BMD", linetype = "BMD")) @@ -667,7 +1048,7 @@ tcplggplot <- function(dat, lvl = 5, verbose = FALSE) { # general function to round/shorten values for plotting tables round_n <- function(x, n=3) { if (!is.na(x)) { - if (x >= 1000 | x<=0.0005) { + if (x >= 1000 | (x<=0.0005 & x != 0)) { # if x>=1000, convert value to scientific notation formatC(x, format = "e", digits = 1) } else { # else, round the value to 3 decimal places @@ -678,24 +1059,403 @@ tcplggplot <- function(dat, lvl = 5, verbose = FALSE) { } } round_n <- Vectorize(round_n) - + combined_p <- data.table::rbindlist(p) - pivoted_p <- combined_p %>% - tidyr::extract(name, c("model", "param"), "([[:alnum:]]+)_([[:alnum:]]+)") %>% - pivot_wider(names_from = "param", values_from = "value") - pivoted_p <- pivoted_p %>% mutate_if(is.numeric, ~ round_n(., 3)) - pivoted_p <- pivoted_p %>% arrange(as.numeric(aic)) - # print(pivoted_p) - t <- tableGrob(pivoted_p, rows = NULL) - l5_details <- tibble(Hitcall = dat$hitc, BMD = dat$bmd, AC50 = dat$ac50) - l5_details <- l5_details %>% mutate_if(is.numeric, ~ round_n(., 3)) - l5_t <- tableGrob(l5_details, rows = NULL) + pivoted_p <- combined_p + t <- NULL + if (lvl != 2) { + l5_details <- tibble(Hitcall = dat$hitc, BMD = dat$bmd, AC50 = dat$ac50) + l5_details <- l5_details %>% mutate_if(is.numeric, ~ round_n(., 3)) + l5_t <- tableGrob(l5_details, rows = NULL) + pivoted_p <- combined_p %>% + tidyr::extract(name, c("model", "param"), "([[:alnum:]]+)_([[:alnum:]]+)") %>% + pivot_wider(names_from = "param", values_from = "value") + pivoted_p <- pivoted_p %>% mutate_if(is.numeric, ~ round_n(., 3)) + pivoted_p <- pivoted_p %>% arrange(as.numeric(aic)) + t <- tableGrob(pivoted_p, rows = NULL) + valigned <- gtable_combine(l5_t, t, along = 2) + } else { + l5_details <- tibble(Hitcall = dat$hitc) + l5_details <- l5_details %>% mutate_if(is.numeric, ~ round_n(., 3)) + l5_t <- tableGrob(l5_details, rows = NULL) + valigned <- gtable_combine(l5_t, along = 2) + } + + if (lvl == 2) { + ifelse(verbose, + return(arrangeGrob(gg, valigned, ncol = 1, heights = c(4,1))), + return(gg) + ) + } else { + ifelse(verbose, + return(arrangeGrob(gg, valigned, nrow = 1, widths = 2:1)), + return(gg) + ) + } +} - valigned <- gtable_combine(l5_t, t, along = 2) - ifelse(verbose, - return(arrangeGrob(gg, valigned, nrow = 1, widths = 2:1)), - return(gg) - ) +#' tcplggplotCompare +#' +#' @param dat data table with all required conc/resp data +#' @param compare.dat data table with all required conc/resp data for comparison +#' overlay +#' @param 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 +#' @param verbose boolean should plotting include table of values next to the plot +#' @param flags boolean should plotting include level 6 flags in plot caption +#' @param yrange Integer of length 2, for overriding the y-axis range, c(,). +#' By default, c(NA,NA). +#' +#' @return A ggplot object or grob with accompanied table depending on verbose option +#' @importFrom dplyr %>% filter group_by summarise left_join inner_join select rowwise mutate pull mutate_if +#' @importFrom dplyr tibble contains everything as_tibble arrange .data +#' @importFrom ggplot2 ggplot aes geom_function geom_vline geom_hline geom_point scale_x_continuous scale_y_continuous scale_color_viridis_d +#' @importFrom ggplot2 guide_legend scale_linetype_manual xlab ylab geom_text labs theme element_blank +#' @importFrom ggplot2 margin unit element_text geom_segment scale_color_manual +#' @import gridExtra +#' @import stringr +tcplggplotCompare <- function(dat, compare.dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA,NA)) { + # variable binding + conc <- resp <- xpos <- ypos <- hjustvar <- vjustvar <- NULL + annotateText <- name <- aic <- l3 <- NULL + l3_dat_main <- tibble(conc = unlist(dat$conc), resp = unlist(dat$resp), max_med = dat$max_med, l3 = "main") + l3_dat_compare <- tibble(conc = unlist(compare.dat$conc), resp = unlist(compare.dat$resp), max_med = compare.dat$max_med, l3 = "compare") + l3_dat_both <- rbind(l3_dat_main, l3_dat_compare) + l3_range <- l3_dat_both %>% + pull(.data$conc) %>% + range() + + if (dat$conc_unit != compare.dat$conc_unit || dat$normalized_data_type != compare.dat$normalized_data_type) stop("Units do not match.") + + # check if model_type is 3 or 4, which means an override method was assigned + if (lvl == 5) { + # main data + if (dat$model_type == 3) { # gain direction + # leave coff but bmr should flip if top is negative + if (!is.null(dat$top) && !is.na(dat$top) && !is.null(dat$bmr)) { + if (dat$top < 0) { + dat$bmr <- dat$bmr * -1 + } + } + } else if (dat$model_type == 4) { # loss direction + # coff and bmr(if top < 0) should be negative + if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { + dat$coff <- dat$coff * -1 + if (dat$top < 0) { + dat$bmr <- dat$bmr * -1 + } + } + } else { # bidirectional + # check if winning model has negative top. If so coff,bmr should be negative + if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { + if (dat$top < 0) { + dat$coff <- dat$coff * -1 + dat$bmr <- dat$bmr * -1 + } + } + } + + # compare data + if (compare.dat$model_type == 3) { # gain direction + # leave coff but bmr should flip if top is negative + if (!is.null(compare.dat$top) && !is.na(compare.dat$top) && !is.null(compare.dat$bmr)) { + if (compare.dat$top < 0) { + compare.dat$bmr <- compare.dat$bmr * -1 + } + } + } else if (compare.dat$model_type == 4) { # loss direction + # coff and bmr(if top < 0) should be negative + if (!is.null(compare.dat$top) && !is.null(compare.dat$coff) && !is.na(compare.dat$top) && !is.null(compare.dat$bmr)) { + compare.dat$coff <- compare.dat$coff * -1 + if (compare.dat$top < 0) { + compare.dat$bmr <- compare.dat$bmr * -1 + } + } + } else { # bidirectional + # check if winning model has negative top. If so coff,bmr should be negative + if (!is.null(compare.dat$top) && !is.null(compare.dat$coff) && !is.na(compare.dat$top) && !is.null(compare.dat$bmr)) { + if (compare.dat$top < 0) { + compare.dat$coff <- compare.dat$coff * -1 + compare.dat$bmr <- compare.dat$bmr * -1 + } + } + } + } else { #single conc + # main data + if (!is.null(dat$coff) && dat$max_med < 0) { + dat$coff <- dat$coff * -1 + } + if (!is.null(dat$coff) && !is.null(dat$hitc) && dat$hitc < 0) { + dat$coff <- dat$coff * -1 + } + + # compare data + if (!is.null(compare.dat$coff) && compare.dat$max_med < 0) { + compare.dat$coff <- compare.dat$coff * -1 + } + if (!is.null(compare.dat$coff) && !is.null(compare.dat$hitc) && compare.dat$hitc < 0) { + compare.dat$coff <- compare.dat$coff * -1 + } + } + + # check if data is outside bounds of yrange. If so, expand yrange bounds + if (!identical(yrange, c(NA,NA))) { + yrange[1] <- min(dat$resp_min, dat$coff, yrange[1], unlist(dat$resp), + compare.dat$resp_min, compare.dat$coff, unlist(compare.dat$resp)) + yrange[2] <- max(dat$resp_max, dat$coff, yrange[2], unlist(dat$resp), + compare.dat$resp_max, compare.dat$coff, unlist(compare.dat$resp)) + } + + check_wllt <- function(data) { + # check if dtxsid is NA, pull wllt in from lvl 3 + if (is.na(data$dsstox_substance_id) | is.na(data$chnm)) { + wllt <- unique(tcplLoadData(type = ifelse(lvl == 2, "sc", "mc"), lvl = 0, fld = list("spid","acid"), + list(data$spid, tcplLoadAcid(fld = "aeid", val = data$aeid)$acid))$wllt) + if (length(wllt) == 1) { + if (wllt == 'c' | wllt == 'p') { + data$dsstox_substance_id <- "Gain-of-signal control" + data$chnm <- "" + } + else if (wllt == 'm' | wllt == 'o') { + data$dsstox_substance_id <- "Loss-of-signal control" + data$chnm <- "" + } + else if (wllt == 'n') { + data$dsstox_substance_id <- "Neutral/negative control" + data$chnm <- "" + } + else if (wllt == 'b') { + data$dsstox_substance_id <- "Blank" + data$chnm <- "" + } + else if (wllt == 'v') { + data$dsstox_substance_id <- "Viability control" + data$chnm <- "" + } + else { + data$dsstox_substance_id <- paste0("Well type: ", wllt) + data$chnm <- "" + } + } + else { + if (length(wllt) > 1) { + data$dsstox_substance_id <- paste0("Well type: ", paste(wllt, collapse = ", ")) + data$chnm <- "" + } else { + warning(paste0("wllt for SPID: ", data$spid, " is missing. + Leaving dsstox_substance_id and chnm as NA.")) + } + } + } + return(data) + } + if (getOption("TCPL_DRVR") != "API") { + dat <- check_wllt(dat) + compare.dat <- check_wllt(compare.dat) + } + + dat$winning_model_string <- paste0("Model A(", dat$modl, ")") + compare.dat$winning_model_string <- paste0("Model B(", compare.dat$modl, ")") + winning_model_geom_function <- function(data, x) { + if (data$modl == "gnls") { + tcplfit2::gnls(ps = c(data$gnls_tp, data$gnls_ga, data$gnls_p, data$gnls_la, data$gnls_q), x = x) + } else if (data$modl == "exp3") { + tcplfit2::exp3(ps = c(data$exp3_a, data$exp3_b, data$exp3_p), x = x) + } else if (data$modl == "exp4") { + tcplfit2::exp4(ps = c(data$exp4_tp, data$exp4_ga), x = x) + } else if (data$modl == "exp5") { + tcplfit2::exp5(ps = c(data$exp5_tp, data$exp5_ga, data$exp5_p), x = x) + } else if (data$modl == "poly1") { + tcplfit2::poly1(ps = c(data$poly1_a), x = x) + } else if (data$modl == "exp2") { + tcplfit2::exp2(ps = c(data$exp2_a, data$exp2_b), x = x) + } else if (data$modl == "poly2") { + tcplfit2::poly2(ps = c(data$poly2_a, data$poly2_b), x = x) + } else if (data$modl == "pow") { + tcplfit2::pow(ps = c(data$pow_a, data$pow_p), x = x) + } else if (data$modl == "hill") { + tcplfit2::hillfn(ps = c(data$hill_tp, data$hill_ga, data$hill_p), x = x) + } else { + x*NA + } + } + + flag_count <- 0 + flag_count_compare <- 0 + if (flags && dat$flag != "None") { + flag_count <- str_count(dat$flag, "\n") + 1 + } + if (flags && compare.dat$flag != "None") { + flag_count_compare <- str_count(compare.dat$flag, "\n") + 1 + } + + + identical_title <- paste0(stringr::str_trunc(paste0( + ifelse(dat$dsstox_substance_id == compare.dat$dsstox_substance_id, paste0(dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm == compare.dat$chnm, paste0(dat$chnm, "\n"), "") + ), 75), + stringr::str_trunc(paste0( + ifelse(dat$spid == compare.dat$spid, paste0("SPID:", dat$spid, " "), ""), + ifelse(dat$aeid == compare.dat$aeid, paste0("AEID:", dat$aeid, " "), ""), + ifelse(dat$aenm == compare.dat$aenm, paste0("AENM:", dat$aenm), "")), 70)) + if (identical_title != "" & !endsWith(identical_title, "\n")) { + identical_title <- paste0(identical_title, "\n") + } + + + if (lvl == 2) { + gg <- ggplot(l3_dat_both, aes(conc, resp, color = l3)) + + geom_hline(aes(yintercept = dat$max_med, linetype = "Max Median A"), color="blue") + + geom_hline(aes(yintercept = compare.dat$max_med, linetype = "Max Median B"), color="red") + + geom_hline(aes(yintercept = compare.dat$coff, linetype="Cutoff B"), color="red") + + geom_hline(aes(yintercept = dat$coff, linetype="Cutoff A"), color="blue") + + geom_point() + + scale_x_continuous(limits = l3_range, trans = ifelse(0 %in% l3_dat_both$conc,"identity","log10")) + + scale_y_continuous(limits = yrange) + + scale_linetype_manual("", breaks = c("Max Median A", "Max Median B", "Cutoff A", "Cutoff B"), + guide = guide_legend(override.aes = list(color = c("blue", "red", "blue", "red"), linetype = c("solid", "solid", "dashed", "dashed"))), + values = if (compare.dat$coff == dat$coff) c("solid", "solid", "39", "15393933") else c("solid", "solid", "33", "33")) + + scale_color_manual(breaks = c(), guide = guide_legend(reverse = TRUE), values=c("red", "blue")) + + xlab(paste0("Concentration ", "(", dat$conc_unit, ")")) + + ylab(stringr::str_to_title(gsub("_", " ", dat$normalized_data_type))) + + labs( + title = paste0( + ifelse(identical_title != "", paste0(identical_title, "\n"), ""), + stringr::str_trunc(paste0( + "A: ", + ifelse(dat$dsstox_substance_id != compare.dat$dsstox_substance_id, paste0(dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm != compare.dat$chnm, paste0(dat$chnm, "\n"), "") + ), 75), + stringr::str_trunc(paste0( + ifelse(dat$aeid != compare.dat$aeid, paste0("AEID:", dat$aeid, " "), ""), + ifelse(dat$aenm != compare.dat$aenm, paste0("AENM:", dat$aenm, "\n"), ""), + ifelse(dat$spid != compare.dat$spid, paste0("SPID:", dat$spid, " "), "")), 70), + "S2ID:", dat$s2id, " ", + ifelse(verbose, "", paste0( + "\nHITC:", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3))) + )), + stringr::str_trunc(paste0( + "\n\n", + "B: ", + ifelse(dat$dsstox_substance_id != compare.dat$dsstox_substance_id, paste0(compare.dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm != compare.dat$chnm, paste0(compare.dat$chnm, "\n"), "") + ), 75), + stringr::str_trunc(paste0( + ifelse(dat$aeid != compare.dat$aeid, paste0("AEID:", compare.dat$aeid, " "), ""), + ifelse(dat$aenm != compare.dat$aenm, paste0("AENM:", compare.dat$aenm, "\n"), ""), + ifelse(dat$spid != compare.dat$spid, paste0("SPID:", compare.dat$spid, " "), "")), 70), + "S2ID:", compare.dat$s2id, " ", + ifelse(verbose, "", paste0( + "\nHITC:", paste0(trimws(format(round(compare.dat$hitc, 3), nsmall = 3))) + )) + ) + ) + + theme( + plot.title = element_text(size = 12), + legend.title = element_blank(), + legend.margin = margin(0, 0, 0, 0), + legend.spacing.x = unit(0, "mm"), + legend.spacing.y = unit(0, "mm") + ) + } else { + gg <- ggplot(l3_dat_both, aes(conc, resp, color = l3)) + + geom_function(aes(linetype = dat$winning_model_string), fun = function(x) winning_model_geom_function(dat, x), color = "blue", alpha = 0.5) + + geom_function(aes(linetype = compare.dat$winning_model_string), fun = function(x) winning_model_geom_function(compare.dat, x), color = "red", alpha = 0.5) + + geom_hline(aes(yintercept = compare.dat$coff, linetype = "Cutoff B"), color = "red") + + geom_hline(aes(yintercept = dat$coff, linetype = "Cutoff A"), color = "blue") + + geom_point(alpha = 0.5) + + scale_x_continuous(limits = l3_range, trans = ifelse(0 %in% l3_dat_both$conc,"identity","log10")) + + scale_y_continuous(limits = yrange) + + scale_linetype_manual("", breaks = c(dat$winning_model_string, compare.dat$winning_model_string, "Cutoff A", "Cutoff B"), + guide = guide_legend(override.aes = list(color = c("blue", "red", "blue", "red"), linetype = c("solid", "solid", "dashed", "dashed"))), + values = if (compare.dat$coff == dat$coff) c("solid", "solid", "39", "15393933") else c("solid", "solid", "33", "33"),) + + scale_color_manual(breaks = c(), guide = guide_legend(reverse = TRUE), values=c("red", "blue")) + + xlab(paste0("Concentration ", "(", dat$conc_unit, ")")) + + ylab(stringr::str_to_title(gsub("_", " ", dat$normalized_data_type))) + + labs( + title = paste0( + ifelse(identical_title != "", paste0(identical_title, "\n"), ""), + stringr::str_trunc(paste0( + "A: ", + ifelse(dat$dsstox_substance_id != compare.dat$dsstox_substance_id, paste0(dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm != compare.dat$chnm, paste0(dat$chnm, "\n"), "") + ), 75), + stringr::str_trunc(paste0( + ifelse(dat$spid != compare.dat$spid, paste0("SPID:", dat$spid, " "), ""), + ifelse(dat$aeid != compare.dat$aeid, paste0("AEID:", dat$aeid, " "), ""), + ifelse(dat$aenm != compare.dat$aenm, paste0("AENM:", dat$aenm, "\n"), "")), 70), + "M4ID:", dat$m4id, " ", + ifelse(verbose, "", paste0( + "\nHITC:", paste0(trimws(format(round(dat$hitc, 3), nsmall = 3))) + )), + stringr::str_trunc(paste0( + "\n\n", + "B: ", + ifelse(dat$dsstox_substance_id != compare.dat$dsstox_substance_id, paste0(compare.dat$dsstox_substance_id, " "), ""), + ifelse(dat$chnm != compare.dat$chnm, paste0(compare.dat$chnm, "\n"), "") + ), 75), + stringr::str_trunc(paste0( + ifelse(dat$spid != compare.dat$spid, paste0("SPID:", compare.dat$spid, " "), ""), + ifelse(dat$aeid != compare.dat$aeid, paste0("AEID:", compare.dat$aeid, " "), ""), + ifelse(dat$aenm != compare.dat$aenm, paste0("AENM:", compare.dat$aenm, "\n"), "")), 70), + "M4ID:", compare.dat$m4id, " ", + ifelse(verbose, "", paste0( + "\nHITC:", paste0(trimws(format(round(compare.dat$hitc, 3), nsmall = 3))) + )) + ), + caption = ifelse(flags, paste0( + "\nFlags:\nA(", flag_count, "): ", paste0(trimws(format(dat$flag, nsmall = 3))), + "\n\nB(", flag_count_compare, "): ", paste0(trimws(format(compare.dat$flag, nsmall = 3))) + ), "") + ) + + theme( + plot.title = element_text(size = 12), + plot.caption = element_text(hjust = 0, margin = margin(-1,0,1,0)), + axis.title.x = element_text(margin = margin(3,0,-5,0)), + legend.title = element_blank(), + legend.margin = margin(0, 0, 0, 0), + legend.spacing.x = unit(0, "mm"), + legend.spacing.y = unit(0, "mm") + ) + } + + # general function to round/shorten values for plotting tables + round_n <- function(x, n=3) { + if (!is.na(x)) { + if (x >= 1000 | (x<=0.0005 & x != 0)) { + # if x>=1000, convert value to scientific notation + formatC(x, format = "e", digits = 1) + } else { # else, round the value to 3 decimal places + format(round(x, n), nsmall = 3) + } + } else { + return(NA) + } + } + round_n <- Vectorize(round_n) + + t <- NULL + if (lvl != 2) { + details <- tibble(Hitcall = c(dat$hitc, compare.dat$hitc), + BMD = c(dat$bmd, compare.dat$bmd), + AC50 = c(dat$ac50, compare.dat$ac50)) + details <- details %>% mutate_if(is.numeric, ~ round_n(., 3)) + details <- as.data.frame(details) + t <- tableGrob(details, rows = c("A", "B")) + ifelse(verbose, + return(arrangeGrob(gg, t, nrow = 1, widths = 2:1)), + return(arrangeGrob(gg)) + ) + } else { + details <- tibble(Hitcall = c(dat$hitc, compare.dat$hitc)) + details <- details %>% mutate_if(is.numeric, ~ round_n(., 3)) + t <- tableGrob(details, rows = c("A", "B")) + ifelse(verbose, + return(arrangeGrob(gg, t, ncol = 1, heights = c(4,1))), + return(gg) + ) + } } diff --git a/R/tcplPlotFitc.R b/R/tcplPlotFitc.R index d38368b8..836bd99c 100644 --- a/R/tcplPlotFitc.R +++ b/R/tcplPlotFitc.R @@ -36,6 +36,9 @@ tcplPlotFitc <- function(fitc = NULL, main = NULL, fitc_sub = NULL) { r <- g <- N <- edge <- plt <- leaf <- parent_fitc <- xloc <- yloc <- NULL name <- J <- NULL + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") + if (!is.null(fitc)) { vals <- data.table(fitc = fitc)[ , .N, by = fitc] diff --git a/R/tcplPlotFits.R b/R/tcplPlotFits.R index 2430c309..fd703539 100644 --- a/R/tcplPlotFits.R +++ b/R/tcplPlotFits.R @@ -31,12 +31,7 @@ #' endpoint ID. #' #' @examples -#' -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfDefault() -#' +#' \dontrun{ #' ## 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 @@ -47,11 +42,9 @@ #' l5 <- tcplLoadData(lvl = 5, fld = "m4id", val = 18609966) #' l4_agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = 18609966) #' -#' \dontrun{ #' 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 @@ -61,14 +54,10 @@ #' ## 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] -#' \dontrun{ #' tcplPlotFits(dat = l5_sub, #' agg = l4_agg[m4id %in% l5_sub$m4id], #' browse = TRUE) #' } -#' -#' ## Reset configuration -#' options(conf_store) #' #' @import data.table #' @export @@ -80,6 +69,9 @@ tcplPlotFits <- function(dat, agg, flg = NULL, boot = NULL, ordr.fitc = FALSE, chid <- chnm <- spid <- aenm <- aeid <- m4id <- fitc <- fval <- NULL flgo <- mc6_mthd_id <- J <- NULL + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") + if (!is.null(flg) & !"m5id" %in% names(dat)) { stop("Must supply level 5 data with a non-null 'flg' input.") } diff --git a/R/tcplPlotLoadData.R b/R/tcplPlotLoadData.R new file mode 100644 index 00000000..e6282578 --- /dev/null +++ b/R/tcplPlotLoadData.R @@ -0,0 +1,142 @@ +#------------------------------------------------------------------------------- +# tcplPlotLoadData: Utility function to load data for tcplPlot +#------------------------------------------------------------------------------- + +#' @title Utility function to load data for tcplPlot +#' +#' @description +#' \code{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. +#' +#' @param type Character of length 1, the data type, "sc" or "mc" +#' @param fld Character, the field(s) to query on. +#' @param val List, vectors of values for each field to query on. Must be in +#' the same order as 'fld'. +#' @param 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 +#' +#' @details +#' This utility function is used by \code{tcplPlot} to load and prepare data from +#' \code{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 \code{tcplPlotLoadData}, switch data source +#' config and pass the data to \code{tcplPlot} \code{dat} parameter. +#' +#' The data \code{type} can be either 'mc' for multiple concentration data, or +#' 'sc' for single concentration data. +#' +#' @examples +#' \dontrun{ +#' ## 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") +#' } +#' +#' @return A data.table containing plot-ready data for the given fields. +#' +#' @seealso \code{\link{tcplPlot}} +#' +#' @import data.table +#' @export +tcplPlotLoadData <- function(type = "mc", fld = "m4id", val, flags = FALSE){ + #variable binding + lvl <- m4id <- conc <- resp <- conc_unit <- NULL + + # Validate vars based on some assumed properties + validated_vars <- tcplPlotValidate(type = type,flags = flags) + # take list of validated vars and add them to the function's environment + list2env(validated_vars, envir = environment()) + + # check that input combination is unique + dat <- tcplLoadData(lvl = lvl, fld = fld, val = val, type = type) + if (nrow(dat) == 0) stop("No data for fld/val provided") + + # set order to given order + dat <- dat[order(match(get(fld[1]), if(is.list(val)) val[[1]] else val))] + if (getOption("TCPL_DRVR") == "API" && tolower(fld) == "aeid") { + dat <- dat %>% arrange(m4id) + } + dat$order <- 1:nrow(dat) + + mcLoadDat <- function(m4id = NULL,flags) { + l4 <- tcplLoadData(lvl = 4, fld = "m4id", val = m4id, add.fld = T) + dat <- l4[dat, on = "m4id"] + if (flags == TRUE) { + l6 <- tcplLoadData(lvl=6, fld='m4id', val=m4id, type='mc') + if (nrow(l6) > 0) { + l6 <- l6[ , .( flag = paste(flag, collapse=";\n")), by = m4id] + no_flags <- setdiff(m4id, l6$m4id) + if (length(no_flags) > 0) { + l6 <- rbindlist(list(l6, data.table("m4id" = no_flags, "flag" = "None"))) + } + } else { + l6 <- data.table(m4id, "flag" = "None") + } + dat <- dat[l6, on = "m4id"] + } + dat + } + + # load dat + if (getOption("TCPL_DRVR") != "API") { + if (type == "mc") { + dat <- mcLoadDat(dat$m4id,flags = flags) + agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = dat$m4id) + } else { # type == 'sc' + agg <- tcplLoadData(lvl = "agg", fld = "s2id", val = dat$s2id, type = "sc") + } + + # unlog concs + if (!("conc" %in% colnames(agg))) agg <- mutate(agg, conc = 10^logc) + + #determine if we're single conc or multiconc based on dat + join_condition <- c("m4id","s2id")[c("m4id","s2id") %in% colnames(dat)] + conc_resp_table <- agg %>% group_by(.data[[join_condition]]) %>% summarise(conc = list(conc), resp = list(resp)) %>% as.data.table() + dat <- dat[conc_resp_table, on = join_condition] + + dat <- tcplPrepOtpt(dat) + + } else { + # fix flags from API for plotting + if (flags == TRUE) { + if (is.null(dat$flag)) { + flag <- NA + } + dat <- dat %>% rowwise() %>% mutate(flag = ifelse(is.na(flag[1]) || flag[1] == "NULL" || is.null(flag[1]), "None", paste(flag, collapse = ';\n'))) %>% ungroup() %>% as.data.table() + } + dat$conc_unit <- dat$tested_conc_unit + } + + # add normalized data type for y axis + ndt <- tcplLoadAeid(fld = "aeid", val = dat$aeid, add.fld = "normalized_data_type") + dat <- dat[ndt, on = "aeid"] + + # correct concentration unit label for x-axis + dat <- dat[is.na(conc_unit), conc_unit:="\u03BCM"] + dat <- dat[conc_unit=="uM", conc_unit:="\u03BCM"] + dat <- dat[conc_unit=="mg/l", conc_unit:="mg/L"] + + dat +} \ No newline at end of file diff --git a/R/tcplPlotM4ID.R b/R/tcplPlotM4ID.R index 0ce96885..f5c09dd4 100644 --- a/R/tcplPlotM4ID.R +++ b/R/tcplPlotM4ID.R @@ -27,17 +27,11 @@ #' the AC50 confidence interval and hit percentage information from bootstrapping. #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' +#' \dontrun{ #' 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 -#' -#' #' ## Reset configuration -#' options(conf_store) +#' } #' #' @seealso \code{\link{tcplPlotFits}}, \code{\link{tcplMakeAeidPlts}} #' @import data.table @@ -46,6 +40,9 @@ tcplPlotM4ID <- function(m4id, lvl = 4L) { + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") + if (length(lvl) > 1 | !lvl %in% 4:7) stop("invalid lvl input.") prs <- list(type = "mc", fld = "m4id", val = m4id) diff --git a/R/tcplPlotPlate.R b/R/tcplPlotPlate.R index f92f5131..39b7470f 100644 --- a/R/tcplPlotPlate.R +++ b/R/tcplPlotPlate.R @@ -35,19 +35,10 @@ #' pointsize = 10, units = "in" #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfDefault() -#' -#' d1 <- tcplLoadData(lvl = 1, fld = "acid", val = 1) #' \dontrun{ +#' d1 <- tcplLoadData(lvl = 1, fld = "acid", val = 1) #' tcplPlotPlate(dat = d1, apid = "09Apr2014.Plate.17") #' } -#' -#' ## Reset configuration -#' options(conf_store) -#' #' @import data.table #' @importFrom stats quantile #' @export @@ -59,6 +50,9 @@ tcplPlotPlate <- function(dat, apid, id = NULL, quant = c(0.001, 0.999)) { wllq <- aid <- wllt <- cndx <- nwll <- rown <- rowi <- coln <- NULL coli <- anm <- NULL + if (check_tcpl_db_schema()) stop("This function is no longer supported in this + version of invitrodb. Consider tcplPlot() instead.") + if (length(apid) != 1) stop("'apid' must be of length 1.") ap <- apid diff --git a/R/tcplPlotUtils.R b/R/tcplPlotUtils.R new file mode 100644 index 00000000..4b32d91a --- /dev/null +++ b/R/tcplPlotUtils.R @@ -0,0 +1,173 @@ +#' tcplPlotSetYRange +#' +#' @param dat dataset +#' @param yuniform should the yrange be uniform +#' @param yrange length 2 of the yrange +#' @param type mc or sc +#' +#' @return yrange of the data +tcplPlotSetYRange <- function(dat, yuniform, yrange, type) { + # variable binding + model_type <- NULL + # validate yrange + if (length(yrange) != 2) { + stop("'yrange' must be of length 2") + } + + # set range + if (yuniform == TRUE && identical(yrange, c(NA, NA))) { + min <- min(dat$resp_min, unlist(dat$resp)) + max <- max(dat$resp_max, unlist(dat$resp)) + if (type == "mc") { + # any bidirectional models contained in dat, cutoff both ways + if (2 %in% dat$model_type) { + cutoffs <- dat[model_type == 2]$coff + min <- min(min, cutoffs, cutoffs * -1) + max <- max(max, cutoffs, cutoffs * -1) + } + # any gain models contained in dat, cutoff only positive + if (3 %in% dat$model_type) { + cutoffs <- dat[model_type == 3]$coff + min <- min(min, cutoffs) + max <- max(max, cutoffs) + } + # any loss models contained in dat, cutoff only negative + if (4 %in% dat$model_type) { + cutoffs <- dat[model_type == 4]$coff + min <- min(min, cutoffs * -1) + max <- max(max, cutoffs * -1) + } + } else { + min <- min(min, dat$coff, dat$coff * -1) + max <- max(max, dat$coff, dat$coff * -1) + } + yrange <- c(min, max) + } + + yrange +} + + +#' tcplPlotValidate +#' +#' @param type string of mc or sc indicating if it is single or multi conc +#' @param flags bool - should we return flags +#' @param output how should the plot be formatted +#' @param multi are there multiple plots +#' @param verbose should the plot return a table with parameters +#' +#' @return a list of validated parameters for plotting +tcplPlotValidate <- function(type = "mc", flags = NULL, output = "none", multi = NULL, verbose = FALSE) { + # set lvl based on type + lvl <- 5 + if (type == "sc") { + lvl <- 2 + if (flags == TRUE) { + warning("'flags' was set to TRUE - no flags exist for plotting single concentration") + flags <- FALSE + } + } + + # default assign multi=TRUE for output="pdf" + if (output == "pdf" && is.null(multi)) { + multi <- TRUE + } + # forced assign multi=FALSE for output = c("console","png","jpg","svg","tiff"), verbose=FALSE for output="console" + if (output != "pdf") { + multi <- FALSE + if (output == "console") { + verbose <- FALSE + } + } + + list(lvl = lvl, type = type, flags = flags, output = output, multi = multi, verbose = verbose) +} + + +#' tcplLegacyPlot +#' +#' @return a ggplot based on old plotting methodology +tcplLegacyPlot <- function() { + # VARIABLE BINDING + fld <- val <- lvl <- multi <- fileprefix <- NULL + if (length(output) > 1) output <- output[1] + + prs <- list(type = "mc", fld = fld, val = val) + + if (lvl == 4L) dat <- do.call(tcplLoadData, args = c(lvl = 4L, prs)) + if (lvl >= 5L) dat <- do.call(tcplLoadData, args = c(lvl = 5L, prs)) + if (lvl >= 6L) { + flg <- do.call(tcplLoadData, args = c(lvl = 6L, prs)) + } else { + flg <- NULL + } + if (lvl == 7L) { + boot <- do.call(tcplLoadData, args = c(lvl = 7L, prs)) + } else { + boot <- NULL + } + + if (nrow(dat) == 0) stop("No data for fld/val provided") + + agg <- do.call(tcplLoadData, args = c(lvl = "agg", prs)) + + if (nrow(dat) == 1 & output == "console") { + tcplPlotFits(dat = dat, agg = agg, flg = flg, boot = boot) + } + if (nrow(dat) > 1 & output == "console") stop("More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: ", nrow(dat)) + + + if (is.null(by)) { + if (output == "pdf" & !multi) { + graphics.off() + pdf( + file = file.path( + getwd(), + paste0(fileprefix, ".", output) + ), + height = 6, + width = 10, + pointsize = 10 + ) + tcplPlotFits(dat = dat, agg = agg, flg = flg, boot = boot) + graphics.off() + } + # plotting if using multiplot function + hitc.all <- TRUE + if (multi) { + graphics.off() + pdf(file = file.path(getwd(), paste0(fileprefix, ".", output)), height = 10, width = 6, pointsize = 10) + par(mfrow = c(3, 2)) + tcplMultiplot(dat = dat, agg = agg, flg = flg, boot = boot, hitc.all = hitc.all) + graphics.off() + } + } else { + if (!by %in% names(dat)) stop("grouping variable unavailable.") + subset <- unlist(unique(dat[, by, with = FALSE])) + for (s in subset) { + if (output == "pdf" & !multi) { + graphics.off() + pdf( + file = file.path( + getwd(), + paste0(fileprefix, "_", by, "_", s, ".", output) + ), + height = 6, + width = 10, + pointsize = 10 + ) + tcplPlotFits(dat = dat[get(by) == s], agg = agg, flg = flg, boot = boot) + graphics.off() + } + # plotting if using multiplot function + hitc.all <- TRUE + if (multi) { + graphics.off() + pdf(file = file.path(getwd(), paste0(fileprefix, "_", by, "_", s, ".", output)), height = 10, width = 6, pointsize = 10) + par(mfrow = c(3, 2)) + tcplMultiplot(dat = dat[get(by) == s], agg = agg, flg = flg, boot = boot, hitc.all = hitc.all) + graphics.off() + } + } + } +} diff --git a/R/tcplPrepOtpt.R b/R/tcplPrepOtpt.R index c3898dd8..a161032f 100644 --- a/R/tcplPrepOtpt.R +++ b/R/tcplPrepOtpt.R @@ -21,12 +21,7 @@ #' function will only attempt to map the ID fields given by 'ids.' #' #' @examples -#' -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' +#' \dontrun{ #' ## Load some example data #' d1 <- tcplLoadData(1) #' @@ -42,10 +37,7 @@ #' d3 <- tcplPrepOtpt(d1, ids = "spid") #' "chnm" %in% names(d3) ## TRUE #' "acnm" %in% names(d3) ## FALSE -#' -#' ## Reset configuration -#' options(conf_store) -#' +#' } #' #' @return The given data.table with chemical and assay information mapped #' @export @@ -54,7 +46,7 @@ tcplPrepOtpt <- function(dat, ids = NULL) { ## Variable-binding to pass R CMD Check acnm <- acid <- aenm <- resp_unit <- aeid <- spid <- chid <- NULL - code <- chnm <- casn <- NULL + code <- chnm <- casn <- dsstox_substance_id <- NULL if (!"data.table" %in% class(dat)) { stop("'dat' must be a data.table.") @@ -98,6 +90,7 @@ tcplPrepOtpt <- function(dat, ids = NULL) { if ("casn" %in% dnames) dat[ , casn := NULL] if ("chnm" %in% dnames) dat[ , chnm := NULL] if ("code" %in% dnames) dat[ , code := NULL] + if ("dsstox_substance_id" %in% dnames) dat[ , dsstox_substance_id := NULL] cmap <- suppressWarnings(tcplLoadChem("spid", dat[ , unique(spid)])) dat <- merge(cmap, dat, by = "spid", all.y = TRUE) #add conc units diff --git a/R/tcplQuery.R b/R/tcplQuery.R index 22464aa1..653249ed 100644 --- a/R/tcplQuery.R +++ b/R/tcplQuery.R @@ -17,6 +17,9 @@ tcplQuery <- function(query, db = getOption("TCPL_DB"), if (is.null(drvr)) drvr <- getOption("TCPL_DRVR") #Check for valid inputs + if (drvr == "API") { + stop("'API' driver not supported in tcplQuery.") + } if (length(query) != 1 || !is(query, "character")) { stop("The input 'query' must be a character of length one.") } @@ -45,20 +48,6 @@ tcplQuery <- function(query, db = getOption("TCPL_DB"), } - if (drvr == "tcplLite") { - #query <- "SELECT spid,chemical.chid,casn,chnm FROM sample LEFT JOIN chemical ON chemical.chid=sample.chid WHERE sample.chid is NULL " - db_pars <- "Just running tcplLite, we're OK" - for (t in tbl) { - fpath <- paste(db, t, sep='/') - fpath <- paste(fpath, 'csv', sep='.') - assign(t, read.table(fpath, header=T, sep=',')) - } - - result <- as.data.table(sqldf(query, stringsAsFactors=F)) - - - } - if (is.null(db_pars)) { stop(getOption("TCPL_DRVR"), " is not a supported database system. See ", @@ -67,6 +56,11 @@ tcplQuery <- function(query, db = getOption("TCPL_DB"), } if (drvr == 'MySQL') { + + if("RMySQL" %in% loadedNamespaces()){ + unloadNamespace("RMySQL") + warning("'RMySQL' package is not supported with tcpl and has been detached.") + } dbcon <- do.call(dbConnect, db_pars) result <- dbGetQuery(dbcon, query) diff --git a/R/tcplQueryAPI.R b/R/tcplQueryAPI.R new file mode 100644 index 00000000..0eb1c559 --- /dev/null +++ b/R/tcplQueryAPI.R @@ -0,0 +1,88 @@ +#------------------------------------------------------------------------------- +# tcplQueryAPI: Query the CCTE Bioactivity API +#------------------------------------------------------------------------------- + +#' @rdname query_funcs +#' +#' @param resource must be either data or assay to determine which api endpoint to hit +#' @param fld field that should be used to query the api +#' @param val value for specified field to query on +#' @param return_flds optional list of fields that should be returned +#' @import data.table +#' @importFrom ctxR get_bioactivity_details_batch get_all_assays +#' @importFrom tidyr unnest +#' @importFrom dplyr select all_of +#' @export + + +tcplQueryAPI <- function(resource = "data", fld = NULL, val = NULL, return_flds = NULL) { + #variable binding + Server <- NULL + + if (getOption("TCPL_DRVR") != "API") stop("TCPL_DRVR must be set to 'API'. See ?tcplConf.") + + if (resource == "data") { + + # check fld + if (is.null(fld)) stop("'fld' cannot be NULL") + if (length(fld) > 1) stop("'fld' must be length 1") + fld <- if(tolower(fld) == "m4id") tolower(fld) else toupper(fld) + if (!(fld %in% c("AEID", "SPID", "m4id", "DTXSID"))) + stop("'fld' must be one of 'AEID', 'SPID', 'm4id', or 'DTXSID'") + + # get data from API using ccdR + dat <- suppressMessages(exec(get_bioactivity_details_batch, !!sym(fld) := val, Server := getOption("TCPL_HOST"))) + + # remove missing elements + lb <- length(dat) # store length before + na_names <- names(dat[sapply(dat, nrow) == 0]) + dat <- dat[sapply(dat, nrow) > 0] + if (lb != length(dat)) warning(paste0("Data not found for the following 'fld' and 'val' combos: \n", paste0(fld, ": ", na_names, collapse = "\n"))) + + dat <- rbindlist(dat, use.names = TRUE, fill = TRUE) + if (nrow(dat) == 0) return(dat) + + dat$dsstox_substance_id <- dat$dtxsid + + # unlist logc to conc + dat <- dat %>% rowwise() %>% mutate(conc = list(10^unlist(logc))) %>% as.data.table() + + } else if (resource == "assay") { + + # using get all assays and then filtering + dat <- get_all_assays(Server = paste0(getOption("TCPL_HOST"))) %>% as.data.table() + + } else stop("'resource' must = 'data' or 'assay'.") + + # adjust column names + colnames(dat) <- gsub("([a-z])([A-Z])", "\\1_\\L\\2", colnames(dat), perl = TRUE) + + # filter if searching by assay list + if (resource == "assay" && !is.null(fld)) { + + if (any(!(fld %in% colnames(dat)))) + stop(paste0("Query field(s) '", + paste0(fld[which(!(fld %in% colnames(dat)))], collapse = "', '"), + "' not available. Try using from the following: \n", + paste0(colnames(dat), collapse = "\n"))) + + # create index vector to length of field + fld_indices <- if (length(fld) == 1 | length(fld) == length(val)) 1:length(fld) + else stop("'fld' and 'val' must be the same size if length(fld) > 1") + + # put val into a list or move items into first element + if (length(fld) == 1) val <- list(unlist(val)) + + # for each field filter by same indexed val + for (i in fld_indices) { + dat <- dat[dat[[fld[i]]] %in% val[[i]],] + } + + } + + if (is.null(return_flds)) return(dat) + else { + return_flds <- intersect(c(tolower(fld), return_flds), colnames(dat)) + return(dat |> select(all_of(return_flds))) + } +} \ No newline at end of file diff --git a/R/tcplSendQuery.R b/R/tcplSendQuery.R index dcad0306..11e6e083 100644 --- a/R/tcplSendQuery.R +++ b/R/tcplSendQuery.R @@ -18,6 +18,9 @@ tcplSendQuery <- function(query, db = getOption("TCPL_DB"), drvr = getOption("TCPL_DRVR"), tbl=NULL, delete=F) { #Check for valid inputs + if (getOption("TCPL_DRVR") == "API") { + stop("'API' driver not supported in tcplSendQuery.") + } if (length(query) != 1 || !is(query,"character")) { stop("The input 'query' must be a character of length one.") } @@ -47,28 +50,6 @@ tcplSendQuery <- function(query, db = getOption("TCPL_DB"), } - if (getOption("TCPL_DRVR") == "tcplLite") { - db_pars <- "Just running tcplLite, we're OK" - - for (t in tbl) { - fpath <- paste(db, t, sep='/') - fpath <- paste(fpath, 'csv', sep='.') - assign(t, read.table(fpath, header=T, sep=',')) - } - - temp <- as.data.table(sqldf(query, stringsAsFactors=F)) - - if (delete == T) { - if (length(tbl) > 1) { - stop("Can't execute delete on more that one table") - } - db_pars <- db - fpath <- paste(db, tbl, sep='/') - fpath <- paste(fpath, 'csv', sep='.') - write.table(temp, file=fpath, append=F, row.names=F, sep=',', col.names=T) # Need to rewrite whole table - } - } - if (is.null(db_pars)) { stop(getOption("TCPL_DRVR"), " is not a supported database system. See ", @@ -77,6 +58,10 @@ tcplSendQuery <- function(query, db = getOption("TCPL_DB"), } if (drvr == 'MySQL') { + if("RMySQL" %in% loadedNamespaces()){ + unloadNamespace("RMySQL") + warning("'RMySQL' package is not supported with tcpl and has been detached.") + } dbcon <- do.call(dbConnect, db_pars) temp <- try(dbSendQuery(dbcon, query), silent = TRUE) if (!is(temp, "try-error")) dbClearResult(temp) diff --git a/R/tcplSubsetChid.R b/R/tcplSubsetChid.R index 0385db99..d71365d1 100644 --- a/R/tcplSubsetChid.R +++ b/R/tcplSubsetChid.R @@ -14,7 +14,7 @@ #' @param flag Integer, the mc6_mthd_id values to go into the flag count, see #' details for more information #' @param type Character of length 1, the data type, "sc" or "mc" -#' @param export_ready Boolean, default TRUE, should only export ready 1 values be included in calculation +#' @param export_ready Boolean, default FALSE, should only export ready 1 values be included in calculation #' #' @details #' \code{tcplSubsetChid} is intended to work with level 5 data that has @@ -23,7 +23,7 @@ #' 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 the modl_ga, +#' 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 \code{flag} param can be used to specify a subset of flags to be used in @@ -32,11 +32,7 @@ #' considering any flags. #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' tcplConfExample() -#' +#' \dontrun{ #' ## Load the example level 5 data #' d1 <- tcplLoadData(lvl = 5, fld = "aeid", val = 797) #' d1 <- tcplPrepOtpt(d1) @@ -49,9 +45,7 @@ #' ## 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)] -#' -#' ## Reset configuration -#' options(conf_store) +#' } #' #' @return A data.table with a single sample for every given chemical-assay #' pair. @@ -61,10 +55,10 @@ #' @import data.table #' @export -tcplSubsetChid <- function(dat, flag = TRUE, type = "mc", export_ready = TRUE) { +tcplSubsetChid <- function(dat, flag = TRUE, type = "mc", export_ready = FALSE) { ## Variable-binding to pass R CMD Check chit <- hitc <- aeid <- casn <- fitc <- fitc.ordr <- m4id <- nflg <- NULL - chid <- logc <- minc <- NULL + chid <- conc <- minc <- NULL if (!type %in% c("mc", "sc")) { stop("type must be sc (single concentration) or mc (multi-concentration)") @@ -152,9 +146,10 @@ tcplSubsetChid <- function(dat, flag = TRUE, type = "mc", export_ready = TRUE) { setkey(dat, "s2id") dat <- dat[dat1] - setkeyv(dat, c("aeid", "chid", "logc")) - dat[, minc := min(logc), by = list(aeid, chid)] - dat <- dat[logc == minc] + concvar <- if ("conc" %in% colnames(dat)) "conc" else "logc" + setkeyv(dat, c("aeid", "chid", concvar)) + dat[, minc := min(get(concvar)), by = list(aeid, chid)] + dat <- dat[get(concvar) == minc] dat <- unique(dat[, c("spid", "chid", "casn", "chnm", "dsstox_substance_id", "code", "aeid", "aenm", "s2id", "bmad", "max_med", "hitc", "coff", "resp_unit")]) setkeyv(dat, c("aeid", "chid", "max_med")) diff --git a/R/tcplVarMat.R b/R/tcplVarMat.R index 044301d5..821939af 100644 --- a/R/tcplVarMat.R +++ b/R/tcplVarMat.R @@ -7,155 +7,118 @@ #' @description #' \code{tcplVarMat} creates chemical by assay matrices. #' -#' @param chid Integer, chemical ID values to subset on +#' @param dsstox_substance_id Integer, chemical ID values to subset on #' @param aeid Integer, assay endpoint ID values to subset on #' @param add.vars Character, mc4 or mc5 field(s) not included in the standard #' list to add additional matrices -#' @param row.id Character, the chemical identifier to use in the output #' @param flag Integer or Logical of length 1, passed to #' \code{\link{tcplSubsetChid}} -#' @param cyto.pars List, named list of arguments passed to -#' \code{\link{tcplCytoPt}} -#' @param include.na.chid Logical of length 1, whether to include the chemicals -#' not listed in the tcpl databases (ie. controls) -#' @param odir Directory to write comma separated file(s) -#' @param file.prefix Character of length 1, prefix to the file name when odir -#' is not NULL -#' #' #' @details #' The \code{tcplVarMat} function is used to create chemical by assay matrices #' for different parameters. The standard list of matrices returned includes: #' #' \enumerate{ -#' \item "modl_ga" -- The logAC50 (in the gain direction) for the winning -#' model. -#' \item "hitc" -- The hit-call for the winning model. -#' \item "m4id" -- The m4id, listing the concentration series selected by -#' \code{tcplSubsetChid}. -#' \item "zscore" -- The z-score based on the output from \code{tcplCytoPt}. -#' The formula used for calculating the z-score is -#' \eqn{-(\mathit{modl\_ga} - \mathit{cyto\_pt})/\mathit{global\_mad}} -#' \item "tested" -- 1 or 0, 1 indicating the chemical/assay pair -#' was tested in either the single- or multiple-concentration format -#' \item "tested_sc" -- 1 or 0, 1 indicating the chemical/assay pair -#' was tested in the single-concentration format -#' \item "tested_mc" -- 1 or 0, 1 indicating the chemical/assay pair -#' was tested in the multiple-concentration format -#' \item "ac50" -- a modified AC50 table (in non-log units) where -#' assay/chemical pairs that were not tested, or tested and had a hitcall of 0 -#' or -1 have the value 1e6. -#' \item "neglogac50" -- -log(AC50/1e6) where assay/chemical pairs that were -#' not tested, or tested and had a hitcall of 0 or -1 have the value 0. +#' \item "ac50" -- The active concentration at 50% maximal response (ac50) for +#' the winning model. +#' \item "ac50_verbose" -- The AC50 for the winning model, with text describing +#' some situations. +#' \item "acc" -- The active concentration at user-defined cutoff for the +#' winning model. +#' \item "acc_verbose" -- The ACC for the winning model, with text describing +#' some situations. +#' \item "mc_hitc" -- The hit-call for the winning model in +#' multiple-concentration (mc) screening. +#' \item "sc_hitc" -- The hit-call in single concentration (sc) screening. #' } #' +#' \code{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: +#' \itemize{ +#' \item set to 1e6 when the chemical is tested but negative in mc. In _verbose +#' matrices, these are indicated as "MC neg". +#' \item 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". +#' \item 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" +#' \item 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, #' \code{tcplVarMat} aggregates multiple samples to a chemical level call -#' utilizing \code{\link{tcplSubsetChid}}. -#' -#' By setting \code{odir} the function will write out a csv with, naming the -#' file with the convention: "var_Matrix_date.csv" where 'var' is the name -#' of the matrix. A prefix can be added to the output files using the -#' 'file.prefix' parameter. -#' -#' When a concentration series has a sample id not listed in the \code{tcpl} -#' database, and 'include.na.chid' is TRUE, the rowname for that series will -#' be the concatenation of "SPID_" and the spid. Note, if the user gives a -#' subset of chid values to the 'chid' parameter, 'include.na.chid' will be -#' set to FALSE with a warning. -#' -#' The tcplVarMat function calls both \code{tcplSubsetChid} and -#' \code{tcplCytoPt} (which separately calls \code{tcplSubsetChid}). The input +#' utilizing \code{\link{tcplSubsetChid}}. The input #' for the \code{tcplVarMat} 'flag' parameter is passed to the -#' \code{tcplSubsetChid} call used to parse down the data to create the -#' matrices. The \code{tcplSubsetChid} called within \code{tcplCytoPt} (to -#' parse down the cytotoxicity data used to define the "zscore" matrix) can -#' be modified by passing a separate 'flag' element in the list defined by the -#' 'cyto.pars' parameter. +#' \code{tcplSubsetChid} call and used to parse down the data to create the +#' matrices. #' -#' @return A list of chemical by assay matrices where the rownames are given by -#' the 'row.id' parameter, and the colnames are given by assay endpoint name -#' (aenm). +#' @return 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). #' #' @examples -#' ## Store the current config settings, so they can be reloaded at the end -#' ## of the examples -#' conf_store <- tcplConfList() -#' TCPLlite <- file.path(system.file(package = "tcpl"), "example") -#' tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") #' \dontrun{ -#' ## Demonstrate the returned values. Note with no "burst" assays defined in -#' ## the example database, the user must provide which aeid values to use -#' ## in calculating the cytotoxicity distributions for the 'zscore' matrix. -#' tcplVarMat(chid = 1:5, cyto.pars = list(aeid = 1:2)) +#' ## Demonstrate the returned values. +#' varmat <- tcplVarMat() #' #' ## Other changes can be made -#' tcplVarMat(chid = 1:5, row.id = "chnm", cyto.pars = list(aeid = 1:2)) -#' tcplVarMat(chid = 1:5, add.vars = "max_med", cyto.pars = list(aeid = 1:2)) +#' 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") #' } -#' ## Reset configuration -#' options(conf_store) #' #' @seealso \code{\link{tcplSubsetChid}} #' #' @import data.table -#' @importFrom stats reformulate -#' @importFrom utils write.csv +#' @importFrom tidyr pivot_wider +#' @importFrom dplyr full_join summarise across all_of group_by filter #' @export -tcplVarMat <- function(chid = NULL, +tcplVarMat <- function(dsstox_substance_id = NULL, aeid = NULL, add.vars = NULL, - row.id = "code", - flag = TRUE, - cyto.pars = list(), - include.na.chid = FALSE, - odir = NULL, - file.prefix = NULL) { - - ## Variable-binding to pass R CMD Check - sc_tst <- spid <- mc_tst <- acid <- cyto_pt <- global_mad <- zscore <- hitc <- NULL - modl_ga <- NULL - - if (length(file.prefix) > 1) { - file.prefix <- file.prefix[1] - warning("Length of file.prefix greater than 1, only first element used.") - } + flag = TRUE) { + #variable binding + hitc <- aenm <- chnm <- NULL + # check input if (!is.null(aeid) & !is.vector(aeid)) stop("'aeid' must be a vector.") - if (!is.null(chid) & !is.vector(chid)) stop("'chid' must be a vector.") + if (!is.null(dsstox_substance_id) & !is.vector(dsstox_substance_id)) stop("'dsstox_substance_id' must be a vector.") - row.id <- row.id[1] - if (!row.id %in% c("code", "casn", "chid", "chnm", "dsstox_substance_id")) row.id <- "code" + row.id <- "dsstox_substance_id" valid_var <- c(tcplListFlds("mc4"), tcplListFlds("mc5")) if (!all(add.vars %in% valid_var)) stop("Invald add.vars value(s).") - std.vars <- c("modl_ga", "hitc", "m4id", "zscore") - vars <- c(std.vars, add.vars) + ac50str = ifelse(check_tcpl_db_schema(),"ac50","modl_ga") - cform <- reformulate(termlabels = "aenm", response = row.id) + std.vars <- c(ac50str, paste0(ac50str, "_verbose"), "acc", "acc_verbose", "hitc", "hitc.y") + vars <- c(std.vars, add.vars) ## Load all possibilities to create matrix dimensions - mc <- tcplQuery("SELECT DISTINCT mc5.aeid, spid FROM mc5 inner join mc4 on mc4.m4id = mc5.m4id;") sc <- tcplQuery("SELECT DISTINCT aeid, spid FROM sc2;") - + tst <- rbindlist(list(sc, mc)) tst <- unique(tst) - tst[ , sc_tst := spid %in% sc$spid] - tst[ , mc_tst := spid %in% mc$spid] rm(sc, mc) - - ## Expand acid to aeid - aeid_info <- tcplLoadAeid("aeid", tst[ , unique(aeid)], add.fld = "acid") - setkey(aeid_info, aeid) - setkey(tst, aeid) - tst <- aeid_info[ , list(acid, aeid)][tst, allow.cartesian = TRUE] ## Subset by aeid if (is.null(aeid)) { @@ -165,111 +128,69 @@ tcplVarMat <- function(chid = NULL, tst <- tst[aeid %in% ae] } - ## Load level 5 data - dat <- tcplLoadData(lvl = 5, fld = "aeid", val = ae, type = "mc") - - setkeyv(dat, c("aeid", "spid")) - setkeyv(tst, c("aeid", "spid")) - dat <- merge(dat, tst, all = TRUE) - - dat <- tcplPrepOtpt(dat) + ## Load sc2 and mc5 data + sc2 <- tcplLoadData(lvl=2,type='sc', fld='aeid',val=ae) - if (!is.null(chid)) { - if (include.na.chid) { - warning("'include.na.chid' cannot be TRUE when 'chid' is not NULL.") - include.na.chid <- FALSE - } - ch <- chid - dat <- dat[chid %in% ch] - } + mc5 <- tcplLoadData(lvl = 5, fld = "aeid", val = ae, type = "mc") - if(include.na.chid) { - dat[ , chid := as.character(chid)] - dat[is.na(chid), - c("casn", "chid", "code", "chnm") := paste0("SPID_", spid)] - } else { - dat <- dat[!is.na(chid)] + if (nrow(sc2) == 0 || nrow(mc5) == 0) { + stop("Missing sc or mc data. Consider expanding to include more aeids") } - dat <- tcplSubsetChid(dat = dat, flag = flag) - - if (is.null(cyto.pars)) cyto.pars <- list() - zdst <- do.call(what = tcplCytoPt, args = cyto.pars) - - if(include.na.chid) zdst[ , chid := as.character(chid)] - - setkey(zdst, chid) - setkey(dat, chid) - - dat <- zdst[ , list(chid, cyto_pt, global_mad)][dat] - - dat[hitc==1 , zscore := -(modl_ga - cyto_pt)/global_mad] - dat[hitc==0 , zscore := NA] - - mat.tested <- dcast(dat, - formula = cform, - fun.aggregate = lu, - value.var = "chid") - - mat.sc_tst <- dcast(dat, - formula = cform, - fun.aggregate = any, - value.var = "sc_tst") + sc2 <- tcplSubsetChid(tcplPrepOtpt(sc2), type='sc')[!is.na(dsstox_substance_id)] - mat.mc_tst <- dcast(dat, - formula = cform, - fun.aggregate = any, - value.var = "mc_tst") - - rnames <- mat.tested[ , get(row.id)] - e1 <- bquote(.(row.id) := NULL) - - mat.tested[ , eval(e1)] - mat.tested <- as.matrix(mat.tested) - row.names(mat.tested) <- rnames - - mat.sc_tst[ , eval(e1)] - mat.sc_tst <- as.matrix(mat.sc_tst) - row.names(mat.sc_tst) <- rnames + # merge mc5 data with all mc/sc spids + setkeyv(mc5, c("aeid", "spid")) + setkeyv(tst, c("aeid", "spid")) + mc5 <- merge(mc5, tst, all = TRUE) - mat.mc_tst[ , eval(e1)] - mat.mc_tst <- as.matrix(mat.mc_tst) - row.names(mat.mc_tst) <- rnames + # get chemical/sample information + mc5 <- tcplPrepOtpt(mc5) - ddt <- function(x) { - mat <- dcast(data = dat, formula = cform, value.var = x) - mat[ , eval(e1)] - mat <- as.matrix(mat) - row.names(mat) <- rnames - mat + # Subset by dsstox_substance_id + dtxsid <- dsstox_substance_id + if (!is.null(dtxsid)) { + mc5 <- mc5[dsstox_substance_id %in% dtxsid] + sc2 <- sc2[dsstox_substance_id %in% dtxsid] } - - mat.list <- lapply(vars, ddt) - names(mat.list) <- vars - mat.list[["tested"]] <- mat.tested - mat.list[["tested_mc"]] <- mat.mc_tst - mat.list[["tested_sc"]] <- mat.sc_tst - - mat_ac <- 10^mat.list[["modl_ga"]] - mat_ac[mat.list[["hitc"]] != 1] <- 1e6 - mat_ac[is.na(mat.list[["modl_ga"]]) & mat.list[["tested"]] == 1] <- 1e6 - mat_lac <- -log10(mat_ac/1e6) + # subset to one sample per chemical + mc5 <- tcplSubsetChid(dat = mc5, flag = flag) - mat.list[["ac50"]] <- mat_ac - mat.list[["neglogac50"]] <- mat_lac + # build matrices + mc5 <- mc5[hitc %in% c(0,-1), c("ac50", "acc") := 1e6] + long_sc2 <- sc2 |> group_by(dsstox_substance_id,aenm,chnm) + if (nrow(long_sc2) > 0) { + long_sc2 <- long_sc2 |> summarise(hitc = max(hitc)) |> filter(!is.na(dsstox_substance_id)) + } - if (!is.null(odir)) { - - fdate <- format(Sys.Date(), "%y%m%d.csv") - fname <- paste(names(mat.list), "Matrix", fdate, sep = "_") - if (!is.null(file.prefix)) fname <- paste(file.prefix, fname, sep = "_") - for(i in 1:length(mat.list)) { - write.csv(mat.list[[i]], file.path(odir, fname[i]), row.names = TRUE) + build_matrix <- function(var, verbose = FALSE) { + if (grepl("_verbose", var, fixed = TRUE)) { + var <- sub("_verbose", "", var) + verbose = TRUE } + long_mc5 <- mc5 |> group_by(dsstox_substance_id,aenm,chnm) |> + summarise(across(all_of(sub("\\.y", "", var)), mean)) |> filter(!is.na(dsstox_substance_id)) + long_all <- long_mc5 |> full_join(long_sc2, by = c("dsstox_substance_id","aenm", "chnm")) + long_res <- if (substr(var, 1, 2) == "ac") long_all |> + mutate("{var}" := case_when(is.na(get(var)) && hitc == 0 ~ 1e8, + is.na(get(var)) && hitc == 1 ~ 1e7, + TRUE ~ get(var)), + "{var}_verbose" := case_when(get(var) == 1e8 ~ "SC neg, No MC", + get(var) == 1e7 ~ "SC pos, No MC", + get(var) == 1e6 ~ "MC neg", + TRUE ~ toString(get(var)))) else long_all + colnames(long_res) = sub("\\.x", "", colnames(long_res)) + if (verbose) var <- paste0(var, "_verbose") + long_res[ , c("dsstox_substance_id", "chnm", "aenm", var)] |> + pivot_wider(names_from = aenm, values_from = var) |> as.data.table() } - mat.list + mat_list <- lapply(vars, build_matrix) + + names(mat_list) = c("ac50", "ac50_verbose", "acc", "acc_verbose", "mc_hitc", "sc_hitc", add.vars) + + mat_list } diff --git a/R/tcplWriteLvl0.R b/R/tcplWriteLvl0.R index b02c7864..a04f66af 100644 --- a/R/tcplWriteLvl0.R +++ b/R/tcplWriteLvl0.R @@ -104,10 +104,13 @@ tcplWriteLvl0 <- function(dat, type) { if (dat[, any(is.na(acid))]) { stop("No ACID supplied for some samples. Ensure all samples have an ACID then rerun.") } + + #set all na b or n wells to conc = 0 + dat[is.na(conc) & (wllt %in% c('b', 'n')), conc:=0] - ## Check for 0 concentration values - if (dat[,any(conc == 0)]) { - stop("Cannot process a concentration value of 0. Confirm source document lists 0 as concentration value and rerun with dummy value of .01") + ## Check for null concentration values + if (dat[,any(is.na(conc))]) { + stop("Cannot process a NULL concentration value. Update missing concentration value then rerun.") } ## Check wllt has been set for all samples diff --git a/R/tcpldbStats.R b/R/tcpldbStats.R index 891d03ba..3457b5ea 100644 --- a/R/tcpldbStats.R +++ b/R/tcpldbStats.R @@ -5,7 +5,7 @@ #' @title Get summary statistics for the database #' #' @description -#' \code{tcpldbStats} takes a string(type) and an optional parameter(val) to return the summary statistics on the entire tcplLite database +#' \code{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' diff --git a/R/v3_schema_functions.R b/R/v3_schema_functions.R index 94dad820..901be211 100644 --- a/R/v3_schema_functions.R +++ b/R/v3_schema_functions.R @@ -3,7 +3,7 @@ #' @param dat output of tcplfit2 that has been unnested into a data.table write_lvl_4 <- function(dat){ #variable binding - lvl <- aeid <- m4id <- m3ids <- NULL + lvl <- aeid <- m4id <- m3ids <- modified_by <- NULL mc4_cols <- c("aeid", "spid", @@ -12,17 +12,28 @@ write_lvl_4 <- function(dat){ "resp_min", "max_mean", "max_mean_conc", + "min_mean", + "min_mean_conc", "max_med", "max_med_conc", - "logc_max", - "logc_min", + "min_med", + "min_med_conc", + "max_med_diff", + "max_med_diff_conc", + "conc_max", + "conc_min", "nconc", "npts", "nrep", - "nmed_gtbl", + "nmed_gtbl_pos", + "nmed_gtbl_neg", "tmpi") mc4_agg_cols <- c(paste0("m", 0:4, "id"), "aeid") + mb <- paste(Sys.info()[c("login", "user", "effective_user")], collapse = ".") + dat[, modified_by := mb] + mc4_cols <- c(mc4_cols,"modified_by") + tcplAppend( dat = copy(dat[, unique(.SD), .SDcols = mc4_cols]), tbl = "mc4", diff --git a/README.Rmd b/README.Rmd new file mode 100644 index 00000000..774259f2 --- /dev/null +++ b/README.Rmd @@ -0,0 +1,38 @@ +--- +output: github_document +--- + + + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%" +) +``` + +# tcpl: The ToxCast Data Analysis Pipeline Supporting Accessible Bioactivity Data for Toxicology + + + +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/tcpl)](https://cran.r-project.org/package=tcpl) +[![Active](http://img.shields.io/badge/Status-Active-green.svg)](https://cran.r-project.org/package=tcpl) +[![Monthly Downloads](https://cranlogs.r-pkg.org/badges/last-month/tcpl?color=7BAFD4)](https://cranlogs.r-pkg.org/badges/last-month/tcpl?color=7BAFD4) +[![DOI](https://zenodo.org/badge/doi/ 10.32614/CRAN.package.tcpl.svg)](http://dx.doi.org/10.32614/CRAN.package.tcpl) + + + +## Welcome to the GitHub repository for the tcpl package. + + + +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 generated by the [US EPA's Toxicity Forecaster (ToxCast) program](https://www.epa.gov/comptox-tools/toxicity-forecasting-toxcast). tcpl can be used to support diverse chemical screening efforts. + +If you are interested in contributing or want to report a bug, please submit a issue or start a discussion. See [CONTRIBUTING](https://github.com/USEPA/CompTox-ToxCast-tcpl/blob/dev/CONTRIBUTING.md) for more information. + +To install the current development version, run the following command: + + devtools::install_github("USEPA/CompTox-ToxCast-tcpl") + diff --git a/README.md b/README.md index 71775be1..40cf4fbf 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,34 @@ -### tcpl: An R package for processing high-throughput chemical screening data -Welcome to the GitHub repository for the tcpl package. + -The tcpl package provides a set of tools for processing and modeling high-throughput and high-content chemical screening data. The package was developed for the chemical screening data generated by the US EPA [ToxCast program](https://www.epa.gov/chemical-research/toxicity-forecasting), but can be used for diverse chemical screening efforts. +# tcpl: The ToxCast Data Analysis Pipeline Supporting Accessible Bioactivity Data for Toxicology -If you are interested in contributing or want to report a bug, please see [CONTRIBUTING](CONTRIBUTING.md) for more information. + -To install the current development version run the following command: +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/tcpl)](https://cran.r-project.org/package=tcpl) +[![Active](http://img.shields.io/badge/Status-Active-green.svg)](https://cran.r-project.org/package=tcpl) +[![Monthly +Downloads](https://cranlogs.r-pkg.org/badges/last-month/tcpl?color=7BAFD4)](https://cranlogs.r-pkg.org/badges/last-month/tcpl?color=7BAFD4) +[![DOI](https://zenodo.org/badge/doi/%2010.32614/CRAN.package.tcpl.svg)](http://dx.doi.org/10.32614/CRAN.package.tcpl) + + + +## Welcome to the GitHub repository for the tcpl package. + + + +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 generated by the [US EPA’s Toxicity Forecaster (ToxCast) +program](https://www.epa.gov/comptox-tools/toxicity-forecasting-toxcast). +tcpl can be used to support diverse chemical screening efforts. + +If you are interested in contributing or want to report a bug, please +submit a issue or start a discussion. See +[CONTRIBUTING](https://github.com/USEPA/CompTox-ToxCast-tcpl/blob/dev/CONTRIBUTING.md) +for more information. + +To install the current development version, run the following command: devtools::install_github("USEPA/CompTox-ToxCast-tcpl") diff --git a/cran-comments.md b/cran-comments.md index 0a155abb..96a81e18 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,50 +1,38 @@ -3.1.0 Release integrates package tcplfit2 bidirectional fitting a major update that impacts resulting invitrodb database +* added single quotes to invitrodb and tcpl in DESCRIPTION +* fixed aeds URI + +## Changes from last version +* To resolve current cran check results: added package anchors to links +* Updated docs and vignette +* Plotting updates +* Added API functionality ## Test environments * local Windows 10 install, R 4.2.2 -* R Under development (unstable) (2023-10-04 r85267 ucrt) -* Rhub Windows Server 2022, R-devel, 64 bit -* Rhub Fedora Linux, R-devel, clang, gfortran -* Rhub Ubuntu Linux 20.04.1 LTS, R-release, GCC - -## rhub CMD check results -- All notes appear to be related to testing (rhub) environment -Found the following (possibly) invalid URLs: - URL: https://www.epa.gov/chemical-research/exploring-toxcast-data-downloadable-data - From: inst/doc/Data_retrieval.html - inst/doc/Introduction_Appendices.html - Status: 403 - Message: Forbidden - URL: https://www.epa.gov/chemical-research/toxicity-forecasting - From: inst/doc/Introduction_Appendices.html - Status: 403 - Message: Forbidden -* checking HTML version of manual ... [13s] NOTE -Skipping checking math rendering: package 'V8' unavailable -* checking for non-standard things in the check directory ... NOTE -Found the following files/directories: - ''NULL'' -* checking for detritus in the temp directory ... NOTE -Found the following files/directories: - 'lastMiKTeXException' - -## win devel check results -1 NOTE - Found the following (possibly) invalid URLs... -All links appear to work correctly when hyperlinked from the vignette, similar note to the rhub testing +* R Under development (unstable) (2024-10-04 r87208 ucrt) + +## winbuilder check results +Installation time in seconds: 13 +Check time in seconds: 183 +Status: OK +R Under development (unstable) (2024-10-08 r87214 ucrt) + ## local R CMD check results 0 ERRORs | 0 WARNINGs | 0 NOTES. ## Downstream dependencies -* There are 2 Downstream dependencies for this package. +* There are 3 Downstream dependencies for this package. ## revdepcheck results -We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 3 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. * We saw 0 new problems * We failed to check 0 packages + + diff --git a/data-raw/default_tcplMthdList.R b/data-raw/default_tcplMthdList.R new file mode 100644 index 00000000..636e563b --- /dev/null +++ b/data-raw/default_tcplMthdList.R @@ -0,0 +1,21 @@ +library(tcpl) +tcplConf(user=user, pass=pass, db="invitrodb", drvr="MySQL", host=host) + +mc2 <- tcplMthdList(2) +mc3 <- tcplMthdList(3) +mc4 <- tcplMthdList(4) +mc5 <- tcplMthdList(5) +mc6 <- tcplMthdList(6) +sc1 <- tcplMthdList(1, type = "sc") +sc2 <- tcplMthdList(2, type = "sc") + +mthd_list_defaults <- list(mc2 = mc2, + mc3 = mc3, + mc4 = mc4, + mc5 = mc5, + mc6= mc6, + sc1 = sc1, + sc2 = sc2 + ) + +usethis::use_data(mthd_list_defaults, overwrite = TRUE) diff --git a/data-raw/mc_test.R b/data-raw/mc_test.R new file mode 100644 index 00000000..cd209fad --- /dev/null +++ b/data-raw/mc_test.R @@ -0,0 +1,161 @@ +#==============================================================================# +# NOTE: This script is written such that it is run from 'top' to 'bottom' +# or programmatically via the Terminal. +# ('R CMD BATCH --vanilla '.) +# Please do not jump around when running this script. +#==============================================================================# +# NOTE: You MUST temporarily update tcplQuery() by adding a line at the top of the +# function: print(query). +# This is because the queries will be captured from output and saved as +# part of the mocking data. +#==============================================================================# +## r packages +devtools::load_all() + +library(here) +library(dplyr) +library(stringr) +#---------------------------# +## code to prepare `mc_test` dataset goes here +# source the user ID, password, host, and database information for connection +# - NOTE: To replicate one will need to save their own 'db_cred.R', including +# the 'userid', 'userpwd', 'host', and DB collection via 'ivtdb'. +source(file = here::here("data-raw/db_cred.R"),verbose = FALSE) +# connect to the DB +tcplConf(user = userid, + pass = userpwd, + host = host, + db = ivtdb, + drvr = "MySQL") + +# pick endpoints and ids +# load the number of rows and max hitc per aeid +mc5_counts <- tcplQuery("SELECT DISTINCT aeid, + COUNT( aeid ) as n, + max(hitc) as max_hitc + FROM invitrodb.mc5 GROUP BY aeid") +# filter to only include where at least one sample is active and n < 10 +mc5_counts <- mc5_counts %>% filter(max_hitc > 0.9 & n == 2) +# pick one aeid +aeid <- selected <- mc5_counts[sample(1:nrow(mc5_counts),size = 1,replace = FALSE),aeid] +# obtain the acid for the example dataset +acid <- tcplLoadAcid(fld = 'aeid',val = aeid)$acid +# pick one sample/row from each level (lvl 3 contains ids back to lvl 0 and lvl 6 does back to lvl 4) +l3 <- tcplLoadData(lvl = 3, fld = "acid", val = acid) +l3_sample1 <- l3[sample(1:nrow(l3),size = 1,replace = FALSE)] +l3_sample2 <- l3[sample(1:nrow(l3),size = 2,replace = FALSE)] +l5 <- tcplLoadData(lvl = 5, fld = "aeid", val = aeid, add.fld = FALSE) +l5_sample1 <- l5[sample(1:nrow(l5),size = 1,replace = FALSE)] +l5_sample2 <- l5[sample(1:nrow(l5),size = 2,replace = FALSE)] +l6 <- tcplLoadData(lvl = 6, fld = "aeid", val = aeid, add.fld = FALSE) +l6_sample1 <- l6[sample(1:nrow(l6),size = 1,replace = FALSE)] +l6_sample2 <- l6[sample(1:nrow(l6),size = 2,replace = FALSE)] +l7 <- tcplLoadData(lvl = 7, fld = "aeid", val = aeid, add.fld = FALSE) +l7_sample1 <- l7[sample(1:nrow(l7),size = 1,replace = FALSE)] +l7_sample2 <- l7[sample(1:nrow(l7),size = 2,replace = FALSE)] +# pick compare.val endpoints and ids +# be sure to only allow to choose from endpoints with the same number of samples +mc5_counts <- filter(mc5_counts, n == mc5_counts[aeid == selected]$n & aeid != selected) +compare.aeid <- mc5_counts[sample(1:nrow(mc5_counts),size = 1,replace = FALSE),aeid] +compare.l5 <- tcplLoadData(lvl = 5, fld = "aeid", val = compare.aeid) +compare.l5_sample1 <- compare.l5[sample(1:nrow(compare.l5),size = 1,replace = FALSE)] +compare.l5_sample2 <- compare.l5[sample(1:nrow(compare.l5),size = 2,replace = FALSE)] + + +get_query_data <- function(lvl, fld, val, compare.val = NULL, add.fld = TRUE, func = "tcplLoadData") { + message(compare.val) + if (func == "tcplLoadData") { + # IMPORTANT || MUST ADD TEMPORARY LINE TO TCPLQUERY -------------------------- + # add temporary line to top of tcplQuery to get the query string: print(query) + query_strings <- capture.output(result<-tcplLoadData(lvl = lvl, fld = fld, val = val, add.fld = add.fld)) + } else if (func == "tcplPlot") { + query_strings <- capture.output(result<-tcplPlot(type = "mc", fld = fld, + val = val, compare.val = compare.val, + output = "pdf", multi = TRUE, flags = TRUE, + fileprefix = "temp_tcplPlot")) + file.remove(stringr::str_subset(list.files(), "^temp_tcplPlot")) # clean up + } + + query_strings <- unique(gsub("\\\\", "\\\"", gsub("\"", "", gsub("\\\\n", "\\\n", gsub("\\[1\\] ", "", query_strings))))) + + # use queries to save data + dat <- lapply(query_strings, function(query_string) { + return(tcplQuery(query_string)) + }) + names(dat) <- query_strings + + # also store fld and val in list object for use in test case + dat[fld] <- val + if (!is.null(compare.val)) dat[sprintf("compare.%s", fld)] <- compare.val + return(dat) + +} + + +# to add more tests with new/different data to test-tcplLoadData.R, add lines below and run script +mc_test <- list( + tcplConfQuery = tcplQuery("SHOW VARIABLES LIKE 'max_allowed_packet'"), + mc0_by_m0id = get_query_data(lvl = 0, fld = "m0id", val = l3_sample1$m0id), + mc0_by_acid = get_query_data(lvl = 0, fld = "acid", val = acid), + mc1_by_m1id = get_query_data(lvl = 1, fld = "m1id", val = l3_sample1$m1id), + mc1_by_acid = get_query_data(lvl = 1, fld = "acid", val = acid), + mc2_by_m2id = get_query_data(lvl = 2, fld = "m2id", val = l3_sample1$m2id), + mc2_by_acid = get_query_data(lvl = 2, fld = "acid", val = acid), + mc3_by_m3id = get_query_data(lvl = 3, fld = "m3id", val = l3_sample1$m3id), + mc3_by_aeid = get_query_data(lvl = 3, fld = "aeid", val = aeid), + mc4_by_m4id = get_query_data(lvl = 4, fld = "m4id", val = l5_sample1$m4id), + mc4_by_aeid = get_query_data(lvl = 4, fld = "aeid", val = aeid, add.fld = FALSE), + mc5_by_m5id = get_query_data(lvl = 5, fld = "m5id", val = l5_sample1$m5id), + mc5_by_aeid = get_query_data(lvl = 5, fld = "aeid", val = aeid, add.fld = FALSE), + mc6_by_m6id = get_query_data(lvl = 6, fld = "m6id", val = l6_sample1$m6id), + mc6_by_aeid = get_query_data(lvl = 6, fld = "aeid", val = aeid), + mc7_by_m7id = get_query_data(lvl = 7, fld = "m7id", val = l7_sample1$m7id), + mc7_by_aeid = get_query_data(lvl = 7, fld = "aeid", val = aeid), + mcagg_by_aeid = get_query_data(lvl = "agg", fld = "aeid", val = aeid), + plot_single_m4id = get_query_data(fld = "m4id", + val = l5_sample1$m4id, + func = "tcplPlot"), + plot_multiple_m4id = get_query_data(fld = "m4id", + val = list(l5_sample2$m4id), + func = "tcplPlot"), + plot_single_aeid = get_query_data(fld = "aeid", + val = aeid, + func = "tcplPlot"), + plot_multiple_aeid = get_query_data(fld = "aeid", + val = list(c(aeid, compare.aeid)), + func = "tcplPlot"), + plot_single_spid = get_query_data(fld = c("spid", "aeid"), + val = list(l5_sample1$spid, aeid), + func = "tcplPlot"), + plot_multiple_spid = get_query_data(fld = c("spid", "aeid"), + val = list(l5_sample2$spid, aeid), + func = "tcplPlot"), + plot_single_m4id_compare = get_query_data(fld = "m4id", + val = l5_sample1$m4id, + compare.val = compare.l5_sample1$m4id, + func = "tcplPlot"), + plot_multiple_m4id_compare = get_query_data(fld = "m4id", + val = list(l5_sample2$m4id), + compare.val = list(compare.l5_sample2$m4id), + func = "tcplPlot"), + plot_single_aeid_compare = get_query_data(fld = "aeid", + val = aeid, + compare.val = compare.aeid, + func = "tcplPlot"), + plot_multiple_aeid_compare = get_query_data(fld = "aeid", + val = list(c(aeid, compare.aeid)), + compare.val = list(c(compare.aeid, aeid)), + func = "tcplPlot"), + plot_single_spid_compare = get_query_data(fld = c("spid", "aeid"), + val = list(l5_sample1$spid, aeid), + compare.val = list(compare.l5_sample1$spid, compare.aeid), + func = "tcplPlot"), + plot_multiple_spid_compare = get_query_data(fld = c("spid", "aeid"), + val = list(l5_sample2$spid, aeid), + compare.val = list(compare.l5_sample2$spid, compare.aeid), + func = "tcplPlot") +) +#---------------------------# +## save the data +usethis::use_data(mc_test, overwrite = TRUE) +#---------------------------# \ No newline at end of file diff --git a/data-raw/mc_vignette.R b/data-raw/mc_vignette.R index f481d3df..4b903f86 100644 --- a/data-raw/mc_vignette.R +++ b/data-raw/mc_vignette.R @@ -28,19 +28,15 @@ tcplConf(user = userid, db = ivtdb, drvr = "MySQL") # obtain the attagene (atg) aeid's (Assay Endpoint ID's) from the DB -atg.aeid <- tcplGetAeid("ATG") %>% - # keep only the 'up' assay endpoints - filter(.,grepl(aenm,pattern = "up")) %>% +atg.aeid <- tcplGetAeid("ATG") %>% # convert to a data.table object as.data.table() # print the data.table of aeid's atg.aeid # number of BioSeek endpoints nrow(atg.aeid) -# choose a random 'aeid' to utilize as an example dataset -set.seed(8011) -atg.aeid.ss <- sample(1:nrow(atg.aeid),size = 1,replace = FALSE) %>% - atg.aeid[.,] +# choose a 'aeid' to utilize as an example dataset +atg.aeid.ss <- atg.aeid[aenm == "ATG_GLI_CIS",] # obtain the 'acid' for the endpoints in the example dataset atg.acid.ss <- tcplLoadAcid(fld = 'aeid',val = atg.aeid.ss[,aeid]) # obtain level 0 mc data @@ -92,38 +88,40 @@ atg.mc5.ss <- atg.mc5 %>% dplyr::filter(.,nrep >=2) %>% # keep only the observations that have a hitcall >= 0.95 dplyr::filter(.,hitc >= 0.95) %>% - # re-arrange the observations by hicall in descending order - dplyr::arrange(desc(hitc)) %>% + # keep only the observations with a DTXSID + dplyr::filter(.,!is.na(dsstox_substance_id)) %>% + # re-arrange the observations by hitcall in descending order + dplyr::arrange(desc(hitc)) %>% # keep the top 5 observations in the data.table .[1:5,] tictoc::toc() # subset levels 0 through 4 data based on spids in the level 5 subset tictoc::tic() -atg.mc0.ss <- atg.mc0 %>% +atg.mc0.ss <- atg.mc0 %>% # keep only those observations that are related to the level 5 spids dplyr::filter(spid %in% atg.mc5.ss[,spid]) tictoc::toc() tictoc::tic() -atg.mc1.ss <- atg.mc1 %>% +atg.mc1.ss <- atg.mc1 %>% # keep only those observations that are related to the level 5 spids dplyr::filter(spid %in% atg.mc5.ss[,spid]) tictoc::toc() tictoc::tic() -atg.mc2.ss <- atg.mc2 %>% +atg.mc2.ss <- atg.mc2 %>% # keep only those observations that are related to the level 5 spids dplyr::filter(spid %in% atg.mc5.ss[,spid]) tictoc::toc() tictoc::tic() -atg.mc3.ss <- atg.mc3 %>% +atg.mc3.ss <- atg.mc3 %>% # keep only those observations that are related to the level 5 spids dplyr::filter(spid %in% atg.mc5.ss[,spid]) tictoc::toc() tictoc::tic() -atg.mc4.ss <- atg.mc4 %>% +atg.mc4.ss <- atg.mc4 %>% # keep only those observations that are related to the level 5 spids dplyr::filter(spid %in% atg.mc5.ss[,spid]) tictoc::toc() @@ -139,4 +137,4 @@ usethis::use_data(mc_vignette, overwrite = TRUE) ## session information Sys.time() sessionInfo() -#---------------------------# \ No newline at end of file +#---------------------------# diff --git a/data-raw/mc_vignette.Rout b/data-raw/mc_vignette.Rout index 9ddbc94d..d0925115 100644 --- a/data-raw/mc_vignette.Rout +++ b/data-raw/mc_vignette.Rout @@ -1,7 +1,7 @@ -R version 3.6.0 (2019-04-26) -- "Planting of a Tree" -Copyright (C) 2019 The R Foundation for Statistical Computing -Platform: x86_64-redhat-linux-gnu (64-bit) +R version 4.2.2 (2022-10-31 ucrt) -- "Innocent and Trusting" +Copyright (C) 2022 The R Foundation for Statistical Computing +Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -26,37 +26,59 @@ Type 'q()' to quit R. > ## r packages > library(tcplfit2) > library(tcpl) -tcpl (v2.1.0) loaded with the following settings: - TCPL_DB: /ccte/home2/sdavid01/R/x86_64-redhat-linux-gnu-library/3.6/tcpl/csv +tcpl (v3.1.0) loaded with the following settings: + TCPL_DB: C:/Program Files/R/R-4.2.2/library/tcpl/csv TCPL_USER: NA TCPL_HOST: NA TCPL_DRVR: tcplLite Default settings stored in tcpl config file. See ?tcplConf for more information. > > library(here) -here() starts at /ccte/home2/sdavid01/Git/tcpl +here() starts at C:/Users/zzhao/OneDrive - Environmental Protection Agency (EPA)/Profile/Documents/CompTox-ToxCast-tcpl +Warning message: +package 'here' was built under R version 4.2.3 > library(data.table) +Warning message: +package 'data.table' was built under R version 4.2.3 > library(devtools) Loading required package: usethis +Warning messages: +1: package 'devtools' was built under R version 4.2.3 +2: package 'usethis' was built under R version 4.2.3 > library(dplyr) -Attaching package: ‘dplyr’ +Attaching package: 'dplyr' -The following objects are masked from ‘package:data.table’: +The following objects are masked from 'package:data.table': between, first, last -The following objects are masked from ‘package:stats’: +The following objects are masked from 'package:stats': filter, lag -The following objects are masked from ‘package:base’: +The following objects are masked from 'package:base': intersect, setdiff, setequal, union +Warning message: +package 'dplyr' was built under R version 4.2.3 > library(tidyr) +Warning message: +package 'tidyr' was built under R version 4.2.3 > library(tictoc) + +Attaching package: 'tictoc' + +The following object is masked from 'package:data.table': + + shift + +Warning message: +package 'tictoc' was built under R version 4.2.3 > library(numbers) +Warning message: +package 'numbers' was built under R version 4.2.3 > #---------------------------# > ## code to prepare `mc_vignette` dataset goes here > # source the user ID, password, host, and database information for connection @@ -70,32 +92,28 @@ The following objects are masked from ‘package:base’: + db = ivtdb, + drvr = "MySQL") > # obtain the attagene (atg) aeid's (Assay Endpoint ID's) from the DB -> atg.aeid <- tcplGetAeid("ATG") %>% -+ # keep only the 'up' assay endpoints -+ filter(.,grepl(aenm,pattern = "up")) %>% +> atg.aeid <- tcplGetAeid("ATG") %>% + # convert to a data.table object + as.data.table() > # print the data.table of aeid's > atg.aeid - aeid aenm - 1: 63 ATG_Ahr_CIS_up - 2: 64 ATG_AP_1_CIS_up - 3: 65 ATG_AP_2_CIS_up - 4: 115 ATG_AR_TRANS_up - 5: 66 ATG_BRE_CIS_up - --- -198: 2011 ATG_zfPPARg_XSP2_up -199: 1965 ATG_zfTRa_XSP1_up -200: 2019 ATG_zfTRa_XSP2_up -201: 1969 ATG_zfTRb_XSP1_up -202: 2021 ATG_zfTRb_XSP2_up + aeid aenm + 1: 63 ATG_Ahr_CIS + 2: 64 ATG_AP_1_CIS + 3: 65 ATG_AP_2_CIS + 4: 115 ATG_AR_TRANS + 5: 66 ATG_BRE_CIS + --- +227: 3135 ATG_zfRXRb_EcoTox2 +228: 1965 ATG_zfTRa_XSP1 +229: 2019 ATG_zfTRa_XSP2 +230: 1969 ATG_zfTRb_XSP1 +231: 2021 ATG_zfTRb_XSP2 > # number of BioSeek endpoints > nrow(atg.aeid) -[1] 202 -> # choose a random 'aeid' to utilize as an example dataset -> set.seed(8011) -> atg.aeid.ss <- sample(1:nrow(atg.aeid),size = 1,replace = FALSE) %>% -+ atg.aeid[.,] +[1] 231 +> # choose a 'aeid' to utilize as an example dataset +> atg.aeid.ss <- atg.aeid[aenm == "ATG_GLI_CIS",] > # obtain the 'acid' for the endpoints in the example dataset > atg.acid.ss <- tcplLoadAcid(fld = 'aeid',val = atg.aeid.ss[,aeid]) > # obtain level 0 mc data @@ -105,7 +123,7 @@ The following objects are masked from ‘package:base’: + fld = 'acid',val = atg.acid.ss[,acid]) + ) > tictoc::toc() -0.687 sec elapsed +17.39 sec elapsed > # obtain level 1 mc data > tictoc::tic() > atg.mc1 <- tcplPrepOtpt( @@ -113,7 +131,7 @@ The following objects are masked from ‘package:base’: + fld = 'acid',val = atg.acid.ss[,acid]) + ) > tictoc::toc() -1.009 sec elapsed +25.75 sec elapsed > # obtain level 2 mc data > tictoc::tic() > atg.mc2 <- tcplPrepOtpt( @@ -121,7 +139,7 @@ The following objects are masked from ‘package:base’: + fld = 'acid',val = atg.acid.ss[,acid]) + ) > tictoc::toc() -2.238 sec elapsed +21.95 sec elapsed > # obtain level 3 mc data > tictoc::tic() > atg.mc3 <- tcplPrepOtpt( @@ -129,7 +147,7 @@ The following objects are masked from ‘package:base’: + fld = 'aeid',val = atg.aeid.ss[,aeid],add.fld = TRUE) + ) > tictoc::toc() -2.164 sec elapsed +31.72 sec elapsed > # obtain level 4 mc data > tictoc::tic() > atg.mc4 <- tcplPrepOtpt( @@ -137,7 +155,7 @@ The following objects are masked from ‘package:base’: + fld = 'aeid',val = atg.aeid.ss[,aeid],add.fld = TRUE) + ) > tictoc::toc() -3.763 sec elapsed +62.55 sec elapsed > # obtain level 5 mc data > tictoc::tic() > atg.mc5 <- tcplPrepOtpt( @@ -145,7 +163,7 @@ The following objects are masked from ‘package:base’: + fld = 'aeid',val = atg.aeid.ss[,aeid],add.fld = TRUE) + ) > tictoc::toc() -0.889 sec elapsed +25.26 sec elapsed > # narrow down to several active compounds/spids > tictoc::tic() > atg.mc5.ss <- atg.mc5 %>% @@ -153,47 +171,49 @@ The following objects are masked from ‘package:base’: + dplyr::filter(.,nrep >=2) %>% + # keep only the observations that have a hitcall >= 0.95 + dplyr::filter(.,hitc >= 0.95) %>% -+ # re-arrange the observations by hicall in descending order -+ dplyr::arrange(desc(hitc)) %>% ++ # keep only the observations with a DTXSID ++ dplyr::filter(.,!is.na(dsstox_substance_id)) %>% ++ # re-arrange the observations by hitcall in descending order ++ dplyr::arrange(desc(hitc)) %>% + # keep the top 5 observations in the data.table + .[1:5,] > tictoc::toc() -0.009 sec elapsed +0.02 sec elapsed > # subset levels 0 through 4 data based on spids in the level 5 subset > tictoc::tic() -> atg.mc0.ss <- atg.mc0 %>% +> atg.mc0.ss <- atg.mc0 %>% + # keep only those observations that are related to the level 5 spids + dplyr::filter(spid %in% atg.mc5.ss[,spid]) > tictoc::toc() -0.002 sec elapsed +0 sec elapsed > > tictoc::tic() -> atg.mc1.ss <- atg.mc1 %>% +> atg.mc1.ss <- atg.mc1 %>% + # keep only those observations that are related to the level 5 spids + dplyr::filter(spid %in% atg.mc5.ss[,spid]) > tictoc::toc() -0.002 sec elapsed +0.01 sec elapsed > > tictoc::tic() -> atg.mc2.ss <- atg.mc2 %>% +> atg.mc2.ss <- atg.mc2 %>% + # keep only those observations that are related to the level 5 spids + dplyr::filter(spid %in% atg.mc5.ss[,spid]) > tictoc::toc() -0.002 sec elapsed +0 sec elapsed > > tictoc::tic() -> atg.mc3.ss <- atg.mc3 %>% +> atg.mc3.ss <- atg.mc3 %>% + # keep only those observations that are related to the level 5 spids + dplyr::filter(spid %in% atg.mc5.ss[,spid]) > tictoc::toc() -0.002 sec elapsed +0 sec elapsed > > tictoc::tic() -> atg.mc4.ss <- atg.mc4 %>% +> atg.mc4.ss <- atg.mc4 %>% + # keep only those observations that are related to the level 5 spids + dplyr::filter(spid %in% atg.mc5.ss[,spid]) > tictoc::toc() -0.003 sec elapsed +0.02 sec elapsed > # collate the data into a single object 'mc_vignette' > mc_vignette <- list( + mc0 = atg.mc0.ss,mc1 = atg.mc1.ss,mc2 = atg.mc2.ss, @@ -202,65 +222,65 @@ The following objects are masked from ‘package:base’: > #---------------------------# > ## save the data > usethis::use_data(mc_vignette, overwrite = TRUE) -✓ Setting active project to '/ccte/home2/sdavid01/Git/tcpl' -✓ Saving 'mc_vignette' to 'data/mc_vignette.rda' +✔ Setting active project to 'C:/Users/zzhao/OneDrive - Environmental Protection Agency (EPA)/Profile/Documents/CompTox-ToxCast-tcpl' +✔ Saving 'mc_vignette' to 'data/mc_vignette.rda' • Document your data (see 'https://r-pkgs.org/data.html') > #---------------------------# > ## session information > Sys.time() -[1] "2022-08-16 08:35:36 EDT" +[1] "2024-04-18 16:35:33 EDT" > sessionInfo() -R version 3.6.0 (2019-04-26) -Platform: x86_64-redhat-linux-gnu (64-bit) -Running under: Red Hat Enterprise Linux +R version 4.2.2 (2022-10-31 ucrt) +Platform: x86_64-w64-mingw32/x64 (64-bit) +Running under: Windows 10 x64 (build 22621) Matrix products: default -BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so locale: - [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C - [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 - [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 - [7] LC_PAPER=en_US.UTF-8 LC_NAME=C - [9] LC_ADDRESS=C LC_TELEPHONE=C -[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C +[1] LC_COLLATE=English_United States.utf8 +[2] LC_CTYPE=English_United States.utf8 +[3] LC_MONETARY=English_United States.utf8 +[4] LC_NUMERIC=C +[5] LC_TIME=English_United States.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: - [1] numbers_0.7-5 tictoc_1.0 tidyr_1.1.3 dplyr_1.0.5 - [5] devtools_2.4.2 usethis_2.0.1 data.table_1.14.0 here_1.0.1 - [9] tcpl_2.1.0 tcplfit2_0.1.3 + [1] numbers_0.8-5 tictoc_1.2 tidyr_1.3.0 dplyr_1.1.2 + [5] devtools_2.4.5 usethis_2.2.2 data.table_1.14.8 here_1.0.1 + [9] tcpl_3.1.0 tcplfit2_0.1.6 loaded via a namespace (and not attached): - [1] httr_1.4.2 pkgload_1.2.1 bit64_4.0.5 - [4] jsonlite_1.7.2 viridisLite_0.3.0 gsubfn_0.7 - [7] blob_1.2.3 remotes_2.3.0 sessioninfo_1.1.1 -[10] globals_0.15.0 numDeriv_2016.8-1.1 pillar_1.5.1 -[13] RSQLite_2.2.14 glue_1.4.2 chron_2.3-57 -[16] digest_0.6.27 RColorBrewer_1.1-2 colorspace_2.0-0 -[19] htmltools_0.5.1.1 pkgconfig_2.0.3 listenv_0.8.0 -[22] purrr_0.3.4 scales_1.1.1 processx_3.5.2 -[25] tibble_3.1.0 generics_0.1.0 ggplot2_3.3.6 -[28] sqldf_0.4-11 ellipsis_0.3.1 cachem_1.0.5 -[31] withr_2.4.1 lazyeval_0.2.2 cli_2.5.0 -[34] proto_1.0.0 magrittr_2.0.1 crayon_1.4.1 -[37] memoise_2.0.0 ps_1.6.0 fs_1.5.0 -[40] future_1.26.1 fansi_0.4.2 parallelly_1.31.1 -[43] pkgbuild_1.2.0 tools_3.6.0 RMariaDB_1.2.1 -[46] prettyunits_1.1.1 hms_1.0.0 lifecycle_1.0.0 -[49] stringr_1.4.0 plotly_4.10.0 munsell_0.5.0 -[52] callr_3.7.0 compiler_3.6.0 rlang_0.4.10 -[55] grid_3.6.0 rstudioapi_0.13 htmlwidgets_1.5.3 -[58] testthat_3.0.2 gtable_0.3.0 codetools_0.2-16 -[61] DBI_1.1.2 R6_2.5.0 gridExtra_2.3 -[64] lubridate_1.8.0 fastmap_1.1.0 future.apply_1.9.0 -[67] bit_4.0.4 utf8_1.2.1 rprojroot_2.0.2 -[70] desc_1.3.0 stringi_1.5.3 parallel_3.6.0 -[73] Rcpp_1.0.8.3 vctrs_0.3.6 tidyselect_1.1.0 + [1] httr_1.4.6 pkgload_1.3.2.1 bit64_4.0.5 + [4] jsonlite_1.8.7 viridisLite_0.4.2 gsubfn_0.7 + [7] shiny_1.7.4.1 blob_1.2.4 remotes_2.4.2.1 +[10] sessioninfo_1.2.2 numDeriv_2016.8-1.1 pillar_1.9.0 +[13] RSQLite_2.3.1 glue_1.6.2 chron_2.3-61 +[16] digest_0.6.33 RColorBrewer_1.1-3 promises_1.2.0.1 +[19] colorspace_2.1-0 htmltools_0.5.5 httpuv_1.6.11 +[22] pkgconfig_2.0.3 purrr_1.0.1 xtable_1.8-4 +[25] scales_1.2.1 processx_3.8.2 later_1.3.1 +[28] timechange_0.2.0 tibble_3.2.1 generics_0.1.3 +[31] ggplot2_3.4.2 sqldf_0.4-11 ellipsis_0.3.2 +[34] withr_2.5.0 cachem_1.0.8 lazyeval_0.2.2 +[37] cli_3.6.1 proto_1.0.0 magrittr_2.0.3 +[40] crayon_1.5.2 mime_0.12 memoise_2.0.1 +[43] ps_1.7.5 fs_1.6.3 fansi_1.0.4 +[46] pkgbuild_1.4.2 profvis_0.3.8 tools_4.2.2 +[49] RMariaDB_1.2.2 prettyunits_1.1.1 hms_1.1.3 +[52] lifecycle_1.0.3 stringr_1.5.0 plotly_4.10.2 +[55] munsell_0.5.0 callr_3.7.3 compiler_4.2.2 +[58] rlang_1.1.1 grid_4.2.2 rstudioapi_0.15.0 +[61] htmlwidgets_1.6.2 miniUI_0.1.1.1 gtable_0.3.4 +[64] DBI_1.1.3 R6_2.5.1 lubridate_1.9.2 +[67] ccdR_1.0.0 gridExtra_2.3 fastmap_1.1.1 +[70] bit_4.0.5 utf8_1.2.3 rprojroot_2.0.3 +[73] desc_1.4.2 stringi_1.7.12 parallel_4.2.2 +[76] Rcpp_1.0.11 vctrs_0.6.3 tidyselect_1.2.0 +[79] urlchecker_1.0.1 > #---------------------------# > > proc.time() user system elapsed - 9.923 1.069 14.276 + 5.01 0.75 208.14 diff --git a/data-raw/sc_test.R b/data-raw/sc_test.R new file mode 100644 index 00000000..4928f9ae --- /dev/null +++ b/data-raw/sc_test.R @@ -0,0 +1,146 @@ +#==============================================================================# +# NOTE: This script is written such that it is run from 'top' to 'bottom' +# or programmatically via the Terminal. +# ('R CMD BATCH --vanilla '.) +# Please do not jump around when running this script. +#==============================================================================# +# NOTE: You MUST temporarily update tcplQuery() by adding a line at the top of the +# function: print(query). +# This is because the queries will be captured from output and saved as +# part of the mocking data. +#==============================================================================# +## r packages +devtools::load_all() + +library(here) +library(dplyr) +library(stringr) +#---------------------------# +## code to prepare `sc_test` dataset goes here +# source the user ID, password, host, and database information for connection +# - NOTE: To replicate one will need to save their own 'db_cred.R', including +# the 'userid', 'userpwd', 'host', and DB collection via 'ivtdb'. +source(file = here::here("data-raw/db_cred.R"),verbose = FALSE) +# connect to the DB +tcplConf(user = userid, + pass = userpwd, + host = host, + db = ivtdb, + drvr = "MySQL") + +# pick endpoints and ids +# load the number of rows and max hitc per aeid +sc2_counts <- tcplQuery("SELECT DISTINCT aeid, + COUNT( aeid ) as n, + max(hitc) as max_hitc + FROM invitrodb.sc2 GROUP BY aeid") +# filter to only include where at least one sample is active and n = 7 +sc2_counts <- sc2_counts %>% filter(max_hitc > 0.9 & n == 7) +# pick one aeid +aeid <- selected <- sc2_counts[sample(1:nrow(sc2_counts),size = 1,replace = FALSE),aeid] +# obtain the acid for the example dataset +acid <- tcplLoadAcid(fld = 'aeid',val = aeid)$acid +# pick one sample/row from each level (lvl 1 contains ids back to lvl 0) +l1 <- tcplLoadData(type = "sc", lvl = 1, fld = "acid", val = acid) +l1_sample1 <- l1[sample(1:nrow(l1),size = 1,replace = FALSE)] +l1_sample2 <- l1[sample(1:nrow(l1),size = 2,replace = FALSE)] +l2 <- tcplLoadData(type = "sc", lvl = 2, fld = "aeid", val = aeid) +l2_sample1 <- l2[sample(1:nrow(l2),size = 1,replace = FALSE)] +l2_sample2 <- l2[sample(1:nrow(l2),size = 2,replace = FALSE)] +# pick compare.val endpoints and ids +# be sure to only allow to choose from endpoints with the same number of samples +sc2_counts <- filter(sc2_counts, n == sc2_counts[aeid == selected]$n & aeid != selected) +compare.aeid <- sc2_counts[sample(1:nrow(sc2_counts),size = 1,replace = FALSE),aeid] +compare.l2 <- tcplLoadData(type = "sc", lvl = 2, fld = "aeid", val = compare.aeid) +compare.l2_sample1 <- compare.l2[sample(1:nrow(compare.l2),size = 1,replace = FALSE)] +compare.l2_sample2 <- compare.l2[sample(1:nrow(compare.l2),size = 2,replace = FALSE)] + + +get_query_data <- function(lvl, fld, val, compare.val = NULL, add.fld = TRUE, func = "tcplLoadData") { + + # IMPORTANT || MUST ADD TEMPORARY LINE TO TCPLQUERY -------------------------- + # add temporary line to top of tcplQuery to get the query string: print(query) + if (func == "tcplLoadData") { + query_strings <- capture.output(result<-tcplLoadData(type = "sc", lvl = lvl, fld = fld, val = val, add.fld = add.fld)) + } else if (func == "tcplPlot") { + query_strings <- capture.output(result<-tcplPlot(type = "sc", fld = fld, + val = val, compare.val = compare.val, + output = "pdf", multi = TRUE, verbose = TRUE, + fileprefix = "temp_tcplPlot")) + file.remove(stringr::str_subset(list.files(), "^temp_tcplPlot")) # clean up + } + + query_strings <- unique(gsub("\\\\", "\\\"", gsub("\"", "", gsub("\\\\n", "\\\n", gsub("\\[1\\] ", "", query_strings))))) + + # use queries to save data + dat <- lapply(query_strings, function(query_string) { + return(tcplQuery(query_string)) + }) + names(dat) <- query_strings + + # also store fld and val in list object for use in test case + dat[fld] <- val + if (!is.null(compare.val)) dat[sprintf("compare.%s", fld)] <- compare.val + return(dat) + +} + + + +# to add more tests with new/different data to test-tcplLoadData.R, add lines below and run script +sc_test <- list( + tcplConfQuery = tcplQuery("SHOW VARIABLES LIKE 'max_allowed_packet'"), + sc0_by_s0id = get_query_data(lvl = 0, fld = "s0id", val = l1_sample1$s0id), + sc0_by_acid = get_query_data(lvl = 0, fld = "acid", val = acid), + sc1_by_s1id = get_query_data(lvl = 1, fld = "s1id", val = l1_sample1$s1id), + sc1_by_acid = get_query_data(lvl = 1, fld = "acid", val = acid), + sc2_by_s2id = get_query_data(lvl = 2, fld = "s2id", val = l2_sample1$s2id), + sc2_by_aeid = get_query_data(lvl = 2, fld = "aeid", val = aeid), + scagg_by_aeid = get_query_data(lvl = "agg", fld = "aeid", val = aeid), + plot_single_s2id = get_query_data(fld = "s2id", + val = l2_sample1$s2id, + func = "tcplPlot"), + plot_multiple_s2id = get_query_data(fld = "s2id", + val = list(l2_sample2$s2id), + func = "tcplPlot"), + plot_single_aeid = get_query_data(fld = "aeid", + val = aeid, + func = "tcplPlot"), + plot_multiple_aeid = get_query_data(fld = "aeid", + val = list(c(aeid, compare.aeid)), + func = "tcplPlot"), + plot_single_spid = get_query_data(fld = c("spid", "aeid"), + val = list(l2_sample1$spid, aeid), + func = "tcplPlot"), + plot_multiple_spid = get_query_data(fld = c("spid", "aeid"), + val = list(l2_sample2$spid, aeid), + func = "tcplPlot"), + plot_single_s2id_compare = get_query_data(fld = "s2id", + val = l2_sample1$s2id, + compare.val = compare.l2_sample1$s2id, + func = "tcplPlot"), + plot_multiple_s2id_compare = get_query_data(fld = "s2id", + val = list(l2_sample2$s2id), + compare.val = list(compare.l2_sample2$s2id), + func = "tcplPlot"), + plot_single_aeid_compare = get_query_data(fld = "aeid", + val = aeid, + compare.val = compare.aeid, + func = "tcplPlot"), + plot_multiple_aeid_compare = get_query_data(fld = "aeid", + val = list(c(aeid, compare.aeid)), + compare.val = list(c(compare.aeid, aeid)), + func = "tcplPlot"), + plot_single_spid_compare = get_query_data(fld = c("spid", "aeid"), + val = list(l2_sample1$spid, aeid), + compare.val = list(compare.l2_sample1$spid, compare.aeid), + func = "tcplPlot"), + plot_multiple_spid_compare = get_query_data(fld = c("spid", "aeid"), + val = list(l2_sample2$spid, aeid), + compare.val = list(compare.l2_sample2$spid, compare.aeid), + func = "tcplPlot") +) +#---------------------------# +## save the data +usethis::use_data(sc_test, overwrite = TRUE) +#---------------------------# \ No newline at end of file diff --git a/data-raw/sc_vignette.R b/data-raw/sc_vignette.R index ade6e63d..d2f2fd73 100644 --- a/data-raw/sc_vignette.R +++ b/data-raw/sc_vignette.R @@ -5,8 +5,7 @@ # Please do not jump around when running this script. #==============================================================================# ## r packages -library(tcplfit2) -library(tcpl) +devtools::load_all() library(here) library(data.table) @@ -43,8 +42,8 @@ atg.acid.sc <- atg.acid %>% filter(.,acid%in%atg.sc.ids) %>% as.data.table() # print the data.table of acid's atg.acid.sc # obtain the aeid's for the atg single concentration data -atg.aeid.sc <- tcplLoadAeid(fld = 'acid',val = atg.acid.sc) %>% - filter(.,grepl(aenm,pattern = "up$")) +atg.aeid.sc <- tcplLoadAeid(fld = 'acid',val = atg.acid.sc) #%>% + #filter(.,grepl(aenm,pattern = "up$")) # obtain the level 2 sc data tictoc::tic() atg.sc2 <- tcplPrepOtpt( @@ -110,9 +109,9 @@ tictoc::toc() tictoc::tic() atg.sc1.ss <- atg.sc1 %>% # keep only those observations that are related to the level 2 spids - dplyr::filter(spid %in% atg.sc2.ss[,spid]) %>% + dplyr::filter(spid %in% atg.sc2.ss[,spid]) #%>% # keep only those observations that are related to the 'up' endpoints - dplyr::filter(.,grepl(aenm,pattern = "up$")) + #dplyr::filter(.,grepl(aenm,pattern = "up$")) tictoc::toc() # collate the data into a single object 'sc_vignette' diff --git a/data-raw/tcplLoadData_columns.R b/data-raw/tcplLoadData_columns.R new file mode 100644 index 00000000..c78a434e --- /dev/null +++ b/data-raw/tcplLoadData_columns.R @@ -0,0 +1,44 @@ +#==============================================================================# +# NOTE: This script is written such that it is run from 'top' to 'bottom' +# or programmatically via the Terminal. +# ('R CMD BATCH --vanilla '.) +# Please do not jump around when running this script. +#==============================================================================# +## r packages +library(tcpl) +library(here) +#---------------------------# +## code to prepare `load_data_columns` dataset goes here +# source the user ID, password, host, and database information for connection +# - NOTE: To replicate one will need to save their own 'db_cred.R', including +# the 'userid', 'userpwd', 'host', and DB collection via 'ivtdb'. +source(file = here::here("data-raw/db_cred.R"),verbose = FALSE) +# connect to the DB, update +tcplConf(user = userid, + pass = userpwd, + host = host, + db = "prod_internal_invitrodb_v4_1", + drvr = "MySQL") +#---------------------------# +# obtain all data tables for each level and pull out the column names +mc0 <- tcplLoadData(lvl = 0, fld = "acid", val = 2850, type = "mc", add.fld = FALSE) +mc1 <- tcplLoadData(lvl = 1, fld = "acid", val = 2850, type = "mc", add.fld = FALSE) +mc2 <- tcplLoadData(lvl = 2, fld = "acid", val = 2850, type = "mc", add.fld = FALSE) +mc3 <- tcplLoadData(lvl = 3, fld = "aeid", val = 3088, type = "mc", add.fld = FALSE) +mc4 <- tcplLoadData(lvl = 4, fld = "aeid", val = 3088, type = "mc", add.fld = FALSE) +mc5 <- tcplLoadData(lvl = 5, fld = "aeid", val = 3088, type = "mc", add.fld = FALSE) +mc6 <- tcplLoadData(lvl = 6, fld = "aeid", val = 3088, type = "mc", add.fld = FALSE) +mcagg <- tcplLoadData(lvl = "agg", fld = "aeid", val = 3088, type = "mc", add.fld = FALSE) +sc0 <- tcplLoadData(lvl = 0, fld = "acid", val = 2850, type = "sc", add.fld = FALSE) +sc1 <- tcplLoadData(lvl = 1, fld = "acid", val = 2850, type = "sc", add.fld = FALSE) +sc2 <- tcplLoadData(lvl = 2, fld = "aeid", val = 3088, type = "sc", add.fld = FALSE) +scagg <- tcplLoadData(lvl = "agg", fld = "aeid", val = 3088, type = "sc", add.fld = FALSE) +load_data_columns <- list(mc0 = colnames(mc0), mc1 = colnames(mc1), + mc2 = colnames(mc2), mc3 = colnames(mc3), + mc4 = colnames(mc4), mc5 = colnames(mc5), + mc6 = colnames(mc6), mcagg = colnames(mcagg), + sc0 = colnames(sc0), sc1 = colnames(sc1), + sc2 = colnames(sc2), scagg = colnames(scagg)) +#---------------------------# +## save the data +usethis::use_data(load_data_columns, overwrite = TRUE) \ No newline at end of file diff --git a/data-raw/test_api.R b/data-raw/test_api.R new file mode 100644 index 00000000..db16336b --- /dev/null +++ b/data-raw/test_api.R @@ -0,0 +1,49 @@ +#==============================================================================# +# NOTE: This script is written such that it is run from 'top' to 'bottom' +# or programmatically via the Terminal. +# ('R CMD BATCH --vanilla '.) +# Please do not jump around when running this script. +#==============================================================================# +# NOTE: You MUST temporarily update tcplQuery() by adding a line at the top of the +# function: print(query). +# This is because the queries will be captured from output and saved as +# part of the mocking data. +#==============================================================================# +## r packages +devtools::load_all() +library(ctxR) +library(here) +library(dplyr) +library(stringr) +#---------------------------# +## code to prepare `test_api` dataset goes here +# source the user ID, password, host, and database information for connection +# - NOTE: To replicate one will need to save their own 'db_cred.R', including +# the 'apikey'. +source(file = here::here("data-raw/db_cred.R"),verbose = FALSE) +# connect to the DB +tcplConf(pass = apikey, + drvr = "API") + +assays <- get_all_assays(Server = paste0(getOption("TCPL_HOST"))) +aeid <- assays[sample(1:nrow(assays), 1),]$aeid +acid <- tcplLoadAcid(fld = "aeid", val = aeid)$acid +aid <- tcplLoadAid(fld = "aeid", val = aeid)$aid +asid <- tcplLoadAsid(fld = "aeid", val = aeid)$asid +dat <- tcplLoadData(lvl = 5, fld = "aeid", val = aeid) +sample <- dat[sample(1:nrow(dat), 1),] + +# to add more tests with new/different data to test-tcplLoadData.R, add lines below and run script +test_api <- list( + aeid = aeid, + acid = acid, + aid = aid, + asid = asid, + dtxsid = sample$dtxsid, + spid = sample$spid, + m4id = sample$m4id +) +#---------------------------# +## save the data +usethis::use_data(test_api, overwrite = TRUE) +#---------------------------# \ No newline at end of file diff --git a/data/chdat.rda b/data/chdat.rda deleted file mode 100644 index d9c01594..00000000 Binary files a/data/chdat.rda and /dev/null differ diff --git a/data/load_data_columns.rda b/data/load_data_columns.rda new file mode 100644 index 00000000..ad61be09 Binary files /dev/null and b/data/load_data_columns.rda differ diff --git a/data/mc_test.rda b/data/mc_test.rda new file mode 100644 index 00000000..cdca61c1 Binary files /dev/null and b/data/mc_test.rda differ diff --git a/data/mc_vignette.rda b/data/mc_vignette.rda index c34a8a1d..db05d2d5 100644 Binary files a/data/mc_vignette.rda and b/data/mc_vignette.rda differ diff --git a/data/mthd_list_defaults.rda b/data/mthd_list_defaults.rda new file mode 100644 index 00000000..26c2f887 Binary files /dev/null and b/data/mthd_list_defaults.rda differ diff --git a/data/sc_test.rda b/data/sc_test.rda new file mode 100644 index 00000000..2998be80 Binary files /dev/null and b/data/sc_test.rda differ diff --git a/data/sc_vignette.rda b/data/sc_vignette.rda index e478e9c9..19310c0a 100644 Binary files a/data/sc_vignette.rda and b/data/sc_vignette.rda differ diff --git a/data/test_api.rda b/data/test_api.rda new file mode 100644 index 00000000..06fd1302 Binary files /dev/null and b/data/test_api.rda differ diff --git a/inst/csv/assay.csv b/inst/csv/assay.csv deleted file mode 100644 index 98672b2b..00000000 --- a/inst/csv/assay.csv +++ /dev/null @@ -1 +0,0 @@ -"aid","asid","assay_name","assay_desc","timepoint_hr","organism_id","organism","tissue","cell_format","cell_free_component_source","cell_short_name","cell_growth_mode","assay_footprint","assay_format_type","assay_format_type_sub","content_readout_type","dilution_solvent","dilution_solvent_percent_max" diff --git a/inst/csv/assay_component.csv b/inst/csv/assay_component.csv deleted file mode 100644 index 5ce3f51e..00000000 --- a/inst/csv/assay_component.csv +++ /dev/null @@ -1 +0,0 @@ -"acid","aid","assay_component_name","assay_component_desc","assay_component_target_desc","parameter_readout_type","assay_design_type","assay_design_type_sub","biological_process_target","detection_technology_type","detection_technology_type_sub","detection_technology","signal_direction_type","key_assay_reagent_type","key_assay_reagent","technological_target_type","technological_target_type_sub" diff --git a/inst/csv/assay_component_endpoint.csv b/inst/csv/assay_component_endpoint.csv deleted file mode 100644 index 8a73250b..00000000 --- a/inst/csv/assay_component_endpoint.csv +++ /dev/null @@ -1 +0,0 @@ -"aeid","acid","assay_component_endpoint_name","export_ready","internal_ready","assay_component_endpoint_desc","assay_function_type","normalized_data_type","analysis_direction","burst_assay","key_positive_control","signal_direction","intended_target_type","intended_target_type_sub","intended_target_family","intended_target_family_sub","fit_all" diff --git a/inst/csv/assay_component_map.csv b/inst/csv/assay_component_map.csv deleted file mode 100644 index 8a4dc485..00000000 --- a/inst/csv/assay_component_map.csv +++ /dev/null @@ -1 +0,0 @@ -"acid","acsn" diff --git a/inst/csv/assay_reagent.csv b/inst/csv/assay_reagent.csv deleted file mode 100644 index 2b80d31f..00000000 --- a/inst/csv/assay_reagent.csv +++ /dev/null @@ -1 +0,0 @@ -arid,aid,reagent_name_value,reagent_name_value_type,culture_or_assay diff --git a/inst/csv/assay_source.csv b/inst/csv/assay_source.csv deleted file mode 100644 index 956cca34..00000000 --- a/inst/csv/assay_source.csv +++ /dev/null @@ -1 +0,0 @@ -"asid","assay_source_name","assay_source_long_name","assay_source_desc" diff --git a/inst/csv/chemical.csv b/inst/csv/chemical.csv deleted file mode 100644 index 6156b732..00000000 --- a/inst/csv/chemical.csv +++ /dev/null @@ -1,7 +0,0 @@ -"chid","casn","chnm","dsstox_substance_id","code" -"20182","80-05-7","Bisphenol A","DTXSID7020182","C80057" -"22364","521-18-6","5alpha-Dihydrotestosterone","DTXSID9022364","C521186" -"23463","150-30-1","Phenylalanine","DTXSID9023463","C150301" -"24102","22224-92-6","Fenamiphos","DTXSID3024102","C22224926" -"21735","67-68-5","Dimethyl sulfoxide","DTXSID2021735","C67685" -"20283","95-83-0","4-Chloro-1,2-diaminobenzene","DTXSID5020283","C95830" diff --git a/inst/csv/chemical_library.csv b/inst/csv/chemical_library.csv deleted file mode 100644 index 4c5cbed0..00000000 --- a/inst/csv/chemical_library.csv +++ /dev/null @@ -1 +0,0 @@ -chid,clib diff --git a/inst/csv/mc0.csv b/inst/csv/mc0.csv deleted file mode 100644 index 0472dd5a..00000000 --- a/inst/csv/mc0.csv +++ /dev/null @@ -1 +0,0 @@ -"m0id","acid","spid","apid","rowi","coli","wllt","wllq","conc","rval","srcf","created_date","modified_date","modified_by" diff --git a/inst/csv/mc1.csv b/inst/csv/mc1.csv deleted file mode 100644 index e1fce207..00000000 --- a/inst/csv/mc1.csv +++ /dev/null @@ -1 +0,0 @@ -"m1id","m0id","acid","cndx","repi","created_date","modified_date","modified_by" diff --git a/inst/csv/mc2.csv b/inst/csv/mc2.csv deleted file mode 100644 index 0ab7ae5e..00000000 --- a/inst/csv/mc2.csv +++ /dev/null @@ -1 +0,0 @@ -"m2id","m0id","acid","m1id","cval","created_date","modified_date","modified_by" diff --git a/inst/csv/mc2_acid.csv b/inst/csv/mc2_acid.csv deleted file mode 100644 index a95bcb82..00000000 --- a/inst/csv/mc2_acid.csv +++ /dev/null @@ -1,3 +0,0 @@ -"mc2_mthd_id","acid","exec_ordr","created_date","modified_date","modified_by" -1,1,1,NA,NA,"mshobair.mshobair.mshobair" -1,1,1,NA,NA,"mshobair.mshobair.mshobair" diff --git a/inst/csv/mc2_methods.csv b/inst/csv/mc2_methods.csv deleted file mode 100644 index 3f2667ac..00000000 --- a/inst/csv/mc2_methods.csv +++ /dev/null @@ -1,13 +0,0 @@ -mc2_mthd_id,mc2_mthd,desc,created_date,modified_date,modified_by -1,none,"apply no level 2 method","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -2,log2,"log2 all raw data","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -3,rmneg,"remove negative values prior to logging values","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -4,rmzero,"remove 0 values prior to logging values","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -5,mult25,"multiply values by 25","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -7,mult100,"multiply values by 100","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -10,log10,"log10 the raw data","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -11,negshift,"Shifts all data to be positive (new min=1)","2014-10-06 14:47:15","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -12,mult2.5,"multiply values by 2.5","2014-11-06 10:36:15","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -13,mult3,"multiply values by 3","2014-11-06 10:36:34","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -14,mult6,"multiply values by 6","2014-11-06 15:53:33","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -17,sub100,"100 minus cval (centers data around zero if prenormalized starting at 100 and going down to zero)","2015-10-05 12:42:21","0000-00-00 00:00:00","mmarti02.mmarti02.mmarti02" diff --git a/inst/csv/mc3.csv b/inst/csv/mc3.csv deleted file mode 100644 index 200acfdd..00000000 --- a/inst/csv/mc3.csv +++ /dev/null @@ -1 +0,0 @@ -"m3id","aeid","m0id","acid","m1id","m2id","bval","pval","logc","resp","created_date","modified_date","modified_by" diff --git a/inst/csv/mc3_aeid.csv b/inst/csv/mc3_aeid.csv deleted file mode 100644 index 805ba2ba..00000000 --- a/inst/csv/mc3_aeid.csv +++ /dev/null @@ -1,13 +0,0 @@ -"mc3_mthd_id","aeid","exec_ordr","created_date","modified_date","modified_by" -17,1,1,NA,NA,"mshobair.mshobair.mshobair" -17,2,1,NA,NA,"mshobair.mshobair.mshobair" -9,1,2,NA,NA,"mshobair.mshobair.mshobair" -9,2,2,NA,NA,"mshobair.mshobair.mshobair" -7,1,3,NA,NA,"mshobair.mshobair.mshobair" -7,2,3,NA,NA,"mshobair.mshobair.mshobair" -17,1,1,NA,NA,"mshobair.mshobair.mshobair" -17,2,1,NA,NA,"mshobair.mshobair.mshobair" -9,1,2,NA,NA,"mshobair.mshobair.mshobair" -9,2,2,NA,NA,"mshobair.mshobair.mshobair" -7,1,3,NA,NA,"mshobair.mshobair.mshobair" -7,2,3,NA,NA,"mshobair.mshobair.mshobair" diff --git a/inst/csv/mc3_methods.csv b/inst/csv/mc3_methods.csv deleted file mode 100644 index 40dd8873..00000000 --- a/inst/csv/mc3_methods.csv +++ /dev/null @@ -1,38 +0,0 @@ -mc3_mthd_id,mc3_mthd,desc,created_date,modified_date,modified_by -1,none,apply no level 3 method,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,bval.apid.lowconc.med,plate-wise baseline based on low conc median value,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,pval.apid.medpcbyconc.max,plate-wise median response of positive control (max),0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,pval.apid.medpcbyconc.min,plate-wise median response of positive control (min),0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,resp.pc,response percent activity,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,resp.multneg1,multiply the response by -1,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,resp.log2,take the log base 2 of the response,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,resp.mult25,multiply the response by 25,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,resp.fc,calculate response as fold-change,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -11,bval.apid.nwlls.med,plate-wise baseline based on neutral ctrl median value,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -12,bval.spid.lowconc.med,sample-wise baseline based on low conc median value,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -13,pval.apid.pwlls.med,"plate-wise meidan based on positive control, single dose",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -14,pval.apid.mwlls.med,"plate-wise meidan based on negative control, single dose",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -15,pval.apid.medncbyconc.min,"plate-wise meidan based on negative control, (min)",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -16,bval.apid.twlls.med,"Take the median cval of the t wells, by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -17,bval.apid.nwllslowconc.med,"Take the median cval of the n wells and the first two concentrations, by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -18,resp.shiftneg.3bmad,Make values below baseline zero.,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -19,resp.blineshift.3bmad.repi,"Do baseline correction by repi, with a window of 3*bmad",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -20,resp.blineshift.50.repi,"Do baseline correction by repi, with a window of 50",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -21,resp.blineshift.50.spid,"Do baseline correction by spid, with a window of 50",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -23,resp.blineshift.3bmad.spid,"Do baseline correction by repi, with a window of 3*bmad",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -24,bval.apid.tn.med,"Take the median cval of the t and n wells, by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -25,pval.apid.pmv.min,"Calculate the median p, m, and v values by concentration, then take the minimum by apid.",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -26,pval.apid.pmv.max,"Calculate the median p, m, and v values by concentration, then take the maximum by apid.",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -27,pval.apid.f.max,"Calculate the median of f values by concentration, then take the maximum by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -28,pval.apid.f.min,"Calculate the median of f values by concentration, then take the minimum by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -29,pval.apid.p.min,"Calculate the median of p values by concentration, then take the minimum by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -30,pval.apid.p.max,"Calculate the median of p values by concentration, then take the maximum by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -31,pval.apid.v.min,"Calculate the median of v values by concentration, then take the minimum by apid",0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -32,pval.zero,Set pval to 0.,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -33,resp.shiftneg.6bmad,Shift response values falling below -6 * bmad to 0.,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -34,resp.shiftneg.10bmad,Shift response values falling below -10 * bmad to 0.,0000-00-00 00:00:00,0000-00-00 00:00:00,dfiler.dfiler.dfiler -35,resp.logfc,Calculate the response as a fold change over baseline for logged values,2014-10-02 14:18:40,0000-00-00 00:00:00,dfiler.dfiler.dfiler -36,resp.scale.mad.log2fc,Scale the resp data by the ratio of log2(1.2) over 3* baseline mad of the unscaled resp values,2015-02-23 13:58:52,0000-00-00 00:00:00, -37,resp.scale.quant.log2fc,Scale resp such that 20% of the maximum resp equals log2(1.2),2015-03-13 16:44:05,0000-00-00 00:00:00,dfiler.dfiler.dfiler -38,bval.apid.nwllstcwllslowconc.med,plate-wise baseline based on neutral and t and c well low conc,2015-09-16 15:22:54,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -39,resp.pc.pval.cor,response percent activity using previously corrected pval,2018-09-05 09:38:32,0000-00-00 00:00:01,tzurlind.tzurlind.tzurlind diff --git a/inst/csv/mc4.csv b/inst/csv/mc4.csv deleted file mode 100644 index 91838497..00000000 --- a/inst/csv/mc4.csv +++ /dev/null @@ -1 +0,0 @@ -"m4id","aeid","spid","bmad","resp_max","resp_min","max_mean","max_mean_conc","max_med","max_med_conc","logc_max","logc_min","cnst","hill","hcov","gnls","gcov","cnst_er","cnst_aic","cnst_rmse","cnst_prob","hill_tp","hill_tp_sd","hill_ga","hill_ga_sd","hill_gw","hill_gw_sd","hill_er","hill_er_sd","hill_aic","hill_rmse","hill_prob","gnls_tp","gnls_tp_sd","gnls_ga","gnls_ga_sd","gnls_gw","gnls_gw_sd","gnls_la","gnls_la_sd","gnls_lw","gnls_lw_sd","gnls_er","gnls_er_sd","gnls_aic","gnls_rmse","gnls_prob","nconc","npts","nrep","nmed_gtbl","tmpi","created_date","modified_date","modified_by" diff --git a/inst/csv/mc4_aeid.csv b/inst/csv/mc4_aeid.csv deleted file mode 100644 index 34b70204..00000000 --- a/inst/csv/mc4_aeid.csv +++ /dev/null @@ -1,9 +0,0 @@ -"mc4_mthd_id","aeid","created_date","modified_date","modified_by" -1,1,NA,NA,"mshobair.mshobair.mshobair" -1,2,NA,NA,"mshobair.mshobair.mshobair" -2,1,NA,NA,"mshobair.mshobair.mshobair" -2,2,NA,NA,"mshobair.mshobair.mshobair" -1,1,NA,NA,"mshobair.mshobair.mshobair" -1,2,NA,NA,"mshobair.mshobair.mshobair" -2,1,NA,NA,"mshobair.mshobair.mshobair" -2,2,NA,NA,"mshobair.mshobair.mshobair" diff --git a/inst/csv/mc4_agg.csv b/inst/csv/mc4_agg.csv deleted file mode 100644 index 14104e8b..00000000 --- a/inst/csv/mc4_agg.csv +++ /dev/null @@ -1 +0,0 @@ -"aeid","m0id","m1id","m2id","m3id","m4id" diff --git a/inst/csv/mc4_methods.csv b/inst/csv/mc4_methods.csv deleted file mode 100644 index 71aa9e90..00000000 --- a/inst/csv/mc4_methods.csv +++ /dev/null @@ -1,3 +0,0 @@ -mc4_mthd_id,mc4_mthd,desc,created_date,modified_date,modified_by -1,bmad.aeid.lowconc.twells,bmad based on two lowest concentration of treatment wells,0000-00-00 00:00:01,0000-00-00 00:00:00,spendse.scitovation -2,bmad.aeid.lowconc.nwells,bmad based on two lowest concentration of nwells,0000-00-00 00:00:00,0000-00-00 00:00:00,spendse.scitovation diff --git a/inst/csv/mc5.csv b/inst/csv/mc5.csv deleted file mode 100644 index a1e00f8b..00000000 --- a/inst/csv/mc5.csv +++ /dev/null @@ -1 +0,0 @@ -m5id,m4id,aeid,modl,hitc,fitc,coff,actp,modl_er,modl_tp,modl_ga,modl_gw,modl_la,modl_lw,modl_prob,modl_rmse,modl_acc,modl_acb,modl_ac10,model_type,created_date,modified_date,modified_by diff --git a/inst/csv/mc5_aeid.csv b/inst/csv/mc5_aeid.csv deleted file mode 100644 index 16b7d08a..00000000 --- a/inst/csv/mc5_aeid.csv +++ /dev/null @@ -1,5 +0,0 @@ -"aeid","mc5_mthd_id","created_date","modified_date","modified_by" -1,6,NA,NA,"mshobair.mshobair.mshobair" -2,6,NA,NA,"mshobair.mshobair.mshobair" -1,6,NA,NA,"mshobair.mshobair.mshobair" -2,6,NA,NA,"mshobair.mshobair.mshobair" diff --git a/inst/csv/mc5_chid.csv b/inst/csv/mc5_chid.csv deleted file mode 100644 index aae71025..00000000 --- a/inst/csv/mc5_chid.csv +++ /dev/null @@ -1 +0,0 @@ -m5id,chid_rep diff --git a/inst/csv/mc5_fit_categories.csv b/inst/csv/mc5_fit_categories.csv deleted file mode 100644 index 2900872d..00000000 --- a/inst/csv/mc5_fit_categories.csv +++ /dev/null @@ -1,56 +0,0 @@ -"fitc","parent_fitc","name","xloc","yloc" -"1","NULL","01: ALL DOSE RESPONSE",1110,756.5 -"2","1","02: CANNOT DETERMINE",977.7455523765,611.9831921304 -"3","1","03: INACTIVE",1022.9653320313,924.2873535156 -"4","3","04: RESP < BLINE",1271.6083984375,974.8182373047 -"5","3","05: RESP >= BLINE",996.8209228516,1127.5755004883 -"6","5","06: CNST",666,1251.5 -"7","6","07: NOTP >= 0.8(COFF)",761.8584594727,1333.5216674805 -"8","6","08: ANYTP >= 0.8(COFF)",507.3630981445,1333.6228027344 -"9","8","09: NOTP >= COFF",337.4776000977,1263.4637451172 -"10","8","10: ANYTP >= COFF",450.4357910156,1397.3994140625 -"11","5","11: HILL",1189.7768554688,1209.4105834961 -"12","11","12: TP < 0.8(COFF)",1149.2390136719,1317.5518188477 -"13","12","13: GNLS < 0.8(COFF)",992.1193237305,1394.7369384766 -"14","12","14: GNLS >= 0.8(COFF)",1246.0364990234,1386.9293518066 -"15","14","15: GNLS < COFF",1218.9203491211,1496.1217041016 -"16","14","16: GNLS >= COFF",1361.9873046875,1443.5811157227 -"17","11","17: TP >= 0.8(COFF)",1460.6746826172,1119.6658935547 -"18","17","18: GNLS < 0.8(COFF)",1539.3952956084,1228.8681030273 -"19","17","19: GNLS >= 0.8(COFF)",1623.3784179688,1043.5646362305 -"20","19","20: GNLS < COFF",1876.1442871094,1040.0154418945 -"21","19","21: GNLS >= COFF",1849.7615966797,948.6744995117 -"22","5","22: GNLS",794.5350952148,1043.2316894531 -"23","22","23: TP < 0.8(COFF)",632.9550857544,936.3232232708 -"24","23","24: HILL < 0.8(COFF)",803.6691931111,753.821326896 -"25","23","25: HILL >= 0.8(COFF)",542.0636749268,831.3344537395 -"26","25","26: HILL < COFF",478.504219532,698.9990045207 -"27","25","27: HILL >= COFF",359.5413589478,763.8884088176 -"28","22","28: TP >= 0.8(COFF)",491.8406066895,1063.1170043945 -"29","28","29: HILL < 0.8(COFF)",446.9388122559,1132.0888671875 -"30","28","30: HILL >= 0.8(COFF)",371.3406066895,956.1169433594 -"31","30","31: HILL < COFF",288.3405761719,853.1170654297 -"32","30","32: HILL >= COFF",107.8862915039,948.5189208984 -"33","1","33: ACTIVE",1276.5,563.5 -"34","33","34: HILL",1190.094543457,462.0799560547 -"35","34","35: TP <= 1.2(COFF)",991.5,302.5 -"36","35","36: AC50 <=",764.6481933594,350.3658447266 -"37","35","37: AC50 ==",749.6301269531,254.4168701172 -"38","35","38: AC50 >=",966.6704101563,183.7718505859 -"39","34","39: TP > 1.2(COFF)",1310.6741943359,263.3843994141 -"40","39","40: AC50 <=",1134.5294799805,105.1185302734 -"41","39","41: AC50 ==",1412.8084716797,121.1416015625 -"42","39","42: AC50 >=",1578.5758056641,187.1433105469 -"43","33","43: GNLS",1558.3104248047,570.28125 -"44","43","44: TP <= 1.2(COFF)",1639.5,451.5 -"45","44","45: AC50 <=",1811.0447998047,377.1083984375 -"46","44","46: AC50 ==",1905.2620849609,445.5483398437 -"47","44","47: AC50 >=",1659.5,320.5 -"48","43","48: TP > 1.2(COFF)",1647.5,685.5 -"49","48","49: AC50 <=",1704.5,806.5 -"50","48","50: AC50 ==",1873.9647216797,741.5611572266 -"51","48","51: AC50 >=",1926.5576171875,671.6712646484 -"52","23","52: HILL DNC",890.4145965576,837.0693170207 -"53","28","53: HILL DNC",155.8844682354,1077.1187744141 -"54","12","54: GNLS DNC",1463.7992844698,1325.916809082 -"55","17","55: GNLS DNC",1774.73046875,1155.2709031221 diff --git a/inst/csv/mc5_methods.csv b/inst/csv/mc5_methods.csv deleted file mode 100644 index 8598257f..00000000 --- a/inst/csv/mc5_methods.csv +++ /dev/null @@ -1,13 +0,0 @@ -mc5_mthd_id,mc5_mthd,desc,created_date,modified_date,modified_by -1,bmad3,Add a cutoff value of 3*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,pc20,Add a cutoff value of 20.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,log2_1.2,Add a cutoff value of log2(1.2).,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,log10_1.2,Add a cutoff value of log10(1.2).,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,bmad5,Add a cutoff value of 5*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,bmad6,Add a cutoff value of 6*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,bmad10,Add a cutoff value of 10*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,maxmed20pct,Add a cutoff value of 20% of the max of max_med,2015-05-06 09:08:50,0000-00-00 00:00:00,kconnors.kconnors.kconnors -9,pc70,70% cutoff,2015-07-28 15:06:35,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -10,pc50,50% cutoff,2015-07-28 15:08:01,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -11,log2_2,log2 of 2 fold change cutoff,2015-07-28 15:08:01,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -12,log10_2,log10 of 2 fold change cutoff,2015-07-28 15:08:01,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 diff --git a/inst/csv/mc6.csv b/inst/csv/mc6.csv deleted file mode 100644 index a9256b01..00000000 --- a/inst/csv/mc6.csv +++ /dev/null @@ -1 +0,0 @@ -"m6id","m5id","m4id","aeid","mc6_mthd_id","flag","fval","fval_unit","created_date","modified_date","modified_by" diff --git a/inst/csv/mc6_aeid.csv b/inst/csv/mc6_aeid.csv deleted file mode 100644 index f06a14e4..00000000 --- a/inst/csv/mc6_aeid.csv +++ /dev/null @@ -1,17 +0,0 @@ -"aeid","mc6_mthd_id","created_date","modified_date","modified_by" -1,6,NA,NA,"mshobair.mshobair.mshobair" -2,6,NA,NA,"mshobair.mshobair.mshobair" -1,7,NA,NA,"mshobair.mshobair.mshobair" -2,7,NA,NA,"mshobair.mshobair.mshobair" -1,8,NA,NA,"mshobair.mshobair.mshobair" -2,8,NA,NA,"mshobair.mshobair.mshobair" -1,10,NA,NA,"mshobair.mshobair.mshobair" -2,10,NA,NA,"mshobair.mshobair.mshobair" -1,11,NA,NA,"mshobair.mshobair.mshobair" -2,11,NA,NA,"mshobair.mshobair.mshobair" -1,12,NA,NA,"mshobair.mshobair.mshobair" -2,12,NA,NA,"mshobair.mshobair.mshobair" -1,15,NA,NA,"mshobair.mshobair.mshobair" -2,15,NA,NA,"mshobair.mshobair.mshobair" -1,16,NA,NA,"mshobair.mshobair.mshobair" -2,16,NA,NA,"mshobair.mshobair.mshobair" diff --git a/inst/csv/mc6_methods.csv b/inst/csv/mc6_methods.csv deleted file mode 100644 index 2b15f3d9..00000000 --- a/inst/csv/mc6_methods.csv +++ /dev/null @@ -1,19 +0,0 @@ -mc6_mthd_id,mc6_mthd,desc,nddr,created_date,modified_date,modified_by -1,row.dev.up,"Look for row-wise plate effects, increase",1,2014-07-28 14:03:41,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,row.dev.dn,"Look for row-wise plate effects, decrease",1,2014-07-28 14:03:54,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,col.dev.dn,"Look for column-wise plate effects, decrease",1,2014-07-28 14:04:08,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,col.dev.up,"Look for column-wise plate effects, increase",1,2014-07-28 14:04:17,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,plate.flare,Look for plate flare effects,1,2014-07-28 14:04:27,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,singlept.hit.high,Look for single point hits with activity only at the highest conc tested,0,2014-07-28 14:06:05,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,singlept.hit.mid,Look for signle point hits with activity not at highest conc tested,0,2014-07-28 14:06:51,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,multipoint.neg,Look for inactives with multiple medians above baseline,0,2014-07-28 14:08:42,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,pintool,Look for pintool carryover issues,1,2014-07-28 14:09:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -10,noise,"Look for noisy curves, relative to the assay",0,2014-07-28 14:09:41,0000-00-00 00:00:00,dfiler.dfiler.dfiler -11,border.hit,Look for actives with borderline activity,0,2014-07-28 14:10:14,0000-00-00 00:00:00,dfiler.dfiler.dfiler -12,border.miss,Look for inactives with borderline activity,0,2014-07-28 14:10:21,0000-00-00 00:00:00,dfiler.dfiler.dfiler -13,plate.interlace,Look for interlaced chemical-plate effects,1,2014-08-21 12:13:26,0000-00-00 00:00:00,dfiler.dfiler.dfiler -14,rep.mismatch,Look for mismatched techinal replicates,1,2014-08-21 12:16:44,0000-00-00 00:00:00,dfiler.dfiler.dfiler -15,gnls.lowconc,Look for low concentration gnls winners,0,2014-08-21 12:21:32,0000-00-00 00:00:00,dfiler.dfiler.dfiler -16,overfit.hit,Flag hit-calls that would get changed after doing the small N correction to the aic values.,0,2014-09-16 11:51:14,0000-00-00 00:00:00,dfiler.dfiler.dfiler -17,efficacy.50,Flag hit-calls with efficacy values less than 50% -- intended for biochemical assays.,0,2014-09-16 11:51:58,0000-00-00 00:00:00,dfiler.dfiler.dfiler -19,viability.gnls,Flag hit-calls with cell viability assay that are fit with gnls winning model,0,03/26/19 10:53 AM,, diff --git a/inst/csv/sample.csv b/inst/csv/sample.csv deleted file mode 100644 index 8420dae4..00000000 --- a/inst/csv/sample.csv +++ /dev/null @@ -1,7 +0,0 @@ -"spid","chid","stkc","stkc_unit","tested_conc_unit","spid_legacy" -"Tox21_400088","20182","","","","" -"Tox21_303655","22364","","","","" -"Tox21_110011","23463","","","","" -"Tox21_400081","24102","","","","" -"DMSO","21735","","","","" -"Tox21_400037","20283","","","","" diff --git a/inst/csv/sc0.csv b/inst/csv/sc0.csv deleted file mode 100644 index 6adac25a..00000000 --- a/inst/csv/sc0.csv +++ /dev/null @@ -1,2 +0,0 @@ -s0id,acid,spid,apid,rowi,coli,wllt,wllq,conc,rval,srcf,created_date,modified_date,modified_by - diff --git a/inst/csv/sc1.csv b/inst/csv/sc1.csv deleted file mode 100644 index 2d54ea07..00000000 --- a/inst/csv/sc1.csv +++ /dev/null @@ -1 +0,0 @@ -s1id,s0id,acid,aeid,logc,bval,pval,resp,created_date,modified_date,modified_by diff --git a/inst/csv/sc1_aeid.csv b/inst/csv/sc1_aeid.csv deleted file mode 100644 index db1ea033..00000000 --- a/inst/csv/sc1_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -sc1_mthd_id,aeid,exec_ordr,created_date,modified_date,modified_by diff --git a/inst/csv/sc1_methods.csv b/inst/csv/sc1_methods.csv deleted file mode 100644 index 0a300039..00000000 --- a/inst/csv/sc1_methods.csv +++ /dev/null @@ -1,17 +0,0 @@ -sc1_mthd_id,sc1_mthd,desc,created_date,modified_date,modified_by -1,bval.apid.nwlls.med,plate-wise baseline based on neutral ctrl median value,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,bval.apid.twlls.med,"Take the median cval of the t wells, by apid",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,bval.apid.tn.med,"Take the median cval of the t and n wells, by apid",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,pval.apid.pwlls.med,"plate-wise meidan based on positive control, single dose",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,pval.apid.mwlls.med,"plate-wise meidan based on negative control, single dose",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,pval.apid.medpcbyconc.max,plate-wise median response of positive control (max),2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,pval.apid.medpcbyconc.min,plate-wise median response of positive control (min),2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,pval.apid.medncbyconc.min,"plate-wise meidan based on negative control, (min)",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,pval.zero,Set pval to 0.,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -10,resp.pc,response percent activity,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -11,resp.fc,calculate response as fold-change,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -12,resp.logfc,Calculate the response as a fold change over baseline for logged values,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -13,resp.log2,take the log base 2 of the response,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -14,none,apply no level 2 method,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -16,resp.multneg1,multiply response values by negative 1,2015-05-29 10:27:45,0000-00-00 00:00:00,Akarmaus.Akarmaus.Akarmaus -17,pval.apid.or.aeid.pwlls.med,calculates pval first based on p wells by plate and then for any plates missing p wells it calculates a pval by median of pval for all other plates,2015-09-30 14:43:40,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 diff --git a/inst/csv/sc2.csv b/inst/csv/sc2.csv deleted file mode 100644 index 1fa7efb8..00000000 --- a/inst/csv/sc2.csv +++ /dev/null @@ -1 +0,0 @@ -s2id,aeid,spid,bmad,max_med,coff,hitc,tmpi,created_date,modified_date,modified_by diff --git a/inst/csv/sc2_aeid.csv b/inst/csv/sc2_aeid.csv deleted file mode 100644 index df7cc430..00000000 --- a/inst/csv/sc2_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -sc2_mthd_id,aeid,exec_ordr,created_date,modified_date,modified_by diff --git a/inst/csv/sc2_agg.csv b/inst/csv/sc2_agg.csv deleted file mode 100644 index db0d02fd..00000000 --- a/inst/csv/sc2_agg.csv +++ /dev/null @@ -1 +0,0 @@ -aeid,s0id,s1id,s2id diff --git a/inst/csv/sc2_methods.csv b/inst/csv/sc2_methods.csv deleted file mode 100644 index c79bb628..00000000 --- a/inst/csv/sc2_methods.csv +++ /dev/null @@ -1,11 +0,0 @@ -sc2_mthd_id,sc2_mthd,desc,created_date,modified_date,modified_by -1,bmad3,Add a cutoff value of 3*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,pc20,Add a cutoff value of 20.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,log2_1.2,Add a cutoff value of log2(1.2).,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,log10_1.2,Add a cutoff value of log10(1.2).,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,bmad5,Add a cutoff value of 5*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,bmad6,Add a cutoff value of 6*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,bmad10,Add a cutoff value of 10*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,pc30orbmad3,"Add a cutoff value of either 30 or 3*bmad, whichever is less.",2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,pc0.88,Add a cutoff value of 0.88.,2015-05-14 13:25:38,0000-00-00 00:00:00,dfiler.dfiler.dfiler -10,log2_1.5,Add a cutoff value of log2(1.5).,2015-05-14 13:25:38,0000-00-00 00:00:00,dfiler.dfiler.dfiler diff --git a/inst/example/assay.csv b/inst/example/assay.csv deleted file mode 100644 index 98672b2b..00000000 --- a/inst/example/assay.csv +++ /dev/null @@ -1 +0,0 @@ -"aid","asid","assay_name","assay_desc","timepoint_hr","organism_id","organism","tissue","cell_format","cell_free_component_source","cell_short_name","cell_growth_mode","assay_footprint","assay_format_type","assay_format_type_sub","content_readout_type","dilution_solvent","dilution_solvent_percent_max" diff --git a/inst/example/assay_component.csv b/inst/example/assay_component.csv deleted file mode 100644 index 5ce3f51e..00000000 --- a/inst/example/assay_component.csv +++ /dev/null @@ -1 +0,0 @@ -"acid","aid","assay_component_name","assay_component_desc","assay_component_target_desc","parameter_readout_type","assay_design_type","assay_design_type_sub","biological_process_target","detection_technology_type","detection_technology_type_sub","detection_technology","signal_direction_type","key_assay_reagent_type","key_assay_reagent","technological_target_type","technological_target_type_sub" diff --git a/inst/example/assay_component_endpoint.csv b/inst/example/assay_component_endpoint.csv deleted file mode 100644 index 7d12e3fe..00000000 --- a/inst/example/assay_component_endpoint.csv +++ /dev/null @@ -1,5 +0,0 @@ -"aeid","acid","assay_component_endpoint_name","export_ready","internal_ready","assay_component_endpoint_desc","assay_function_type","normalized_data_type","analysis_direction","burst_assay","key_positive_control","signal_direction","intended_target_type","intended_target_type_sub","intended_target_family","intended_target_family_sub","fit_all" -797,534,"TOX21_MMP_ratio_down",1,1,"Data from the assay component Tox21_MMP_ratio was analyzed into 2 assay endpoints. This assay endpoint, Tox21_MMP_ratio, was analyzed in the positive fitting direction relative to DMSO as the negative control and baseline of activity. -Using a type of 6 membrane potential reporter, gain-of-signal activity can be used to understand changes in the signaling. -Furthermore, this assay endpoint can be referred to as a primary readout, because this assay has produced multiple assay endpoints where this one serves a signaling function. -To generalize the intended target to other relatable targets, this assay endpoint is annotated to the cell morphology intended target family, where the subfamily is organelle conformation.","signaling","percent_activity","positive",0,"FCCP","loss","cellular","mitochondria","cell morphology","organelle conformation",0 diff --git a/inst/example/assay_component_map.csv b/inst/example/assay_component_map.csv deleted file mode 100644 index 8a4dc485..00000000 --- a/inst/example/assay_component_map.csv +++ /dev/null @@ -1 +0,0 @@ -"acid","acsn" diff --git a/inst/example/assay_source.csv b/inst/example/assay_source.csv deleted file mode 100644 index 956cca34..00000000 --- a/inst/example/assay_source.csv +++ /dev/null @@ -1 +0,0 @@ -"asid","assay_source_name","assay_source_long_name","assay_source_desc" diff --git a/inst/example/chemical.csv b/inst/example/chemical.csv deleted file mode 100644 index c4e45594..00000000 --- a/inst/example/chemical.csv +++ /dev/null @@ -1,2 +0,0 @@ -chid,casn,chnm,dsstox_substance_id,code -20182,80-05-7,Bisphenol A,DTXSID7020182,C80057 diff --git a/inst/example/chemical_library.csv b/inst/example/chemical_library.csv deleted file mode 100644 index 02616e4c..00000000 --- a/inst/example/chemical_library.csv +++ /dev/null @@ -1,8 +0,0 @@ -"chid","clib" -20182,"TOX21SL" -20182,"TOXCAST" -20182,"TOXCAST_EPATox21" -20182,"TOXCAST_ph1v2" -20182,"TOXCAST_PhaseI" -20182,"TOXCAST_PhaseII" -20182,"TOXCAST_PhaseIII" diff --git a/inst/example/mc0.csv b/inst/example/mc0.csv deleted file mode 100644 index e42a25c1..00000000 --- a/inst/example/mc0.csv +++ /dev/null @@ -1,45 +0,0 @@ -"m0id","acid","spid","apid","rowi","coli","wllt","wllq","conc","rval","srcf","created_date","modified_date","modified_by" -430748046,534,"Tox21_202992","T5397033",7,17,"t",1,3.65161290322581,-25.8516680725,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430752654,534,"Tox21_202992","T5397035",7,17,"t",1,1.63305093580645,-12.808278967,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430764942,534,"Tox21_202992","T5397037",7,17,"t",1,0.730322580645161,-7.7695268125,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430754190,534,"Tox21_202992","T5397039",7,17,"t",1,0.326610187142857,-3.0309182114,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430761870,534,"Tox21_202992","T5397041",7,17,"t",1,0.146064516129032,0.6320821129,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430763406,534,"Tox21_202992","T5397043",7,17,"t",1,0.0653220374193548,0.2937049989,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430746510,534,"Tox21_202992","T5397047",7,17,"t",1,0.0292129032258065,4.8854945307,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430744974,534,"Tox21_202992","T5397049",7,17,"t",1,0.0130644074654378,0.6047468531,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430751118,534,"Tox21_202992","T5397051",7,17,"t",1,0.00584258064516129,0.3394452023,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430758798,534,"Tox21_202992","T5397053",7,17,"t",1,0.00261288147465438,1.0971752187,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430755726,534,"Tox21_202992","T5397067",7,17,"t",1,0.00116851612903226,5.1009273696,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430766478,534,"Tox21_202992","T5397071",7,17,"t",1,8.16525467912442,-27.4639329578,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430749582,534,"Tox21_202992","T5397073",7,17,"t",1,18.258064516129,-56.1735755773,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430757262,534,"Tox21_202992","T5397077",7,17,"t",1,40.8262733956221,-72.2783059098,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430760334,534,"Tox21_202992","T5397079",7,17,"t",1,91.2903225806452,-90.5887455377,"tox21-mitotox-p1.txt","2017-06-09 07:56:25","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430377914,534,"Tox21_202992","T5397607",8,17,"t",1,0.146064516129032,4.9452627381,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430385594,534,"Tox21_202992","T5397609",8,17,"t",1,0.0653220374193548,19.7403169424,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430422415,534,"Tox21_202992","T5397611",7,18,"t",1,0.00116851612903226,20.6084942663,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430388666,534,"Tox21_202992","T5397617",8,17,"t",1,91.2903225806452,-94.4253640904,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430393274,534,"Tox21_202992","T5397619",8,17,"t",1,40.8262733956221,-77.3032971548,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430391738,534,"Tox21_202992","T5397621",8,17,"t",1,18.258064516129,-58.5190729633,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430387130,534,"Tox21_202992","T5397625",8,17,"t",1,8.16525467912442,-50.0178492903,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430384058,534,"Tox21_202992","T5397627",8,17,"t",1,3.65161290322581,-44.5386085275,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430382522,534,"Tox21_202992","T5397629",8,17,"t",1,1.63305093580645,-24.2872869162,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430425487,534,"Tox21_202992","T5400075",7,18,"t",1,0.00584258064516129,9.6191813961,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430423951,534,"Tox21_202992","T5400077",7,18,"t",1,0.00261288147465438,-0.1189863227,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430440847,534,"Tox21_202992","T5400009",7,18,"t",1,91.2903225806452,-109.5033957167,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430433167,534,"Tox21_202992","T5400071",7,18,"t",1,0.0292129032258065,12.7991460404,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430436239,534,"Tox21_202992","T5400073",7,18,"t",1,0.0130644074654378,3.6750887039,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430396346,534,"Tox21_202992","T5400079",8,17,"t",1,0.326610187142857,-6.2171842637,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430430095,534,"Tox21_202992","T5400069",7,18,"t",1,0.0653220374193548,4.2768491029,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430376378,534,"Tox21_202992","T5400081",8,17,"t",1,0.0292129032258065,16.0491804873,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430434703,534,"Tox21_202992","T5400083",7,18,"t",1,0.730322580645161,-12.5694069267,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430442383,534,"Tox21_202992","T5400087",7,18,"t",1,0.326610187142857,-5.5464142931,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430437775,534,"Tox21_202992","T5400089",7,18,"t",1,0.146064516129032,7.7790889947,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430443919,534,"Tox21_202992","T5400091",7,18,"t",1,40.8262733956221,-108.1864438838,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430428559,534,"Tox21_202992","T5400093",7,18,"t",1,18.258064516129,-78.5294105576,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430431631,534,"Tox21_202992","T5400095",7,18,"t",1,8.16525467912442,-41.5760993818,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430427023,534,"Tox21_202992","T5400097",7,18,"t",1,3.65161290322581,-29.8191354153,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430439311,534,"Tox21_202992","T5400099",7,18,"t",1,1.63305093580645,-5.7325549136,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430380986,534,"Tox21_202992","T5400111",8,17,"t",1,0.0130644074654378,7.0767484891,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430394810,534,"Tox21_202992","T5400113",8,17,"t",1,0.00584258064516129,-9.2539696563,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430397882,534,"Tox21_202992","T5400115",8,17,"t",1,0.00261288147465438,-9.1805107616,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -430390202,534,"Tox21_202992","T5400117",8,17,"t",1,0.00116851612903226,-3.4352984691,"tox21-mitotox-p1.txt","2017-06-09 07:54:27","0000-00-00 00:00:00","rjudson.rjudson.rjudson" diff --git a/inst/example/mc1.csv b/inst/example/mc1.csv deleted file mode 100644 index 73118131..00000000 --- a/inst/example/mc1.csv +++ /dev/null @@ -1,45 +0,0 @@ -"m1id","m0id","acid","cndx","repi","created_date","modified_date","modified_by" -449243302,430748046,534,11,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243303,430752654,534,10,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243304,430764942,534,9,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243305,430754190,534,8,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243306,430761870,534,7,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243307,430763406,534,6,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243308,430746510,534,5,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243309,430744974,534,4,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243310,430751118,534,3,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243311,430758798,534,2,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243312,430755726,534,1,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243313,430766478,534,12,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243314,430749582,534,13,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243315,430757262,534,14,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243316,430760334,534,15,1,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243317,430377914,534,7,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243318,430385594,534,6,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243319,430422415,534,1,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243320,430388666,534,15,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243321,430393274,534,14,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243322,430391738,534,13,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243323,430387130,534,12,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243324,430384058,534,11,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243325,430382522,534,10,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243330,430425487,534,3,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243331,430423951,534,2,2,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243334,430440847,534,15,3,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243341,430433167,534,5,3,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243342,430436239,534,4,3,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243343,430396346,534,8,3,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243348,430430095,534,6,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243349,430376378,534,5,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243350,430434703,534,9,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243351,430442383,534,8,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243352,430437775,534,7,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243353,430443919,534,14,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243354,430428559,534,13,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243355,430431631,534,12,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243356,430427023,534,11,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243357,430439311,534,10,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243358,430380986,534,4,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243359,430394810,534,3,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243360,430397882,534,2,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -449243361,430390202,534,1,4,"2017-06-10 01:44:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" diff --git a/inst/example/mc2.csv b/inst/example/mc2.csv deleted file mode 100644 index 26913820..00000000 --- a/inst/example/mc2.csv +++ /dev/null @@ -1,45 +0,0 @@ -"m2id","m0id","acid","m1id","cval","created_date","modified_date","modified_by" -424939723,430748046,534,449243302,-25.8516680725,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939722,430752654,534,449243303,-12.808278967,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939721,430764942,534,449243304,-7.7695268125,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939720,430754190,534,449243305,-3.0309182114,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939719,430761870,534,449243306,0.6320821129,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939718,430763406,534,449243307,0.2937049989,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939717,430746510,534,449243308,4.8854945307,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939716,430744974,534,449243309,0.6047468531,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939715,430751118,534,449243310,0.3394452023,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939714,430758798,534,449243311,1.0971752187,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939713,430755726,534,449243312,5.1009273696,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939712,430766478,534,449243313,-27.4639329578,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939711,430749582,534,449243314,-56.1735755773,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939710,430757262,534,449243315,-72.2783059098,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939709,430760334,534,449243316,-90.5887455377,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939708,430377914,534,449243317,4.9452627381,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939707,430385594,534,449243318,19.7403169424,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939706,430422415,534,449243319,20.6084942663,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939705,430388666,534,449243320,-94.4253640904,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939704,430393274,534,449243321,-77.3032971548,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939703,430391738,534,449243322,-58.5190729633,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939702,430387130,534,449243323,-50.0178492903,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939701,430384058,534,449243324,-44.5386085275,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939700,430382522,534,449243325,-24.2872869162,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939699,430425487,534,449243330,9.6191813961,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939698,430423951,534,449243331,-0.1189863227,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939697,430440847,534,449243334,-109.5033957167,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939696,430433167,534,449243341,12.7991460404,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939695,430436239,534,449243342,3.6750887039,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939694,430396346,534,449243343,-6.2171842637,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939693,430430095,534,449243348,4.2768491029,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939692,430376378,534,449243349,16.0491804873,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939691,430434703,534,449243350,-12.5694069267,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939690,430442383,534,449243351,-5.5464142931,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939689,430437775,534,449243352,7.7790889947,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939688,430443919,534,449243353,-108.1864438838,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939687,430428559,534,449243354,-78.5294105576,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939686,430431631,534,449243355,-41.5760993818,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939685,430427023,534,449243356,-29.8191354153,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939684,430439311,534,449243357,-5.7325549136,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939683,430380986,534,449243358,7.0767484891,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939682,430394810,534,449243359,-9.2539696563,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939681,430397882,534,449243360,-9.1805107616,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -424939680,430390202,534,449243361,-3.4352984691,"2017-06-10 01:45:15","0000-00-00 00:00:00","rjudson.rjudson.rjudson" diff --git a/inst/example/mc2_acid.csv b/inst/example/mc2_acid.csv deleted file mode 100644 index 4eeb2ffc..00000000 --- a/inst/example/mc2_acid.csv +++ /dev/null @@ -1 +0,0 @@ -"mc2_mthd_id","acid","exec_ordr","created_date","modified_date","modified_by" diff --git a/inst/example/mc2_methods.csv b/inst/example/mc2_methods.csv deleted file mode 100644 index 3f2667ac..00000000 --- a/inst/example/mc2_methods.csv +++ /dev/null @@ -1,13 +0,0 @@ -mc2_mthd_id,mc2_mthd,desc,created_date,modified_date,modified_by -1,none,"apply no level 2 method","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -2,log2,"log2 all raw data","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -3,rmneg,"remove negative values prior to logging values","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -4,rmzero,"remove 0 values prior to logging values","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -5,mult25,"multiply values by 25","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -7,mult100,"multiply values by 100","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -10,log10,"log10 the raw data","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -11,negshift,"Shifts all data to be positive (new min=1)","2014-10-06 14:47:15","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -12,mult2.5,"multiply values by 2.5","2014-11-06 10:36:15","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -13,mult3,"multiply values by 3","2014-11-06 10:36:34","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -14,mult6,"multiply values by 6","2014-11-06 15:53:33","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 -17,sub100,"100 minus cval (centers data around zero if prenormalized starting at 100 and going down to zero)","2015-10-05 12:42:21","0000-00-00 00:00:00","mmarti02.mmarti02.mmarti02" diff --git a/inst/example/mc3.csv b/inst/example/mc3.csv deleted file mode 100644 index 4cb95056..00000000 --- a/inst/example/mc3.csv +++ /dev/null @@ -1,45 +0,0 @@ -"m3id","aeid","m0id","acid","m1id","m2id","bval","pval","logc","resp","created_date","modified_date","modified_by" -482775747,797,430748046,534,449243302,424939723,NA,NA,0.602059991327962,25.8516680725,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775748,797,430752654,534,449243303,424939722,NA,NA,0.301029995663981,12.808278967,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775749,797,430764942,534,449243304,424939721,NA,NA,-0.154901959985743,7.7695268125,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775750,797,430754190,534,449243305,424939720,NA,NA,-0.522878745280338,3.0309182114,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775751,797,430761870,534,449243306,424939719,NA,NA,-1,-0.6320821129,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775752,797,430763406,534,449243307,424939718,NA,NA,-1.15490195998574,-0.2937049989,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775753,797,430746510,534,449243308,424939717,NA,NA,-1.52287874528034,-4.8854945307,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775754,797,430744974,534,449243309,424939716,NA,NA,-2,-0.6047468531,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775755,797,430751118,534,449243310,424939715,NA,NA,-2.22184874961636,-0.3394452023,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775756,797,430758798,534,449243311,424939714,NA,NA,-2.52287874528034,-1.0971752187,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775757,797,430755726,534,449243312,424939713,NA,NA,-3,-5.1009273696,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775758,797,430766478,534,449243313,424939712,NA,NA,0.903089986991944,27.4639329578,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775759,797,430749582,534,449243314,424939711,NA,NA,1.30102999566398,56.1735755773,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775760,797,430757262,534,449243315,424939710,NA,NA,1.60205999132796,72.2783059098,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775761,797,430760334,534,449243316,424939709,NA,NA,1.95424250943932,90.5887455377,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775762,797,430377914,534,449243317,424939708,NA,NA,-1,-4.9452627381,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775763,797,430385594,534,449243318,424939707,NA,NA,-1.15490195998574,-19.7403169424,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775764,797,430422415,534,449243319,424939706,NA,NA,-3,-20.6084942663,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775765,797,430388666,534,449243320,424939705,NA,NA,1.95424250943932,94.4253640904,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775766,797,430393274,534,449243321,424939704,NA,NA,1.60205999132796,77.3032971548,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775767,797,430391738,534,449243322,424939703,NA,NA,1.30102999566398,58.5190729633,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775768,797,430387130,534,449243323,424939702,NA,NA,0.903089986991944,50.0178492903,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775769,797,430384058,534,449243324,424939701,NA,NA,0.602059991327962,44.5386085275,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775770,797,430382522,534,449243325,424939700,NA,NA,0.301029995663981,24.2872869162,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775771,797,430425487,534,449243330,424939699,NA,NA,-2.22184874961636,-9.6191813961,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775772,797,430423951,534,449243331,424939698,NA,NA,-2.52287874528034,0.1189863227,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775773,797,430440847,534,449243334,424939697,NA,NA,1.95424250943932,109.5033957167,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775774,797,430433167,534,449243341,424939696,NA,NA,-1.52287874528034,-12.7991460404,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775775,797,430436239,534,449243342,424939695,NA,NA,-2,-3.6750887039,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775776,797,430396346,534,449243343,424939694,NA,NA,-0.522878745280338,6.2171842637,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775777,797,430430095,534,449243348,424939693,NA,NA,-1.15490195998574,-4.2768491029,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775778,797,430376378,534,449243349,424939692,NA,NA,-1.52287874528034,-16.0491804873,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775779,797,430434703,534,449243350,424939691,NA,NA,-0.154901959985743,12.5694069267,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775780,797,430442383,534,449243351,424939690,NA,NA,-0.522878745280338,5.5464142931,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775781,797,430437775,534,449243352,424939689,NA,NA,-1,-7.7790889947,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775782,797,430443919,534,449243353,424939688,NA,NA,1.60205999132796,108.1864438838,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775783,797,430428559,534,449243354,424939687,NA,NA,1.30102999566398,78.5294105576,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775784,797,430431631,534,449243355,424939686,NA,NA,0.903089986991944,41.5760993818,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775785,797,430427023,534,449243356,424939685,NA,NA,0.602059991327962,29.8191354153,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775786,797,430439311,534,449243357,424939684,NA,NA,0.301029995663981,5.7325549136,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775787,797,430380986,534,449243358,424939683,NA,NA,-2,-7.0767484891,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775788,797,430394810,534,449243359,424939682,NA,NA,-2.22184874961636,9.2539696563,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775789,797,430397882,534,449243360,424939681,NA,NA,-2.52287874528034,9.1805107616,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -482775790,797,430390202,534,449243361,424939680,NA,NA,-3,3.4352984691,"2017-06-10 01:49:02","0000-00-00 00:00:00","rjudson.rjudson.rjudson" diff --git a/inst/example/mc3_aeid.csv b/inst/example/mc3_aeid.csv deleted file mode 100644 index 91fe04a8..00000000 --- a/inst/example/mc3_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -"mc3_mthd_id","aeid","exec_ordr","created_date","modified_date","modified_by" diff --git a/inst/example/mc3_methods.csv b/inst/example/mc3_methods.csv deleted file mode 100644 index 4561cd21..00000000 --- a/inst/example/mc3_methods.csv +++ /dev/null @@ -1,37 +0,0 @@ -mc3_mthd_id,mc3_mthd,desc,created_date,modified_date,modified_by -1,none,"apply no level 3 method","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -2,bval.apid.lowconc.med,"plate-wise baseline based on low conc median value","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -3,pval.apid.medpcbyconc.max,"plate-wise median response of positive control (max)","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -4,pval.apid.medpcbyconc.min,"plate-wise median response of positive control (min)","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -5,resp.pc,"response percent activity","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -6,resp.multneg1,"multiply the response by -1","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -7,resp.log2,"take the log base 2 of the response","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -8,resp.mult25,"multiply the response by 25","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -9,resp.fc,"calculate response as fold-change","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -11,bval.apid.nwlls.med,"plate-wise baseline based on neutral ctrl median value","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -12,bval.spid.lowconc.med,"sample-wise baseline based on low conc median value","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -13,pval.apid.pwlls.med,"plate-wise meidan based on positive control, single dose","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -14,pval.apid.mwlls.med,"plate-wise meidan based on negative control, single dose","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -15,pval.apid.medncbyconc.min,"plate-wise meidan based on negative control, (min)","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -16,bval.apid.twlls.med,"Take the median cval of the t wells, by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -17,bval.apid.nwllslowconc.med,"Take the median cval of the n wells and the first two concentrations, by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -18,resp.shiftneg.3bmad,"Make values below baseline zero.","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -19,resp.blineshift.3bmad.repi,"Do baseline correction by repi, with a window of 3*bmad","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -20,resp.blineshift.50.repi,"Do baseline correction by repi, with a window of 50","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -21,resp.blineshift.50.spid,"Do baseline correction by spid, with a window of 50","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -23,resp.blineshift.3bmad.spid,"Do baseline correction by repi, with a window of 3*bmad","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -24,bval.apid.tn.med,"Take the median cval of the t and n wells, by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -25,pval.apid.pmv.min,"Calculate the median p, m, and v values by concentration, then take the minimum by apid.","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -26,pval.apid.pmv.max,"Calculate the median p, m, and v values by concentration, then take the maximum by apid.","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -27,pval.apid.f.max,"Calculate the median of f values by concentration, then take the maximum by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -28,pval.apid.f.min,"Calculate the median of f values by concentration, then take the minimum by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -29,pval.apid.p.min,"Calculate the median of p values by concentration, then take the minimum by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -30,pval.apid.p.max,"Calculate the median of p values by concentration, then take the maximum by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -31,pval.apid.v.min,"Calculate the median of v values by concentration, then take the minimum by apid","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -32,pval.zero,"Set pval to 0.","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -33,resp.shiftneg.6bmad,"Shift response values falling below -6 * bmad to 0.","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -34,resp.shiftneg.10bmad,"Shift response values falling below -10 * bmad to 0.","0000-00-00 00:00:00","0000-00-00 00:00:00",dfiler.dfiler.dfiler -35,resp.logfc,"Calculate the response as a fold change over baseline for logged values","2014-10-02 14:18:40","0000-00-00 00:00:00",dfiler.dfiler.dfiler -36,resp.scale.mad.log2fc,"Scale the resp data by the ratio of log2(1.2) over 3* baseline mad of the unscaled resp values","2015-02-23 13:58:52","0000-00-00 00:00:00", -37,resp.scale.quant.log2fc,"Scale resp such that 20% of the maximum resp equals log2(1.2)","2015-03-13 16:44:05","0000-00-00 00:00:00",dfiler.dfiler.dfiler -38,bval.apid.nwllstcwllslowconc.med,"plate-wise baseline based on neutral and t and c well low conc","2015-09-16 15:22:54","0000-00-00 00:00:00",mmarti02.mmarti02.mmarti02 diff --git a/inst/example/mc4.csv b/inst/example/mc4.csv deleted file mode 100644 index 2c41f5c8..00000000 --- a/inst/example/mc4.csv +++ /dev/null @@ -1,3 +0,0 @@ -"m4id","aeid","spid","bmad","resp_max","resp_min","max_mean","max_mean_conc","max_med","max_med_conc","logc_max","logc_min","cnst","hill","hcov","gnls","gcov","cnst_er","cnst_aic","cnst_rmse","cnst_prob","hill_tp","hill_tp_sd","hill_ga","hill_ga_sd","hill_gw","hill_gw_sd","hill_er","hill_er_sd","hill_aic","hill_rmse","hill_prob","gnls_tp","gnls_tp_sd","gnls_ga","gnls_ga_sd","gnls_gw","gnls_gw_sd","gnls_la","gnls_la_sd","gnls_lw","gnls_lw_sd","gnls_er","gnls_er_sd","gnls_aic","gnls_rmse","gnls_prob","nconc","npts","nrep","nmed_gtbl","tmpi","created_date","modified_date","modified_by" -18609966,797,"Tox21_202992",6.44391923052108,109.5033957167,-20.6084942663,98.1725017816,1.95424250943932,94.4253640904,1.95424250943932,1.95424250943932,-3,1,1,1,1,1,3.30736588007509,448.319915469051,41.5886357915789,3.35489346740589e-26,117.394184254973,17.4784180417536,1.21619689238089,0.200620880158924,0.854051897308764,0.141503541025264,2.00693525091024,0.143926067618168,331.260186646208,9.63076046108619,0.880797096613293,117.393199211778,17.4776426213293,1.21617912878982,0.200614786833848,0.854055545558882,0.141499853761845,2.61425477137428,262.04321448648,11.362237550244,4508.98837634178,2.00693352306279,0.143925899094951,335.26018700119,9.63073734439273,0.119202903386706,15,44,3,5,1638,"2017-06-10 02:09:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" -18610151,797,"Tox21_400088",6.44391923052108,117.540528361,-37.3394224506,100.465424800569,1.95424250943932,100.3208208064,1.95424250943932,1.95424250943932,-3,1,1,1,1,1,3.33501313432901,6821.79750955702,41.9662055992013,0,133.708893343495,6.41773553786922,1.31680522530087,0.0665611981171054,0.743424361310043,0.0334320778614389,1.96352280443088,0.0360049761129623,4868.6694563213,9.32970302693295,0.880797093510943,133.711503236814,6.41799605183265,1.31683434789418,0.0665631490577626,0.74340794366297,0.0334305924702818,2.59988218062917,283.579662805397,13.0554747440897,5724.33660767495,1.96351586178074,0.0360048976725412,4872.66945661719,9.32970719208977,0.119202906489057,15,670,45,6,1823,"2017-06-10 02:09:36","0000-00-00 00:00:00","rjudson.rjudson.rjudson" diff --git a/inst/example/mc4_aeid.csv b/inst/example/mc4_aeid.csv deleted file mode 100644 index 3d9062b3..00000000 --- a/inst/example/mc4_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -"mc4_mthd_id","aeid","created_date","modified_date","modified_by" diff --git a/inst/example/mc4_agg.csv b/inst/example/mc4_agg.csv deleted file mode 100644 index f55d3ae6..00000000 --- a/inst/example/mc4_agg.csv +++ /dev/null @@ -1,45 +0,0 @@ -"aeid","m0id","m1id","m2id","m3id","m4id" -797,430748046,449243302,424939723,482775747,18609966 -797,430752654,449243303,424939722,482775748,18609966 -797,430764942,449243304,424939721,482775749,18609966 -797,430754190,449243305,424939720,482775750,18609966 -797,430761870,449243306,424939719,482775751,18609966 -797,430763406,449243307,424939718,482775752,18609966 -797,430746510,449243308,424939717,482775753,18609966 -797,430744974,449243309,424939716,482775754,18609966 -797,430751118,449243310,424939715,482775755,18609966 -797,430758798,449243311,424939714,482775756,18609966 -797,430755726,449243312,424939713,482775757,18609966 -797,430766478,449243313,424939712,482775758,18609966 -797,430749582,449243314,424939711,482775759,18609966 -797,430757262,449243315,424939710,482775760,18609966 -797,430760334,449243316,424939709,482775761,18609966 -797,430377914,449243317,424939708,482775762,18609966 -797,430385594,449243318,424939707,482775763,18609966 -797,430422415,449243319,424939706,482775764,18609966 -797,430388666,449243320,424939705,482775765,18609966 -797,430393274,449243321,424939704,482775766,18609966 -797,430391738,449243322,424939703,482775767,18609966 -797,430387130,449243323,424939702,482775768,18609966 -797,430384058,449243324,424939701,482775769,18609966 -797,430382522,449243325,424939700,482775770,18609966 -797,430425487,449243330,424939699,482775771,18609966 -797,430423951,449243331,424939698,482775772,18609966 -797,430440847,449243334,424939697,482775773,18609966 -797,430433167,449243341,424939696,482775774,18609966 -797,430436239,449243342,424939695,482775775,18609966 -797,430396346,449243343,424939694,482775776,18609966 -797,430430095,449243348,424939693,482775777,18609966 -797,430376378,449243349,424939692,482775778,18609966 -797,430434703,449243350,424939691,482775779,18609966 -797,430442383,449243351,424939690,482775780,18609966 -797,430437775,449243352,424939689,482775781,18609966 -797,430443919,449243353,424939688,482775782,18609966 -797,430428559,449243354,424939687,482775783,18609966 -797,430431631,449243355,424939686,482775784,18609966 -797,430427023,449243356,424939685,482775785,18609966 -797,430439311,449243357,424939684,482775786,18609966 -797,430380986,449243358,424939683,482775787,18609966 -797,430394810,449243359,424939682,482775788,18609966 -797,430397882,449243360,424939681,482775789,18609966 -797,430390202,449243361,424939680,482775790,18609966 diff --git a/inst/example/mc4_methods.csv b/inst/example/mc4_methods.csv deleted file mode 100644 index 71aa9e90..00000000 --- a/inst/example/mc4_methods.csv +++ /dev/null @@ -1,3 +0,0 @@ -mc4_mthd_id,mc4_mthd,desc,created_date,modified_date,modified_by -1,bmad.aeid.lowconc.twells,bmad based on two lowest concentration of treatment wells,0000-00-00 00:00:01,0000-00-00 00:00:00,spendse.scitovation -2,bmad.aeid.lowconc.nwells,bmad based on two lowest concentration of nwells,0000-00-00 00:00:00,0000-00-00 00:00:00,spendse.scitovation diff --git a/inst/example/mc5.csv b/inst/example/mc5.csv deleted file mode 100644 index 0e6bf2aa..00000000 --- a/inst/example/mc5.csv +++ /dev/null @@ -1,3 +0,0 @@ -m5id,m4id,aeid,modl,hitc,fitc,coff,actp,modl_er,modl_tp,modl_ga,modl_gw,modl_la,modl_lw,modl_prob,modl_rmse,modl_acc,modl_acb,modl_ac10,model_type,created_date,modified_date,modified_by -19428453,18609966,797,hill,1,42,38.6635153831265,1,2.00693525091024,117.394184254973,1.21619689238089,0.854051897308764,NA,NA,0.880797096613293,9.63076046108619,0.854576476290224,0.390449306126648,0.098884803447799,0,2017-06-10 02:10:13,0000-00-00 00:00:00,rjudson.rjudson.rjudson -19428267,18610151,797,hill,1,42,38.6635153831265,1,1.96352280443088,133.708893343495,1.31680522530087,0.743424361310043,NA,NA,0.880797093510943,9.32970302693295,0.79135881305226,0.278276070856458,0.033228093448769,0,2017-06-10 02:10:13,0000-00-00 00:00:00,rjudson.rjudson.rjudson diff --git a/inst/example/mc5_aeid.csv b/inst/example/mc5_aeid.csv deleted file mode 100644 index 0cc5ff7f..00000000 --- a/inst/example/mc5_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -"aeid","mc5_mthd_id","created_date","modified_date","modified_by" diff --git a/inst/example/mc5_fit_categories.csv b/inst/example/mc5_fit_categories.csv deleted file mode 100644 index 2900872d..00000000 --- a/inst/example/mc5_fit_categories.csv +++ /dev/null @@ -1,56 +0,0 @@ -"fitc","parent_fitc","name","xloc","yloc" -"1","NULL","01: ALL DOSE RESPONSE",1110,756.5 -"2","1","02: CANNOT DETERMINE",977.7455523765,611.9831921304 -"3","1","03: INACTIVE",1022.9653320313,924.2873535156 -"4","3","04: RESP < BLINE",1271.6083984375,974.8182373047 -"5","3","05: RESP >= BLINE",996.8209228516,1127.5755004883 -"6","5","06: CNST",666,1251.5 -"7","6","07: NOTP >= 0.8(COFF)",761.8584594727,1333.5216674805 -"8","6","08: ANYTP >= 0.8(COFF)",507.3630981445,1333.6228027344 -"9","8","09: NOTP >= COFF",337.4776000977,1263.4637451172 -"10","8","10: ANYTP >= COFF",450.4357910156,1397.3994140625 -"11","5","11: HILL",1189.7768554688,1209.4105834961 -"12","11","12: TP < 0.8(COFF)",1149.2390136719,1317.5518188477 -"13","12","13: GNLS < 0.8(COFF)",992.1193237305,1394.7369384766 -"14","12","14: GNLS >= 0.8(COFF)",1246.0364990234,1386.9293518066 -"15","14","15: GNLS < COFF",1218.9203491211,1496.1217041016 -"16","14","16: GNLS >= COFF",1361.9873046875,1443.5811157227 -"17","11","17: TP >= 0.8(COFF)",1460.6746826172,1119.6658935547 -"18","17","18: GNLS < 0.8(COFF)",1539.3952956084,1228.8681030273 -"19","17","19: GNLS >= 0.8(COFF)",1623.3784179688,1043.5646362305 -"20","19","20: GNLS < COFF",1876.1442871094,1040.0154418945 -"21","19","21: GNLS >= COFF",1849.7615966797,948.6744995117 -"22","5","22: GNLS",794.5350952148,1043.2316894531 -"23","22","23: TP < 0.8(COFF)",632.9550857544,936.3232232708 -"24","23","24: HILL < 0.8(COFF)",803.6691931111,753.821326896 -"25","23","25: HILL >= 0.8(COFF)",542.0636749268,831.3344537395 -"26","25","26: HILL < COFF",478.504219532,698.9990045207 -"27","25","27: HILL >= COFF",359.5413589478,763.8884088176 -"28","22","28: TP >= 0.8(COFF)",491.8406066895,1063.1170043945 -"29","28","29: HILL < 0.8(COFF)",446.9388122559,1132.0888671875 -"30","28","30: HILL >= 0.8(COFF)",371.3406066895,956.1169433594 -"31","30","31: HILL < COFF",288.3405761719,853.1170654297 -"32","30","32: HILL >= COFF",107.8862915039,948.5189208984 -"33","1","33: ACTIVE",1276.5,563.5 -"34","33","34: HILL",1190.094543457,462.0799560547 -"35","34","35: TP <= 1.2(COFF)",991.5,302.5 -"36","35","36: AC50 <=",764.6481933594,350.3658447266 -"37","35","37: AC50 ==",749.6301269531,254.4168701172 -"38","35","38: AC50 >=",966.6704101563,183.7718505859 -"39","34","39: TP > 1.2(COFF)",1310.6741943359,263.3843994141 -"40","39","40: AC50 <=",1134.5294799805,105.1185302734 -"41","39","41: AC50 ==",1412.8084716797,121.1416015625 -"42","39","42: AC50 >=",1578.5758056641,187.1433105469 -"43","33","43: GNLS",1558.3104248047,570.28125 -"44","43","44: TP <= 1.2(COFF)",1639.5,451.5 -"45","44","45: AC50 <=",1811.0447998047,377.1083984375 -"46","44","46: AC50 ==",1905.2620849609,445.5483398437 -"47","44","47: AC50 >=",1659.5,320.5 -"48","43","48: TP > 1.2(COFF)",1647.5,685.5 -"49","48","49: AC50 <=",1704.5,806.5 -"50","48","50: AC50 ==",1873.9647216797,741.5611572266 -"51","48","51: AC50 >=",1926.5576171875,671.6712646484 -"52","23","52: HILL DNC",890.4145965576,837.0693170207 -"53","28","53: HILL DNC",155.8844682354,1077.1187744141 -"54","12","54: GNLS DNC",1463.7992844698,1325.916809082 -"55","17","55: GNLS DNC",1774.73046875,1155.2709031221 diff --git a/inst/example/mc5_methods.csv b/inst/example/mc5_methods.csv deleted file mode 100644 index 8598257f..00000000 --- a/inst/example/mc5_methods.csv +++ /dev/null @@ -1,13 +0,0 @@ -mc5_mthd_id,mc5_mthd,desc,created_date,modified_date,modified_by -1,bmad3,Add a cutoff value of 3*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,pc20,Add a cutoff value of 20.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,log2_1.2,Add a cutoff value of log2(1.2).,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,log10_1.2,Add a cutoff value of log10(1.2).,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,bmad5,Add a cutoff value of 5*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,bmad6,Add a cutoff value of 6*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,bmad10,Add a cutoff value of 10*bmad.,2015-05-04 12:03:49,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,maxmed20pct,Add a cutoff value of 20% of the max of max_med,2015-05-06 09:08:50,0000-00-00 00:00:00,kconnors.kconnors.kconnors -9,pc70,70% cutoff,2015-07-28 15:06:35,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -10,pc50,50% cutoff,2015-07-28 15:08:01,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -11,log2_2,log2 of 2 fold change cutoff,2015-07-28 15:08:01,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 -12,log10_2,log10 of 2 fold change cutoff,2015-07-28 15:08:01,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 diff --git a/inst/example/mc6.csv b/inst/example/mc6.csv deleted file mode 100644 index a9256b01..00000000 --- a/inst/example/mc6.csv +++ /dev/null @@ -1 +0,0 @@ -"m6id","m5id","m4id","aeid","mc6_mthd_id","flag","fval","fval_unit","created_date","modified_date","modified_by" diff --git a/inst/example/mc6_aeid.csv b/inst/example/mc6_aeid.csv deleted file mode 100644 index d2da162a..00000000 --- a/inst/example/mc6_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -"aeid","mc6_mthd_id","created_date","modified_date","modified_by" diff --git a/inst/example/mc6_methods.csv b/inst/example/mc6_methods.csv deleted file mode 100644 index 2b15f3d9..00000000 --- a/inst/example/mc6_methods.csv +++ /dev/null @@ -1,19 +0,0 @@ -mc6_mthd_id,mc6_mthd,desc,nddr,created_date,modified_date,modified_by -1,row.dev.up,"Look for row-wise plate effects, increase",1,2014-07-28 14:03:41,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,row.dev.dn,"Look for row-wise plate effects, decrease",1,2014-07-28 14:03:54,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,col.dev.dn,"Look for column-wise plate effects, decrease",1,2014-07-28 14:04:08,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,col.dev.up,"Look for column-wise plate effects, increase",1,2014-07-28 14:04:17,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,plate.flare,Look for plate flare effects,1,2014-07-28 14:04:27,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,singlept.hit.high,Look for single point hits with activity only at the highest conc tested,0,2014-07-28 14:06:05,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,singlept.hit.mid,Look for signle point hits with activity not at highest conc tested,0,2014-07-28 14:06:51,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,multipoint.neg,Look for inactives with multiple medians above baseline,0,2014-07-28 14:08:42,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,pintool,Look for pintool carryover issues,1,2014-07-28 14:09:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -10,noise,"Look for noisy curves, relative to the assay",0,2014-07-28 14:09:41,0000-00-00 00:00:00,dfiler.dfiler.dfiler -11,border.hit,Look for actives with borderline activity,0,2014-07-28 14:10:14,0000-00-00 00:00:00,dfiler.dfiler.dfiler -12,border.miss,Look for inactives with borderline activity,0,2014-07-28 14:10:21,0000-00-00 00:00:00,dfiler.dfiler.dfiler -13,plate.interlace,Look for interlaced chemical-plate effects,1,2014-08-21 12:13:26,0000-00-00 00:00:00,dfiler.dfiler.dfiler -14,rep.mismatch,Look for mismatched techinal replicates,1,2014-08-21 12:16:44,0000-00-00 00:00:00,dfiler.dfiler.dfiler -15,gnls.lowconc,Look for low concentration gnls winners,0,2014-08-21 12:21:32,0000-00-00 00:00:00,dfiler.dfiler.dfiler -16,overfit.hit,Flag hit-calls that would get changed after doing the small N correction to the aic values.,0,2014-09-16 11:51:14,0000-00-00 00:00:00,dfiler.dfiler.dfiler -17,efficacy.50,Flag hit-calls with efficacy values less than 50% -- intended for biochemical assays.,0,2014-09-16 11:51:58,0000-00-00 00:00:00,dfiler.dfiler.dfiler -19,viability.gnls,Flag hit-calls with cell viability assay that are fit with gnls winning model,0,03/26/19 10:53 AM,, diff --git a/inst/example/sample.csv b/inst/example/sample.csv deleted file mode 100644 index 40880bf9..00000000 --- a/inst/example/sample.csv +++ /dev/null @@ -1,3 +0,0 @@ -"spid","chid","stkc","stkc_unit","tested_conc_unit","spid_legacy" -"Tox21_202992",20182,20,"mM","uM","Tox21_202992" -"Tox21_400088",20182,20,"mM","uM","Tox21_400088" diff --git a/inst/example/sc0.csv b/inst/example/sc0.csv deleted file mode 100644 index 79455906..00000000 --- a/inst/example/sc0.csv +++ /dev/null @@ -1,5 +0,0 @@ -"s0id","acid","spid","apid","rowi","coli","wllt","wllq","conc","rval","srcf","created_date","modified_date","modified_by" -13196766,201,"TP0000757A10","EPA13-A384-06",14,22,"t",1,10.2,25887,"400-0905-384-01-20111107.txt","2018-06-04 12:44:18","0000-00-00 00:00:00","nrush.nrush.nrush" -13196766,201,"TP0000757A10","EPA13-A384-06",14,22,"t",1,10.2,25887,"400-0905-384-01-20111107.txt","2018-06-04 12:44:18","0000-00-00 00:00:00","nrush.nrush.nrush" -13196765,201,"TP0000757A10","EPA13-A384-06",14,21,"t",1,10.2,26215,"400-0905-384-01-20111107.txt","2018-06-04 12:44:18","0000-00-00 00:00:00","nrush.nrush.nrush" -13196765,201,"TP0000757A10","EPA13-A384-06",14,21,"t",1,10.2,26215,"400-0905-384-01-20111107.txt","2018-06-04 12:44:18","0000-00-00 00:00:00","nrush.nrush.nrush" diff --git a/inst/example/sc1.csv b/inst/example/sc1.csv deleted file mode 100644 index b462e2cc..00000000 --- a/inst/example/sc1.csv +++ /dev/null @@ -1,5 +0,0 @@ -"s1id","s0id","acid","aeid","logc","bval","pval","resp","created_date","modified_date","modified_by" -10210785,13196766,201,320,1,26499,3970,-2.71649873496382,"2018-06-04 12:59:31","0000-00-00 00:00:00","nrush.nrush.nrush" -10205619,13196766,201,319,1,26499,3970,2.71649873496382,"2018-06-04 12:59:31","0000-00-00 00:00:00","nrush.nrush.nrush" -10210786,13196765,201,320,1,26499,3970,-1.26059745217275,"2018-06-04 12:59:31","0000-00-00 00:00:00","nrush.nrush.nrush" -10205620,13196765,201,319,1,26499,3970,1.26059745217275,"2018-06-04 12:59:31","0000-00-00 00:00:00","nrush.nrush.nrush" diff --git a/inst/example/sc1_aeid.csv b/inst/example/sc1_aeid.csv deleted file mode 100644 index feff4d15..00000000 --- a/inst/example/sc1_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -"sc1_mthd_id","aeid","exec_ordr","created_date","modified_date","modified_by" diff --git a/inst/example/sc1_methods.csv b/inst/example/sc1_methods.csv deleted file mode 100644 index 0a300039..00000000 --- a/inst/example/sc1_methods.csv +++ /dev/null @@ -1,17 +0,0 @@ -sc1_mthd_id,sc1_mthd,desc,created_date,modified_date,modified_by -1,bval.apid.nwlls.med,plate-wise baseline based on neutral ctrl median value,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,bval.apid.twlls.med,"Take the median cval of the t wells, by apid",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,bval.apid.tn.med,"Take the median cval of the t and n wells, by apid",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,pval.apid.pwlls.med,"plate-wise meidan based on positive control, single dose",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,pval.apid.mwlls.med,"plate-wise meidan based on negative control, single dose",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,pval.apid.medpcbyconc.max,plate-wise median response of positive control (max),2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,pval.apid.medpcbyconc.min,plate-wise median response of positive control (min),2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,pval.apid.medncbyconc.min,"plate-wise meidan based on negative control, (min)",2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,pval.zero,Set pval to 0.,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -10,resp.pc,response percent activity,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -11,resp.fc,calculate response as fold-change,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -12,resp.logfc,Calculate the response as a fold change over baseline for logged values,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -13,resp.log2,take the log base 2 of the response,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -14,none,apply no level 2 method,2015-05-13 11:44:35,0000-00-00 00:00:00,dfiler.dfiler.dfiler -16,resp.multneg1,multiply response values by negative 1,2015-05-29 10:27:45,0000-00-00 00:00:00,Akarmaus.Akarmaus.Akarmaus -17,pval.apid.or.aeid.pwlls.med,calculates pval first based on p wells by plate and then for any plates missing p wells it calculates a pval by median of pval for all other plates,2015-09-30 14:43:40,0000-00-00 00:00:00,mmarti02.mmarti02.mmarti02 diff --git a/inst/example/sc2.csv b/inst/example/sc2.csv deleted file mode 100644 index aa92bfd3..00000000 --- a/inst/example/sc2.csv +++ /dev/null @@ -1 +0,0 @@ -"s2id","aeid","spid","bmad","max_med","coff","hitc","tmpi","created_date","modified_date","modified_by" diff --git a/inst/example/sc2_aeid.csv b/inst/example/sc2_aeid.csv deleted file mode 100644 index f471e380..00000000 --- a/inst/example/sc2_aeid.csv +++ /dev/null @@ -1 +0,0 @@ -"sc2_mthd_id","aeid","created_date","modified_date","modified_by" diff --git a/inst/example/sc2_agg.csv b/inst/example/sc2_agg.csv deleted file mode 100644 index 420ea93e..00000000 --- a/inst/example/sc2_agg.csv +++ /dev/null @@ -1 +0,0 @@ -"aeid","s0id","s1id","s2id" diff --git a/inst/example/sc2_methods.csv b/inst/example/sc2_methods.csv deleted file mode 100644 index c79bb628..00000000 --- a/inst/example/sc2_methods.csv +++ /dev/null @@ -1,11 +0,0 @@ -sc2_mthd_id,sc2_mthd,desc,created_date,modified_date,modified_by -1,bmad3,Add a cutoff value of 3*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -2,pc20,Add a cutoff value of 20.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -3,log2_1.2,Add a cutoff value of log2(1.2).,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -4,log10_1.2,Add a cutoff value of log10(1.2).,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -5,bmad5,Add a cutoff value of 5*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -6,bmad6,Add a cutoff value of 6*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -7,bmad10,Add a cutoff value of 10*bmad.,2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -8,pc30orbmad3,"Add a cutoff value of either 30 or 3*bmad, whichever is less.",2015-05-13 13:51:13,0000-00-00 00:00:00,dfiler.dfiler.dfiler -9,pc0.88,Add a cutoff value of 0.88.,2015-05-14 13:25:38,0000-00-00 00:00:00,dfiler.dfiler.dfiler -10,log2_1.5,Add a cutoff value of log2(1.5).,2015-05-14 13:25:38,0000-00-00 00:00:00,dfiler.dfiler.dfiler diff --git a/man/MC2_Methods.Rd b/man/MC2_Methods.Rd index f73165c5..8458ab7a 100644 --- a/man/MC2_Methods.Rd +++ b/man/MC2_Methods.Rd @@ -40,7 +40,7 @@ available in the package vignette, "Data_processing." \item{rmneg}{Exclude wells with negative corrected response values (cval) and downgrading their well quality (wllq); if \eqn{cval<0, wllq=0}{cval<0, wllq=0}.} \item{rmzero}{Exclude wells with corrected response values (cval) equal to zero and - downgrading their well quality (wllq); if \eqn{cval=0, wllq=0}{cval=0, wllq=0}.} + downgrading their well quality (wllq); if \eqn{cval=0, wllq=0}{cval=0, wllq=0}.} \item{mult25}{Multiply corrected response value (cval) by 25; \eqn{25*cval}{25*cval}.} \item{mult100}{Multiply corrected response value (cval) by 100; \eqn{100*cval}{100*cval}.} \item{negshift}{Shift corrected response values (cval) by subtracting the minimum cval and @@ -49,15 +49,12 @@ available in the package vignette, "Data_processing." \item{mult3}{Multiply corrected response value (cval) by 3; \eqn{3*cval}{3*cval}.} \item{mult6}{Multiply corrected response value (cval) by 6; \eqn{6*cval}{6*cval}.} \item{sub100}{Center data around zero by subtracting the corrected response value (cval) from - 100; \eqn{100-cval}{100-cval}. Typically used if data was pre-normalized around 100 with - responses decreasing to 0.} + 100; \eqn{100-cval}{100-cval}. Typically used if data was pre-normalized around 100 with responses + decreasing to 0.} \item{zscore.npwlls}{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); - \eqn{cval=|(cval-mean(cval~for~wllt~=~n~and~p)/sd(cval~for~wllt~=~n~and~p)|}{cval= - |(cval-mean(cval for wllt = n and p)/sd(cval for wllt = n and p)|}.} + on the neutral and positive control wells (wllts = n and p), by assay plate ID (apid)} \item{sub1}{Center data around zero by subtracting the corrected response value (cval) from 1; - \eqn{1-cval}{1-cval}. Typically used if data was pre-normalized around 1 with responses - decreasing to 0.} + \eqn{1-cval}{1-cval}. Typically used if data was pre-normalized around 1 with responses decreasing to 0.} } } @@ -65,22 +62,10 @@ available in the package vignette, "Data_processing." \describe{ \item{agg.mean.rep.apid}{Aggregate technical test replicates (wllt=t) by taking the plate-wise mean per sample id (spid), assay plate (apid), and concentration index (cndx).} \item{agg.median.rep.apid}{Aggregate technical test replicates (wllt=t) by taking the plate-wise median per sample id (spid), assay plate (apid), and concentration index (cndx).} - \item{agg.percent.rep.spid}{Use for binary data. Aggregate technical replicates as percentage by taking the sum of hits relative to total replicates per sample id (spid) and concentration index (cndx); cval = (sum(rval)/.N)*100.} - \item{agg.percent.rep.spid.min1}{Use for binary data. Aggregate technical replicates as percentage by taking the sum of hits relative to total replicates per per sample id (spid) and concentration index (cndx), where there is more than one replicate; cval = (sum(rval)/.N)*100, where .N>1.} - \item{agg.mean.rep.apid}{Aggregate technical replicates by taking the plate-wise mean per - sample id (spid), assay plate (apid), and concentration index (cndx).} - \item{agg.median.rep.apid}{Aggregate technical replicates by taking the plate-wise median per - sample id (spid), assay plate (apid), and concentration index (cndx).} - \item{agg.percent.rep.spid}{Use for binary data. Aggregate technical replicates as percentage - by taking the sum of hits relative to total replicates per sample id (spid) and concentration - index (cndx); \eqn{cval = (sum(rval)/.N)*100}{cval = (sum(rval)/.N)*100}.} - \item{agg.percent.rep.spid.min1}{Use for binary data. Aggregate technical replicates as - percentage by taking the sum of hits relative to total replicates per per sample id (spid) and - concentration index (cndx), where there is more than one replicate; - \eqn{cval=(sum(rval)/.N)*100,~where~.N>1}{cval = (sum(rval)/.N)*100, where .N>1}.} + \item{agg.percent.rep.spid}{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); \eqn{cval = (sum(rval)/.N)*100}{cval = (sum(rval)/.N)*100}.} + \item{agg.percent.rep.spid.min1}{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; \eqn{cval=(sum(rval)/.N)*100,~where~.N>1}{cval = (sum(rval)/.N)*100, where .N>1}.} Rvals are collapsed to one value per cndx.} } } -} \seealso{ \code{\link{mc2}}, \code{\link{Method functions}} to query what diff --git a/man/MC4_Methods.Rd b/man/MC4_Methods.Rd index 2f6290aa..05b65458 100644 --- a/man/MC4_Methods.Rd +++ b/man/MC4_Methods.Rd @@ -39,16 +39,14 @@ available in the package vignette, "Data_processing." \describe{ \item{bmad.aeid.lowconc.twells}{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.} + 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.} \item{bmad.aeid.lowconc.nwells}{Calculate the baseline median absolute value (bmad) as the - median absolute deviation of normalized response values (resp) for neutral control wells - (wllt = n).} - \item{onesd.aeid.lowconc.twells}{Calculate one standard deviation of the normalized response - for test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2; - \eqn{onesd=\sqrt{\sum{(resp-mean(resp))^{2}}/(n-1)}}{onesd = sqrt(sum((resp - mean - resp)^2)/sample size - 1)}. Used to establish BMR and therefore required for tcplfit2 - processing.} + 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.} \item{bidirectional.false}{Limits bidirectional fitting and processes data in positive analysis direction only. Use for gain-of-signal or inverted data.} \item{bmad5.onesd16.static}{Replace baseline median absolute deviation @@ -56,6 +54,7 @@ available in the package vignette, "Data_processing." 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.} + \item{no.unbounded.models}{Exclude unbounded models and only fit data to bounded models (hill, gnls, exp4 and exp5).} } } diff --git a/man/MC5_Methods.Rd b/man/MC5_Methods.Rd index af422a6a..bd6dffbb 100644 --- a/man/MC5_Methods.Rd +++ b/man/MC5_Methods.Rd @@ -68,7 +68,9 @@ vignette, "Data_processing." \subsection{Fold Change Methods}{ \describe{ \item{fc0.2}{Add a cutoff value of 0.2. Typically for zero centered fold change data.} + \item{fc0.25}{Add a cutoff value of 0.25. Typically for zero centered fold change data.} \item{fc0.3}{Add a cutoff value of 0.3. Typically for zero centered fold change data.} + \item{fc0.5}{Add a cutoff value of 0.5. Typically for zero centered fold change data.} } } @@ -93,9 +95,11 @@ Log Base 2 \describe{ \item{pc05}{Add a cutoff value of 5. Typically for percent of control data.} \item{pc10}{Add a cutoff value of 10. Typically for percent of control data.} + \item{pc16}{Add a cutoff value of 16. Typically for percent of control data.} \item{pc20}{Add a cutoff value of 20. Typically for percent of control data.} \item{pc25}{Add a cutoff value of 25. Typically for percent of control data.} \item{pc30}{Add a cutoff value of 30. Typically for percent of control data.} + \item{pc40}{Add a cutoff value of 40. Typically for percent of control data.} \item{pc50}{Add a cutoff value of 50. Typically for percent of control data.} \item{pc70}{Add a cutoff value of 70. Typically for percent of control data.} \item{pc95}{Add a cutoff value of 95. Typically for percent of control data.} @@ -109,6 +113,13 @@ Log Base 2 \item{coff_2.32}{Add a cutoff value of 2.32.} \item{loec.coff}{Method not yet updated for tcpl implementation. Identify the lowest observed effective concentration (loec) compared to baseline.} + \item{ow_bidirectional_loss}{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.} + \item{ow_bidirectional_gain}{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.} + \item{osd_coff_bmr}{Overwrite the osd value so that bmr equals cutoff.} } } } diff --git a/man/MC6_Methods.Rd b/man/MC6_Methods.Rd index 001debeb..39718d3c 100644 --- a/man/MC6_Methods.Rd +++ b/man/MC6_Methods.Rd @@ -68,8 +68,9 @@ available in the package vignette, "Data_processing." viability assay with winning model is gain-loss (gnls); if hitc >= 0.9, modl = "gnls" and cell_viability_assay = 1, then flag.} \item{no.med.gt.3bmad}{Flag series where no median response values are greater than baseline as - defined by 3 times the baseline median absolute deviation (bmad); nmed_gtbl = 0, where - nmed_gtbl is the number of medians greater than 3 * bmad.} + 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.} } } diff --git a/man/SC1_Methods.Rd b/man/SC1_Methods.Rd index 52e4df7d..15cf42c9 100644 --- a/man/SC1_Methods.Rd +++ b/man/SC1_Methods.Rd @@ -49,6 +49,8 @@ available in the package vignette, "Data_processing." \item{bval.apid.tn.med}{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).} + \item{bval.nwlls.med}{Calculate the baseline value (bval) as the median of the raw values + (rval) for neutral control wells (wllt = n) by assay endpoint id (aeid).} } } diff --git a/man/SC2_Methods.Rd b/man/SC2_Methods.Rd index c60bad70..b71536bf 100644 --- a/man/SC2_Methods.Rd +++ b/man/SC2_Methods.Rd @@ -65,6 +65,7 @@ vignette, "Data_processing." \subsection{Percent of Control Methods}{ \describe{ \item{pc0.88}{Add a cutoff value of 0.88. Typically for percent of control data.} + \item{pc16}{Add a cutoff value of 16. Typically for percent of control data.} \item{pc20}{Add a cutoff value of 20. Typically for percent of control data.} \item{pc25}{Add a cutoff value of 25. Typically for percent of control data.} \item{pc30}{Add a cutoff value of 30. Typically for percent of control data.} @@ -100,8 +101,12 @@ Log Base 10 \describe{ \item{ow_bmad_nwells}{Overwrite the default baseline median absolute value (bmad) with a bmad calculated using neutral control wells (wllt = n).} - \item{ow_bidirectional_false}{Overwrite the max_med and max_tmp values, which were calculated - using absolute value, to a calculation not using absolute value for non-bidirectional data.} + \item{ow_bidirectional_gain}{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.} + \item{ow_bidirectional_loss}{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.} } } } diff --git a/man/assay_funcs.Rd b/man/assay_funcs.Rd index 679951f4..dbc54345 100644 --- a/man/assay_funcs.Rd +++ b/man/assay_funcs.Rd @@ -40,12 +40,7 @@ name for the given assay element. For example, \code{tcplLoadAsid} will return the assay source ID (asid) and assay source name (asnm). } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -TCPLlite <- file.path(system.file(package = "tcpl"), "example") -tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") - +\dontrun{ ## The load assay functions can be used without any parameters to list the ## full list of registered assay elements: tcplLoadAsid() @@ -64,8 +59,6 @@ tcplListFlds("assay") a1 <- tcplLoadAeid(fld = "anm", val = "Steroidogenesis") a2 <- tcplLoadAeid(fld = "assay_name", val = "Steroidogenesis") identical(a1, a2) - -## Reset configuration -options(conf_store) +} } diff --git a/man/blineShift.Rd b/man/blineShift.Rd index 07b14f2b..029b5172 100644 --- a/man/blineShift.Rd +++ b/man/blineShift.Rd @@ -4,12 +4,12 @@ \alias{blineShift} \title{Shift the baseline to 0} \usage{ -blineShift(resp, logc, wndw) +blineShift(resp, conc, wndw) } \arguments{ \item{resp}{Numeric, the response values} -\item{logc}{Numeric, the log10 concentration values} +\item{conc}{Numeric, the concentration values} \item{wndw}{Numeric, the threshold window} } diff --git a/man/chdat.Rd b/man/chdat.Rd deleted file mode 100644 index 9c0e1df6..00000000 --- a/man/chdat.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{chdat} -\alias{chdat} -\title{Chemical library of tested chemicals in the example datasets with the corresponding sample IDs.} -\format{ -A data frame with 6 rows and 6 variables: -\describe{ - \item{spid}{sample ID} - \item{casn}{Chemical Abstract Service(CAS) number} - \item{chnm}{chemical name} - \item{dsstox_substance_id}{chemical-specific DTXSID} - \item{code}{CAS number compressed into numeric string} - \item{chid}{unique chemical ID number for tcpl} - -} -} -\source{ -ToxCast database -} -\usage{ -chdat -} -\description{ -Chemical library of tested chemicals in the example datasets with the corresponding sample IDs. -} -\keyword{datasets} diff --git a/man/config_funcs.Rd b/man/config_funcs.Rd index efbdeacc..20ba2262 100644 --- a/man/config_funcs.Rd +++ b/man/config_funcs.Rd @@ -1,12 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/config_funcs.R, R/tcplConf.R, -% R/tcplConfDefault.R, R/tcplConfExample.R, R/tcplConfList.R, -% R/tcplConfLoad.R, R/tcplConfReset.R, R/tcplConfSave.R +% R/tcplConfDefault.R, R/tcplConfList.R, R/tcplConfLoad.R, R/tcplConfReset.R, +% R/tcplConfSave.R \name{Configure functions} \alias{Configure functions} \alias{tcplConf} \alias{tcplConfDefault} -\alias{tcplConfExample} \alias{tcplConfList} \alias{tcplConfLoad} \alias{tcplConfReset} @@ -17,8 +16,6 @@ tcplConf(drvr = NULL, user = NULL, pass = NULL, host = NULL, db = NULL, ...) tcplConfDefault() -tcplConfExample() - tcplConfList(show.pass = FALSE) tcplConfLoad(list.new = TRUE) @@ -48,8 +45,8 @@ tcplConfSave() These functions are used to configure the tcpl settings. } \details{ -Currently, the tcpl package only supports the "MySQL" and "tcplLite" database -drivers. +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 @@ -82,8 +79,7 @@ tcpl settings. configuration file. \code{tcplConfDefault} changes the \code{options} to reflect the default -settings for the example tcplLite database, i.e. local directory, but does -not alter the configuration file. +settings for the API connection, but does not alter the configuration file. \code{tcplConfReset} is used to generate the initial configuration script, and can be used to reset or regenerate the configuration script by the user. diff --git a/man/load_data_columns.Rd b/man/load_data_columns.Rd new file mode 100644 index 00000000..40165bd4 --- /dev/null +++ b/man/load_data_columns.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{load_data_columns} +\alias{load_data_columns} +\title{Lists of column names returned from tcplLoadData invitrodb v4.1 (same as CCTE +Bioactivity API version).} +\format{ +A list with 12 items: +\describe{ + \item{mc0}{Column names returned requesting mc lvl 0 data} + \item{mc1}{Column names returned requesting mc lvl 1 data} + \item{mc2}{Column names returned requesting mc lvl 2 data} + \item{mc3}{Column names returned requesting mc lvl 3 data} + \item{mc4}{Column names returned requesting mc lvl 4 data} + \item{mc5}{Column names returned requesting mc lvl 5 data} + \item{mc6}{Column names returned requesting mc lvl 6 data} + \item{mcagg}{Column names returned requesting mc lvl "agg" data} + \item{sc0}{Column names returned requesting sc lvl 0 data} + \item{sc1}{Column names returned requesting sc lvl 1 data} + \item{sc2}{Column names returned requesting sc lvl 2 data} + \item{scagg}{Column names returned requesting sc lvl "agg" data} +} +} +\source{ +ToxCast database +} +\usage{ +load_data_columns +} +\description{ +Lists of column names returned from tcplLoadData invitrodb v4.1 (same as CCTE +Bioactivity API version). +} +\keyword{datasets} diff --git a/man/mc_test.Rd b/man/mc_test.Rd new file mode 100644 index 00000000..b98db1de --- /dev/null +++ b/man/mc_test.Rd @@ -0,0 +1,154 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{mc_test} +\alias{mc_test} +\title{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.} +\format{ +A list with 30 items: +\describe{ + \item{tcplConfQuery}{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.} + \item{mc0_by_m0id}{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.} + \item{mc0_by_acid}{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.} + \item{mc1_by_m1id}{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.} + \item{mc1_by_acid}{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.} + \item{mc2_by_m2id}{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.} + \item{mc2_by_acid}{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.} + \item{mc3_by_m3id}{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.} + \item{mc3_by_aeid}{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.} + \item{mc4_by_m4id}{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.} + \item{mc4_by_aeid}{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.} + \item{mc5_by_m5id}{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.} + \item{mc5_by_aeid}{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.} + \item{mc6_by_m6id}{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.} + \item{mc6_by_aeid}{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.} + \item{mc7_by_m7id}{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.} + \item{mc7_by_aeid}{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.} + \item{mcagg_by_aeid}{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.} + \item{plot_single_m4id}{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.} + \item{plot_multiple_m4id}{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.} + \item{plot_single_aeid}{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.} + \item{plot_multiple_aeid}{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.} + \item{plot_single_spid}{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.} + \item{plot_multiple_spid}{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.} + \item{plot_single_m4id_compare}{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.} + \item{plot_multiple_m4id_compare}{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.} + \item{plot_single_aeid_compare}{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.} + \item{plot_multiple_aeid_compare}{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.} + \item{plot_single_spid_compare}{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.} + \item{plot_multiple_spid_compare}{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.} +} +} +\source{ +ToxCast database +} +\usage{ +mc_test +} +\description{ +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. +} +\keyword{datasets} diff --git a/man/mcdat.Rd b/man/mcdat.Rd index 486dc713..fb9b6bbc 100644 --- a/man/mcdat.Rd +++ b/man/mcdat.Rd @@ -27,6 +27,6 @@ mcdat } \description{ The example dataset is used to illustrate how the user can pipeline multiple-concentration -data from chemical screening using tcplLite. +data from chemical screening using tcpl. } \keyword{datasets} diff --git a/man/mthd_funcs.Rd b/man/mthd_funcs.Rd index f4c0d003..89bc4cc9 100644 --- a/man/mthd_funcs.Rd +++ b/man/mthd_funcs.Rd @@ -51,11 +51,7 @@ multiple-concentration processing. More information about method assignments and the delete cascade are available in the package vignette. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfDefault() - +\dontrun{ ## tcplListMthd allows the user to display the available methods for ## a given level and data type head(tcplMthdList(lvl = 2, type = "mc")) @@ -66,7 +62,6 @@ head(tcplMthdList(lvl = 2, type = "mc")) ## whether an ID exists before assigning/clearing methods. tcplMthdLoad(lvl = 2, id = 55, type = "mc") -\dontrun{ ## ACID 55 does not have any methods. Assign methods from the list above. tcplMthdAssign(lvl = 2, id = 55, @@ -83,6 +78,4 @@ tcplMthdAssign(lvl = 2, ## Cleanup example method assigments tcplMthdClear(lvl = 2, id = 53:55, type = "mc") } -## Reset configuration -options(conf_store) } diff --git a/man/mthd_list_defaults.Rd b/man/mthd_list_defaults.Rd new file mode 100644 index 00000000..e285beb9 --- /dev/null +++ b/man/mthd_list_defaults.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{mthd_list_defaults} +\alias{mthd_list_defaults} +\title{Lists of data frames returned from tcplMthdList invitrodb v4.2} +\format{ +A list with 7 items: +\describe{ + \item{mc2}{displays the available methods for mc lvl 2 data} + \item{mc3}{displays the available methods for mc lvl 3 data} + \item{mc4}{displays the available methods for mc lvl 4 data} + \item{mc5}{displays the available methods for mc lvl 5 data} + \item{mc6}{displays the available methods for mc lvl 6 data} + \item{sc1}{displays the available methods for sc lvl 1 data} + \item{sc2}{displays the available methods for sc lvl 2 data} +} +} +\source{ +ToxCast database +} +\usage{ +mthd_list_defaults +} +\description{ +Lists of data frames returned from tcplMthdList invitrodb v4.2 +} +\keyword{datasets} diff --git a/man/query_funcs.Rd b/man/query_funcs.Rd index 09fc380b..d23d602a 100644 --- a/man/query_funcs.Rd +++ b/man/query_funcs.Rd @@ -1,8 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/query_funcs.R, R/tcplQuery.R, R/tcplSendQuery.R +% Please edit documentation in R/query_funcs.R, R/tcplQuery.R, R/tcplQueryAPI.R, +% R/tcplSendQuery.R \name{Query functions} \alias{Query functions} \alias{tcplQuery} +\alias{tcplQueryAPI} \alias{tcplSendQuery} \title{Wrappers for sending queries and fetching results} \usage{ @@ -13,6 +15,8 @@ tcplQuery( tbl = NULL ) +tcplQueryAPI(resource = "data", fld = NULL, val = NULL, return_flds = NULL) + tcplSendQuery( query, db = getOption("TCPL_DB"), @@ -30,6 +34,14 @@ tcplSendQuery( \item{tbl}{Tables to be read queried} +\item{resource}{must be either data or assay to determine which api endpoint to hit} + +\item{fld}{field that should be used to query the api} + +\item{val}{value for specified field to query on} + +\item{return_flds}{optional list of fields that should be returned} + \item{delete}{Logical of length 1, execute delete on queried table} } \description{ @@ -37,31 +49,23 @@ 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. } \details{ -Currently, the tcpl package only supports the "MySQL" and "tcplLite" database -drivers. +Currently, the tcpl package supports the "MySQL", "example", and "API" +database drivers. \code{tcplQuery} returns a data.table object with the query results. \code{tcplSendQuery} sends a query, but does not fetch any results, and -returns 'TRUE' or the error message given by the database. +returns 'TRUE' or the error message given by the database. +\code{tcplQueryAPI} returns a data.table object with the query results when +connected using "API" as driver. } \examples{ - -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -TCPLlite <- file.path(system.file(package = "tcpl"), "example") -tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") - +\dontrun{ +# only with MySQL driver tcplQuery("SELECT 'Hello World';") -## When using tcplLite, name of table must be passed into tcplQuery -if (conf_store$TCPL_DRVR == 'MySQL') { - tcplQuery("SELECT * FROM assay;") -} else { - tcplQuery("SELECT * FROM assay;", tbl='assay') +# only with API driver +tcplConfDefault() +tcplQueryAPI(resource = "data", fld = "aeid", val = 2) } - -## Reset configuration -options(conf_store) } diff --git a/man/rgstr_funcs.Rd b/man/rgstr_funcs.Rd index 23ae35dd..5575e3ee 100644 --- a/man/rgstr_funcs.Rd +++ b/man/rgstr_funcs.Rd @@ -49,13 +49,7 @@ rather than the full "assay_component_endpoint_name." More information about the registration process and all of the fields is available in the vignette. } \examples{ - \dontrun{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfDefault() - ## Load current ASID information tcplLoadAsid() @@ -76,17 +70,6 @@ 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. - -## If using the tcplLite DRVR, must specify table name -if (conf_store$TCPL_DRVR == 'MySQL') { - tcplSendQuery(paste0("DELETE FROM assay_source WHERE asid = ", i1, ";")) -} else { - qy <- paste0("SELECT * FROM assay_source WHERE NOT asid = ", i1, ";") - tcplSendQuery(qy, tbl='assay_source', delete=TRUE) -} - -## Reset configuration -options(conf_store) } } diff --git a/man/sc_test.Rd b/man/sc_test.Rd new file mode 100644 index 00000000..841e9a41 --- /dev/null +++ b/man/sc_test.Rd @@ -0,0 +1,114 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{sc_test} +\alias{sc_test} +\title{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.} +\format{ +A list with 20 items: +\describe{ + \item{tcplConfQuery}{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.} + \item{sc0_by_s0id}{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.} + \item{sc0_by_acid}{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.} + \item{sc1_by_s1id}{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.} + \item{sc1_by_acid}{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.} + \item{sc2_by_s2id}{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.} + \item{sc2_by_aeid}{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.} + \item{scagg_by_aeid}{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.} + \item{plot_single_s2id}{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.} + \item{plot_multiple_s2id}{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.} + \item{plot_single_aeid}{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.} + \item{plot_multiple_aeid}{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.} + \item{plot_single_spid}{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.} + \item{plot_multiple_spid}{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.} + \item{plot_single_s2id_compare}{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.} + \item{plot_multiple_s2id_compare}{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.} + \item{plot_single_aeid_compare}{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.} + \item{plot_multiple_aeid_compare}{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.} + \item{plot_single_spid_compare}{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.} + \item{plot_multiple_spid_compare}{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.} +} +} +\source{ +ToxCast database +} +\usage{ +sc_test +} +\description{ +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. +} +\keyword{datasets} diff --git a/man/scdat.Rd b/man/scdat.Rd index df9e6d39..c6eb0a36 100644 --- a/man/scdat.Rd +++ b/man/scdat.Rd @@ -28,6 +28,6 @@ scdat } \description{ The example dataset is used to illustrate how the user can pipeline single-concentration -data from chemical screening using tcplLite. +data from chemical screening using tcpl. } \keyword{datasets} diff --git a/man/tcplCytoPt.Rd b/man/tcplCytoPt.Rd index b22af93d..08fd2f6f 100644 --- a/man/tcplCytoPt.Rd +++ b/man/tcplCytoPt.Rd @@ -88,11 +88,7 @@ The resulting data.table has the following fields: } } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfDefault() - +\dontrun{ ## Can only calculate the cytotox burst if using the MySQL database and ## TCPL_DRVR == 'MySQL' @@ -115,8 +111,6 @@ tcplCytoPt(aeid = 1:2) ## Changing 'default.pt' will change cyto_pt in the resulting data.table tcplCytoPt(aeid = 1:2, default.pt = 6) } - -## Reset configuration -options(conf_store) +} } diff --git a/man/tcplFit2.Rd b/man/tcplFit2.Rd index 1159dd03..f5068369 100644 --- a/man/tcplFit2.Rd +++ b/man/tcplFit2.Rd @@ -8,8 +8,7 @@ tcplFit2( dat, fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4", "exp5"), - bmed = NULL, - bidirectional = TRUE + bmed = NULL ) } \arguments{ @@ -18,8 +17,6 @@ tcplFit2( \item{fitmodels}{list of the models that should be fit with the data} \item{bmed}{baseline value, typically should be 0} - -\item{bidirectional}{boolean, default is TRUE (bidirectional fitting)} } \value{ Data.table with an additional column fitparams that includes all of the fitting parameters diff --git a/man/tcplGetAeid.Rd b/man/tcplGetAeid.Rd index ea990ee8..ef175b59 100644 --- a/man/tcplGetAeid.Rd +++ b/man/tcplGetAeid.Rd @@ -15,16 +15,10 @@ aeids associated with those names.The function performs a regular expression lik assay component endpoint name column in the assay component endpoint table. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - +\dontrun{ ## Search for aenm (assay name) case insensitive tcplGetAeid("TOX21") tcplGetAeid("tox21") - -## Reset configuration -options(conf_store) +} } diff --git a/man/tcplLegacyPlot.Rd b/man/tcplLegacyPlot.Rd new file mode 100644 index 00000000..3afd2567 --- /dev/null +++ b/man/tcplLegacyPlot.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tcplPlotUtils.R +\name{tcplLegacyPlot} +\alias{tcplLegacyPlot} +\title{tcplLegacyPlot} +\usage{ +tcplLegacyPlot() +} +\value{ +a ggplot based on old plotting methodology +} +\description{ +tcplLegacyPlot +} diff --git a/man/tcplListFlds.Rd b/man/tcplListFlds.Rd index 4643d69f..e28f57d6 100644 --- a/man/tcplListFlds.Rd +++ b/man/tcplListFlds.Rd @@ -22,7 +22,9 @@ This function can be particularly useful in defining the 'fld' param in the tcplLoad- functions. } \examples{ +\dontrun{ ## Gives the fields in the mc1 table tcplListFlds("mc1") +} } diff --git a/man/tcplLoadChem.Rd b/man/tcplLoadChem.Rd index 88163b76..cc4184ce 100644 --- a/man/tcplLoadChem.Rd +++ b/man/tcplLoadChem.Rd @@ -34,11 +34,7 @@ setting 'val' to "phenol" when 'field' is "chnm" and 'exact' is the string in 'val' to an RLIKE statement within the MySQL query. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - +\dontrun{ ## Passing no parameters gives all of the registered chemicals with their ## sample IDs tcplLoadChem() @@ -52,8 +48,6 @@ tcplLoadChem(field = 'chem.only') ## Other examples: tcplLoadChem(field = "chnm", val = "Bisphenol A") tcplLoadChem(field = "chid", val = 20182) - -## Reset configuration -options(conf_store) +} } diff --git a/man/tcplLoadChemList.Rd b/man/tcplLoadChemList.Rd new file mode 100644 index 00000000..5cc9c4d8 --- /dev/null +++ b/man/tcplLoadChemList.Rd @@ -0,0 +1,56 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tcplLoadChemList.R +\name{tcplLoadChemList} +\alias{tcplLoadChemList} +\title{Load chemical list information} +\usage{ +tcplLoadChemList(field = NULL, val = NULL) +} +\arguments{ +\item{field}{Character of length 1, \code{'chid'}, \code{'dsstox_substance_id'} +or \code{'list_acronym'}, whether to search by chemical id (chid), +dsstox_substance_id, or list_acronym} + +\item{val}{The values to query on} +} +\value{ +A data.table with the chemical list information for the given +parameters. +} +\description{ +\code{tcplLoadChemList} queries the tcpl databases and returns information +about the chemical lists. +} +\details{ +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). +} +\examples{ +\dontrun{ +## 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") +} + +} diff --git a/man/tcplLoadClib.Rd b/man/tcplLoadClib.Rd deleted file mode 100644 index c154b57a..00000000 --- a/man/tcplLoadClib.Rd +++ /dev/null @@ -1,63 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tcplLoadClib.R -\name{tcplLoadClib} -\alias{tcplLoadClib} -\title{Load chemical library information} -\usage{ -tcplLoadClib(field = NULL, val = NULL) -} -\arguments{ -\item{field}{Character of length 1, \code{'chid'} or \code{'clib'}, whether -to search by chemical id (chid), or chemical library (clib)} - -\item{val}{The values to query on} -} -\value{ -A data.table with the chemical library information for the given -parameters. -} -\description{ -\code{tcplLoadClib} queries the tcpl databases and returns information -about the chemical library. -} -\details{ -Chemicals are stored in different libraries by chemical ID. Therefore, it -is not possible to delineate samples with the same chemical ID into two -distinct chemical libraries. However, it is possible for a chemical ID to -belong to more than one (or no) chemical libraries. - -When chemicals belong to more than one library, the chemical is listed -multiple times (one for each distinct library). -} -\examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - -## Passing no parameters gives all of the chemical ISs that have a chemical -## library registered -clib <- tcplLoadClib() - -## Notice there are more rows in tcplLoadClib than in tcplLoadChem, -## indicating some chemicals must belong to more than library. -chem <- tcplLoadChem(include.spid = FALSE) -nrow(chem) -nrow(clib) - -## It is possible that some chemicals do not have a chemical library -## registered, although this is not the case in the example data. -all(chem$chid \%in\% clib$chid) - -## Show the unique chemical libraries -clib[ , unique(clib)] - -## Specifying a chemical library will not show what other libraries a -## chemical might belong to. -tcplLoadClib(field = "clib", val = "TOXCAST") -tcplLoadClib(field = "chid", val = 20182) - -## Reset configuration -options(conf_store) - -} diff --git a/man/tcplLoadConcUnit.Rd b/man/tcplLoadConcUnit.Rd index d777fdc6..3cff5cd9 100644 --- a/man/tcplLoadConcUnit.Rd +++ b/man/tcplLoadConcUnit.Rd @@ -18,5 +18,5 @@ spids. with the concentration units for the given assay endpoint ids (spid). } \seealso{ -\code{\link{tcplQuery}}, \code{\link{data.table}} +\code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} } diff --git a/man/tcplLoadData.Rd b/man/tcplLoadData.Rd index 60934694..1236ff5c 100644 --- a/man/tcplLoadData.Rd +++ b/man/tcplLoadData.Rd @@ -36,6 +36,15 @@ 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 \code{tcplConf()} was set with "API" as the driver, then \code{tcplLoadData} +will return data from the CCTE Bioactivity API. API data is available for +\code{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 \code{add.fld} to +\code{TRUE}. API query-able fields include "aeid", "spid", "m4id", and +"dtxsid". + Leaving \code{fld} NULL will return all data. Valid \code{fld} inputs are based on the data level and type: @@ -57,11 +66,7 @@ mc \tab 7 \tab mc4, mc7 } } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - +\dontrun{ ## Load all of level 0 for multiple-concentration data, note 'mc' is the ## default value for type tcplLoadData(lvl = 0) @@ -76,10 +81,8 @@ 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))) - -## Reset configuration -options(conf_store) +} } \seealso{ -\code{\link{tcplQuery}}, \code{\link{data.table}} +\code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} } diff --git a/man/tcplLoadUnit.Rd b/man/tcplLoadUnit.Rd index 27d88e46..3de04f7b 100644 --- a/man/tcplLoadUnit.Rd +++ b/man/tcplLoadUnit.Rd @@ -18,5 +18,5 @@ aeids. with the response units for the given assay endpoint ids (aeid). } \seealso{ -\code{\link{tcplQuery}}, \code{\link{data.table}} +\code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} } diff --git a/man/tcplLvlCount.Rd b/man/tcplLvlCount.Rd index 7c7c24ba..c5ec07dc 100644 --- a/man/tcplLvlCount.Rd +++ b/man/tcplLvlCount.Rd @@ -26,16 +26,10 @@ for single concentration data. Leaving \code{lvls} NULL will return all data. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -TCPLlite <- file.path(system.file(package = "tcpl"), "example") -tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") - +\dontrun{ ## Get all counts for level 1 for multiple-concentration tcplLvlCount(lvls = 1) -\dontrun{ ## Get all counts for levels 4 through 7 for multiple-concentration tcplLvlCount(lvls = 4:7) @@ -44,10 +38,7 @@ tcplLvlCount(lvls = 4:7) tcplLvlCount() } -## Reset configuration -options(conf_store) - } \seealso{ -\code{\link{tcplQuery}}, \code{\link{data.table}} +\code{\link{tcplQuery}}, \code{\link[data.table]{data.table}} } diff --git a/man/tcplMakeAeidMultiPlts.Rd b/man/tcplMakeAeidMultiPlts.Rd index a48408df..2f883a18 100644 --- a/man/tcplMakeAeidMultiPlts.Rd +++ b/man/tcplMakeAeidMultiPlts.Rd @@ -9,7 +9,6 @@ tcplMakeAeidMultiPlts( lvl = 4L, fname = NULL, odir = getwd(), - clib = NULL, hitc.all = TRUE ) } @@ -22,9 +21,6 @@ tcplMakeAeidMultiPlts( \item{odir}{The directory to save the .pdf file in} -\item{clib}{Character, the chemical library to subset on, see -\code{\link{tcplLoadClib}} for more information.} - \item{hitc.all}{If FALSE, only plots with hitc==1 will be displayed} } \description{ diff --git a/man/tcplMakeAeidPlts.Rd b/man/tcplMakeAeidPlts.Rd index 9068e5bd..05a8513a 100644 --- a/man/tcplMakeAeidPlts.Rd +++ b/man/tcplMakeAeidPlts.Rd @@ -11,7 +11,6 @@ tcplMakeAeidPlts( fname = NULL, odir = getwd(), ordr.fitc = TRUE, - clib = NULL, cnst = NULL ) } @@ -28,10 +27,7 @@ tcplMakeAeidPlts( \item{ordr.fitc}{Logical, should the fits be ordered by fit category?} -\item{clib}{Character, the chemical library to subset on, see} - -\item{cnst}{Constant hline to draw on plot -\code{\link{tcplLoadClib}} for more information.} +\item{cnst}{Constant hline to draw on plot} } \description{ \code{tcplMakeAeidPlts} creates a .pdf file with the dose-response plots for diff --git a/man/tcplMakeChidMultiPlts.Rd b/man/tcplMakeChidMultiPlts.Rd index de030f24..81779681 100644 --- a/man/tcplMakeChidMultiPlts.Rd +++ b/man/tcplMakeChidMultiPlts.Rd @@ -9,7 +9,6 @@ tcplMakeChidMultiPlts( lvl = 4L, fname = NULL, odir = getwd(), - clib = NULL, hitc.all = TRUE ) } @@ -22,9 +21,6 @@ tcplMakeChidMultiPlts( \item{odir}{The directory to save the .pdf file in} -\item{clib}{Character, the chemical library to subset on, see -\code{\link{tcplLoadClib}} for more information.} - \item{hitc.all}{If FALSE, only plots with hitc==1 will be displayed} } \description{ diff --git a/man/tcplPlot.Rd b/man/tcplPlot.Rd index 8a247da4..7d4cbc09 100644 --- a/man/tcplPlot.Rd +++ b/man/tcplPlot.Rd @@ -6,10 +6,11 @@ Generic Plotting Function for tcpl} \usage{ tcplPlot( - lvl = 5, + dat = NULL, + type = "mc", fld = "m4id", val = NULL, - type = "mc", + compare.val = NULL, by = NULL, output = c("console", "pdf", "png", "jpg", "svg", "tiff"), fileprefix = paste0("tcplPlot_", Sys.Date()), @@ -17,23 +18,35 @@ tcplPlot( verbose = FALSE, nrow = NULL, ncol = NULL, - dpi = 600 + dpi = 600, + flags = FALSE, + yuniform = FALSE, + yrange = c(NA, NA) ) } \arguments{ -\item{lvl}{Integer of length 1, the level of data to load.} +\item{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 \code{tcplPlotLoadData}.} + +\item{type}{Character of length 1, the data type, "sc" or "mc".} \item{fld}{Character, the field(s) to query on.} \item{val}{List, vectors of values for each field to query on. Must be in the same order as 'fld'.} -\item{type}{Character of length 1, the data type, "sc" or "mc".} +\item{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} \item{by}{Parameter to divide files into e.g. "aeid".} -\item{output}{How should the plot be presented. To view the plot in application, -use "console", or to save as a file type, use "pdf", "jpg", "png", "svg", or "tiff".} +\item{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".} \item{fileprefix}{Prefix of file when saving.} @@ -49,31 +62,30 @@ is included with the plot.} \item{ncol}{Integer, number of columns in multiplot. By default 3, 2 if verbose.} \item{dpi}{Integer, image print resolution. By default 600.} + +\item{flags}{Boolean, by default FALSE. If TRUE, level 6 flags are displayed +below annotations on plot} + +\item{yuniform}{Boolean, by default FALSE. If TRUE, all plots will have uniform +y axis scaling, automatically determined.} + +\item{yrange}{Integer of length 2, for directly setting the y-axis range, +c(,). By default, c(NA,NA).} } \description{ -\code{tcplLoadData} queries the tcpl databases and returns a plot +\code{tcplPlot} queries the tcpl databases and returns a plot for the given level and data type. } \details{ -The data type can be either 'mc' for mutliple concentration data, or 'sc' +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. -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. - Leaving \code{fld} NULL will return all data. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - -tcplPlot(lvl = 4, fld = "m4id", val = c(18609966)) ## Create a level 4 plot - -## Reset configuration -options(conf_store) +\dontrun{ +tcplPlot(fld = "m4id", val = c(18609966)) ## Create a level 4 plot +} } diff --git a/man/tcplPlotFits.Rd b/man/tcplPlotFits.Rd index 5bc77085..f605ff0f 100644 --- a/man/tcplPlotFits.Rd +++ b/man/tcplPlotFits.Rd @@ -52,12 +52,7 @@ ID. Inputs with multiple assay endpoints will first be ordered by assay endpoint ID. } \examples{ - -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfDefault() - +\dontrun{ ## 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 @@ -68,11 +63,9 @@ tcplConfDefault() l5 <- tcplLoadData(lvl = 5, fld = "m4id", val = 18609966) l4_agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = 18609966) -\dontrun{ 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 @@ -82,13 +75,9 @@ graphics.off() ## 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] -\dontrun{ tcplPlotFits(dat = l5_sub, agg = l4_agg[m4id \%in\% l5_sub$m4id], browse = TRUE) } - -## Reset configuration -options(conf_store) } diff --git a/man/tcplPlotLoadData.Rd b/man/tcplPlotLoadData.Rd new file mode 100644 index 00000000..00f6dd80 --- /dev/null +++ b/man/tcplPlotLoadData.Rd @@ -0,0 +1,69 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tcplPlotLoadData.R +\name{tcplPlotLoadData} +\alias{tcplPlotLoadData} +\title{Utility function to load data for tcplPlot} +\usage{ +tcplPlotLoadData(type = "mc", fld = "m4id", val, flags = FALSE) +} +\arguments{ +\item{type}{Character of length 1, the data type, "sc" or "mc"} + +\item{fld}{Character, the field(s) to query on.} + +\item{val}{List, vectors of values for each field to query on. Must be in +the same order as 'fld'.} + +\item{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} +} +\value{ +A data.table containing plot-ready data for the given fields. +} +\description{ +\code{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. +} +\details{ +This utility function is used by \code{tcplPlot} to load and prepare data from +\code{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 \code{tcplPlotLoadData}, switch data source +config and pass the data to \code{tcplPlot} \code{dat} parameter. + +The data \code{type} can be either 'mc' for multiple concentration data, or +'sc' for single concentration data. +} +\examples{ +\dontrun{ +## 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") +} + +} +\seealso{ +\code{\link{tcplPlot}} +} diff --git a/man/tcplPlotM4ID.Rd b/man/tcplPlotM4ID.Rd index 9a049669..d7a41c6c 100644 --- a/man/tcplPlotM4ID.Rd +++ b/man/tcplPlotM4ID.Rd @@ -31,17 +31,11 @@ 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. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - +\dontrun{ 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 - -#' ## Reset configuration -options(conf_store) +} } \seealso{ diff --git a/man/tcplPlotPlate.Rd b/man/tcplPlotPlate.Rd index 2dbab05f..d4ed1a96 100644 --- a/man/tcplPlotPlate.Rd +++ b/man/tcplPlotPlate.Rd @@ -41,17 +41,8 @@ For the optimal output size, use width = 10, height = 10*(2/3), pointsize = 10, units = "in" } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfDefault() - -d1 <- tcplLoadData(lvl = 1, fld = "acid", val = 1) \dontrun{ +d1 <- tcplLoadData(lvl = 1, fld = "acid", val = 1) tcplPlotPlate(dat = d1, apid = "09Apr2014.Plate.17") } - -## Reset configuration -options(conf_store) - } diff --git a/man/tcplPlotSetYRange.Rd b/man/tcplPlotSetYRange.Rd new file mode 100644 index 00000000..51152188 --- /dev/null +++ b/man/tcplPlotSetYRange.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tcplPlotUtils.R +\name{tcplPlotSetYRange} +\alias{tcplPlotSetYRange} +\title{tcplPlotSetYRange} +\usage{ +tcplPlotSetYRange(dat, yuniform, yrange, type) +} +\arguments{ +\item{dat}{dataset} + +\item{yuniform}{should the yrange be uniform} + +\item{yrange}{length 2 of the yrange} + +\item{type}{mc or sc} +} +\value{ +yrange of the data +} +\description{ +tcplPlotSetYRange +} diff --git a/man/tcplPlotValidate.Rd b/man/tcplPlotValidate.Rd new file mode 100644 index 00000000..8db513c4 --- /dev/null +++ b/man/tcplPlotValidate.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tcplPlotUtils.R +\name{tcplPlotValidate} +\alias{tcplPlotValidate} +\title{tcplPlotValidate} +\usage{ +tcplPlotValidate( + type = "mc", + flags = NULL, + output = "none", + multi = NULL, + verbose = FALSE +) +} +\arguments{ +\item{type}{string of mc or sc indicating if it is single or multi conc} + +\item{flags}{bool - should we return flags} + +\item{output}{how should the plot be formatted} + +\item{multi}{are there multiple plots} + +\item{verbose}{should the plot return a table with parameters} +} +\value{ +a list of validated parameters for plotting +} +\description{ +tcplPlotValidate +} diff --git a/man/tcplPlotlyPlot.Rd b/man/tcplPlotlyPlot.Rd index a904e19b..9ce3a12a 100644 --- a/man/tcplPlotlyPlot.Rd +++ b/man/tcplPlotlyPlot.Rd @@ -10,9 +10,8 @@ tcplPlotlyPlot(dat, lvl = 5) \item{dat}{data table with all required conc/resp data} \item{lvl}{integer level of data that should be plotted -level 4 - all fit models -level 5 - all fit models and winning model with hitcall -level 6 - include all flags} +level 2 - for 'sc' plotting +level 5 - for 'mc' plotting, all fit models and winning model with hitcall} } \value{ A plotly plot diff --git a/man/tcplPrepOtpt.Rd b/man/tcplPrepOtpt.Rd index e01cbed0..47aec601 100644 --- a/man/tcplPrepOtpt.Rd +++ b/man/tcplPrepOtpt.Rd @@ -28,12 +28,7 @@ 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.' } \examples{ - -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - +\dontrun{ ## Load some example data d1 <- tcplLoadData(1) @@ -49,9 +44,6 @@ d2 <- tcplPrepOtpt(d1) ## d3 <- tcplPrepOtpt(d1, ids = "spid") "chnm" \%in\% names(d3) ## TRUE "acnm" \%in\% names(d3) ## FALSE - -## Reset configuration -options(conf_store) - +} } diff --git a/man/tcplSubsetChid.Rd b/man/tcplSubsetChid.Rd index f68108c7..9952511d 100644 --- a/man/tcplSubsetChid.Rd +++ b/man/tcplSubsetChid.Rd @@ -4,7 +4,7 @@ \alias{tcplSubsetChid} \title{Subset level 5 data to a single sample per chemical} \usage{ -tcplSubsetChid(dat, flag = TRUE, type = "mc", export_ready = TRUE) +tcplSubsetChid(dat, flag = TRUE, type = "mc", export_ready = FALSE) } \arguments{ \item{dat}{data.table, a data.table with level 5 data} @@ -14,7 +14,7 @@ details for more information} \item{type}{Character of length 1, the data type, "sc" or "mc"} -\item{export_ready}{Boolean, default TRUE, should only export ready 1 values be included in calculation} +\item{export_ready}{Boolean, default FALSE, should only export ready 1 values be included in calculation} } \value{ A data.table with a single sample for every given chemical-assay @@ -33,7 +33,7 @@ chemical and assay information mapped with \code{\link{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 the modl_ga, +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 \code{flag} param can be used to specify a subset of flags to be used in @@ -42,11 +42,7 @@ Setting \code{flag} to \code{FALSE} will do the subsetting without considering any flags. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -tcplConfExample() - +\dontrun{ ## Load the example level 5 data d1 <- tcplLoadData(lvl = 5, fld = "aeid", val = 797) d1 <- tcplPrepOtpt(d1) @@ -59,9 +55,7 @@ d2[, list(m4id, hitc, fitc, modl_ga)] ## 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)] - -## Reset configuration -options(conf_store) +} } \seealso{ diff --git a/man/tcplVarMat.Rd b/man/tcplVarMat.Rd index 04be046a..02c73201 100644 --- a/man/tcplVarMat.Rd +++ b/man/tcplVarMat.Rd @@ -5,45 +5,27 @@ \title{Create chemical by assay matrices} \usage{ tcplVarMat( - chid = NULL, + dsstox_substance_id = NULL, aeid = NULL, add.vars = NULL, - row.id = "code", - flag = TRUE, - cyto.pars = list(), - include.na.chid = FALSE, - odir = NULL, - file.prefix = NULL + flag = TRUE ) } \arguments{ -\item{chid}{Integer, chemical ID values to subset on} +\item{dsstox_substance_id}{Integer, chemical ID values to subset on} \item{aeid}{Integer, assay endpoint ID values to subset on} \item{add.vars}{Character, mc4 or mc5 field(s) not included in the standard list to add additional matrices} -\item{row.id}{Character, the chemical identifier to use in the output} - \item{flag}{Integer or Logical of length 1, passed to \code{\link{tcplSubsetChid}}} - -\item{cyto.pars}{List, named list of arguments passed to -\code{\link{tcplCytoPt}}} - -\item{include.na.chid}{Logical of length 1, whether to include the chemicals -not listed in the tcpl databases (ie. controls)} - -\item{odir}{Directory to write comma separated file(s)} - -\item{file.prefix}{Character of length 1, prefix to the file name when odir -is not NULL} } \value{ -A list of chemical by assay matrices where the rownames are given by -the 'row.id' parameter, and the colnames are given by assay endpoint name -(aenm). +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). } \description{ \code{tcplVarMat} creates chemical by assay matrices. @@ -53,72 +35,65 @@ The \code{tcplVarMat} function is used to create chemical by assay matrices for different parameters. The standard list of matrices returned includes: \enumerate{ - \item "modl_ga" -- The logAC50 (in the gain direction) for the winning - model. - \item "hitc" -- The hit-call for the winning model. - \item "m4id" -- The m4id, listing the concentration series selected by - \code{tcplSubsetChid}. - \item "zscore" -- The z-score based on the output from \code{tcplCytoPt}. - The formula used for calculating the z-score is - \eqn{-(\mathit{modl\_ga} - \mathit{cyto\_pt})/\mathit{global\_mad}} - \item "tested" -- 1 or 0, 1 indicating the chemical/assay pair - was tested in either the single- or multiple-concentration format - \item "tested_sc" -- 1 or 0, 1 indicating the chemical/assay pair - was tested in the single-concentration format - \item "tested_mc" -- 1 or 0, 1 indicating the chemical/assay pair - was tested in the multiple-concentration format - \item "ac50" -- a modified AC50 table (in non-log units) where - assay/chemical pairs that were not tested, or tested and had a hitcall of 0 - or -1 have the value 1e6. - \item "neglogac50" -- -log(AC50/1e6) where assay/chemical pairs that were - not tested, or tested and had a hitcall of 0 or -1 have the value 0. + \item "ac50" -- The active concentration at 50% maximal response (ac50) for + the winning model. + \item "ac50_verbose" -- The AC50 for the winning model, with text describing + some situations. + \item "acc" -- The active concentration at user-defined cutoff for the + winning model. + \item "acc_verbose" -- The ACC for the winning model, with text describing + some situations. + \item "mc_hitc" -- The hit-call for the winning model in + multiple-concentration (mc) screening. + \item "sc_hitc" -- The hit-call in single concentration (sc) screening. } +\code{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: +\itemize{ + \item set to 1e6 when the chemical is tested but negative in mc. In _verbose + matrices, these are indicated as "MC neg". + \item 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". + \item 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" + \item 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, \code{tcplVarMat} aggregates multiple samples to a chemical level call -utilizing \code{\link{tcplSubsetChid}}. - -By setting \code{odir} the function will write out a csv with, naming the -file with the convention: "var_Matrix_date.csv" where 'var' is the name -of the matrix. A prefix can be added to the output files using the -'file.prefix' parameter. - -When a concentration series has a sample id not listed in the \code{tcpl} -database, and 'include.na.chid' is TRUE, the rowname for that series will -be the concatenation of "SPID_" and the spid. Note, if the user gives a -subset of chid values to the 'chid' parameter, 'include.na.chid' will be -set to FALSE with a warning. - -The tcplVarMat function calls both \code{tcplSubsetChid} and -\code{tcplCytoPt} (which separately calls \code{tcplSubsetChid}). The input +utilizing \code{\link{tcplSubsetChid}}. The input for the \code{tcplVarMat} 'flag' parameter is passed to the -\code{tcplSubsetChid} call used to parse down the data to create the -matrices. The \code{tcplSubsetChid} called within \code{tcplCytoPt} (to -parse down the cytotoxicity data used to define the "zscore" matrix) can -be modified by passing a separate 'flag' element in the list defined by the -'cyto.pars' parameter. +\code{tcplSubsetChid} call and used to parse down the data to create the +matrices. } \examples{ -## Store the current config settings, so they can be reloaded at the end -## of the examples -conf_store <- tcplConfList() -TCPLlite <- file.path(system.file(package = "tcpl"), "example") -tcplConf(db = TCPLlite, user = NA, host = NA, drvr = "tcplLite") \dontrun{ -## Demonstrate the returned values. Note with no "burst" assays defined in -## the example database, the user must provide which aeid values to use -## in calculating the cytotoxicity distributions for the 'zscore' matrix. -tcplVarMat(chid = 1:5, cyto.pars = list(aeid = 1:2)) +## Demonstrate the returned values. +varmat <- tcplVarMat() ## Other changes can be made -tcplVarMat(chid = 1:5, row.id = "chnm", cyto.pars = list(aeid = 1:2)) -tcplVarMat(chid = 1:5, add.vars = "max_med", cyto.pars = list(aeid = 1:2)) +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") } -## Reset configuration -options(conf_store) } \seealso{ diff --git a/man/tcpldbStats.Rd b/man/tcpldbStats.Rd index b7f3e567..3f2373e8 100644 --- a/man/tcpldbStats.Rd +++ b/man/tcpldbStats.Rd @@ -12,7 +12,7 @@ tcpldbStats(type = "all", val = NULL) \item{val}{integer if type = "aeid" , string if type = "spid"} } \description{ -\code{tcpldbStats} takes a string(type) and an optional parameter(val) to return the summary statistics on the entire tcplLite database +\code{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' diff --git a/man/tcplggplot.Rd b/man/tcplggplot.Rd index 93f769c4..7082ef31 100644 --- a/man/tcplggplot.Rd +++ b/man/tcplggplot.Rd @@ -4,17 +4,21 @@ \alias{tcplggplot} \title{tcplggplot} \usage{ -tcplggplot(dat, lvl = 5, verbose = FALSE) +tcplggplot(dat, lvl = 5, verbose = FALSE, flags = FALSE, yrange = c(NA, NA)) } \arguments{ \item{dat}{data table with all required conc/resp data} \item{lvl}{integer level of data that should be plotted -level 4 - all fit models -level 5 - all fit models and winning model with hitcall -level 6 - include all flags} +level 2 - for 'sc' plotting +level 5 - for 'mc' plotting, all fit models and winning model with hitcall} \item{verbose}{boolean should plotting include table of values next to the plot} + +\item{flags}{boolean should plotting include level 6 flags in plot caption} + +\item{yrange}{Integer of length 2, for overriding the y-axis range, c(,). +By default, c(NA,NA).} } \value{ A ggplot object or grob with accompanied table depending on verbose option diff --git a/man/tcplggplotCompare.Rd b/man/tcplggplotCompare.Rd new file mode 100644 index 00000000..01e18262 --- /dev/null +++ b/man/tcplggplotCompare.Rd @@ -0,0 +1,38 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tcplPlot.R +\name{tcplggplotCompare} +\alias{tcplggplotCompare} +\title{tcplggplotCompare} +\usage{ +tcplggplotCompare( + dat, + compare.dat, + lvl = 5, + verbose = FALSE, + flags = FALSE, + yrange = c(NA, NA) +) +} +\arguments{ +\item{dat}{data table with all required conc/resp data} + +\item{compare.dat}{data table with all required conc/resp data for comparison +overlay} + +\item{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} + +\item{verbose}{boolean should plotting include table of values next to the plot} + +\item{flags}{boolean should plotting include level 6 flags in plot caption} + +\item{yrange}{Integer of length 2, for overriding the y-axis range, c(,). +By default, c(NA,NA).} +} +\value{ +A ggplot object or grob with accompanied table depending on verbose option +} +\description{ +tcplggplotCompare +} diff --git a/man/test_api.Rd b/man/test_api.Rd new file mode 100644 index 00000000..9f352c5d --- /dev/null +++ b/man/test_api.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{test_api} +\alias{test_api} +\title{List containing ids used for different automated tests of tcpl integration +with the CTX APIs, randomly selected from what is available via API.} +\format{ +A list with 7 items: +\describe{ + \item{aeid}{Randomly selected assay component endpoint id} + \item{acid}{Assay component id associated with the above aeid} + \item{aid}{Assay id associated with the above aeid} + \item{asid}{Assay source id associated with the above aeid} + \item{dtxsid}{dsstox substance id of one sample from the above aeid} + \item{spid}{Sample id of one (the same) sample from the above aeid} + \item{m4id}{Level 4 id of one (the same) sample from the above aeid} +} +} +\source{ +CTX Bioactivity API +} +\usage{ +test_api +} +\description{ +List containing ids used for different automated tests of tcpl integration +with the CTX APIs, randomly selected from what is available via API. +} +\keyword{datasets} diff --git a/tests/testthat/_snaps/tcplPlot/negative-cutoff-bmr.svg b/tests/testthat/_snaps/tcplPlot/negative-cutoff-bmr.svg deleted file mode 100644 index edd4e0ab..00000000 --- a/tests/testthat/_snaps/tcplPlot/negative-cutoff-bmr.svg +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --0.4 --0.2 -0.0 - - - - - - - -0.1 -1.0 -10.0 -100.0 -Concentration (uM) -Log2 Fold Induction - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Winning Model -(pow) -Losing Models -Cutoff -BMD -AC50 -DTXSID10379991 3-(Perfluorooctyl)propanol -SPID:1210314466 AEID:80 AENM:ATG_GLI_CIS_up -M4ID:482359 HITC:0.960 - - diff --git a/tests/testthat/_snaps/tcplPlot/test-output-482273.svg b/tests/testthat/_snaps/tcplPlot/test-output-482273.svg deleted file mode 100644 index 4fd6daf6..00000000 --- a/tests/testthat/_snaps/tcplPlot/test-output-482273.svg +++ /dev/null @@ -1,790 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0.0 -0.3 -0.6 - - - - - - - -0.1 -1.0 -10.0 -100.0 -Concentration (uM) -Log2 Fold Induction - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Winning Model -(exp2) -Losing Models -Cutoff -BMD -AC50 -DTXSID80379721 1H,1H,6H,6H-Perfluorohexane-1,6-diol diacrylate -SPID:01504209 AEID:80 AENM:ATG_GLI_CIS_up -M4ID:482273 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Hitcall - - - - -1.000 - - - - -model - - - - -poly2 - - - - -BMD - - - - -46.275 - - - - -aic - - - - -pow - - - - -AC50 - - - - -79.547 - - - - -rme - - - - -exp2 - - - - -hill - - - - -exp3 - - - - -exp5 - - - - -gnls - - - - -poly1 - - - - -exp4 - - - - -cnst - - - - --2.1e+01 - - - - --2.1e+01 - - - - --2.1e+01 - - - - --1.9e+01 - - - - --1.9e+01 - - - - --1.9e+01 - - - - --1.5e+01 - - - - --1.5e+01 - - - - --7.3e+00 - - - - -4.350 - - - - -0.094 - - - - -0.094 - - - - -0.093 - - - - -0.094 - - - - -0.093 - - - - -0.094 - - - - -0.094 - - - - -0.116 - - - - -0.142 - - - - -0.332 - - - - diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/assay.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/assay.json new file mode 100644 index 00000000..3d4de4e4 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/assay.json @@ -0,0 +1,236 @@ +[ + { + "aeid": 1390, + "assayComponentEndpointName": "LTEA_HepaRG_SLC22A6", + "exportReady": 1, + "internalReady": 1, + "assayComponentEndpointDesc": "Data from the assay component LTEA_HepaRG_SLC22A6 was analyzed into 1 endpoint. This assay endpoint, LTEA_HepaRG_SLC22A6, was analyzed with bidirectional fitting relative to DMSO as the negative control and baseline of activity. Using a type of inducible reporter, measures of mRNA induction for gain or loss-of-signal activity can be used to understand regulation of transcription factor activity. To generalize the intended target to other relatable targets, this assay endpoint is annotated to the transporter intended target family, where the subfamily is organic anion transporter.", + "assayFunctionType": "reporter gene", + "normalizedDataType": "log2_fold_induction", + "burstAssay": 0, + "keyPositiveControl": null, + "signalDirection": "bidirectional", + "intendedTargetType": "rna", + "intendedTargetTypeSub": "mRNA", + "intendedTargetFamily": "transporter", + "intendedTargetFamilySub": "organic anion transporter", + "cellViabilityAssay": 0, + "dataUsability": 1, + "acid": 957, + "assayComponentName": "LTEA_HepaRG_SLC22A6", + "assayComponentDesc": "LTEA_HepaRG_SLC22A6 is one of 102 assay component(s) measured in the LTEA HepaRG cell culture assay. It is a marker of NR mediated transport.", + "assayComponentTargetDesc": "Metabolically-competent HepaRG cell cultures were exposed to a chemical for 48 hours before cytotoxicty (LDH) and alterations in transcription were assessed.", + "parameterReadoutType": "single", + "assayDesignType": "inducible reporter", + "assayDesignTypeSub": "mRNA induction", + "biologicalProcessTarget": "regulation of transcription factor activity", + "detectionTechnologyType": "Fluorescence", + "detectionTechnologyTypeSub": "Fluorescence intensity", + "detectionTechnology": "Fluidigm qRT-PCR", + "keyAssayReagentType": null, + "keyAssayReagent": null, + "technologicalTargetType": "rna", + "technologicalTargetTypeSub": "mRNA", + "aid": 371, + "assayName": "LTEA_HepaRG", + "assayDesc": "LTEA_HepaRG is a cell based, multiplexed-readout assay that uses HepaRG, a human liver cell line, with measurements taken at 48 hours after chemical dosing on a 96-well plate.", + "timepointHr": 48.0, + "organismId": 9606, + "organism": "human", + "tissue": "liver", + "cellFormat": "cell line", + "cellFreeComponentSource": "", + "cellShortName": "HepaRG", + "cellGrowthMode": "adherent", + "assayFootprint": "microplate: 96-well plate", + "assayFormatType": "cell-based", + "assayFormatTypeSub": "cell-based format", + "contentReadoutType": "multiplexed", + "dilutionSolvent": "DMSO", + "dilutionSolventPercentMax": 0.5, + "asid": 9, + "assaySourceName": "LTEA", + "assaySourceLongName": "LifeTech/Expression Analysis", + "assaySourceDesc": "Life Technologies, acquired by Thermo Fisher, is a Contract Research Organization (CRO) that provides transcriptomics and expression screening.", + "gene": { + "geneId": 353, + "geneName": "solute carrier family 22 (organic anion transporter), member 6", + "description": null, + "geneSymbol": "SLC22A6", + "organismId": 1, + "trackStatus": "live", + "entrezGeneId": 9356, + "officialSymbol": "SLC22A6", + "officialFullName": "solute carrier family 22 (organic anion transporter), member 6", + "uniprotAccessionNumber": "Q4U2R8" + }, + "assayList": null, + "citations": { + "doi": "doi: 10.1038/s41540-020-00166-2", + "url": "https://pubmed.ncbi.nlm.nih.gov/33504769/", + "pmid": 33504769, + "title": "High-throughput toxicogenomic screening of chemicals in the environment using metabolically competent hepatic cell cultures", + "author": "Franzosa JA, Bonzo JA, Jack J, Baker NC, Kothiya P, Witek RP, Hurban P, Siferd S, Hester S, Shah I, Ferguson SS, Houck KA, Wambaugh JF", + "citation": "Franzosa JA, Bonzo JA, Jack J, Baker NC, Kothiya P, Witek RP, Hurban P, Siferd S, Hester S, Shah I, Ferguson SS, Houck KA, Wambaugh JF. High-throughput toxicogenomic screening of chemicals in the environment using metabolically competent hepatic cell cultures. NPJ Syst Biol Appl. 2021 Jan 27;7(1):7. doi: 10.1038/s41540-020-00166-2. PMID: 33504769; PMCID: PMC7840683.", + "otherId": "0", + "citationId": 247, + "otherSource": "" + } + }, + { + "aeid": 1392, + "assayComponentEndpointName": "LTEA_HepaRG_KLK3", + "exportReady": 1, + "internalReady": 1, + "assayComponentEndpointDesc": "Data from the assay component LTEA_HepaRG_KLK3 was analyzed into 1 endpoint. This assay endpoint, LTEA_HepaRG_KLK3, was analyzed with bidirectional fitting relative to DMSO as the negative control and baseline of activity. Using a type of inducible reporter, measures of mRNA induction for gain or loss-of-signal activity can be used to understand regulation of transcription factor activity. To generalize the intended target to other relatable targets, this assay endpoint is annotated to the protease intended target family, where the subfamily is Cellular remodeling.", + "assayFunctionType": "reporter gene", + "normalizedDataType": "log2_fold_induction", + "burstAssay": 0, + "keyPositiveControl": null, + "signalDirection": "bidirectional", + "intendedTargetType": "rna", + "intendedTargetTypeSub": "mRNA", + "intendedTargetFamily": "protease", + "intendedTargetFamilySub": "Cellular remodeling", + "cellViabilityAssay": 0, + "dataUsability": 1, + "acid": 958, + "assayComponentName": "LTEA_HepaRG_KLK3", + "assayComponentDesc": "LTEA_HepaRG_KLK3 is one of 102 assay component(s) measured in the LTEA HepaRG cell culture assay. It is a marker of Cellular remodeling.", + "assayComponentTargetDesc": "Metabolically-competent HepaRG cell cultures were exposed to a chemical for 48 hours before cytotoxicty (LDH) and alterations in transcription were assessed.", + "parameterReadoutType": "single", + "assayDesignType": "inducible reporter", + "assayDesignTypeSub": "mRNA induction", + "biologicalProcessTarget": "regulation of transcription factor activity", + "detectionTechnologyType": "Fluorescence", + "detectionTechnologyTypeSub": "Fluorescence intensity", + "detectionTechnology": "Fluidigm qRT-PCR", + "keyAssayReagentType": null, + "keyAssayReagent": null, + "technologicalTargetType": "rna", + "technologicalTargetTypeSub": "mRNA", + "aid": 371, + "assayName": "LTEA_HepaRG", + "assayDesc": "LTEA_HepaRG is a cell based, multiplexed-readout assay that uses HepaRG, a human liver cell line, with measurements taken at 48 hours after chemical dosing on a 96-well plate.", + "timepointHr": 48.0, + "organismId": 9606, + "organism": "human", + "tissue": "liver", + "cellFormat": "cell line", + "cellFreeComponentSource": "", + "cellShortName": "HepaRG", + "cellGrowthMode": "adherent", + "assayFootprint": "microplate: 96-well plate", + "assayFormatType": "cell-based", + "assayFormatTypeSub": "cell-based format", + "contentReadoutType": "multiplexed", + "dilutionSolvent": "DMSO", + "dilutionSolventPercentMax": 0.5, + "asid": 9, + "assaySourceName": "LTEA", + "assaySourceLongName": "LifeTech/Expression Analysis", + "assaySourceDesc": "Life Technologies, acquired by Thermo Fisher, is a Contract Research Organization (CRO) that provides transcriptomics and expression screening.", + "gene": { + "geneId": 25, + "geneName": "kallikrein-related peptidase 3", + "description": null, + "geneSymbol": "KLK3", + "organismId": 1, + "trackStatus": "live", + "entrezGeneId": 354, + "officialSymbol": "KLK3", + "officialFullName": "kallikrein-related peptidase 3", + "uniprotAccessionNumber": "P07288" + }, + "assayList": null, + "citations": { + "doi": "doi: 10.1038/s41540-020-00166-2", + "url": "https://pubmed.ncbi.nlm.nih.gov/33504769/", + "pmid": 33504769, + "title": "High-throughput toxicogenomic screening of chemicals in the environment using metabolically competent hepatic cell cultures", + "author": "Franzosa JA, Bonzo JA, Jack J, Baker NC, Kothiya P, Witek RP, Hurban P, Siferd S, Hester S, Shah I, Ferguson SS, Houck KA, Wambaugh JF", + "citation": "Franzosa JA, Bonzo JA, Jack J, Baker NC, Kothiya P, Witek RP, Hurban P, Siferd S, Hester S, Shah I, Ferguson SS, Houck KA, Wambaugh JF. High-throughput toxicogenomic screening of chemicals in the environment using metabolically competent hepatic cell cultures. NPJ Syst Biol Appl. 2021 Jan 27;7(1):7. doi: 10.1038/s41540-020-00166-2. PMID: 33504769; PMCID: PMC7840683.", + "otherId": "0", + "citationId": 247, + "otherSource": "" + } + }, + { + "aeid": 1394, + "assayComponentEndpointName": "LTEA_HepaRG_SLC10A1", + "exportReady": 1, + "internalReady": 1, + "assayComponentEndpointDesc": "Data from the assay component LTEA_HepaRG_SLC10A1 was analyzed into 1 endpoint. This assay endpoint, LTEA_HepaRG_SLC10A1, was analyzed with bidirectional fitting relative to DMSO as the negative control and baseline of activity. Using a type of inducible reporter, measures of mRNA induction for gain or loss-of-signal activity can be used to understand regulation of transcription factor activity. To generalize the intended target to other relatable targets, this assay endpoint is annotated to the transporter intended target family, where the subfamily is sodium/bile acid cotransporter.", + "assayFunctionType": "reporter gene", + "normalizedDataType": "log2_fold_induction", + "burstAssay": 0, + "keyPositiveControl": null, + "signalDirection": "bidirectional", + "intendedTargetType": "rna", + "intendedTargetTypeSub": "mRNA", + "intendedTargetFamily": "transporter", + "intendedTargetFamilySub": "sodium/bile acid cotransporter", + "cellViabilityAssay": 0, + "dataUsability": 1, + "acid": 959, + "assayComponentName": "LTEA_HepaRG_SLC10A1", + "assayComponentDesc": "LTEA_HepaRG_SLC10A1 is one of 102 assay component(s) measured in the LTEA HepaRG cell culture assay. It is a marker of NR mediated transport.", + "assayComponentTargetDesc": "Metabolically-competent HepaRG cell cultures were exposed to a chemical for 48 hours before cytotoxicty (LDH) and alterations in transcription were assessed.", + "parameterReadoutType": "single", + "assayDesignType": "inducible reporter", + "assayDesignTypeSub": "mRNA induction", + "biologicalProcessTarget": "regulation of transcription factor activity", + "detectionTechnologyType": "Fluorescence", + "detectionTechnologyTypeSub": "Fluorescence intensity", + "detectionTechnology": "Fluidigm qRT-PCR", + "keyAssayReagentType": null, + "keyAssayReagent": null, + "technologicalTargetType": "rna", + "technologicalTargetTypeSub": "mRNA", + "aid": 371, + "assayName": "LTEA_HepaRG", + "assayDesc": "LTEA_HepaRG is a cell based, multiplexed-readout assay that uses HepaRG, a human liver cell line, with measurements taken at 48 hours after chemical dosing on a 96-well plate.", + "timepointHr": 48.0, + "organismId": 9606, + "organism": "human", + "tissue": "liver", + "cellFormat": "cell line", + "cellFreeComponentSource": "", + "cellShortName": "HepaRG", + "cellGrowthMode": "adherent", + "assayFootprint": "microplate: 96-well plate", + "assayFormatType": "cell-based", + "assayFormatTypeSub": "cell-based format", + "contentReadoutType": "multiplexed", + "dilutionSolvent": "DMSO", + "dilutionSolventPercentMax": 0.5, + "asid": 9, + "assaySourceName": "LTEA", + "assaySourceLongName": "LifeTech/Expression Analysis", + "assaySourceDesc": "Life Technologies, acquired by Thermo Fisher, is a Contract Research Organization (CRO) that provides transcriptomics and expression screening.", + "gene": { + "geneId": 299, + "geneName": "solute carrier family 10 (sodium/bile acid cotransporter), member 1", + "description": null, + "geneSymbol": "SLC10A1", + "organismId": 1, + "trackStatus": "live", + "entrezGeneId": 6554, + "officialSymbol": "SLC10A1", + "officialFullName": "solute carrier family 10 (sodium/bile acid cotransporter), member 1", + "uniprotAccessionNumber": "Q14973" + }, + "assayList": null, + "citations": { + "doi": "doi: 10.1038/s41540-020-00166-2", + "url": "https://pubmed.ncbi.nlm.nih.gov/33504769/", + "pmid": 33504769, + "title": "High-throughput toxicogenomic screening of chemicals in the environment using metabolically competent hepatic cell cultures", + "author": "Franzosa JA, Bonzo JA, Jack J, Baker NC, Kothiya P, Witek RP, Hurban P, Siferd S, Hester S, Shah I, Ferguson SS, Houck KA, Wambaugh JF", + "citation": "Franzosa JA, Bonzo JA, Jack J, Baker NC, Kothiya P, Witek RP, Hurban P, Siferd S, Hester S, Shah I, Ferguson SS, Houck KA, Wambaugh JF. High-throughput toxicogenomic screening of chemicals in the environment using metabolically competent hepatic cell cultures. NPJ Syst Biol Appl. 2021 Jan 27;7(1):7. doi: 10.1038/s41540-020-00166-2. PMID: 33504769; PMCID: PMC7840683.", + "otherId": "0", + "citationId": 247, + "otherSource": "" + } + } +] \ No newline at end of file diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-aeid/0.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-aeid/0.json new file mode 100644 index 00000000..41b42e67 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-aeid/0.json @@ -0,0 +1,3 @@ +[ + +] diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-aeid/1390.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-aeid/1390.json new file mode 100644 index 00000000..98ff9665 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-aeid/1390.json @@ -0,0 +1,372 @@ +[ + { + "aeid": 1390, + "m4id": 906167, + "spid": "TX009761", + "chid": 24845, + "casn": "64-86-8", + "chnm": "Colchicine", + "dtxsid": "DTXSID5024845", + "bmad": 0.9405044150032765, + "respMax": 2.60967253749995, + "respMin": 2.1440377088333484, + "maxMean": 2.3768551231666493, + "maxMeanConc": -1.5228787452803376, + "maxMed": 2.3768551231666493, + "maxMedConc": -1.5228787452803376, + "logcMax": -1.5228787452803376, + "logcMin": -1.5228787452803376, + "nconc": 1, + "npts": 2, + "nrep": 2.0, + "nmedGtbl": 0, + "tmpi": 72, + "m5id": 6384473, + "modl": "none", + "hitc": 0.0, + "fitc": 2, + "coff": 2.8215132450098297, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.5228787452803376, + -1.5228787452803376 + ], + "resp": [ + 2.1440377088333484, + 2.60967253749995 + ] + }, + "mc4Param": { + "pow_a": null, + "pow_p": null, + "exp2_a": null, + "exp2_b": null, + "exp3_a": null, + "exp3_b": null, + "exp3_p": null, + "exp5_p": null, + "gnls_p": null, + "gnls_q": null, + "hill_p": null, + "pow_er": null, + "cnst_er": null, + "exp2_er": null, + "exp3_er": null, + "exp4_er": null, + "exp4_ga": null, + "exp4_tp": null, + "exp5_er": null, + "exp5_ga": null, + "exp5_tp": null, + "gnls_er": null, + "gnls_ga": null, + "gnls_la": null, + "gnls_tp": null, + "hill_er": null, + "hill_ga": null, + "hill_tp": null, + "poly1_a": null, + "poly2_a": null, + "poly2_b": null, + "pow_aic": null, + "pow_cov": null, + "pow_rme": null, + "all_bmed": 0, + "cnst_aic": null, + "cnst_rme": null, + "exp2_aic": null, + "exp2_cov": null, + "exp2_rme": null, + "exp3_aic": null, + "exp3_cov": null, + "exp3_rme": null, + "exp4_aic": null, + "exp4_cov": null, + "exp4_rme": null, + "exp5_aic": null, + "exp5_cov": null, + "exp5_rme": null, + "gnls_aic": null, + "gnls_cov": null, + "gnls_rme": null, + "hill_aic": null, + "hill_cov": null, + "hill_rme": null, + "poly1_er": null, + "poly2_er": null, + "pow_a_sd": null, + "pow_p_sd": null, + "all_onesd": 1.0063376519421736, + "exp2_a_sd": null, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp5_p_sd": null, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_p_sd": null, + "poly1_aic": null, + "poly1_cov": null, + "poly1_rme": null, + "poly2_aic": null, + "poly2_cov": null, + "poly2_rme": null, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly2_a_sd": null, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": null, + "cnst_success": null, + "exp2_success": null, + "exp3_success": null, + "exp4_success": null, + "exp5_success": null, + "gnls_success": null, + "hill_success": null, + "poly1_success": null, + "poly2_success": null + }, + "mc5Param": { + "bmr": 1.3575494924699922, + "hitcall": 0 + }, + "mc6Param": null + }, + { + "aeid": 1390, + "m4id": 906192, + "spid": "TX012530", + "chid": 34192, + "casn": "10161-33-8", + "chnm": "17beta-Trenbolone", + "dtxsid": "DTXSID0034192", + "bmad": 0.9405044150032765, + "respMax": 2.717409684333399, + "respMin": -0.8545140676665994, + "maxMean": 1.3163384146666992, + "maxMeanConc": -1.5228787452803376, + "maxMed": 1.3163384146666992, + "maxMedConc": -1.5228787452803376, + "logcMax": 1.4771212547196624, + "logcMin": -1.5228787452803376, + "nconc": 6, + "npts": 10, + "nrep": 2.0, + "nmedGtbl": 0, + "tmpi": 97, + "m5id": 6384498, + "modl": "poly1", + "hitc": 1.5382110124750505E-5, + "fitc": 13, + "coff": 2.8215132450098297, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 19.58913043530091, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.5228787452803376, + 1.4771212547196624, + 0.47712125471966244, + -1.5228787452803376, + 0, + 0, + -0.5228787452803376, + -1, + -0.5228787452803376, + -1 + ], + "resp": [ + -0.08473285500000038, + -0.3307718959999999, + 0.2718659670000001, + 2.717409684333399, + -0.7598897116665988, + 0.616657414666701, + 0.9084294140000004, + -0.5178109723332991, + -0.8545140676665994, + -0.15577021666659974 + ] + }, + "mc4Param": { + "pow_a": -0.0000032015551244766303, + "pow_p": 3.3938876456093636, + "exp2_a": -0.0008425672205370199, + "exp2_b": 5.025952810047121, + "exp3_a": -0.3165412302939914, + "exp3_b": 32.7886760846325, + "exp3_p": 3.823113636098184, + "exp5_p": 4.521308309626776, + "gnls_p": 0.7060536922649157, + "gnls_q": 7.995803111831659, + "hill_p": 7.999995740946841, + "pow_er": -0.3948197735362726, + "cnst_er": -0.3688009411915791, + "exp2_er": -0.39189255925874833, + "exp3_er": -0.394828315652932, + "exp4_er": -0.39001576568747853, + "exp4_ga": 94.86188101488622, + "exp4_tp": -1.536218042365886, + "exp5_er": -0.3943079735577426, + "exp5_ga": 38.01553780063972, + "exp5_tp": -1.5637566207089924, + "gnls_er": -0.3888279954274361, + "gnls_ga": 0.008360957321139052, + "gnls_la": 0.26439669331621307, + "gnls_tp": -0.11011944003100936, + "hill_er": -0.3969989913318005, + "hill_ga": 0.05553142030323221, + "hill_tp": -0.14277058589126485, + "poly1_a": -0.010176546872189638, + "poly2_a": -0.00014558397574643742, + "poly2_b": 0.6414632462188614, + "pow_aic": 32.701296578338486, + "pow_cov": 1, + "pow_rme": 1.0134598100344008, + "pow_top": -0.33002326866351944, + "all_bmed": 0, + "cnst_aic": 28.986099667961145, + "cnst_rme": 1.0188398204286804, + "exp2_aic": 32.70205365440622, + "exp2_cov": 1, + "exp2_rme": 1.013472783830085, + "exp2_top": -0.3287033214604972, + "exp3_aic": 34.70116703286695, + "exp3_cov": 1, + "exp3_rme": 1.0134574027805858, + "exp3_top": -0.32852403639508787, + "exp4_aic": 32.74728386838651, + "exp4_cov": 1, + "exp4_rme": 1.0143301743393136, + "exp4_top": -1.536218042365886, + "exp5_aic": 34.70111771210726, + "exp5_cov": 1, + "exp5_rme": 1.0134565513089702, + "exp5_top": -1.5637566207089924, + "gnls_aic": 38.93400660033059, + "gnls_cov": 1, + "gnls_rme": 1.034443341409848, + "gnls_top": -0.09639462099752036, + "hill_aic": 34.71752150835012, + "hill_cov": 1, + "hill_rme": 1.0156361325302317, + "hill_top": -0.14277058589126485, + "poly1_er": -0.3904282715639928, + "poly2_er": -0.3885113969429605, + "pow_a_sd": 0.000007635522959665768, + "pow_ac50": 24.458147755686916, + "pow_p_sd": 0.639975040113934, + "all_onesd": 1.0063376519421736, + "exp2_a_sd": 0.02555615257745943, + "exp2_ac50": 26.529108697337612, + "exp2_b_sd": 25.57941425563839, + "exp3_a_sd": null, + "exp3_ac50": 26.099812908926182, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 94.86188101488622, + "exp5_ac50": 38.01553780063972, + "exp5_p_sd": 175.1469903178518, + "gnls_ac50": 0.005863101227685299, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.05553142030323221, + "hill_p_sd": 33.18967248654182, + "poly1_aic": 30.74302350258141, + "poly1_cov": 1, + "poly1_rme": 1.0142482587192818, + "poly1_top": -0.3052964061656891, + "poly2_aic": 32.706800555191634, + "poly2_cov": 1, + "poly2_rme": 1.0135546465438303, + "poly2_top": -0.3252376206529743, + "pow_er_sd": 0.3056178894168387, + "exp2_er_sd": 0.30593434754216753, + "exp3_er_sd": null, + "exp4_er_sd": 0.30493315529014337, + "exp4_ga_sd": 1415.862995217581, + "exp4_tp_sd": 20.95632072022936, + "exp5_er_sd": 0.30568017455861324, + "exp5_ga_sd": 1717.327449801869, + "exp5_tp_sd": 256.65062953004656, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.3082074518503941, + "hill_ga_sd": 0.1384923679951287, + "hill_tp_sd": 0.27120396237793026, + "poly1_a_sd": 0.02009033680518044, + "poly1_ac50": 14.999999999999998, + "poly2_a_sd": 0.0044102960138753585, + "poly2_ac50": 21.12046278082584, + "poly2_b_sd": 9.884046203612312, + "poly1_er_sd": 0.30494359178836106, + "poly2_er_sd": 0.306194068294261, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.2676524754092505 + }, + "mc5Param": { + "a": -0.010176546872189638, + "er": -0.3904282715639928, + "ac5": 1.4999999999999998, + "bmd": 133.399817199279, + "bmr": 1.3575494924699922, + "mll": -13.371511751290704, + "top": -0.3052964061656891, + "ac10": 2.9999999999999996, + "ac20": 5.999999999999999, + "ac50": 14.999999999999998, + "bmdl": 28.55532213605833, + "rmse": 1.0142482587192818, + "ac1sd": 98.88792972518829, + "caikwt": 0.7065033912112693, + "hitcall": 0.000015382110124750505, + "top_over_cutoff": 0.10820307390214838 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 9 + ] + } + } +] \ No newline at end of file diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/DTXSID7024827.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/DTXSID7024827.json new file mode 100644 index 00000000..021c2671 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/DTXSID7024827.json @@ -0,0 +1,217 @@ +[ + { + "aeid": 1390, + "m4id": 906160, + "spid": "TX007998", + "chid": 24827, + "casn": "69-09-0", + "chnm": "Chlorpromazine hydrochloride", + "dtxsid": "DTXSID7024827", + "bmad": 0.9405044150032765, + "respMax": 1.8515926973332988, + "respMin": -1.4281684306667, + "maxMean": 1.8515926973332988, + "maxMeanConc": 0.47712125471966244, + "maxMed": 1.8515926973332988, + "maxMedConc": 0.47712125471966244, + "logcMax": 1.4771212547196624, + "logcMin": -1.5228787452803376, + "nconc": 7, + "npts": 11, + "nrep": 2.0, + "nmedGtbl": 0, + "tmpi": 65, + "m5id": 6384466, + "modl": "poly1", + "hitc": 0.0024578389852192156, + "fitc": 13, + "coff": 2.8215132450098297, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.5228787452803376, + 1.4771212547196624, + 1, + 1, + 0, + -0.5228787452803376, + -1, + 0, + -0.5228787452803376, + -1, + 0.47712125471966244 + ], + "resp": [ + -0.9813260029999995, + 1.5374573823333009, + -1.4281684306667, + -0.32735703500000035, + -1.3241634073333994, + -1.0260995583333994, + -1.0514509676666997, + -0.5339457896666993, + 0.12475134633329965, + 0.19027474800000022, + 1.8515926973332988 + ] + }, + "mc4Param": { + "pow_a": -0.12566043650192105, + "pow_p": 0.3000000760970656, + "exp2_a": 0.00005409723692181811, + "exp2_b": 2.926433605638978, + "exp3_a": 0.0860553861034103, + "exp3_b": 25.39417577173585, + "exp3_p": 6.462227914321612, + "exp5_p": 7.999995501143407, + "gnls_p": 7.999999766002532, + "gnls_q": 5.893182343508286, + "hill_p": 7.999977254660707, + "pow_er": -0.02668788798634633, + "cnst_er": -0.00005587395876571964, + "exp2_er": -0.14143509239759122, + "exp3_er": -0.13812042333901542, + "exp4_er": -0.16122837373604454, + "exp4_ga": 0.0030000004459148624, + "exp4_tp": -0.4810580307329651, + "exp5_er": -0.014805216328310444, + "exp5_ga": 2.1980811936727713, + "exp5_tp": 0.531614971877592, + "gnls_er": -0.1375957170803842, + "gnls_ga": 27.127146335911107, + "gnls_la": 2743.9146424667124, + "gnls_tp": 2.2219107252768273, + "hill_er": -0.13751350433218543, + "hill_ga": 27.12725380446655, + "hill_tp": 2.221910837751462, + "poly1_a": 0.034174465728783694, + "poly2_a": 0.00000581387559022372, + "poly2_b": 0.0613437971523207, + "pow_aic": 40.730575914149746, + "pow_cov": 1, + "pow_rme": 1.108005849297976, + "pow_top": -0.34860615663608846, + "all_bmed": 0, + "cnst_aic": 36.88069322285861, + "cnst_rme": 1.0933976567217754, + "exp2_aic": 38.30484249916912, + "exp2_cov": 1, + "exp2_rme": 0.990514101299949, + "exp2_top": 1.5320750752034935, + "exp3_aic": 40.29939443038798, + "exp3_cov": 1, + "exp3_rme": 0.9903013443725064, + "exp3_top": 1.5355429734335535, + "exp4_aic": 38.95205323487634, + "exp4_cov": 1, + "exp4_rme": 1.0804367450037984, + "exp4_top": -0.4810580307329651, + "exp5_aic": 42.41773720168884, + "exp5_cov": 1, + "exp5_rme": 1.0680140469043815, + "exp5_top": 0.531614971877592, + "gnls_aic": 44.30150704437108, + "gnls_cov": 1, + "gnls_rme": 0.9903897984324356, + "gnls_top": 2.221910034969751, + "hill_aic": 40.301507223703744, + "hill_cov": 1, + "hill_rme": 0.9903898000887952, + "hill_top": 2.221910837751462, + "poly1_er": -0.04768893180125318, + "poly2_er": -0.1076996570720005, + "pow_a_sd": null, + "pow_ac50": 2.9763787168112, + "pow_p_sd": null, + "all_onesd": 1.0063376519421736, + "exp2_a_sd": 0.0005773152369056387, + "exp2_ac50": 27.9716541234155, + "exp2_b_sd": 3.052516069810458, + "exp3_a_sd": null, + "exp3_ac50": 28.87725370503856, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.0030000004459148624, + "exp5_ac50": 2.1980811936727713, + "exp5_p_sd": 27.739007083026586, + "gnls_ac50": 27.127144229078343, + "gnls_p_sd": 29.579967451529043, + "gnls_q_sd": 1225546.386380094, + "hill_ac50": 27.12725380446655, + "hill_p_sd": 29.553198047151273, + "poly1_aic": 37.96640788888903, + "poly1_cov": 1, + "poly1_rme": 1.0561318921086802, + "poly1_top": 1.0252339718635106, + "poly2_aic": 38.922635208397416, + "poly2_cov": 1, + "poly2_rme": 1.0160491957368996, + "poly2_top": 1.3933302600334307, + "pow_er_sd": null, + "exp2_er_sd": 0.2650852722288604, + "exp3_er_sd": null, + "exp4_er_sd": 0.2857915198655576, + "exp4_ga_sd": 0.02653437280711767, + "exp4_tp_sd": 0.3119497794295538, + "exp5_er_sd": 0.25462944166653867, + "exp5_ga_sd": 3.03566950705641, + "exp5_tp_sd": 0.7757908917924725, + "gnls_er_sd": 0.2654683915084613, + "gnls_ga_sd": 84.57292159743136, + "gnls_la_sd": 3264804642.55479, + "gnls_tp_sd": 18.273240826272417, + "hill_er_sd": 0.265475852091525, + "hill_ga_sd": 84.26162495005872, + "hill_tp_sd": 18.20715964440844, + "poly1_a_sd": 0.03019381035149349, + "poly1_ac50": 14.999999999999996, + "poly2_a_sd": 0.000005527708582237654, + "poly2_ac50": 21.204230920194803, + "poly2_b_sd": 0.022513901449174135, + "poly1_er_sd": 0.2597243178031879, + "poly2_er_sd": 0.26562527897815486, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2743.9149317779675 + }, + "mc5Param": { + "a": 0.034174465728783694, + "er": -0.04768893180125318, + "ac5": 1.4999999999999998, + "bmd": 39.724088248922826, + "bmr": 1.3575494924699922, + "mll": -16.983203944444515, + "top": 1.0252339718635106, + "ac10": 2.9999999999999996, + "ac20": 5.999999999999999, + "ac50": 14.999999999999996, + "bmdl": 16.683323649719604, + "rmse": 1.0561318921086802, + "ac1sd": 29.44706319416073, + "caikwt": 0.6324768555183732, + "hitcall": 0.0024578389852192156, + "top_over_cutoff": 0.3633631611252418 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 9 + ] + } + } +] diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/fakedtxsid.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/fakedtxsid.json new file mode 100644 index 00000000..41b42e67 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/fakedtxsid.json @@ -0,0 +1,3 @@ +[ + +] diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-m4id/0.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-m4id/0.json new file mode 100644 index 00000000..41b42e67 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-m4id/0.json @@ -0,0 +1,3 @@ +[ + +] diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-m4id/906160.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-m4id/906160.json new file mode 100644 index 00000000..a845c4a4 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-m4id/906160.json @@ -0,0 +1,215 @@ +{ + "aeid": 1390, + "m4id": 906160, + "spid": "TX007998", + "chid": 24827, + "casn": "69-09-0", + "chnm": "Chlorpromazine hydrochloride", + "dtxsid": "DTXSID7024827", + "bmad": 0.9405044150032765, + "respMax": 1.8515926973332988, + "respMin": -1.4281684306667, + "maxMean": 1.8515926973332988, + "maxMeanConc": 0.47712125471966244, + "maxMed": 1.8515926973332988, + "maxMedConc": 0.47712125471966244, + "logcMax": 1.4771212547196624, + "logcMin": -1.5228787452803376, + "nconc": 7, + "npts": 11, + "nrep": 2.0, + "nmedGtbl": 0, + "tmpi": 65, + "m5id": 6384466, + "modl": "poly1", + "hitc": 0.0024578389852192156, + "fitc": 13, + "coff": 2.8215132450098297, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.5228787452803376, + 1.4771212547196624, + 1, + 1, + 0, + -0.5228787452803376, + -1, + 0, + -0.5228787452803376, + -1, + 0.47712125471966244 + ], + "resp": [ + -0.9813260029999995, + 1.5374573823333009, + -1.4281684306667, + -0.32735703500000035, + -1.3241634073333994, + -1.0260995583333994, + -1.0514509676666997, + -0.5339457896666993, + 0.12475134633329965, + 0.19027474800000022, + 1.8515926973332988 + ] + }, + "mc4Param": { + "pow_a": -0.12566043650192105, + "pow_p": 0.3000000760970656, + "exp2_a": 0.00005409723692181811, + "exp2_b": 2.926433605638978, + "exp3_a": 0.0860553861034103, + "exp3_b": 25.39417577173585, + "exp3_p": 6.462227914321612, + "exp5_p": 7.999995501143407, + "gnls_p": 7.999999766002532, + "gnls_q": 5.893182343508286, + "hill_p": 7.999977254660707, + "pow_er": -0.02668788798634633, + "cnst_er": -0.00005587395876571964, + "exp2_er": -0.14143509239759122, + "exp3_er": -0.13812042333901542, + "exp4_er": -0.16122837373604454, + "exp4_ga": 0.0030000004459148624, + "exp4_tp": -0.4810580307329651, + "exp5_er": -0.014805216328310444, + "exp5_ga": 2.1980811936727713, + "exp5_tp": 0.531614971877592, + "gnls_er": -0.1375957170803842, + "gnls_ga": 27.127146335911107, + "gnls_la": 2743.9146424667124, + "gnls_tp": 2.2219107252768273, + "hill_er": -0.13751350433218543, + "hill_ga": 27.12725380446655, + "hill_tp": 2.221910837751462, + "poly1_a": 0.034174465728783694, + "poly2_a": 0.00000581387559022372, + "poly2_b": 0.0613437971523207, + "pow_aic": 40.730575914149746, + "pow_cov": 1, + "pow_rme": 1.108005849297976, + "pow_top": -0.34860615663608846, + "all_bmed": 0, + "cnst_aic": 36.88069322285861, + "cnst_rme": 1.0933976567217754, + "exp2_aic": 38.30484249916912, + "exp2_cov": 1, + "exp2_rme": 0.990514101299949, + "exp2_top": 1.5320750752034935, + "exp3_aic": 40.29939443038798, + "exp3_cov": 1, + "exp3_rme": 0.9903013443725064, + "exp3_top": 1.5355429734335535, + "exp4_aic": 38.95205323487634, + "exp4_cov": 1, + "exp4_rme": 1.0804367450037984, + "exp4_top": -0.4810580307329651, + "exp5_aic": 42.41773720168884, + "exp5_cov": 1, + "exp5_rme": 1.0680140469043815, + "exp5_top": 0.531614971877592, + "gnls_aic": 44.30150704437108, + "gnls_cov": 1, + "gnls_rme": 0.9903897984324356, + "gnls_top": 2.221910034969751, + "hill_aic": 40.301507223703744, + "hill_cov": 1, + "hill_rme": 0.9903898000887952, + "hill_top": 2.221910837751462, + "poly1_er": -0.04768893180125318, + "poly2_er": -0.1076996570720005, + "pow_a_sd": null, + "pow_ac50": 2.9763787168112, + "pow_p_sd": null, + "all_onesd": 1.0063376519421736, + "exp2_a_sd": 0.0005773152369056387, + "exp2_ac50": 27.9716541234155, + "exp2_b_sd": 3.052516069810458, + "exp3_a_sd": null, + "exp3_ac50": 28.87725370503856, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.0030000004459148624, + "exp5_ac50": 2.1980811936727713, + "exp5_p_sd": 27.739007083026586, + "gnls_ac50": 27.127144229078343, + "gnls_p_sd": 29.579967451529043, + "gnls_q_sd": 1225546.386380094, + "hill_ac50": 27.12725380446655, + "hill_p_sd": 29.553198047151273, + "poly1_aic": 37.96640788888903, + "poly1_cov": 1, + "poly1_rme": 1.0561318921086802, + "poly1_top": 1.0252339718635106, + "poly2_aic": 38.922635208397416, + "poly2_cov": 1, + "poly2_rme": 1.0160491957368996, + "poly2_top": 1.3933302600334307, + "pow_er_sd": null, + "exp2_er_sd": 0.2650852722288604, + "exp3_er_sd": null, + "exp4_er_sd": 0.2857915198655576, + "exp4_ga_sd": 0.02653437280711767, + "exp4_tp_sd": 0.3119497794295538, + "exp5_er_sd": 0.25462944166653867, + "exp5_ga_sd": 3.03566950705641, + "exp5_tp_sd": 0.7757908917924725, + "gnls_er_sd": 0.2654683915084613, + "gnls_ga_sd": 84.57292159743136, + "gnls_la_sd": 3264804642.55479, + "gnls_tp_sd": 18.273240826272417, + "hill_er_sd": 0.265475852091525, + "hill_ga_sd": 84.26162495005872, + "hill_tp_sd": 18.20715964440844, + "poly1_a_sd": 0.03019381035149349, + "poly1_ac50": 14.999999999999996, + "poly2_a_sd": 0.000005527708582237654, + "poly2_ac50": 21.204230920194803, + "poly2_b_sd": 0.022513901449174135, + "poly1_er_sd": 0.2597243178031879, + "poly2_er_sd": 0.26562527897815486, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2743.9149317779675 + }, + "mc5Param": { + "a": 0.034174465728783694, + "er": -0.04768893180125318, + "ac5": 1.4999999999999998, + "bmd": 39.724088248922826, + "bmr": 1.3575494924699922, + "mll": -16.983203944444515, + "top": 1.0252339718635106, + "ac10": 2.9999999999999996, + "ac20": 5.999999999999999, + "ac50": 14.999999999999996, + "bmdl": 16.683323649719604, + "rmse": 1.0561318921086802, + "ac1sd": 29.44706319416073, + "caikwt": 0.6324768555183732, + "hitcall": 0.0024578389852192156, + "top_over_cutoff": 0.3633631611252418 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 9 + ] + } +} diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-spid/TX007998.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-spid/TX007998.json new file mode 100644 index 00000000..021c2671 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-spid/TX007998.json @@ -0,0 +1,217 @@ +[ + { + "aeid": 1390, + "m4id": 906160, + "spid": "TX007998", + "chid": 24827, + "casn": "69-09-0", + "chnm": "Chlorpromazine hydrochloride", + "dtxsid": "DTXSID7024827", + "bmad": 0.9405044150032765, + "respMax": 1.8515926973332988, + "respMin": -1.4281684306667, + "maxMean": 1.8515926973332988, + "maxMeanConc": 0.47712125471966244, + "maxMed": 1.8515926973332988, + "maxMedConc": 0.47712125471966244, + "logcMax": 1.4771212547196624, + "logcMin": -1.5228787452803376, + "nconc": 7, + "npts": 11, + "nrep": 2.0, + "nmedGtbl": 0, + "tmpi": 65, + "m5id": 6384466, + "modl": "poly1", + "hitc": 0.0024578389852192156, + "fitc": 13, + "coff": 2.8215132450098297, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.5228787452803376, + 1.4771212547196624, + 1, + 1, + 0, + -0.5228787452803376, + -1, + 0, + -0.5228787452803376, + -1, + 0.47712125471966244 + ], + "resp": [ + -0.9813260029999995, + 1.5374573823333009, + -1.4281684306667, + -0.32735703500000035, + -1.3241634073333994, + -1.0260995583333994, + -1.0514509676666997, + -0.5339457896666993, + 0.12475134633329965, + 0.19027474800000022, + 1.8515926973332988 + ] + }, + "mc4Param": { + "pow_a": -0.12566043650192105, + "pow_p": 0.3000000760970656, + "exp2_a": 0.00005409723692181811, + "exp2_b": 2.926433605638978, + "exp3_a": 0.0860553861034103, + "exp3_b": 25.39417577173585, + "exp3_p": 6.462227914321612, + "exp5_p": 7.999995501143407, + "gnls_p": 7.999999766002532, + "gnls_q": 5.893182343508286, + "hill_p": 7.999977254660707, + "pow_er": -0.02668788798634633, + "cnst_er": -0.00005587395876571964, + "exp2_er": -0.14143509239759122, + "exp3_er": -0.13812042333901542, + "exp4_er": -0.16122837373604454, + "exp4_ga": 0.0030000004459148624, + "exp4_tp": -0.4810580307329651, + "exp5_er": -0.014805216328310444, + "exp5_ga": 2.1980811936727713, + "exp5_tp": 0.531614971877592, + "gnls_er": -0.1375957170803842, + "gnls_ga": 27.127146335911107, + "gnls_la": 2743.9146424667124, + "gnls_tp": 2.2219107252768273, + "hill_er": -0.13751350433218543, + "hill_ga": 27.12725380446655, + "hill_tp": 2.221910837751462, + "poly1_a": 0.034174465728783694, + "poly2_a": 0.00000581387559022372, + "poly2_b": 0.0613437971523207, + "pow_aic": 40.730575914149746, + "pow_cov": 1, + "pow_rme": 1.108005849297976, + "pow_top": -0.34860615663608846, + "all_bmed": 0, + "cnst_aic": 36.88069322285861, + "cnst_rme": 1.0933976567217754, + "exp2_aic": 38.30484249916912, + "exp2_cov": 1, + "exp2_rme": 0.990514101299949, + "exp2_top": 1.5320750752034935, + "exp3_aic": 40.29939443038798, + "exp3_cov": 1, + "exp3_rme": 0.9903013443725064, + "exp3_top": 1.5355429734335535, + "exp4_aic": 38.95205323487634, + "exp4_cov": 1, + "exp4_rme": 1.0804367450037984, + "exp4_top": -0.4810580307329651, + "exp5_aic": 42.41773720168884, + "exp5_cov": 1, + "exp5_rme": 1.0680140469043815, + "exp5_top": 0.531614971877592, + "gnls_aic": 44.30150704437108, + "gnls_cov": 1, + "gnls_rme": 0.9903897984324356, + "gnls_top": 2.221910034969751, + "hill_aic": 40.301507223703744, + "hill_cov": 1, + "hill_rme": 0.9903898000887952, + "hill_top": 2.221910837751462, + "poly1_er": -0.04768893180125318, + "poly2_er": -0.1076996570720005, + "pow_a_sd": null, + "pow_ac50": 2.9763787168112, + "pow_p_sd": null, + "all_onesd": 1.0063376519421736, + "exp2_a_sd": 0.0005773152369056387, + "exp2_ac50": 27.9716541234155, + "exp2_b_sd": 3.052516069810458, + "exp3_a_sd": null, + "exp3_ac50": 28.87725370503856, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.0030000004459148624, + "exp5_ac50": 2.1980811936727713, + "exp5_p_sd": 27.739007083026586, + "gnls_ac50": 27.127144229078343, + "gnls_p_sd": 29.579967451529043, + "gnls_q_sd": 1225546.386380094, + "hill_ac50": 27.12725380446655, + "hill_p_sd": 29.553198047151273, + "poly1_aic": 37.96640788888903, + "poly1_cov": 1, + "poly1_rme": 1.0561318921086802, + "poly1_top": 1.0252339718635106, + "poly2_aic": 38.922635208397416, + "poly2_cov": 1, + "poly2_rme": 1.0160491957368996, + "poly2_top": 1.3933302600334307, + "pow_er_sd": null, + "exp2_er_sd": 0.2650852722288604, + "exp3_er_sd": null, + "exp4_er_sd": 0.2857915198655576, + "exp4_ga_sd": 0.02653437280711767, + "exp4_tp_sd": 0.3119497794295538, + "exp5_er_sd": 0.25462944166653867, + "exp5_ga_sd": 3.03566950705641, + "exp5_tp_sd": 0.7757908917924725, + "gnls_er_sd": 0.2654683915084613, + "gnls_ga_sd": 84.57292159743136, + "gnls_la_sd": 3264804642.55479, + "gnls_tp_sd": 18.273240826272417, + "hill_er_sd": 0.265475852091525, + "hill_ga_sd": 84.26162495005872, + "hill_tp_sd": 18.20715964440844, + "poly1_a_sd": 0.03019381035149349, + "poly1_ac50": 14.999999999999996, + "poly2_a_sd": 0.000005527708582237654, + "poly2_ac50": 21.204230920194803, + "poly2_b_sd": 0.022513901449174135, + "poly1_er_sd": 0.2597243178031879, + "poly2_er_sd": 0.26562527897815486, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2743.9149317779675 + }, + "mc5Param": { + "a": 0.034174465728783694, + "er": -0.04768893180125318, + "ac5": 1.4999999999999998, + "bmd": 39.724088248922826, + "bmr": 1.3575494924699922, + "mll": -16.983203944444515, + "top": 1.0252339718635106, + "ac10": 2.9999999999999996, + "ac20": 5.999999999999999, + "ac50": 14.999999999999996, + "bmdl": 16.683323649719604, + "rmse": 1.0561318921086802, + "ac1sd": 29.44706319416073, + "caikwt": 0.6324768555183732, + "hitcall": 0.0024578389852192156, + "top_over_cutoff": 0.3633631611252418 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 9 + ] + } + } +] diff --git a/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-spid/fakespid.json b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-spid/fakespid.json new file mode 100644 index 00000000..41b42e67 --- /dev/null +++ b/tests/testthat/ctx/api-ccte.epa.gov/bioactivity/data/search/by-spid/fakespid.json @@ -0,0 +1,3 @@ +[ + +] diff --git a/tests/testthat/test-tcplConf.R b/tests/testthat/test-tcplConf.R index 966c1b4f..5b0eaedf 100644 --- a/tests/testthat/test-tcplConf.R +++ b/tests/testthat/test-tcplConf.R @@ -1,13 +1,29 @@ test_that("example=driver updates option TCPL_DRVR", { - tcplConf(drvr = "example") - expect_equal("example", - getOption("TCPL_DRVR")) + drvr <- "example" + tcplConf(drvr) + expect_equal(getOption("TCPL_DRVR"), + drvr) }) test_that("unsupported driver error message", { drvr <- "test" expect_error( tcplConf(drvr), - paste0(drvr," is not a supported database driver. Must be 'MySQL', 'tcplLite', or 'example'.") + paste0(drvr," is not a supported database driver. Must be 'MySQL', 'API', or 'example'.") ) +}) + +test_that("API driver no key error message", { + drvr <- "API" + expect_error( + tcplConf(drvr), + "'API' driver requires an API-key, supply it to the 'pass' parameter. To request a key, send an email to ccte_api@epa.gov." + ) +}) + +test_that("API driver properly sets URL", { + tcplConf(drvr = "API", pass = "api_key") + expect_equal(getOption("TCPL_HOST"), + "https://api-ccte.epa.gov/bioactivity" + ) }) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadAcid.R b/tests/testthat/test-tcplLoadAcid.R new file mode 100644 index 00000000..254a6a8f --- /dev/null +++ b/tests/testthat/test-tcplLoadAcid.R @@ -0,0 +1,37 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadAcid with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + assays <- tcplQueryAPI(resource = "assay") + test_that("tcplLoadAcid works by aeid", { + expect_no_error(dat <- tcplLoadAcid(fld = "aeid", val = test_api$aeid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("aeid", "acid", "acnm") %in% colnames(dat))) + expect_equal(dat$acid, test_api$acid) + }) + test_that("tcplLoadAcid works by non-id", { + expect_no_error(dat <- tcplLoadAcid(fld = c("intended_target_type", "detection_technology_type"), val = list(assays$intended_target_type[1], assays$detection_technology_type[1]))) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("intended_target_type", "detection_technology_type", "acid", "acnm") %in% colnames(dat))) + expect_equal(unique(dat$intended_target_type), assays$intended_target_type[1]) + expect_equal(unique(dat$detection_technology_type), assays$detection_technology_type[1]) + }) + #error cases + test_that("data not found results in null data.table", { + expect_no_error(dat <- tcplLoadAcid(fld = "aeid", val = 0)) + expect_equal(nrow(dat), 0) + }) + test_that("invalid field results in error", { + expect_error(dat <- tcplLoadAcid(fld = "awid", val = 0), "Query field\\(s\\) 'awid' not available. Try using from the following:*") + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadAeid.R b/tests/testthat/test-tcplLoadAeid.R new file mode 100644 index 00000000..1a4e0573 --- /dev/null +++ b/tests/testthat/test-tcplLoadAeid.R @@ -0,0 +1,37 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadAeid with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + assays <- tcplQueryAPI(resource = "assay") + test_that("tcplLoadAeid works by acid", { + expect_no_error(dat <- tcplLoadAeid(fld = "acid", val = test_api$acid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("acid", "aeid", "aenm") %in% colnames(dat))) + expect_equal(dat$aeid, test_api$aeid) + }) + test_that("tcplLoadAeid works by non-id", { + expect_no_error(dat <- tcplLoadAeid(fld = c("intended_target_type", "detection_technology_type"), val = list(assays$intended_target_type[1], assays$detection_technology_type[1]))) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("intended_target_type", "detection_technology_type", "aeid", "aenm") %in% colnames(dat))) + expect_equal(unique(dat$intended_target_type), assays$intended_target_type[1]) + expect_equal(unique(dat$detection_technology_type), assays$detection_technology_type[1]) + }) + #error cases + test_that("data not found results in null data.table", { + expect_no_error(dat <- tcplLoadAeid(fld = "acid", val = 0)) + expect_equal(nrow(dat), 0) + }) + test_that("invalid field results in error", { + expect_error(dat <- tcplLoadAeid(fld = "awid", val = 0), "Query field\\(s\\) 'awid' not available. Try using from the following:*") + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadAid.R b/tests/testthat/test-tcplLoadAid.R new file mode 100644 index 00000000..49006709 --- /dev/null +++ b/tests/testthat/test-tcplLoadAid.R @@ -0,0 +1,37 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadAid with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + assays <- tcplQueryAPI(resource = "assay") + test_that("tcplLoadAid works by aeid", { + expect_no_error(dat <- tcplLoadAid(fld = "aeid", val = test_api$aeid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("aeid", "aid", "anm") %in% colnames(dat))) + expect_equal(dat$aid, test_api$aid) + }) + test_that("tcplLoadAid works by non-id", { + expect_no_error(dat <- tcplLoadAid(fld = c("intended_target_type", "detection_technology_type"), val = list(assays$intended_target_type[1], assays$detection_technology_type[1]))) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("intended_target_type", "detection_technology_type", "aid", "anm") %in% colnames(dat))) + expect_equal(unique(dat$intended_target_type), assays$intended_target_type[1]) + expect_equal(unique(dat$detection_technology_type), assays$detection_technology_type[1]) + }) + #error cases + test_that("data not found results in null data.table", { + expect_no_error(dat <- tcplLoadAid(fld = "aeid", val = 0)) + expect_equal(nrow(dat), 0) + }) + test_that("invalid field results in error", { + expect_error(dat <- tcplLoadAid(fld = "awid", val = 0), "Query field\\(s\\) 'awid' not available. Try using from the following:*") + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadAsid.R b/tests/testthat/test-tcplLoadAsid.R new file mode 100644 index 00000000..4312dc16 --- /dev/null +++ b/tests/testthat/test-tcplLoadAsid.R @@ -0,0 +1,37 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadAsid with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + assays <- tcplQueryAPI(resource = "assay") + test_that("tcplLoadAsid works by aeid", { + expect_no_error(dat <- tcplLoadAsid(fld = "aeid", val = test_api$aeid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("aeid", "asid", "asnm") %in% colnames(dat))) + expect_equal(dat$asid, test_api$asid) + }) + test_that("tcplLoadAsid works by non-id", { + expect_no_error(dat <- tcplLoadAsid(fld = c("intended_target_type", "detection_technology_type"), val = list(assays$intended_target_type[1], assays$detection_technology_type[1]))) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("intended_target_type", "detection_technology_type", "asid", "asnm") %in% colnames(dat))) + expect_equal(unique(dat$intended_target_type), assays$intended_target_type[1]) + expect_equal(unique(dat$detection_technology_type), assays$detection_technology_type[1]) + }) + #error cases + test_that("data not found results in null data.table", { + expect_no_error(dat <- tcplLoadAsid(fld = "aeid", val = 0)) + expect_equal(nrow(dat), 0) + }) + test_that("invalid field results in error", { + expect_error(dat <- tcplLoadAsid(fld = "awid", val = 0), "Query field\\(s\\) 'awid' not available. Try using from the following:*") + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadChem.R b/tests/testthat/test-tcplLoadChem.R new file mode 100644 index 00000000..fa2c9e10 --- /dev/null +++ b/tests/testthat/test-tcplLoadChem.R @@ -0,0 +1,37 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadChem with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + assays <- tcplQueryAPI(resource = "assay") + test_that("tcplLoadChem works by spid", { + expect_no_error(dat <- tcplLoadChem(field = "spid", val = test_api$spid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("spid", "chid", "casn", "chnm", "dsstox_substance_id", "code") %in% colnames(dat))) + expect_equal(dat$spid, test_api$spid) + }) + test_that("exact is silently changed to TRUE if driver is API", { + expect_no_error(dat <- tcplLoadChem(field = "spid", val = test_api$spid, exact = FALSE)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("spid", "chid", "casn", "chnm", "dsstox_substance_id", "code") %in% colnames(dat))) + expect_equal(dat$spid, test_api$spid) + }) + #error cases + test_that("field can only be spid if driver is API", { + expect_error(tcplLoadChem(field = "chnm", val = "fakechnm"), "When drvr option is set to 'API', only 'spid' is a valid 'field' value.") + }) + test_that("data not found results in null data.table", { + expect_warning(dat <- tcplLoadChem(field = "spid", val = "fakespid"), "Data not found for the following 'fld' and 'val' combos: +SPID: fakespid") + expect_equal(nrow(dat), 0) + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadConcUnit.R b/tests/testthat/test-tcplLoadConcUnit.R new file mode 100644 index 00000000..404edb82 --- /dev/null +++ b/tests/testthat/test-tcplLoadConcUnit.R @@ -0,0 +1,26 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadConcUnit with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + test_that("tcplLoadConcUnit works by spid", { + expect_no_error(dat <- tcplLoadConcUnit(spid = test_api$spid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("spid", "conc_unit") %in% colnames(dat))) + expect_equal(dat$spid, test_api$spid) + }) + #error cases + test_that("data not found results in null data.table", { + expect_warning(dat <- tcplLoadConcUnit(spid = "fakespid"), "Data not found for the following 'fld' and 'val' combos: +SPID: fakespid") + expect_equal(nrow(dat), 0) + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplLoadData.R b/tests/testthat/test-tcplLoadData.R index c1d673a5..6565e3d0 100644 --- a/tests/testthat/test-tcplLoadData.R +++ b/tests/testthat/test-tcplLoadData.R @@ -156,6 +156,701 @@ test_that("mc example error message appears", { ) }) -# test_that("description", { -# expect_*(code) -# }) \ No newline at end of file + +#------------------------------------------------------------------------------- +# Covers testing tcplLoadData with "MySQL" driver +# new method using mocking for tcplQuery function +#------------------------------------------------------------------------------- + +# SC0 +test_that("tcplLoadData loads sc0 data for one s0id", { + data("sc_test") + mocked <- sc_test$sc0_by_s0id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = 0, fld = "s0id", val = mocked$s0id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s0id", "acid", "spid", "wllt", "wllq", "conc", "rval") %in% colnames(dat))) + expect_true(mocked$s0id %in% dat$s0id) +}) + +test_that("tcplLoadData loads sc0 data for one acid", { + data("sc_test") + mocked <- sc_test$sc0_by_acid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = 0, fld = "acid", val = mocked$acid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s0id", "acid", "spid", "wllt", "wllq", "conc", "rval") %in% colnames(dat))) + expect_true(mocked$acid %in% dat$acid) +}) + +# SC1 +test_that("tcplLoadData loads sc1 data for one s1id", { + data("sc_test") + mocked <- sc_test$sc1_by_s1id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = 1, fld = "s1id", val = mocked$s1id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s0id", "s1id", "acid", "aeid", "spid", "wllt", "wllq", "conc", "resp") %in% colnames(dat))) + expect_true(mocked$s1id %in% dat$s1id) +}) + +test_that("tcplLoadData loads sc1 data for one acid", { + data("sc_test") + mocked <- sc_test$sc1_by_acid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = 1, fld = "acid", val = mocked$acid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s0id", "s1id", "acid", "aeid", "spid", "wllt", "wllq", "conc", "resp") %in% colnames(dat))) + expect_true(mocked$acid %in% dat$acid) +}) + +# SC2 +test_that("tcplLoadData loads sc2 data for one s2id", { + data("sc_test") + mocked <- sc_test$sc2_by_s2id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = 2, fld = "s2id", val = mocked$s2id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s2id", "aeid", "spid", "bmad", "max_med", "coff", "hitc") %in% colnames(dat))) + expect_true(mocked$s2id %in% dat$s2id) +}) + +test_that("tcplLoadData loads sc2 data for one aeid", { + data("sc_test") + mocked <- sc_test$sc2_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = 2, fld = "aeid", val = mocked$aeid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s2id", "aeid", "spid", "bmad", "max_med", "coff", "hitc") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# SCagg +test_that("tcplLoadData loads sc 'agg' data for one aeid", { + data("sc_test") + mocked <- sc_test$scagg_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(type = "sc", lvl = "agg", fld = "aeid", val = mocked$aeid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("s0id", "s1id", "s2id", "acid", "aeid", "conc", "resp") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# MC0 +test_that("tcplLoadData loads mc0 data for one m0id", { + data("mc_test") + mocked <- mc_test$mc0_by_m0id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 0, fld = "m0id", val = mocked$m0id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "acid", "spid", "wllt", "wllq", "conc", "rval") %in% colnames(dat))) + expect_true(mocked$m0id %in% dat$m0id) +}) + +test_that("tcplLoadData loads mc0 data for one acid", { + data("mc_test") + mocked <- mc_test$mc0_by_acid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 0, fld = "acid", val = mocked$acid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "acid", "spid", "wllt", "wllq", "conc", "rval") %in% colnames(dat))) + expect_true(mocked$acid %in% dat$acid) +}) + +# MC1 +test_that("tcplLoadData loads mc1 data for one m1id", { + data("mc_test") + mocked <- mc_test$mc1_by_m1id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 1, fld = "m1id", val = mocked$m1id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "acid", "spid", "wllt", "wllq", "conc", "rval") %in% colnames(dat))) + expect_true(mocked$m1id %in% dat$m1id) +}) + +test_that("tcplLoadData loads mc1 data for one acid", { + data("mc_test") + mocked <- mc_test$mc1_by_acid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 1, fld = "acid", val = mocked$acid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "acid", "spid", "wllt", "wllq", "conc", "rval") %in% colnames(dat))) + expect_true(mocked$acid %in% dat$acid) +}) + +# MC2 +test_that("tcplLoadData loads mc2 data for one m2id", { + data("mc_test") + mocked <- mc_test$mc2_by_m2id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 2, fld = "m2id", val = mocked$m2id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "m2id", "acid", "spid", "wllt", "wllq", "conc", "rval", "cval") %in% colnames(dat))) + expect_true(mocked$m2id %in% dat$m2id) +}) + +test_that("tcplLoadData loads mc2 data for one acid", { + data("mc_test") + mocked <- mc_test$mc2_by_acid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 2, fld = "acid", val = mocked$acid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "m2id", "acid", "spid", "wllt", "wllq", "conc", "rval", "cval") %in% colnames(dat))) + expect_true(mocked$acid %in% dat$acid) +}) + +# MC3 +test_that("tcplLoadData loads mc3 data for one m3id", { + data("mc_test") + mocked <- mc_test$mc3_by_m3id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 3, fld = "m3id", val = mocked$m3id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "m2id", "m3id", "acid", "aeid", "spid", "wllt", "wllq", "conc", "rval", "resp") %in% colnames(dat))) + expect_true(mocked$m3id %in% dat$m3id) +}) + +test_that("tcplLoadData loads mc3 data for one aeid", { + data("mc_test") + mocked <- mc_test$mc3_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 3, fld = "aeid", val = mocked$aeid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "m2id", "m3id", "acid", "aeid", "spid", "wllt", "wllq", "conc", "rval", "resp") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# MC4 +test_that("tcplLoadData loads mc4 data for one m4id", { + data("mc_test") + mocked <- mc_test$mc4_by_m4id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 4, fld = "m4id", val = mocked$m4id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "aeid", "spid", "bmad", "nconc", "nrep", "cnst_aic") %in% colnames(dat))) + expect_true(mocked$m4id %in% dat$m4id) +}) + +test_that("tcplLoadData loads mc4 data for one aeid with add.fld = FALSE", { + data("mc_test") + mocked <- mc_test$mc4_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 4, fld = "aeid", val = mocked$aeid, add.fld = FALSE) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "aeid", "spid", "bmad", "nconc", "nrep") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# MC5 +test_that("tcplLoadData loads mc5 data for one m5id", { + data("mc_test") + mocked <- mc_test$mc5_by_m5id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 5, fld = "m5id", val = mocked$m5id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "nconc", "nrep", "modl", "hitc", "coff", "top") %in% colnames(dat))) + expect_true(mocked$m5id %in% dat$m5id) +}) + +test_that("tcplLoadData loads mc5 data for one aeid with add.fld = FALSE", { + data("mc_test") + mocked <- mc_test$mc5_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 5, fld = "aeid", val = mocked$aeid, add.fld = FALSE) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "nconc", "nrep", "modl", "hitc", "coff") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# MC6 +test_that("tcplLoadData loads mc6 data for one m6id", { + data("mc_test") + mocked <- mc_test$mc6_by_m6id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 6, fld = "m6id", val = mocked$m6id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "m6id", "aeid", "spid", "bmad", "nconc", "nrep", "flag") %in% colnames(dat))) + expect_true(mocked$m6id %in% dat$m6id) +}) + +test_that("tcplLoadData loads mc6 data for one aeid", { + data("mc_test") + mocked <- mc_test$mc6_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 6, fld = "aeid", val = mocked$aeid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "m6id", "aeid", "spid", "bmad", "nconc", "nrep", "flag") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# MC7 +test_that("tcplLoadData loads mc7 data for one m7id", { + data("mc_test") + mocked <- mc_test$mc7_by_m7id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 7, fld = "m7id", val = mocked$m7id) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m7id", "aeid", "spid", "bmad", "nconc", "nrep", "aed_val") %in% colnames(dat))) + expect_true(mocked$m7id %in% dat$m7id) +}) + +test_that("tcplLoadData loads mc7 data for one aeid", { + data("mc_test") + mocked <- mc_test$mc7_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = 7, fld = "aeid", val = mocked$aeid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m7id", "aeid", "spid", "bmad", "nconc", "nrep", "aed_val") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# MCagg +test_that("tcplLoadData loads mc 'agg' data for one aeid", { + data("mc_test") + mocked <- mc_test$mcagg_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplLoadData(lvl = "agg", fld = "aeid", val = mocked$aeid) + #expectations + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m0id", "m1id", "m2id", "m3id", "m4id", "acid", "aeid", "spid", + "conc", "resp", "bmad", "nconc", "nrep") %in% colnames(dat))) + expect_true(mocked$aeid %in% dat$aeid) +}) + +# error cases +test_that("invalid lvl and type error message", { + data("mc_test") + mocked <- mc_test$mcagg_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_error( + tcplLoadData(lvl = 5, type = "sc"), + "Invalid 'lvl' and 'type' combination." + ) +}) + +test_that("missing val error message", { + data("mc_test") + mocked <- mc_test$mcagg_by_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_error( + tcplLoadData(lvl = 5, type = "mc", fld = "aeid"), + "'val' cannot be NULL check that a valid value was provided for the specified field" + ) +}) + + +#------------------------------------------------------------------------------- +# Covers testing tcplLoadData with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and rerun this ENTIRE test file (temporarily +# replacing the 'apikey' string with a valid key) to repopulate the stored +# .jsons. These will likely be huge and will need to be edited by hand to reduce +# their sizes. To do this, open the file(s) and remove all but one element of +# the outer array -- we don't need more than one endpoint-sample. When editing +# down the files, it is recommended to make sure the same aeid is present in each +# selected endpoint-sample, or assay for the saved assay.json response, to make +# sure every test has its necessary data still available. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + test_that("level 3 API data loads by m4id", { + expect_no_error(dat <- tcplLoadData(lvl = 3, fld = "m4id", val = test_api$m4id, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("m4id", "spid", "conc", "aeid") %in% colnames(dat))) + expect_true(test_api$m4id %in% dat$m4id) + }) + test_that("level 3 API data loads by aeid", { + expect_no_error(dat <- tcplLoadData(lvl = 3, fld = "aeid", val = test_api$aeid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("aeid", "spid", "conc") %in% colnames(dat))) + expect_true(test_api$aeid %in% dat$aeid) + }) + test_that("level 3 API data loads by dtxsid", { + expect_no_error(dat <- tcplLoadData(lvl = 3, fld = "dtxsid", val = test_api$dtxsid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("dtxsid", "spid", "conc", "aeid") %in% colnames(dat))) + expect_true(test_api$dtxsid %in% dat$dtxsid) + }) + test_that("level 3 API data loads by spid", { + expect_no_error(dat <- tcplLoadData(lvl = 3, fld = "spid", val = test_api$spid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("aeid", "spid", "conc") %in% colnames(dat))) + expect_true(test_api$spid %in% dat$spid) + }) + test_that("level 4 API data loads by m4id", { + expect_no_error(dat <- tcplLoadData(lvl = 4, fld = "m4id", val = test_api$m4id, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("m4id", "aeid", "bmad", "spid", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$m4id %in% dat$m4id) + }) + test_that("level 4 API data loads by aeid", { + expect_no_error(dat <- tcplLoadData(lvl = 4, fld = "aeid", val = test_api$aeid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$aeid %in% dat$aeid) + }) + test_that("level 4 API data loads by dtxsid", { + expect_no_error(dat <- tcplLoadData(lvl = 4, fld = "dtxsid", val = test_api$dtxsid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("dtxsid", "spid", "m4id", "aeid", "bmad", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$dtxsid %in% dat$dtxsid) + }) + test_that("level 4 API data loads by spid", { + expect_no_error(dat <- tcplLoadData(lvl = 4, fld = "spid", val = test_api$spid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("spid", "m4id", "aeid", "bmad", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$spid %in% dat$spid) + }) + test_that("level 5 API data loads by m4id", { + expect_no_error(dat <- tcplLoadData(lvl = 5, fld = "m4id", val = test_api$m4id, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "modl", "hitc", "coff", "model_type") %in% colnames(dat))) + expect_true(test_api$m4id %in% dat$m4id) + }) + test_that("level 5 API data loads by aeid", { + expect_no_error(dat <- tcplLoadData(lvl = 5, fld = "aeid", val = test_api$aeid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "modl", "hitc", "coff", "model_type") %in% colnames(dat))) + expect_true(test_api$aeid %in% dat$aeid) + }) + test_that("level 5 API data loads by dtxsid", { + expect_no_error(dat <- tcplLoadData(lvl = 5, fld = "dtxsid", val = test_api$dtxsid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("dtxsid", "m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "modl", "hitc", "coff", "model_type") %in% colnames(dat))) + expect_true(test_api$dtxsid %in% dat$dtxsid) + }) + test_that("level 5 API data loads by spid", { + expect_no_error(dat <- tcplLoadData(lvl = 5, fld = "spid", val = test_api$spid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "modl", "hitc", "coff", "model_type") %in% colnames(dat))) + expect_true(test_api$spid %in% dat$spid) + }) + test_that("level 6 API data loads by m4id", { + expect_no_error(dat <- tcplLoadData(lvl = 6, fld = "m4id", val = test_api$m4id, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "flag") %in% colnames(dat))) + expect_true(test_api$m4id %in% dat$m4id) + }) + test_that("level 6 API data loads by aeid", { + expect_no_error(dat <- tcplLoadData(lvl = 6, fld = "aeid", val = test_api$aeid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "flag") %in% colnames(dat))) + expect_true(test_api$aeid %in% dat$aeid) + }) + test_that("level 6 API data loads by dtxsid", { + expect_no_error(dat <- tcplLoadData(lvl = 6, fld = "dtxsid", val = test_api$dtxsid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("dtxsid", "m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "flag") %in% colnames(dat))) + expect_true(test_api$dtxsid %in% dat$dtxsid) + }) + test_that("level 6 API data loads by spid", { + expect_no_error(dat <- tcplLoadData(lvl = 6, fld = "spid", val = test_api$spid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("m4id", "m5id", "aeid", "spid", "bmad", "max_med", "nconc", "nrep", "flag") %in% colnames(dat))) + expect_true(test_api$spid %in% dat$spid) + }) + test_that("agg level API data loads by m4id", { + expect_no_error(dat <- tcplLoadData(lvl = "agg", fld = "m4id", val = test_api$m4id, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("m4id", "aeid", "spid", "bmad", "logc", "resp", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$m4id %in% dat$m4id) + }) + test_that("agg level API data loads by aeid", { + expect_no_error(dat <- tcplLoadData(lvl = "agg", fld = "aeid", val = test_api$aeid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("m4id", "aeid", "spid", "bmad", "logc", "resp", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$aeid %in% dat$aeid) + }) + test_that("agg level API data loads by dtxsid", { + expect_no_error(dat <- tcplLoadData(lvl = "agg", fld = "dtxsid", val = test_api$dtxsid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("dtxsid", "m4id", "aeid", "spid", "bmad", "logc", "resp", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$dtxsid %in% dat$dtxsid) + }) + test_that("agg level API data loads by spid", { + expect_no_error(dat <- tcplLoadData(lvl = "agg", fld = "spid", val = test_api$spid, add.fld = FALSE)) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 1) + expect_true(all(c("m4id", "aeid", "spid", "bmad", "logc", "resp", "max_med", "nconc", "nrep") %in% colnames(dat))) + expect_true(test_api$spid %in% dat$spid) + }) + # error cases + test_that("more than one field results in error", { + expect_error(tcplLoadData(lvl = 5, fld = c("aeid", "spid"), val = list(test_api$aeid, test_api$spid), add.fld = FALSE), + "'fld' must be length 1") + }) + test_that("fields outside of dtxsid, aeid, m4id, spid result in error", { + expect_error(tcplLoadData(lvl = 3, fld = "acid", val = test_api$acid, add.fld = FALSE), + "'fld' must be one of 'AEID', 'SPID', 'm4id', or 'DTXSID'") + }) + test_that("levels other than 3-6 and 'agg' result in error", { + expect_error(tcplLoadData(lvl = 2, fld = "aeid", val = test_api$aeid, add.fld = FALSE), + "Only lvl = c(3,4,5,6) and 'agg' are supported using API data as source.", fixed = TRUE) + }) + test_that("type = 'sc' result in error", { + expect_error(tcplLoadData(type = "sc", lvl = 2, fld = "aeid", val = test_api$aeid, add.fld = FALSE), + "Only type = 'mc' is supported using API data as source.") + }) + test_that("data not found results in null data.table", { + expect_warning(dat <- tcplLoadData(lvl = 3, fld = "aeid", val = 0, add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +AEID: 0", fixed = TRUE) + expect_equal(nrow(dat), 0) + expect_warning(dat <- tcplLoadData(lvl = 4, fld = "spid", val = "fakespid", add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +SPID: fakespid", fixed = TRUE) + expect_equal(nrow(dat), 0) + expect_warning(dat <- tcplLoadData(lvl = 5, fld = "dtxsid", val = "fakedtxsid", add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +DTXSID: fakedtxsid", fixed = TRUE) + expect_equal(nrow(dat), 0) + expect_warning(dat <- tcplLoadData(lvl = 6, fld = "m4id", val = 0, add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +m4id: 0", fixed = TRUE) + expect_equal(nrow(dat), 0) + }) + test_that("some data not found results in warning", { + expect_warning(dat <- tcplLoadData(lvl = 3, fld = "aeid", val = c(0, test_api$aeid), add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +AEID: 0", fixed = TRUE) + expect_true(nrow(dat) > 0) + expect_warning(dat <- tcplLoadData(lvl = 4, fld = "spid", val = c("fakespid", test_api$spid), add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +SPID: fakespid", fixed = TRUE) + expect_true(nrow(dat) > 0) + expect_warning(dat <- tcplLoadData(lvl = 5, fld = "dtxsid", val = c("fakedtxsid", test_api$dtxsid), add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +DTXSID: fakedtxsid", fixed = TRUE) + expect_true(nrow(dat) > 0) + expect_warning(dat <- tcplLoadData(lvl = 6, fld = "m4id", val = c(0, test_api$m4id), add.fld = FALSE), + "Data not found for the following 'fld' and 'val' combos: +m4id: 0", fixed = TRUE) + expect_true(nrow(dat) > 0) + }) +}) diff --git a/tests/testthat/test-tcplLoadUnit.R b/tests/testthat/test-tcplLoadUnit.R new file mode 100644 index 00000000..1ea7f402 --- /dev/null +++ b/tests/testthat/test-tcplLoadUnit.R @@ -0,0 +1,25 @@ +#------------------------------------------------------------------------------- +# Covers testing tcplLoadUnit with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and follow the instructions in the test- +# tcplLoadData test file. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + test_that("tcplLoadUnit works by aeid", { + expect_no_error(dat <- tcplLoadUnit(aeid = test_api$aeid)) + expect_true(is.data.table(dat)) + expect_equal(nrow(dat), 1) + expect_true(all(c("aeid", "resp_unit") %in% colnames(dat))) + expect_equal(dat$aeid, test_api$aeid) + }) + #error cases + test_that("data not found results in null data.table", { + expect_no_error(dat <- tcplLoadUnit(aeid = 0)) + expect_equal(nrow(dat), 0) + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-tcplPlot.R b/tests/testthat/test-tcplPlot.R index 55e65081..8b28419a 100644 --- a/tests/testthat/test-tcplPlot.R +++ b/tests/testthat/test-tcplPlot.R @@ -1,3 +1,7 @@ +#------------------------------------------------------------------------------- +# old tests using drvr = "example" +#------------------------------------------------------------------------------- + tcplConf(drvr="example") if (!interactive()) pdf(NULL) @@ -7,153 +11,9 @@ test_that("round_n function works", { c("1.2e+03",NA,"0.333")) }) -test_that("check_tcpl_db_schema() loaded", { - expect_false( - (check_tcpl_db_schema()) - ) -}) - -test_that("error message works: 'No data for fld/val provided'", { - input <- NULL - expect_error( - if (nrow(input) == 0) stop("No data for fld/val provided") - ) -}) - -test_that("tcplPlot loads data", { - input <- tcplLoadData(lvl = 4, type = "mc") - expect_no_error( - if (nrow(input) == 0) stop("No data for fld/val provided") - ) -}) - -test_that("logic check works: assign multi=TRUE for output='pdf'", { - output <- "pdf" - multi <- NULL - if (output == "pdf" && is.null(multi)) { - multi <- TRUE - } - expect_true(multi) -}) - -test_that("logic check works: assign multi=FALSE for output != 'pdf', - verbose=FALSE for output='console'", { - output = 'console' - if (output !="pdf") { - multi <- FALSE - if(output =="console"){ - verbose <- FALSE - } - } - expect_false(multi) - expect_false(verbose) - }) - -test_that("logic check works: assign nrow = ncol = 1 for output='pdf' and - multi=FALSE to plot one plot per page", { - output = 'pdf' - multi = FALSE - input <- tcplLoadData(lvl = 4, type = "mc") - if(nrow(input) > 1 && output == "pdf" && multi == FALSE) { - nrow = ncol = 1 - } - expect_equal( - c(nrow,ncol), - c(1,1) - ) -}) - -test_that("error message: output = 'console' and multi = FALSE - to avoid multiple plots in console", { - input <- tcplLoadData(lvl = 4, type = "mc") - expect_error( - if(nrow(input) > 1 && output == "console" && multi == FALSE) stop("More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: ", nrow(input)) - ) -}) - - -test_that("nrow value set based on verbose", { - nrow = NULL - verbose = TRUE - if(is.null(nrow)){ - nrow <- ifelse(verbose,2,2) - } - expect_equal(nrow,2) -}) - -test_that("ncol value set based on verbose", { - ncol = NULL - verbose = FALSE - if(is.null(ncol)){ - ncol <- ifelse(verbose,2,3) - } - expect_equal(ncol,3) -}) - -test_that("m4id filters mc4 input", { - input <- tcplLoadData(lvl = 4, type = "mc") - m4id <- input$m4id - expect_length(m4id,5) -}) - -test_that("m4id filters mc5 input", { - input <- tcplLoadData(lvl = 5, type = "mc") - m4id <- input$m4id - expect_length(m4id,5) -}) - -test_that("dat table loads", { - lvl = 5 - l4 <- tcplLoadData(lvl = 4, type = "mc", add.fld = TRUE) - if (lvl >= 5L) { - l5 <- tcplLoadData(lvl = 5, type = "mc", add.fld = TRUE) - dat <- l4[l5, on = "m4id"] - } - expect_length(dat,length(l5)+length(l4)-1) -}) - -test_that("tcplPrepOtpt loads chemical and units", { - lvl = 5 - l4 <- tcplLoadData(lvl = 4, type = "mc", add.fld = TRUE) - if (lvl >= 5L) { - l5 <- mc_vignette[["mc5"]] - dat <- l4[l5, on = c("m4id","aeid")] - dat <- dat[,!c("tp","ga","q","la","ac50_loss")] - } - expect_length(dat,188) - expect_type(dat$dsstox_substance_id,"character") - expect_type(dat$conc_unit,"character") -}) - -test_that("unlog conc data table works", { - agg <- tcplLoadData(lvl = "agg", type = "mc") - conc_resp_table <- agg %>% - group_by(m4id) %>% - summarise(conc = list(10^logc), resp = list(resp)) %>% - as.data.table() - expect_true(is.data.table(conc_resp_table)) - expect_length(conc_resp_table,3) - expect_length(conc_resp_table$conc,5) -}) - -test_that("conc_resp_table joins dat table correctly", { - lvl = 5 - l4 <- tcplLoadData(lvl = 4, type = "mc", add.fld = TRUE) - if (lvl >= 5L) { - l5 <- tcplLoadData(lvl = 5, type = "mc", add.fld = TRUE) - dat <- l4[l5, on = "m4id"] - } - agg <- tcplLoadData(lvl = "agg", type = "mc") - conc_resp_table <- agg %>% - group_by(m4id) %>% - summarise(conc = list(10^logc), resp = list(resp)) %>% - as.data.table() - dat <- dat[conc_resp_table, on = "m4id"] - expect_length(dat,183) -}) test_that("one m4id tcplPlot works", { - skip_on_ci() + skip() lvl = 5 verbose = TRUE l4 <- tcplLoadData(lvl = 4, type = "mc", add.fld = TRUE) @@ -165,17 +25,19 @@ test_that("one m4id tcplPlot works", { agg <- tcplLoadData(lvl = "agg", type = "mc") conc_resp_table <- agg %>% group_by(m4id) %>% - summarise(conc = list(10^logc), resp = list(resp)) %>% + summarise(conc = list(conc), resp = list(resp)) %>% as.data.table() dat <- dat[conc_resp_table, on = "m4id"] dat <- dat[,normalized_data_type:="log2_fold_induction"] dat <- dat[spid == "01504209"] - mc5_tcplplot <- tcplggplot(dat,verbose = verbose) + mc5_tcplplot <- suppressWarnings(tcplggplot(dat,verbose = verbose)) expect_no_warning(mc5_tcplplot) vdiffr::expect_doppelganger("test_output_482273", mc5_tcplplot) }) +# needs updates or removal; new spid is not in downward direction test_that("negative direction plot has negative bmr and cutoff lines", { + skip() lvl = 5 verbose = FALSE l4 <- tcplLoadData(lvl = 4, type = "mc", add.fld = TRUE) @@ -187,33 +49,730 @@ test_that("negative direction plot has negative bmr and cutoff lines", { agg <- tcplLoadData(lvl = "agg", type = "mc") conc_resp_table <- agg %>% group_by(m4id) %>% - summarise(conc = list(10^logc), resp = list(resp)) %>% + summarise(conc = list(conc), resp = list(resp)) %>% as.data.table() dat <- dat[conc_resp_table, on = "m4id"] dat <- dat[,normalized_data_type:="log2_fold_induction"] - dat <- dat[spid == "1210314466"] - mc5_tcplplot <- tcplggplot(dat,verbose = verbose) + dat <- dat[spid == "01504209"] + mc5_tcplplot <- suppressWarnings(tcplggplot(dat,verbose = verbose)) vdiffr::expect_doppelganger("negative_cutoff_bmr", mc5_tcplplot) }) -test_that("coff,bmr should be negative if winning model has negative top", { - lvl = 5 - l4 <- tcplLoadData(lvl = 4, type = "mc", add.fld = TRUE) - if (lvl >= 5L) { - l5 <- tcplLoadData(lvl = 5, type = "mc", add.fld = TRUE) - dat <- l4[l5, on = "m4id"] - } - dat <- dat[spid == "1210314466"] - if (!is.null(dat$top) && !is.null(dat$coff) && !is.na(dat$top) && !is.null(dat$bmr)) { - if (dat$top < 0) { - dat$coff <- dat$coff * -1 - dat$bmr <- dat$bmr * -1 + +#------------------------------------------------------------------------------- +# new tests using drvr = "MySQL" and mocking +#------------------------------------------------------------------------------- +# Format +# test_that("something works", { + # data("mc_test") + # mocked <- mc_test$mc0_by_m0id # change this + # local_mocked_bindings( + # tcplQuery = function(query, db, tbl) { + # if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + # else mocked[query][[1]] + # } + # ) + # tcplConf(drvr = "MySQL", db = "invitrodb") # must include both +# }) + +# Test tcplPlotLoadData +test_that("tcplPlotLoadData loads all necessary mc data", { + data("mc_test") + mocked <- mc_test$plot_single_m4id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(val = mocked$m4id, flags = TRUE) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("dsstox_substance_id", "aenm", "m4id", "bmad", "hitc", "modl", + "cnst_aic", "flag", "ac50", "order", "conc", "resp", "conc_unit", + "resp_unit", "normalized_data_type") %in% colnames(dat))) + expect_true(mocked$m4id %in% dat$m4id) +}) + +test_that("tcplPlotLoadData loads all necessary sc data", { + data("sc_test") + mocked <- sc_test$plot_single_s2id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(type = "sc", fld = "s2id", val = mocked$s2id) + expect_true(is.data.table(dat)) + expect_true(nrow(dat) > 0) + expect_true(all(c("dsstox_substance_id", "aenm", "s2id", "bmad", "hitc", "max_med", + "order", "conc", "resp", "conc_unit", "coff", + "resp_unit", "normalized_data_type") %in% colnames(dat))) + expect_true(mocked$s2id %in% dat$s2id) +}) + +test_that("tcplPlotLoadData errors if type is not 'mc' or 'sc'", { + data("mc_test") + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_error(tcplPlotLoadData(type = "ms", val = 123, flags = TRUE), + "Invalid 'lvl' and 'type' combination.") +}) + +# Test tcplPlotValidate +test_that("tcplPlotValidate warns user if flags = TRUE and type = 'sc'", { + expect_warning(validated_params <- tcplPlotValidate(type = "sc",flags = TRUE,output = "pdf",multi = NULL,verbose = FALSE)) + expect_equal(validated_params, list(lvl = 2, type = "sc", flags = FALSE, output = "pdf", multi = TRUE, verbose = FALSE)) +}) + +test_that("tcplPlotValidate force assigns multi = FALSE and verbose = FALSE if output != pdf", { + validated_params <- tcplPlotValidate(type = "mc",flags = TRUE,output = "console",multi = TRUE,verbose = TRUE) + expect_equal(validated_params, list(lvl = 5, type = "mc", flags = TRUE, output = "console", multi = FALSE, verbose = FALSE)) +}) + +test_that("tcplPlotValidate doesn't change correctly assigned parameters", { + validated_params <- tcplPlotValidate(type = "mc",flags = TRUE,output = "pdf",multi = TRUE,verbose = TRUE) + expect_equal(validated_params, list(lvl = 5, type = "mc", flags = TRUE, output = "pdf", multi = TRUE, verbose = TRUE)) +}) + +# Test tcplPlotSetYRange +test_that("tcplPlotSetYRange validates range", { + # error cases + expect_error(tcplPlotSetYRange(dat=NULL,yuniform=FALSE,yrange=c(1,2,3),type="mc"), "'yrange' must be of length 2") + expect_error(tcplPlotSetYRange(dat=NULL,yuniform=FALSE,yrange=1,type="mc"), "'yrange' must be of length 2") + expect_error(tcplPlotSetYRange(dat=NULL,yuniform=FALSE,yrange=NULL,type="mc"), "'yrange' must be of length 2") + # validate existing set yrange and doesn't overwrite it regardless if yuniform is TRUE + expect_equal(tcplPlotSetYRange(dat=NULL,yuniform=FALSE,yrange=c(-100,100),type="mc"),c(-100,100)) + expect_equal(tcplPlotSetYRange(dat=NULL,yuniform=TRUE,yrange=c(-100,100),type="mc"),c(-100,100)) +}) + +test_that("tcplPlotSetYRange correctly sets yrange for mc data", { + data("mc_test") + mocked <- mc_test$plot_multiple_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(fld = "aeid", val = mocked$aeid, flags = TRUE) + expect_no_error(yrange <- tcplPlotSetYRange(dat=dat,yuniform=TRUE,yrange=c(NA,NA),type="mc")) + expect_length(yrange,2) + min <- min(dat$resp_min, unlist(dat$resp)) + max <- max(dat$resp_max, unlist(dat$resp)) + if (2 %in% dat$model_type) { + cutoffs <- dat[model_type == 2]$coff + min <- min(min, cutoffs, cutoffs * -1) + max <- max(max, cutoffs, cutoffs * -1) + } + # any gain models contained in dat, cutoff only positive + if (3 %in% dat$model_type) { + cutoffs <- dat[model_type == 3]$coff + min <- min(min, cutoffs) + max <- max(max, cutoffs) + } + # any loss models contained in dat, cutoff only negative + if (4 %in% dat$model_type) { + cutoffs <- dat[model_type == 4]$coff + min <- min(min, cutoffs * -1) + max <- max(max, cutoffs * -1) } - expect_lt(dat$coff,0) - expect_lt(dat$bmr,0) + expect_equal(yrange, c(min,max)) }) -# test_that("description", { -# expect_*(code) -# }) +test_that("tcplPlotSetYRange correctly sets yrange for sc data", { + data("sc_test") + mocked <- sc_test$plot_multiple_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(type = "sc", fld = "aeid", val = mocked$aeid) + expect_no_error(yrange <- tcplPlotSetYRange(dat=dat,yuniform=TRUE,yrange=c(NA,NA),type="sc")) + expect_length(yrange,2) + min <- min(dat$resp_min, unlist(dat$resp)) + max <- max(dat$resp_max, unlist(dat$resp)) + min <- min(min, dat$coff, dat$coff * -1) + max <- max(max, dat$coff, dat$coff * -1) + expect_equal(yrange, c(min,max)) +}) + +# Test tcplPlot - mc +test_that("tcplPlot works for single m4id", { + data("mc_test") + mocked <- mc_test$plot_single_m4id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple m4id", { + data("mc_test") + mocked <- mc_test$plot_multiple_m4id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 2") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single aeid", { + data("mc_test") + mocked <- mc_test$plot_single_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 2") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple aeid", { + data("mc_test") + mocked <- mc_test$plot_multiple_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "pdf", by = "aeid", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "pdf", flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "pdf", flags = TRUE, by = "aeid", multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 4") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 3) # exactly three files created (2 from `by = "aeid"` output) + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single spid/aeid", { + data("mc_test") + mocked <- mc_test$plot_single_spid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "console", verbose = TRUE, flags = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple spid/aeid", { + data("mc_test") + mocked <- mc_test$plot_multiple_spid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 2") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single m4id compared", { + data("mc_test") + mocked <- mc_test$plot_single_m4id_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id, output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple m4id compared", { + data("mc_test") + mocked <- mc_test$plot_multiple_m4id_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id, output = "pdf", flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 4") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single aeid compared", { + data("mc_test") + mocked <- mc_test$plot_single_aeid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 4") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple aeid compared", { + data("mc_test") + mocked <- mc_test$plot_multiple_aeid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "pdf", multi = TRUE, flags = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 8") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single spid/aeid compared", { + data("mc_test") + mocked <- mc_test$plot_single_spid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "pdf", multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "console", verbose = TRUE, flags = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple spid/aeid compared", { + data("mc_test") + mocked <- mc_test$plot_multiple_spid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "pdf", flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "mc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "console", verbose = TRUE, flags = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 4") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +# Test tcplPlot - sc +test_that("tcplPlot works for single s2id", { + data("sc_test") + mocked <- sc_test$plot_single_s2id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, output = "console", verbose = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple s2id", { + data("sc_test") + mocked <- sc_test$plot_multiple_s2id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 2") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single aeid", { + data("sc_test") + mocked <- sc_test$plot_single_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 7") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple aeid", { + data("sc_test") + mocked <- sc_test$plot_multiple_aeid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, by = "aeid", output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 14") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 3) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single spid/aeid", { + data("sc_test") + mocked <- sc_test$plot_single_spid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "console", verbose = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple spid/aeid", { + data("sc_test") + mocked <- sc_test$plot_multiple_spid + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 2") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single s2id compared", { + data("sc_test") + mocked <- sc_test$plot_single_s2id_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, compare.val = mocked$compare.s2id, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, compare.val = mocked$compare.s2id, output = "console", verbose = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple s2id compared", { + data("sc_test") + mocked <- sc_test$plot_multiple_s2id_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, compare.val = mocked$compare.s2id, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = "s2id", val = mocked$s2id, compare.val = mocked$compare.s2id, output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 4") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single aeid compared", { + data("sc_test") + mocked <- sc_test$plot_single_aeid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 14") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple aeid compared", { + data("sc_test") + mocked <- sc_test$plot_multiple_aeid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = "aeid", val = mocked$aeid, compare.val = mocked$compare.aeid, output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 28") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for single spid/aeid compared", { + data("sc_test") + mocked <- sc_test$plot_single_spid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "console", verbose = TRUE, multi = TRUE))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("tcplPlot works for multiple spid/aeid compared", { + data("sc_test") + mocked <- sc_test$plot_multiple_spid_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + expect_no_error(suppressWarnings(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + # console does not work with length(val) > 1 + expect_error(tcplPlot(type = "sc", fld = c("spid", "aeid"), val = list(mocked$spid, mocked$aeid), compare.val = list(mocked$compare.spid, mocked$compare.aeid), output = "console", verbose = TRUE, multi = TRUE), + "More than 1 concentration series returned for given field/val combination. Set output to pdf or reduce the number of curves to 1. Current number of curves: 4") + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +# Stand-alone plotting +test_that("standalone plotting works in mc", { + data("mc_test") + mocked <- mc_test$plot_single_m4id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(val = mocked$m4id, flags = TRUE) + expect_no_error(suppressWarnings(tcplPlot(dat = dat, type = "mc", fld = "m4id", val = mocked$m4id, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("standalone advanced comparison plotting works in mc", { + data("mc_test") + mocked <- mc_test$plot_single_m4id_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") mc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(val = mocked$m4id, flags = TRUE) + expect_no_error(suppressWarnings(tcplPlot(dat = dat, type = "mc", fld = "m4id", val = mocked$m4id, compare.val = mocked$compare.m4id , output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("standalone plotting works in sc", { + data("sc_test") + mocked <- sc_test$plot_single_s2id + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(type = "sc", fld = "s2id", val = mocked$s2id) + expect_no_error(suppressWarnings(tcplPlot(dat = dat, type = "sc", fld = "s2id", val = mocked$s2id, output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + +test_that("standalone advanced comparison plotting works in sc", { + data("sc_test") + mocked <- sc_test$plot_single_s2id_compare + local_mocked_bindings( + tcplQuery = function(query, db, tbl) { + if (query == "SHOW VARIABLES LIKE 'max_allowed_packet'") sc_test$tcplConfQuery + else mocked[query][[1]] + } + ) + tcplConf(drvr = "MySQL", db = "invitrodb") # must include both + dat <- tcplPlotLoadData(type = "sc", fld = "s2id", val = mocked$s2id) + expect_no_error(suppressWarnings(tcplPlot(dat = dat, type = "sc", fld = "s2id", val = mocked$s2id, compare.val = mocked$compare.s2id , output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up +}) + + + +#------------------------------------------------------------------------------- +# Covers testing tcplLoadData with "API" driver +# Using httptest mocking to automatically save json responses from http requests +# NOTE -- updates to the CTX API may mean stored json files are out of date. In +# this case, delete the 'ctx' folder and rerun this ENTIRE test file (temporarily +# replacing the 'apikey' string with a valid key) to repopulate the stored +# .jsons. These will likely be huge and will need to be edited by hand to reduce +# their sizes. To do this, open the file(s) and remove all but one element of +# the outer array -- we don't need more than one endpoint-sample. +#------------------------------------------------------------------------------- +httptest::with_mock_dir("ctx", { + apikey <- "apikey" + tcplConf(pass = apikey, + drvr = "API") + data(test_api) + test_that("tcplPlot works with API data by m4id", { + expect_no_error(suppressWarnings(tcplPlot(val = test_api$m4id, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up + }) + test_that("tcplPlot works with API data by aeid", { + expect_no_error(suppressWarnings(tcplPlot(fld = "aeid", val = test_api$aeid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up + }) + test_that("tcplPlot works with API data by spid", { + expect_no_error(suppressWarnings(tcplPlot(fld = "spid", val = test_api$spid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up + }) + test_that("tcplPlot works with API data by dtxsid", { + expect_no_error(suppressWarnings(tcplPlot(fld = "dtxsid", val = test_api$dtxsid, output = "pdf", verbose = TRUE, flags = TRUE, multi = TRUE, fileprefix = "temp_tcplPlot"))) + fn <- stringr::str_subset(list.files(), "^temp_tcplPlot") + expect_length(fn, 1) # exactly one file created + file.remove(fn) # clean up + }) +}) \ No newline at end of file diff --git a/vignettes/Assay_Registration.Rmd b/vignettes/Assay_Registration.Rmd deleted file mode 100644 index 86a17719..00000000 --- a/vignettes/Assay_Registration.Rmd +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: tcpl 3.0
Assay Registration
-author: "Center for Computational Toxicology and Exposure" -output: - prettydoc::html_pretty: - theme: architect - toc: yes - toc_depth: 4 -vignette: > - %\VignetteIndexEntry{Assay Registration} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -```{r, include = FALSE} -knitr::opts_chunk$set( - collapse = TRUE, - comment = "#>" -) -``` - -```{r setup, echo = FALSE, message = FALSE} -library(tcpl) -``` - -# Introduction -This vignette provides an overview of assay registration process for the tcpl package. The definition of an "assay" is, for the purposes of this package, broken into:
- -       **assay_source** -- the vendor/origination of the data
-       **assay** -- the procedure to generate the component data
-       **assay_component** -- the raw data readout(s)
-       **assay_component_endpoint** -- the normalized component data
- -## Hierarchical Structure - -Assay source, assay, assay component, and assay endpoint are registered via tcpl scripting into a collection of tables. These assay element tables broadly describe who conducted the assay, what platform was used, what was being measured (raw readout), and how the measurement was interpreted (normalized component data). A hierarchical structure of the assay elements is as follows: assay source > assay > assay component > assay component endpoint. - -As one moves down the hierarchy, each additional level has a ‘one-to-many’ relationship with the previous level. For example, an assay component can have multiple assay endpoints, but an assay endpoint can derive only from a single assay component. From a database v3.4 snapshot taken in December 2020, InvitroDB supported 32 assay sources, 763 assays, 2074 components, and 2780 endpoints. - -## Minimum Required Fields -Throughout the tcpl R package, the levels of assay hierarchy are defined and referenced by their auto-incremented primary keys in the tcpl database: $\mathit{asid}$ (assay source ID), $\mathit{aid}$ (assay ID), $\mathit{acid}$ (assay component ID), and $\mathit{aeid}$ (assay endpoint ID). These abbreviations mirror the abbreviations for the identifiers (ids) with “nm” in place of “id” in the abbreviations, e.g. assay\_component\_name is abbreviated $\mathit{acnm}$. - -The tcpl R package provides three functions for adding new data: - -       **tcplRegister** -- to register a new assay element or chemical
-       **tcplUpdate** -- to change or add additional information for existing assay or chemical ids
-       **tcplWriteLvl0** -- to load formatted source data
- -All processing occurs by assay component or assay endpoint, depending on the processing type (single-concentration or multiple-concentration) and level. No data is stored at the assay or assay source level. The “assay” and “assay_source” tables store annotations to help in the processing and down-stream understanding of the data. Additional details for registering each assay element and updating annotations are provided below. In addition to each assay element’s id, the minimal registration fields in order to ‘pipeline’ are: $\mathit{assay\_source\_name}$ ($\mathit{asnm}$), $\mathit{assay\_name}$ ($\mathit{anm}$), $\mathit{assay\_footprint}$, $\mathit{assay\_component\_name}$ ($\mathit{acnm}$), $\mathit{assay\_component\_endpoint\_name}$ ($\mathit{aenm}$), and $\mathit{normalized\_data\_type}$. - -# Naming Conventions -## Assay Source -Assay source refers to the vendor or origination of the data. **To register an assay source, an unused $\mathit{asid}$ must be selected to prevent overwriting of existing data.** When adding a new assay source, this should be an abbreviation, as subsequent levels will build on this assay source name. -```{r eval = TRUE, message = FALSE} -#tcplLoadAsid() -#tcplRegister(what = "asid", flds = list(asid = 1, asnm = "Tox21")) -``` -The tcplRegister function takes the abbreviation for $\mathit{assay\_source\_name}$, but the function will also take the unabbreviated form. The same is true of the tcplLoadA- functions, which load the information for the assay annotations stored in the database. - -## Assay -Assay refers to the procedure, conducted by some vendor, to generate the component data. **To register an assay, an $\mathit{asid}$ must be provided to map the assay to the correct assay source.** One source may have many assays. To ensure consistency of the naming convention, first check how other registered assays within the assay source were conducted and named. The assay names follow an abbreviated and flexible naming convention of *Source_Assay*. Notable assay design features to describe the assay include: - -* Technology (i.e., detection technology), -* Format (e.g., organism, tissue, cell short name, or cell free component source name), -* Target (i.e., intended target, intended target family, gene), or -* Objective aspects (e.g., timepoint or assay footprint). - -The most distinguishing features will be selected to create a succinct assay name. Variation depends on the assay itself as well as other assays provided by the vendor. If multiple features are needed to describe an assay, order will be based on relative importance in describing the assay and the assay’s relation to other assays provided by the vendor to limit confusion. “Source_Technology_Format_Target” is a commonly used naming order. However, if one target is screened on different assay platforms by the vendor, “Source_Target_Technology” is a more appropriate naming convention. This is the case for the Tox21 assays. Additional features may be relevant, including agonist or antagonist mode, or “Follow-up” if the assay is a secondary specificity assay. Conversely, some assays utilize a cell-based format to screen a functional profile of targets. These assays follow a naming convention, *Source_Format*, where specific target information is defined at the component and endpoint level. Bioseek and Attagene are sources that provide cell-based assays. Considering the diversity of the data sources and high throughput assays in ToxCast, a flexible naming approach is best used in conjunction with subject matter expert discretion. -```{r eval = TRUE, message = FALSE} -#tcplLoadAid(what = "asid", val=1) -#tcplRegister(what = "aid", -# flds = list(asid = 1, -# anm = "TOX21_ERa_BLA_Agonist", -# assay_footprint = "1536 well")) -``` -When registering an assay ($\mathit{aid}$), the user must give an $\mathit{asid}$ to map the assay to the correct assay source. Registering an assay, in addition to an assay\_name ($\mathit{anm}$) and $\mathit{asid}$, requires $\mathit{assay\_footprint}$. The $\mathit{assay\_footprint}$ field is used in the assay plate visualization functions (discussed later) to define the appropriate plate size. The $\mathit{assay\_footprint}$ field can take most string values, but only the numeric value will be extracted, e.g. the text string "hello 384" would indicate to draw a 384-well microtitier plate. Values containing multiple numeric values in $\mathit{assay\_footprint}$ may cause errors in plotting plate diagrams. - -## Assay Component Registration -Assay component, or “component” for short, describes the raw data readouts. Like the previous level, one assay may have many components. **To register an assay component and create an $\mathit{acid}$, an $\mathit{aid}$ must be provided to map the component to the correct assay.** The assay component name will build on its respective assay name, to describe the specific feature being measured in each component. If there is only one component, the component name can be the same as the assay name. If there are multiple components measured in an assay, understanding the differences, and how one component may relate to another within an assay, are important naming considerations to prevent confusion. Assay component names will usually follow the naming convention of *Source_Assay_Component*, where “Component” is a brief description of what is being measured. -```{r eval = TRUE, message = FALSE} -#tcplLoadAcid(what = "asid", val=1, add.fld=c("aid", "anm")) -#tcplRegister(what = "acid", -# flds = list(aid = 1, -# acnm = "TOX21_ERa_BLA_Agonist_ratio")) -``` -The final piece of assay information needed is the assay component source name (abbreviated $\mathit{acsn}$), stored in the "assay_component_map" table. The assay component source name is intended to simplify level 0 pre-processing by defining unique character strings (concatenating information if necessary) from the source files that identify the specific assay components. An assay component can have multiple $\mathit{acsn}$ values, but an $\mathit{acsn}$ must be unique to one assay component. Assay components can have multiple $\mathit{acsn}$ values to minimize the amount of data manipulation required (and therefore potential errors) during the level 0 pre-processing if assay source files change or are inconsistent. The unique character strings ($\mathit{acsn}$) get mapped to $\mathit{acid}$. -```{r eval = TRUE, message = FALSE} -#tcplRegister(what = "acsn", flds = list(acid = 1, acsn = "TCPL-MC-Demo")) -``` - -## Assay Component Endpoint Registration -Assay component endpoint, or “endpoint” for short, represents the normalized component data. **To register an endpoint and create an $\mathit{aeid}$, an $\mathit{acid}$ must be provided to map the endpoint to the correct component.** In past tcpl versions, each component could have up to two endpoints therefore endpoint names would express directionality (*_up/_down*). tcpl_v3 allows bidirectional fitting to capture both the gain and loss of signal. Therefore for tcpl_v3 onward, the endpoint name will usually be the same as the component name. -```{r eval = TRUE, message = FALSE} -#tcplLoadAeid(fld="asid",val=1, add.fld = c("aid", "anm", "acid", "acnm")) -#tcplRegister(what = "aeid", -# flds = list(acid = 1, -# aenm = "TOX21_ERa_BLA_Agonist_ratio", -# normalized_data_type = "percent_activity", -# export_ready = 1, -# burst_assay = 0, -# fit_all = 0)) -``` -Notice registering an assay endpoint also requires the $\mathit{normalized\_data\_type}$ field. The $\mathit{normalized\_data\_type}$ field gives some default values for plotting. Currently, the package supports three $\mathit{normalized\_data\_type}$ values: (1) percent_activity, (2) log2_fold_induction, and (3) log10_fold_induction. Any other values will be treated as "percent_activity." - -The other three additional fields when registering an assay endpoint do not have to be explicitly defined when working in the MySQL environment and will default to the values given above. All three fields represent Boolean values (1 or 0, 1 being TRUE ). The $\mathit{export\_ready}$ field indicates (1) the data is done and ready for export or (0) still in progress. The $\mathit{burst\_assay}$ field is specific to multiple-concentration processing and indicates (1) the assay endpoint is included in the burst distribution calculation or (0) not. The $\mathit{fit\_all}$ field is specific to multiple-concentration processing and indicates (1) the package should try to fit every concentration series, or (0) only attempt to fit concentration series that show evidence of activity. - -# Naming Revision -There are circumstances where assay, assay component, and assay endpoint names change. The $\mathit{aid}$, $\mathit{acid}$, and $\mathit{aeid}$ are considered more stable in the database, and these auto-incremented keys should not change. To revise naming for assay elements, the correct id must be specified in the tcplUpdate statement to prevent overwriting data. - -```{r eval = TRUE, message = FALSE} -# tcplUpdate(what = "acid", -# flds = list(aid = 1, -# acnm = "TOX21_ERa_BLA_Agonist_ratio")) -``` - -Reasons for name changes could include: - -* Feedback from subject matter experts or assay data generators; -* Clarifications on cell line and cell line drift; -* Addition of new assay data that makes the old naming convention insufficient, such as antagonist assays run with different concentrations of an agonist; or -* Laboratory or Center reorganizations. - -Thus, users should be advised that while assay naming is used to infer information about the biology of the assay, assay naming will change over time to reflect progress in building ToxCast as a data resource. \ No newline at end of file diff --git a/vignettes/Data_processing-Archive_tcpl_v2.Rmd b/vignettes/Data_processing-Archive_tcpl_v2.Rmd deleted file mode 100644 index fa2aadeb..00000000 --- a/vignettes/Data_processing-Archive_tcpl_v2.Rmd +++ /dev/null @@ -1,912 +0,0 @@ ---- -title: tcpl 2.0
Data Processing
-author: "National Center for Computational Toxicology, US EPA" -output: - prettydoc::html_pretty: - theme: architect - toc: yes - toc_depth: 4 -vignette: > - %\VignetteIndexEntry{tcpl 2.0 Data Processing} - %\VignetteEngine{knitr::rmarkdown} - %\usepackage[utf8]{inputenc} ---- - - - - - - - -```{r eval = TRUE, echo = FALSE, message = FALSE} -library(htmlTable) -library(tcpl) -library(data.table) - -``` -```{r eval = TRUE, echo = FALSE, message = FALSE, results = "hide"} -## This chunk copies the tcplLite local directory to the temp directory used in installation -## to comply with CRAN policies on not writing to the installation directory -tmpdir <- tempdir() -#dbfile <- file.path(system.file(package = "tcpl"), "csv") -#file.copy(from = dbfile, tmpdir, recursive = TRUE) -dbfile_temp <- file.path(tmpdir, "csv") -dir.create(dbfile_temp, showWarnings = F) -tcplConf(db = dbfile_temp, drvr = 'tcplLite') - -``` - -```{r eval = TRUE, echo = FALSE, message = FALSE} -tcplRegister(what='spid', flds = list(spid=c("Tox21_303655", "Tox21_110011", "Tox21_400081", "DMSO", "Tox21_400037"), - chid=c("22364", "23463", "24102", "21735", "20283"), - tested_conc_unit=c('uM', 'uM', 'uM', 'uM', 'uM') - - ) ) -tcplRegister(what='chid', flds=list(chid = c("22364", "23463" , "24102", "21735","20283"), - casn = c("521-18-6", "150-30-1", "22224-92-6", "67-68-5", "95-83-0"), - chnm = c("5alpha-Dihydrotestosterone","Phenylalanine","Fenamiphos", -"Dimethyl sulfoxide","4-Chloro-1,2-diaminobenzene"), - dsstox_substance_id = c("DTXSID9022364", "DTXSID9023463", "DTXSID3024102", "DTXSID2021735", "DTXSID5020283"), - code = c("C521186","C150301","C22224926", "C67685","C95830"))) -``` - - - - -# Uploading and Processing Data - -This vignette explains in the first section how to register and upload new data into the tcpl local directory using a small subset of ToxCast data showing changes in the activity of the intracellular estrogen receptor. The following section discusses how to process the registered data through the data analysis pipeline. - -The tcpl package provides three functions for adding new data: (1) tcplRegister to register a new assay or chemical ID, (2) tcplUpdate to change or add additional information for existing assay or chemical IDs, and (3) tcplWriteLvl0 for loading data. Before writing any data to the tcpl database, the user has to register the assay and chemical information. - -## A. Register and Upload New Data - - -The first step in registering new assays is to register the assay source. As discussed in the previous section, the package refers to the levels of the assay hierarchy by their ID names, e.g. $\mathit{asid}$ for assay source.The following code shows how to register an assay source, then ensure the assay source was properly registered. - -```{r eval = TRUE, message = FALSE} -## Add a new assay source, call it CTox, -## that produced the data -tcplRegister(what = "asid", flds = list(asid = 1, - asnm = "CTox")) -``` - -```{r eval = TRUE} -tcplLoadAsid() -``` - -The tcplRegister function takes the abbreviation for $\mathit{assay\_source\_name}$, but the function will also take the unabbreviated form. The same is true of the tcplLoadA- functions, which load the information for the assay annotations stored in the database. The next steps show how to register, in order, an assay, assay component, and assay endpoints. -```{r eval = TRUE, message = FALSE} -tcplRegister(what = "aid", - flds = list(asid = 1, - anm = "TOX21_ERa_BLA_Agonist", - assay_footprint = "1536 well")) -``` - -When registering an assay ($\mathit{aid}$), the user must give an $\mathit{asid}$ to map the assay to the correct assay source. Registering an assay, in addition to an assay\_name ($\mathit{anm}$) and $\mathit{asid}$, requires $\mathit{assay\_footprint}$. The $\mathit{assay\_footprint}$ field is used in the assay plate visualization functions (discussed later) to define the appropriate plate size. The $\mathit{assay\_footprint}$ field can take most string values, but only the numeric value will be extracted, e.g. the text string "hello 384" would indicate to draw a 384-well microtitier plate. Values containing multiple numeric values in $\mathit{assay\_footprint}$ may cause errors in plotting plate diagrams. - -With the assay registered, the next step is to register an assay component. The example data presented here only contains data for one assay component, but at this step the user could add multiple assay components to the assay. - -```{r eval = TRUE, message = FALSE} -tcplRegister(what = "acid", - flds = list(aid = 1, - acnm = "TOX21_ERa_BLA_Agonist_ratio")) -tcplRegister(what = "aeid", - flds = list(acid = c(1, 1), - aenm = c("TOX21_ERa_BLA_Agonist_ratio_gain", - "TOX21_ERa_BLA_Agonist_ratio_loss"), - normalized_data_type = - rep("percent_activity", 1), - export_ready = c(1, 1), - burst_assay = c(0, 0), - fit_all = c(0, 0))) -``` -In the example above, two assay endpoints were assigned to the assay component. Multiple endpoints allow for different normalization approaches of the data, in this case to detect activity in both the positive and negative directions (up and down). Notice registering an assay endpoint also requires the $\mathit{normalized\_data\_type}$ field. The $\mathit{normalized\_data\_type}$ field gives some default values for plotting. Currently, the package supports three $\mathit{normalized\_data\_type}$ values: (1) percent_activity, (2) log2_fold_induction, and (3) log10_fold_induction. Any other values will be treated as "percent_activity." - -The other three additional fields when registering an assay endpoint do not have to be explicitly defined when working in the MySQL environment and will default to the values given above. All three fields represent Boolean values (1 or 0, 1 being TRUE ). The $\mathit{export\_ready}$ field indicates (1) the data is done and ready for export or (0) still in progress. The $\mathit{burst\_assay}$ field is specific to multiple-concentration processing and indicates (1) the assay endpoint is included in the burst distribution calculation or (0) not (Appendix C). The $\mathit{fit\_all}$ field is specific to multiple-concentration processing and indicates (1) the package should try to fit every concentration series, or (0) only attempt to fit concentration series that show evidence of activity. - -The final piece of assay information needed is the assay component source name (abbreviated $\mathit{acsn}$), stored in the "assay_component_map" table. The assay component source name is intended to simplify level 0 pre-processing by defining unique character strings (concatenating information if necessary) from the source files that identify the specific assay components. The unique character strings ($\mathit{acsn}$) get mapped to $\mathit{acid}$. An example of how to register a new $\mathit{acsn}$ will be given later in this section. - -With the minimal assay information registered, the next step is to register the necessary chemical and sample information. The "chdat" dataset included in the package contains the sample and chemical information for the data that will be loaded. The following shows an example of how to load chemical information. Similar to the order in registering assay information, the user must first register chemicals, then register the samples that map to the corresponding chemical. - - -```{r eval = TRUE} -data(chdat, package = "tcpl") -setDT(chdat) -head(chdat) -``` -```{r eval = TRUE, message = FALSE} -## Register the unique chemicals -cmap <- tcplLoadChem() # Chemicals already registered -chdat.register <- chdat[!(chdat$code %in% cmap$code)] # Chemicals in chdat that are not registered yet - -tcplRegister(what = "chid", - flds = chdat.register[, - unique(.SD), - .SDcols = c("casn", "chnm", "dsstox_substance_id", "code", "chid")]) -``` - -The "chdat" dataset contains a map of sample to chemical information, but chemical and sample information have to be registered separately because a chemical could potentially have multiple samples. Registering chemicals only takes a chemical CAS registry number ($\mathit{casn}$) and name ($\mathit{chnm}$). In the above example, only the unique chemicals were loaded. The $\mathit{casn}$ and $\mathit{chnm}$ fields have unique constraints; trying to register multiple chemicals with the same name or CAS registry number is not possible and will result in an error. With the chemicals loaded, the samples can be registered by mapping the sample ID ($\mathit{spid}$) to the chemical ID. Note, the user needs to load the chemical information to get the chemical IDs then merge the new chemical IDs with the sample IDs from the original file by chemical name or CASRN. - -```{r eval = TRUE, message = FALSE} -tcplRegister(what = "spid", - flds = merge(chdat[ , list(spid, casn)], - chdat.register[ , list(casn, chid)], - by = "casn")[ , list(spid, chid)]) -``` -Optionally, the user can subdivide the chemcial IDs into different groups or libraries. For illustration, the chemical IDs will be arbitrarily divided into two chemical libraries, with the even numbered chemical IDs in group 1 and the odd numbered chemical IDs in group 2. - -```{r eval = FALSE} -grp1 <- cmap[chid %% 2 == 0, unique(chid)] -grp2 <- cmap[chid %% 2 == 1, unique(chid)] -tcplRegister(what = "clib", - flds = list(clib = "group_1", chid = grp1)) -``` -```{r eval = FALSE} -tcplRegister(what = "clib", - flds = list(clib = "group_2", chid = grp2)) -``` - -Chemical IDs can belong to more than one library, and will be listed as seperate entries when loading chemical library information^[The tcplLoadClib() function provides more information about the ToxCast chemical library used for sample generation, and is only relevant to the MySQL version of invitrodb]. - -```{r eval = FALSE} -tcplRegister(what = "clib", - flds = list(clib = "other", chid = 1:2)) -``` - -```{r eval = FALSE} -tcplLoadClib(field = "chid", val = 1:2) -``` - -After registering the chemical and assay information, the data can be loaded into the tcpl local directory. The package includes two datasets from the ToxCast program, "scdat" and "mcdat", with a subset of single- and multiple-concentration data, respectively. The single- and multiple-concentration processing require the same level 0 fields; more information about level 0 pre-processing is in Appendix B. - -```{r eval = TRUE} -data(mcdat, package = 'tcpl') -setDT(mcdat) - -``` - - -As discussed above, the final step before loading data is mapping the assay component source name ($\mathit{acsn}$) to the correct $\mathit{acid}$. An assay component can have multiple $\mathit{acsn}$ values, but an $\mathit{acsn}$ must be unique to one assay component. Assay components can have multiple $\mathit{acsn}$ values to minimize the amount of data manipulation required (and therefore potential errors) during the level 0 pre-processing if assay source files change or are inconsistent. The example data presented here only has one $\mathit{acsn}$ value, "TCPL-MC-Demo." - -```{r eval = TRUE, message = FALSE} -tcplRegister(what = "acsn", - flds = list(acid = 1, acsn = "TCPL-MC-Demo")) -``` -The data are now ready to be loaded with the tcplWriteLvl0 function. -```{r eval = TRUE, message = FALSE} -## Cannot process a concentration value of 0; use .01 as a dummy value -mcdat$conc[mcdat$conc == 0] <- .01 -tcplWriteLvl0(dat = mcdat, type = "mc") - -``` - -The type argument is used throughout the package to distinguish the type of data/processing: "sc" indicates single-concentration; "mc" indicates multiple-concentration. The tcplLoadData function can be used to load the data from the tcpl local directory or a MySQL database. - -```{r eval = TRUE} -tcplLoadData(lvl = 0, fld = "acid", val = 1, type = "mc") -``` - -Notice in the loaded data, the $\mathit{acsn}$ is replaced by the correct $\mathit{acid}$ and the $\mathit{m0id}$ field is added. The "m#" -fields in the multiple-concentration data are the primary keys for each level of data. These primary keys link the various levels of data. All of the keys are auto-generated and will change anytime data are reloaded or processed. Note, the primary keys only change for the levels affected, e.g. if the user reprocesses level 1, the level 0 keys will remain the same. - - -## B. Data Processing and the tcplRun Function - - -This section is intended to help the user understand the general aspects of how the data are processed before diving into the specifics of each processing level for both screening paradigms. The details of the two screening paradigms are provided in later sections. - -All processing in the tcpl package occurs at the assay component or assay endpoint level. There is no capability within either screening paradigm to do any processing which combines data from multiple assay components or assay endpoints. Any combining of data must occur before or after the pipeline processing. For example, a ratio of two values could be processed through the pipeline if the user calculated the ratio during the level 0 pre-processing and uploaded a single "component." - -Once the data are uploaded, data processing occurs through the tcplRun function for both single- and multiple-concentration screening. The tcplRun function can either take a single ID ($\mathit{acid}$ or $\mathit{aeid}$, depending on the processing type and level) or an $\mathit{asid}$. If given an $\mathit{asid}$, the tcplRun function will attempt to process all corresponding components/endpoints. When processing by $\mathit{acid}$ or $\mathit{aeid}$, the user must know which ID to give for each level (Table 1). - -The processing is sequential, and every level of processing requires successful processing at the antecedent level. Any processing changes will cause a "delete cascade," removing any subsequent data affected by the processing change to ensure complete data fidelity at any given time. For example, processing level 3 data will cause the data from levels 4 through 6 to be deleted for the corresponding IDs. Changing any method assignments will also trigger a delete cascade for any corresponding data (more on method assignments below). - -The user must give a start and end level when using the tcplRun function. If processing more than one assay component or endpoint, the function will not stop if one component or endpoint fails. If a component or endpoint fails while processing multiple levels, the function will not attempt to process the failed component/endpoint in subsequent levels. When finished processing, the tcplRun function returns a list indicating the processing success of each id. For each level processed, the list will contain two elements: (1) "l#" a named Boolean vector where TRUE indicates successful processing, and (2) "l#_failed" containing the names of any ids that failed processing, where "#" is the processing level. - -The processing functions print messages to the console indicating the four steps of the processing. First, data for the given assay component ID are loaded, the data are processed, data for the same ID in subsequent levels are deleted, then the processed data is written to the database. The 'outfile' parameter in the tcplRun function gives the user the option of printing all of the output text to a file. - -The tcplRun function will attempt to use multiple processors on Unix-based systems (does not include Windows). Depending on the system environment, or if the user is running into memory constraints, the user may wish to use less processing power and can do so by setting the "mc.cores" parameter in the tcplRun function. - - -```{r warning = FALSE, echo = FALSE} -Type <- c('SC', 'SC', 'MC', 'MC', 'MC', 'MC', 'MC', 'MC') -Level <- c('Lvl1', 'Lvl2', 'Lvl1', 'Lvl2', 'Lvl3', 'Lvl4', 'Lvl5', 'Lvl6') -InputID <- c('acid', 'aeid', 'acid', 'acid', 'acid', 'aeid', 'aeid', 'aeid') -MethodID <- c('aeid', 'aeid', 'N/A', 'acid', 'aeid', 'N/A', 'aeid', 'aeid') -Table <- data.frame(Type, Level, InputID, MethodID) -library(htmlTable) -htmlTable(Table, - rnames = FALSE , - - caption="Table 1: Processing checklist.", - tfoot = " The Input ID column indicates the ID used for each processing step; Method ID indicates the ID used for assigning methods for data processing, when necessary. SC = single-concentration; MC = multiple-concentration.") - -``` -The processing requirements vary by screening paradigm and level. Later sections will cover the details, but in general, many of the processing steps require specific methods to accommodate different experimental designs or data processing approaches. - -Notice from Table 1 that level 1 single-concentration processing (SC1) requires an $\mathit{acid}$ input (Table 1), but the methods are assigned by $\mathit{aeid}$. The same is true for MC3 processing. SC1 and MC3 are the normalization steps and convert $\mathit{acid}$ to $\mathit{aeid}$. (Only MC2 has methods assigned by $\mathit{acid}$.) The normalization process is discussed in the following section. - -To promote reproducibility, all method assignments must occur through the database. Methods cannot be passed to either the tcplRun function or the low-level processing functions called by tcplRun . - -In general, method data are stored in the "_methods" and "_id" tables that correspond to the data-storing tables. For example, the "sc1" table is accompanied by the "sc1\_methods" table which stores the available methods for SC1, and the "sc1_aeid" table which stores the method assignments and execution order. - -The tcpl package provides three functions for easily modifying and loading the method assignments for the given assay components or endpoints: (1) tcplMthdAssign allows the user to assign methods, (2) tcplMthdClear clears method assignments, and (3) tcplMthdLoad queries the tcpl database and returns the method assignments. The package also includes the tcplMthdList function that queries the tcpl database and returns the list of available methods. - -The following code blocks will give some examples of how to use the method-related functions. -```{r eval= FALSE} -## For illustrative purposes, assign level 2 MC methods to -## ACIDs 97, 98, and 99. First check for available methods. -mthds <- tcplMthdList(lvl = 2, type = "mc") -mthds[1:2] -## Assign some methods to ACID 97, 98, and 99 -tcplMthdAssign(lvl = 2, - id = 97:99, - mthd_id = c(3, 4, 2), - ordr = 1:3, - type = "mc") -tcplMthdLoad(lvl = 2, id = 97:99, type = "mc") -## Methods can be cleared one at a time for the given id(s) -tcplMthdClear(lvl = 2, id = 99, mthd_id = 2, type = "mc") -tcplMthdLoad(lvl = 2, id = 99, type = "mc") -## Or all methods can be cleared for the given id(s) -tcplMthdClear(lvl = 2, id = 97:98, type = "mc") -tcplMthdLoad(lvl = 2, id = 97:98, type = "mc") -``` - - -## C. Data Normalization - -Data normalization occurs in both single- and multiple-concentration processing at levels 1 and 3, respectively. While the two paradigms use different methods, the normalization approach is the same for both single- and multiple-concentration processing. Data normalization does not have to occur within the package, and normalized data can be loaded into the database at level 0. However, **data must be zero-centered and will only be fit in the positive direction**. - -The tcpl package supports fold-change and a percent of control approaches to normalization. All data must be zero-centered, so all fold-change data must be log-transformed. Normalizing to a control requires three normalization methods: (1) one to define the baseline value, (2) one to define the control value, and (3) one to calculate percent of control ("resp.pc"). Normalizing to fold-change also requires three methods: (1) one to define the baseline value, (2) one to calculate the fold-change, and (3) one to log-transform the fold-change values. Methods defining a baseline value ($\mathit{bval}$) have the "bval" prefix, methods defining the control value ($\mathit{pval}$) have the "pval" prefix, and methods that calculate or modify the final response value have the "resp" prefix. For example, "resp.log2" does a log-transformation of the response value using a base value of 2. The formluae for calculating the percent of control and fold-change response values are listed in equations 1 and 2, respectively. - -The percent of control and fold-change values, respectively: - -$$ resp.pc = \frac{cval - bval}{pval - bval}\;100 $$ - -$$ resp.fc = \frac{cval}{bval} $$ - - -Order matters when assigning normalization methods. The $\mathit{bval}$, and $\mathit{pval}$ if normalizing as a percent of control, need to be calculated prior to calculating the response value. Table 2 shows some possible normalization schemes. - - -```{r warning = FALSE, echo = FALSE} -output <- - matrix(c("1. bval.apid.nwlls.med", "2. resp.fc", "1. bval.apid.lowconc.med", "2. bval.apid.pwlls.med", -"3. resp.log2", "4. resp.mult.neg1", "3. resp.pc", "4. resp.multneg1 ", -"1. bval.apid.lowconc.med", "2. resp.fc", "1. bval.spid.lowconc.med", "2. pval.apid.mwlls.med", -"3. resp.log2", "4. \t", "3. resp.pc", "4. \t" , -"1. none", "2. resp.log10", "1. none", "2. resp.multneg1", -"3. resp.blineshift.50.spid", "4. \t", "3. \t", "4. \t"), - ncol=4, byrow = TRUE) - -library(htmlTable) -htmlTable(output, - - rnames = FALSE, - rgroup = c("Scheme 1", - "Scheme 2", "Scheme3"), - n.rgroup = c(2,2), - cgroup = c("Fold-Change", "\\%Control"), - n.cgroup = c(2,2), - caption="Table 2: Example normalization method assignments.") - -``` - - -If the data does not require any normalization, the "none" method must be assigned for normalization. The "none" method simply copies the input data to the response field. Without assigning "none", the response field will not get generated and the processing will not complete. - -To reiterate, the package only models responses in the positive direction. Therefore, a signal in the negative direction must be transformed to the positive direction during normalization. Negative direction data are inverted by multiplying the final response values by ${-1}$ (see the "resp.mult.neg" methods in Table 2). - -In addition to the required normalization methods, the user can add additional methods to transform the normalized values. For example, the third fold-change example in Table 2 includes "resp.blineshift.50.spid," which corrects for baseline deviations by $\mathit{spid}$. A complete list of available methods, by processing type and level, can be listed with tcplMthdList . More information is available in the package documentation, and can be found by running ??tcpl::Methods . - -As discussed in the Assay Structure section, an assay component can have more than one assay endpoint. Creating multiple endpoints for one component enables multiple normalization approaches. Multiple normalization approaches may become necessary when the assay component detects a signal in both positive and negative directions. - -## D. Single-concentration Screening - -This section will cover the tcpl process for handling single-concentration data^[This section assumes a working knowledge of the concepts covered in the Data Processing and Data Normalization sections]. The goal of single-concentration processing is to identify potentially active compounds from a broad screen at a single concentration. After the data is loaded into the tcpl database, the single-concentration processing consists of 2 levels (Table 3). - - - - -```{r warning = FALSE, echo = FALSE} -Level <- c(" Lvl 0", "Lvl 1 ", "Lvl 2 ") -Description <- c("Pre-processing: Vendor/dataset-specific pre-processing to organize heterogeneous raw data to the uniform format for processing by the *tcpl* package†", - "Normalize: Apply assay endpoint-specific normalization listed in the \'sc1_aeid\' table to the raw data to define response", - "Activity Call: Collapse replicates by median response, define the response cutoff based on methods in the \'sc2_aeid\' table, and determine activity" - ) - -output <- - data.frame(Level, Description) - -library(htmlTable) -htmlTable(output, - - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - - align = 'l', - align.header = 'l', - caption="Table 3: Summary of the tcpl single-concentration pipeline.", - tfoot="† Level 0 pre-processing is outside the scope of this package") - -``` - -### Level 1 - -Level 1 processing converts the assay component to assay endpoint(s) and defines the normalized-response value field ($\mathit{resp}$), logarithm-concentration field ($\mathit{logc}$), and optionally, the baseline value ($\mathit{bval}$) and positive control value ($\mathit{pval}$) fields. The purpose of level 1 is to normalize the raw values to either the percentage of a control or to fold-change from baseline. The normalization process is discussed in greater detail in the Data Normalization section. Before assigning the methods below, the user needs to register the data for the single-concentration assay, as shown in the Register and Upload New Data section. - -Before beginning the normalization process, all wells with well quality ($\mathit{wllq}$) equal to 0 are removed. - -The first step in beginning the processing is to identify which assay endpoints stem from the assay component(s) being processed. - -```{r eval = FALSE} -tcplLoadAeid(fld = "acid", val = 2) -``` - -With the corresponding endpoints identified, the appropriate methods can be assigned. - -```{r eval = FALSE} -tcplMthdAssign(lvl = 1, - id = 1:2, - mthd_id = c(1, 11, 13), - ordr = 1:3, - type = "sc") - -``` - -```{r eval = FALSE} -tcplMthdAssign(lvl = 1, - id = 2, - mthd_id = 16, - ordr = 1, - type = "sc") -``` -Above, methods 1, 11, and 13 were assigned for both endpoints. The method assignments instruct the processing to: (1) calculate $\mathit{bval}$ for each assay plate ID by taking the median of all data where the well type equals "n;" (2) calculate a fold-change over $\mathit{bval}$; (3) log-transform the fold-change values with base 2. The second method assignment (only for AEID 2) indicates to multiply all response values by $-1$. - -For a complete list of normalization methods see tcplMthdList(lvl = 1, type = "sc") or ?SC1\_Methods . With the assay endpoints and normalization methods defined, the data are ready for level 1 processing. - -```{r eval = FALSE} -## Do level 1 processing for acid 1 -sc1_res <- tcplRun(id = 1, slvl = 1, elvl = 1, type = "sc") -``` - -**Notice that level 1 processing takes an assay component ID, not an assay endpoint ID, as the input ID.** As mentioned in previously, the user must assign normalization methods by assay endpoint, then do the processing by assay component. The level 1 processing will attempt to process all endpoints in the database for a given component. If one endpoint fails for any reason (e.g., does not have appropriate methods assigned), the processing for the entire component fails. - -### Level 2 - -Level 2 processing defines the baseline median absolute deviation ($\mathit{bmad}$), collapses any replicates by sample ID, and determines the activity. - -Before the data are collapsed by sample ID, the $\mathit{bmad}$ is calculated as the median absolute deviation of all wells with well type equal to "t." The calculation to define $\mathit{bmad}$ is done once across the entire assay endpoint. **If additional data is added to the database for an assay component, the $\mathit{bmad}$ values for all associated assay endpoints will change.** Note, this $\mathit{bmad}$ definition is different from the $\mathit{bmad}$ definition used for multiple-concentration screening. - -To collapse the data by sample ID, the median response value is calculated at each concentration. The data are then further collapsed by taking the maximum of those median values ($\mathit{max\_med}$). - -Once the data are collapsed, such that each assay endpoint-sample pair only has one value, the activity is determined. For a sample to get an active hit call, the $\mathit{max\_med}$ must be greater than an efficacy cutoff. The efficacy cutoff is determined by the level 2 methods. The efficacy cutoff value ($\mathit{coff}$) is defined as the maximum of all values given by the assigned level 2 methods. Failing to assign a level 2 method will result in every sample being called active. For a complete list of level 5 methods, see tcplMthdList(lvl = 2, type = "sc") or ?SC2\_Methods. - -```{r eval = FALSE} -## Assign a cutoff value of log2(1.2) -tcplMthdAssign(lvl = 2, - id = 1, - mthd_id = 3, - type = "sc") -``` - -For the example data (edit), the cutoff value is $log_2(1.2)$. If the maximum median value ($\mathit{max\_med}$) is greater than or equal to the efficacy cutoff ($\mathit{coff}$), the sample ID is considered active and the hit call ($\mathit{hitc}$) is set to 1. - -With the methods assigned, the level 2 processing can be completed. - -```{r eval = FALSE} -## Do level 2 processing for acid 1 -sc2_res <- tcplRun(id = 1, slvl = 2, elvl = 2, type = "sc") -``` - -## E. Multiple-concentration Screening - -This section will cover the tcpl process for handling multiple-concentration data^[This section assumes a working knowledge of the concepts covered in the Data Processing and Data Normalization sections]. The goal of multiple-concentration processing is to estimate the activity, potency, efficacy, and other parameters for sample-assay pairs. After the data is loaded into the tcpl database, the multiple-concentration processing consists of six levels (Table 4). - - - -```{r warning = FALSE, echo = FALSE} -Level <- c("Lvl 0 ", "Lvl 1", "Lvl 2", "Lvl 3", "Lvl 4", "Lvl 5", "Lvl 6") -Description <- c("Pre-processing: Vendor/dataset-specific pre-processing to organize heterogeneous raw data to the uniform format for processing by the *tcpl* package†", - "Index: Defne the replicate and concentration indices to facilitate -all subsequent processing", - "Transform: Apply assay component-specifc transformations -listed in the \'mc2_acid\' table to the raw data to defne the -corrected data", -"Normalize: Apply assay endpoint-specifc normalization listed in -the \'mc3_aeid\' table to the corrected data to define response", -"Fit: Model the concentration-response data utilizing three -objective functions: (1) constant, (2) hill, and (3) gain-loss", -"Model Selection/Acitivty Call: Select the winning model, define -the response cutoff based on methods in the \'mc5_aeid\' table, and -determine activity", -"Flag: Flag potential false positive and false negative endings based -on methods in the \'mc6_aeid\' table" - ) - -output <- - data.frame(Level, Description) - -library(htmlTable) -htmlTable(output, - - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - align = 'l', - align.header = 'l', - caption="Table 4: Summary of the tcpl multiple-concentration pipeline.", - tfoot="† Level 0 pre-processing is outside the scope of this package") - -``` -### Level 1 - -Level 1 processing defines the replicate and concentration index fields to facilitate downstream processing. Because of cost, availability, physicochemical, and technical constraints, screening-level efforts utilize numerous experimental designs and test compound (sample) stock concentrations. The resulting data may contain inconsistent numbers of concentrations, concentration values, and technical replicates. To enable quick and uniform processing, level 1 processing explicitly defines concentration and replicate indices, giving integer values $1 \dots N$ to increasing concentrations and technical replicates, where $1$ represents the lowest concentration or first technical replicate. - -To assign replicate and concentration indices, we assume one of two experimental designs. The first design assumes samples are plated in multiple concentrations on each assay plate, such that the concentration series all falls on a single assay plate. The second design assumes samples are plated in a single concentration on each assay plate, such that the concentration series falls across many assay plates. - -For both experimental designs, data are ordered by source file ($\mathit{srcf}$), assay plate ID ($\mathit{apid}$), column index ($\mathit{coli}$), row index ($\mathit{rowi}$), sample ID ($\mathit{spid}$), and concentration ($\mathit{conc}$). Concentration is rounded to three significant figures to correct for potential rounding errors. After ordering the data, we create a temporary replicate ID, identifying an individual concentration series. For test compounds in experimental designs with the concentration series on a single plate and all control compounds, the temporary replicate ID consists of the sample ID, well type ($\mathit{wllt}$), source file, assay plate ID, and concentration. The temporary replicate ID for test compounds in experimental designs with concentration series that span multiple assay plates is defined similarly, but does not include the assay plate ID. - -Once the data are ordered, and the temporary replicate ID is defined, the data are scanned from top to bottom and increment the replicate index ($\mathit{repi}$) every time a replicate ID is duplicated. Then, for each replicate, the concentration index ($\mathit{cndx}$) is defined by ranking the unique concentrations, with the lowest concentration starting at 1. - -The following demonstrates how to carry out the level 1 processing and look at the resulting data: - -```{r eval = TRUE, message = FALSE} -## Do level 1 processing for acid 1 -mc1_res <- tcplRun(id = 1, slvl = 1, elvl = 1, type = "mc") -``` - -With the processing complete, the resulting level 1 data can be loaded to check the processing: - -```{r eval = TRUE} -## Load the level 1 data and look at the cndx and repi values -m1dat <- tcplLoadData(lvl = 1, - fld = "acid", - val = 1, - type = "mc") -m1dat <- tcplPrepOtpt(m1dat) -setkeyv(m1dat, c("repi", "cndx")) -m1dat[chnm == "Bisphenol A", - list(chnm, conc, cndx, repi)] -``` - -The package also contains a tool for visualizing the data at the assay plate level. - -```{r eval = TRUE, warning = FALSE, message = FALSE, fig.width = 30, fig.height= 20} -tcplPlotPlate(dat = m1dat, apid = "4009721") - -``` - -Figure 1: An assay plate diagram. The color indicates the raw values according to the key on the right. The bold lines on the key show the distribution of values for the plate on the scale of values across the entire assay. The text inside each well shows the well type and concentration index. For example, 't4' indicates a test compound at the fourth concentration. The wells with an 'X' have a well quality of 0. - -In Figure 1, we see the results of tcplPlotPlate . The tcplPlotPlate function can be used to visualize the data at levels 1 to 3. The row and column indices are printed along the edge of the plate, with the values in each well represented by color. While the plate does not give sample ID information, the letter/number codes in the wells indicate the well type and concentration index, respectively. The plate display also shows the wells with poor quality (as defined by the well quality, $\mathit{wllq}$, field at level 0) with an "X." Plotting plates in subsequent levels of wells with poor quality will appear empty. The title of the plate display lists the assay component/assay endpoint and the assay plate ID ($\mathit{apid}$). - - -### Level 2 - -Level 2 processing removes data where the well quality ($\mathit{wllq}$) equals 0 and defines the corrected value ($\mathit{cval}$) field. Level 2 processing allows for any transformation of the raw values at the assay component level. Examples of transformation methods could range from basic logarithm transformations, to complex spacial noise reduction algorithms. Currently the tcpl package only consists of basic transformations, but could be expanded in future releases. Level 2 processing does not include normalization methods; normalization should occur during level 3 processing. - -For the example data used in this vignette, no transformations are necessary at level 2. To not apply any transformation methods, assign the "none" method: - -```{r eval = TRUE, message = FALSE} -tcplMthdAssign(lvl = 2, - id =1, - mthd_id = 1, - ordr = 1, - type = "mc") -``` - -Every assay component needs at least one transformation method assigned to complete level 2 processing. With the method assigned, the processing can be completed. - -```{r eval = TRUE, warning = FALSE, message = FALSE} -## Do level 2 processing for acid 1 -mc2_res <- tcplRun(id = 1, slvl = 2, elvl = 2, type = "mc") -``` -For the complete list of level 2 transformation methods currently available, see tcplMthdList(lvl = 2, type = "mc") or ?MC2\_Methods for more detail. The coding methodology used to implement the methods is beyond the scope of this vignette, but, in brief, the method names in the database correspond to a function name in the list of functions returned by mc2\_mthds() (the mc2\_mthds function is not exported, and not intended for use by the user). Each of the functions in the list given by mc2\_mthds only return expression objects that processing function called by tcplRun executes in the local function environment to avoid making additional copies of the data in memory. We encourage suggestions for new methods. - -### Level 3 - -Level 3 processing converts the assay component to assay endpoint(s) and defines the normalized-response value field ($\mathit{resp}$); logarithm-concentration field ($\mathit{logc}$); and optionally, the baseline value ($\mathit{bval}$) and positive control value ($\mathit{pval}$) fields. The purpose of level 3 processing is to normalize the corrected values to either the percentage of a control or to fold-change from baseline. The normalization process is discussed in greater detail in the Data Normalization section . The processing aspect of level 3 is almost completely analogous to level 2, except the user has to be careful about using assay component versus assay endpoint. - -The user first needs to check which assay endpoints stem from the the assay component queued for processing. - - -```{r eval = TRUE} -## Look at the assay endpoints for acid 1 -tcplLoadAeid(fld = "acid", val = 1) -``` - -With the corresponding assay endpoints listed, the normalization methods can be assigned. - -```{r eval = TRUE, message = FALSE} -tcplMthdAssign(lvl = 3, - id = 1:2, - mthd_id = c(17, 9, 7), - ordr = 1:3, type = "mc") - -``` - -Above, methods 17, 9, and 7 were assigned for both endpoints. The method assignments instruct the processing to: (1) calculate $\mathit{bval}$ for each assay plate ID by taking the median of all data where the well type equals "n" or the well type equals "t" and the concentration index is 1 or 2; (2) calculate a fold-change over $\mathit{bval}$; (3) log-transform the fold-change values with base 2. - -For a complete list of normalization methods see tcplMthdList(lvl = 3, type = "mc") or ?MC3\_Methods . With the assay endpoints and normalization methods defined, the data are ready for level 3 processing. - -```{r eval = TRUE,warning = FALSE, message = FALSE} -## Do level 3 processing for acid 1 -mc3_res <- tcplRun(id = 1, slvl = 3, elvl = 3, type = "mc") -``` - -**Notice that level 3 processing takes an assay component ID, not an assay endpoint ID, as the input ID.** As mentioned in previous sections, the user must assign normalization methods by assay endpoint, then do the processing by assay component. The level 3 processing will attempt to process all endpoints in the database for a given component. If one endpoint fails for any reason (e.g., does not have appropriate methods assigned), the processing for the entire component fails. - -### Level 4 - -Level 4 processing splits the data into concentration series by sample and assay endpoint, then models the activity of each concentration series. Activity is modeled only in the positive direction. More information on readouts with both directions is available in the previous section. - -The first step in level 4 processing is to remove the well types with only one concentration. To establish the noise-band for the assay endpoint, the baseline median absolute deviation ($\mathit{bmad}$) is calculated as the median absolute deviation of the response values for test compounds where the concentration index equals 1 or 2. The calculation to define $\mathit{bmad}$ is done once across the entire assay endpoint. **If additional data is added to the database for an assay component, the $\mathit{bmad}$ values for all associated assay endpoints will change.** Note, this $\mathit{bmad}$ definition is different from the $\mathit{bmad}$ definition used for single-concentration screening. - -Before the model parameters are estimated, a set of summary values are calculated for each concentration series: the minimum and maximum response; minimum and maximum log concentration; the number of concentrations, points, and replicates; the maximum mean and median with the concentration at which they occur; and the number of medians greater than $3\mathit{bmad}$. When referring to the concentration series , the "mean" and "median" values are defined as the mean or median of the response values at every concentration. In other words, the maximum median is the maximum of all median values across the concentration series. - -Concentration series must have at least four concentrations to enter the fitting algorithm. By default, concentration series must additionally have at least one median value greater than $3\mathit{bmad}$ to enter the fitting algorithm. The median value above $3\mathit{bmad}$ requirement can be ignored by setting $\mathit{fit\_all}$ to 1 in the assay endpoint annotation. - -All models draw from the Student's t-distribution with four degrees of freedom. The wider tails in the t-distribution diminish the influence of outlier values, and produce more robust estimates than does the more commonly used normal distribution. The robust fitting removes the need for any outlier elimination before fitting. The fitting algorithm utilizes the maximum likelihood estimates of parameters for three models as defined below in equations 3 through 16. - -Let $t(z,\nu)$ be the Student's t-distribution with $\nu$ degrees of freedom, $y_{i}$ be the observed response at the $i^{th}$ observation, and $\mu_{i}$ be the estimated response at the $i^{th}$ observation. We calculate $z_{i}$ as - - - - - $$ z_{i} = \frac{y_{i} - \mu_{i}}{exp(\sigma)}, $$ - - -where $\sigma$ is the scale term. Then the log-likelihood is
- - -$$ \sum_{i=1}^{n} [\ln\left(t(z_{i}, 4)\right) - \sigma]\mathrm{,} $$ - - -where $n$ is the number of observations. - -The first model fit in the fitting algorithm is a constant model at 0, abbreviated "cnst." The constant model only has one parameter, the scale term. For the constant model $\mu_{i}$ is given by - - -$$ \mu_{i} = 0\mathrm{.} $$ - - -The second model in the fitting algorithm is a constrained Hill model (hill), where the bottom asymptote is forced to 0. Including the scale parameter, the Hill model has four parameters. Let $\mathit{tp}$ be the top asymptote, $\mathit{ga}$ be the AC$_{50}$ ^[The AC$_{50}$ is the activity concentration at 50\%, or the concentration where the modeled activity equals 50\% of the top asymptote.] in the gain direction, $\mathit{gw}$ be the Hill coefficient in the gain direction, and $x_{i}$ be the log concentration at the $i^{th}$ observation. Then $\mu_{i}$ for the Hill model is given by - - -$$\mu_{i} = \frac{tp}{1 + 10^{(\mathit{ga} - x_{i})\mathit{gw}}}\mathrm{,} $$ - -with the constraints - - -$$ 0 \leq \mathit{tp} \leq 1.2\mathrm{max\;resp,} $$ - - -$$\mathrm{min\;logc} - 2 \leq \mathit{ga} \leq \mathrm{max\;logc} + 0.5\mathrm{,} $$ - -and - - -$$ 0.3 \leq \mathit{gw} \leq 8\mathit{.} $$ - -The third model in the fitting algorithm is a constrained gain-loss model (gnls), defined as a product of two Hill models, with a shared top asymptote and both bottom asymptote values equal to 0. Including the scale term, the gain-loss model has six parameters. Let $\mathit{tp}$ be the shared top asymptote, $\mathit{ga}$ be the AC$_{50}$ in the gain direction, $\mathit{gw}$ be the Hill coefficient in the gain direction, $\mathit{la}$ be the AC$_{50}$ in the loss direction, $\mathit{lw}$ be the Hill coefficient in the loss direction, and $x_{i}$ be the log concentration at the $i^{th}$ observation. Then $\mu_{i}$ for the gain-loss model is given by - -$$\mu_{i} = \mathit{tp}\left(\frac{1}{1 + 10^{(\mathit{ga} - x_{i})\mathit{gw}}}\right)\left(\frac{1}{1 + 10^{(x_{i} - \mathit{la})\mathit{lw}}}\right)\mathrm{,}$$ - -with the constraints - -$$ 0 \leq \mathit{tp} \leq 1.2\mathrm{max\;resp,} $$ - -$$\mathrm{min\;logc} - 2 \leq \mathit{ga} \leq \mathrm{max\;logc,}$$ - - -$$0.3 \leq \mathit{gw} \leq 8\mathrm{,}$$ - - - -$$ \mathrm{min\;logc} - 2 \leq \mathit{la} \leq \mathrm{max\;logc} + 2\mathrm{,}$$ - -$$0.3 \leq \mathit{lw} \leq 18\mathrm{,}$$ - -and - -$$\mathit{la}-\mathit{ga} > 0.25\mathrm{.}$$ -Level 4 does not utilize any assay endpoint-specific methods; the user only needs to run the tcplRun function. **Level 4 processing and all subsequent processing is done by assay endpoint, not assay component**. The previous section showed how to find the assay endpoints for an assay component using the tcplLoadAeid function. The example dataset includes two assay endpoints with aeid values of 1 and 2. - -```{r eval = TRUE, message = FALSE, warning = FALSE} -## Do level 4 processing for aeids 1&2 and load the data -tcplMthdAssign(lvl = 4, id = 1:2, mthd_id = c(1,2), type = "mc" ) -mc4_res <- tcplRun(id = 1:2, slvl = 4, elvl = 4, type = "mc") -``` -The level 4 data include 52 variables, including the ID fields. A complete list of level 4 fields is available in Appendix A. The level 4 data include the fields $\mathit{cnst}$, $\mathit{hill}$, and $\mathit{gnls}$ indicating the convergence of the model where a value of 1 means the model converged and a value of 0 means the model did not converge. N/A values indicate the fitting algorithm did not attempt to fit the model. $\mathit{cnst}$ will be N/A when the concentration series had less than 4 concentrations; $\mathit{hill}$ and $\mathit{gnls}$ will be N/A when none of the medians were greater than or equal to $3\mathit{bmad}$. Similarly, the $\mathit{hcov}$ and $\mathit{gcov}$ fields indicate the success in inverting the Hessian matrix. Where the Hessian matrix did not invert, the parameter standard deviation estimates will be N/A. NaN values in the parameter standard deviation fields indicate the covariance matrix was not positive definite. In Figure 2, the $\mathit{hill}$ field is used to find potentially active compounds to visualize with the tcplPlotM4ID function. - -```{r eval = TRUE} -## Load the level 4 data -m4dat <- tcplPrepOtpt(tcplLoadData(lvl = 4, type = "mc")) -## List the first m4ids where the hill model converged -## for AEID 1 -m4dat[hill == 1 & aeid == 1, head(m4id)] -``` - -```{r eval = TRUE, fig.width = 15, fig.height= 10} -## Plot a fit for m4id 7 -tcplPlotM4ID(m4id = 7, lvl = 4) - -``` - -Figure 2. An example level 4 plot for a single concentration series. The orange dashed line shows the constant model, the red dashed line shows the Hill model, and the blue dashed line shows the gain-loss model. The gray striped box shows the baseline region, $0 \pm 3\mathit{bmad}$. The summary panel shows assay endpoint and sample information, the parameter values (val) and standard deviations (sd) for the Hill and gain-loss models, and summary values for each model. - -The model summary values in Figure 2 include Akaike Information Criterion (AIC), probability, and the root mean square error (RMSE). Let $log(\mathcal{L}(\hat{\theta}, y))$ be the log-likelihood of the model $\hat{\theta}$ given the observed values $y$, and $K$ be the number of parameters in $\hat{\theta}$, then, - - -$$\mathrm{AIC} = -2\log(\mathcal{L}(\hat{\theta}, y)) + 2K\mathrm{.} $$ - - -The probability, $\omega_{i}$, is defined as the weight of evidence that model $i$ is the best model, given that one of the models must be the best model. Let $\Delta_{i}$ be the difference $\mathrm{AIC}_{i} - \mathrm{AIC}_{min}$ for the $i^{th}$ model. If $R$ is the set of models, then $\omega_{i}$ is given by - -$$\omega_{i} = \frac{\exp\left(-\frac{1}{2}\Delta_{i}\right)}{\sum_{i=1}^{R} \exp\left(-\frac{1}{2}\Delta_{r}\right)}\mathrm{.} $$ - - -The RMSE is given by - -$$\mathrm{RMSE} = \sqrt{\frac{\sum_{i=1}^{N} (y_{i} - \mu_{i})^2}{N}}\mathrm{,}$$ - - -where $N$ is the number of observations, and $\mu_{i}$ and $y_{i}$ are the estimated and observed values at the $i^{th}$ observation, respectively. - -### Level 5 - -Level 5 processing determines the winning model and activity for the concentration series, bins all of the concentration series into categories, and calculates additional point-of-departure estimates based on the activity cutoff. - -**The model with the lowest AIC value is selected as the winning model** ($\mathit{modl}$), and is used to determine the activity or hit call for the concentration series. If two models have equal AIC values, the simpler model (the model with fewer parameters) wins the tie. All of the parameters for the winning model are stored at level 5 with the prefix "modl\_" to facilitate easier queries. For a concentration series to get an active hit call, either the Hill or gain-loss must be selected as the winning model. In addition to selecting the Hill or gain-loss model, the modeled and observed response must meet an efficacy cutoff. - -The efficacy cutoff is defined by the level 5 methods. The efficacy cutoff value ($\mathit{coff}$) is defined as the maximum of all values given by the assigned level 5 methods. Failing to assign a level 5 method will result in every concentration series being called active. For a complete list of level 5 methods, see -tcplMthdList(lvl = 5) or ?MC5\_Methods . - -```{r eval = TRUE, warning = FALSE} -## Assign a cutoff value of 6*bmad -tcplMthdAssign(lvl = 5, - id = 1:2, - mthd_id = 6, - ordr = 1, - type = "mc") -``` -For the example data, the cutoff value is $6\mathit{bmad}$. If the Hill or gain-loss model wins, and the estimated top parameter for the winning model ($\mathit{modl\_tp}$) and the maximum median value ($\mathit{max\_med}$) are both greater than or equal to the efficacy cutoff ($\mathit{coff}$), the concentration series is considered active and the hit call ($\mathit{hitc}$) is set to 1. - -The hit call can be 1, 0, or -1. A hit call of 1 or 0 indicates the concentration series is active or inactive, respectively, according to the analysis; a hit call of -1 indicates the concentration series had less than four concentrations. - -For active concentration series, two additional point-of-departure estimates are calculated for the winning model: (1) the activity concentration at baseline (ACB or $\mathit{modl\_acb}$) and (2) the activity concentration at cutoff (ACC or $\mathit{modl\_acc}$). The ACB and ACC are defined as the concentration where the estimated model value equals $3\mathit{bmad}$ and the cutoff, respectively. The point-of-departure estimates are summarized in Figure 3. - -```{r eval = TRUE} - -par(family = "mono", mar = rep(1, 4), pty = "m") -plot.new() -plot.window(xlim = c(0, 30), ylim = c(-30, 100)) -axis(side = 2, lwd = 2, col = "gray35") -rect(xleft = par()$usr[1], - xright = par()$usr[2], - ybottom = -15, - ytop = 15, - border = NA, - col = "gray45", - density = 15, - angle = 45) -abline(h = 26, lwd = 3, lty = "dashed", col = "gray30") -tmp <- list(modl = "gnls", gnls_ga = 12, gnls_tp = 80, - gnls_gw = 0.18, gnls_lw = 0.7, gnls_la = 25) -tcplAddModel(pars = tmp, lwd = 3, col = "dodgerblue2") - -abline(v = 8.46, lwd = 3, lty = "solid", col = "firebrick") -text(x = 8.46, y = par()$usr[4]*0.9, - font = 2, labels = "ACB", cex = 2, pos = 2, srt = 90) -abline(v = 10.24, lwd = 3, lty = "solid", col = "yellow2") -text(x = 10.24, y = par()$usr[4]*0.9, - font = 2, labels = "ACC", cex = 2, pos = 2, srt = 90) -abline(v = 12, lwd = 3, lty = "solid", col = "dodgerblue2") -text(x = 12, y = par()$usr[4]*0.9, - font = 2, labels = "AC50", cex = 2, pos = 2, srt = 90) - -points(x = c(8.46, 10.24, 12), y = c(15, 26, 40), - pch = 21, cex = 2, col = "gray30", lwd = 2, - bg = c("firebrick", "yellow2", "dodgerblue2")) - -``` - -Figure 3: The point-of-departure estimates calculated by the tcpl package. The shaded rectangle represents the baseline region, $0 \pm 3\mathit{bmad}$. The dark stripped line represents the efficacy cutoff ($\mathit{coff}$). The vertical lines show where the point-of-departure estimates are defined: the red line shows the ACB, the yellow line shows the ACC, and the blue line shows the AC~50~. - -All concentration series fall into a single fit category ($\mathit{fitc}$), defined by the leaves on the tree structure in Figure 4. Concentration series in the same category will have similar characteristics, and often look very similar. Categorizing all of the series enables faster quality control checking and easier identification of potential false results. The first split differentiates series by hit call. Series with a hit call of -1 go into fit category 2. The following two paragraphs will outline the logic for the active and inactive branches. - - - -```{r eval = TRUE} -mc5_fit_categories <- fread(system.file("/example/mc5_fit_categories.csv", - package = "tcpl"), - sep = ",", - header = TRUE) -tcplPlotFitc(mc5_fit_categories) -``` - -Figure 4: The categories used to bin each fit. Each fit falls into one leaf of the tree. The leaves are indicated by bold green font. (Figure created by calling tcplPlotFitc() ) - - -The first split in the active branch differentiates series by the model winner, Hill or gain-loss. For each model, the next split is defined by the efficacy of its top parameter in relation to the cutoff. The top value is either less than $1.2\mathit{coff}$ or greater than or equal to $1.2\mathit{coff}$. Finally, series on the active branch go into leaves based on the position of the AC$_{50}$ parameter in relation to the tested concentration range. For comparison purposes, the activity concentration at 95\% (AC95) is calculated, but not stored.^[The tcplHill- functions can be used to calculate values, concentrations, and activity concentrations for the Hill model.] Series with AC$_{50}$ values less than the minimum concentration tested ($\mathit{logc\_min}$) go into the "$<=$" leaves, series with AC$_{50}$ values greater than the minimum tested concentration and AC95 values less than the maximum tested concentration ($\mathit{logc\_max}$) go into the "$==$" leaves, and series with AC95 values greater than the maximum concentration tested go into the "$>=$" leaves. - -The inactive branch is first divided by whether any median values were greater than or equal to $3\mathit{bmad}$. Series with no evidence of activity go into fit category 4. Similar to the active branch, series with evidence of activity are separated by the model winner. The Hill and gain-loss portions of the inactive branch follow the same logic. First, series diverge by the efficacy of their top parameter in relation to the cutoff: $\mathit{modl\_tp < 0.8\mathit{coff}}$ or $\mathit{modl\_tp \geq 0.8\mathit{coff}}$. Then, the same comparison is made on the top values of the losing model. If the losing model did not converge, then the series go into the "DNC" category. If the losing model top value is greater than or equal to $0.8\mathit{coff}$, then the series are split based on whether the losing model top surpassed the cutoff. On the constant model branch, if neither top parameter is greater than or equal to $0.8\mathit{bmad}$, then the series go into fit category 7. If one of the top parameters is greater than or equal to $0.8\mathit{coff}$, the series go into fit category 9 or 10 based on whether one of the top values surpassed the cutoff. - -With the level 5 methods assigned, the data are ready for level 5 processing: - -```{r eval = TRUE, warning = FALSE, message = FALSE} -## Do level 5 processing for aeids 1&2 and load the data -mc5_res <- tcplRun(id = 1:2, slvl = 5, elvl = 5, type = "mc") -``` - -```{r eval = TRUE, fig.width = 15, fig.height= 10} -tcplPlotM4ID(m4id = 4, lvl = 5) -``` - -Figure 5: An example level 5 plot for a single concentration series. The solid line and model highlighting indicate the model winner. The horizontal line shows the cutoff value. In addition to the information from the level 4 plots, the summary panel includes the cutoff ($\mathit{coff}$), hit call ($\mathit{hitc}$), fit category ($\mathit{fitc}$) and activity probability ($\mathit{actp}$) values. - -Figure 5 shows an example of a concentration series in fit category 41, indicating the series is active and the Hill model won with a top value greater than $1.2\mathit{coff}$, and an AC$_{50}$ value within the tested concentration range. The tcplPlotFitc function shows the distribution of concentration series across the fit category tree (Figure 6). - - - -```{r eval = TRUE} -m5dat <- tcplLoadData(lvl = 5, type = "mc") -tcplPlotFitc(fitc = m5dat$fitc) -``` - -Figure 6:The distribution of concentration series by fit category for the example data. Both the size and color of the circles indicate the number of concentration series. The legend gives the range for number of concentration series by color. - - - -The distribution in Figure 6 shows 312-721 concentration series fell into fit category 21. Following the logic discussed previously, fit category 21 indicates an inactive series where the Hill model was selected, the top asymptote for the Hill model was greater than or equal to $0.8\mathit{coff}$, and the gain-loss top asymptote was greater than or equal to the cutoff. The series in fit category 21 can be found easily in the level 5 data. - -```{r eval = TRUE} -head(m5dat[fitc == 21, - list(m4id, hill_tp, gnls_tp, - max_med, coff, hitc)]) -``` - - -The plot in Figure 7 shows a concentration series in fit category 21. In the example given by Figure 7, the $\mathit{hill\_tp}$ and $\mathit{gnls\_tp}$ parameters are equal and greater than $\mathit{coff}$; however, the maximum median value ($\mathit{max\_med}$) is not greater than the cutoff making the series inactive. - -```{r eval = TRUE, fig.width = 15, fig.height= 10} -tcplPlotM4ID(m4id = 3, lvl = 5) -``` - -Figure 7: Level 5 plot for m4id 3 showing an example series in fit category 21. - -### Level 6 - -Level 6 processing uses various methods to identify concentration series with etiologies that may suggest false positive/false negative results or explain apparent anomalies in the data. Each flag is defined by a level 6 method that has to be assigned to each assay endpoint. Similar to level 5, an assay endpoint does not need any level 6 methods assigned to complete processing. - -```{r eval = TRUE, warning = FALSE, message = FALSE, error = TRUE} -## Clear old methods -tcplMthdClear(lvl = 6, id = 1:2, type = "mc") -tcplMthdAssign(lvl = 6, id = 1:2, - mthd_id = c(6:8, 10:12, 15:16), - type = "mc") -tcplMthdLoad(lvl = 6, id = 1, type = "mc") -``` - -The example above assigns the most common flags. Some of the available flags only apply to specific experimental designs and do not apply to all data. For a complete list of normalization methods see tcplMthdList(lvl = 6) or ?MC6\_Methods(lvl = 6) . - -The additional $\mathit{nddr}$ field in the "mc6\_methods"(and the output from tcplMthdLoad() / tcplMthdList() for level 6) indicates whether the method requires additional data. Methods with an $\mathit{nddr}$ value of 0 only require the modeled/summary information from levels 4 and 5. Methods with an $\mathit{nddr}$ value of 1 also require the individual response and concentration values from level 3. Methods requiring data from level 3 can greatly increase the processing time. - -```{r eval = TRUE, warning = FALSE, error = TRUE} - -## Do level 6 processing -mc6_res <- tcplRun(id = 1:2, slvl = 5, elvl = 6, type = "mc") -``` - -```{r eval = TRUE, warning = FALSE} -m6dat <- tcplLoadData(lvl = 6, type = "mc") -``` -For the two assay endpoints, concentration series were flagged in the level 6 processing. Series not flagged in the level 6 processing do not get stored at level 6. Each series-flag combination is a separate entry in the level 6 data. Or, in other words, if a series has multiple flags, it will show up on multiple rows in the output. For example, consider the following results: - -```{r eval = TRUE} -m6dat[m4id == 6] -``` - -The data above lists two flags: "Multiple points above baseline, inactive" and "Borderline inactive." Without knowing much about the flags, one might assume this concentration series had some evidence of activity, but was not called a hit, and could potentially be a false negative. In cases of borderline results, plotting the curve is often helpful. - -```{r eval = TRUE, fig.width = 15, fig.height= 10} -tcplPlotM4ID(m4id = 6, lvl = 6) -``` - -Figure 8: An example level 6 plot for a single concentration series. All level 6 method ID (*l6_mthd_id*) values are concatenated in the flags section. If flags have an associated value (*fval*), the value will be shown in parentheses to the right of the level 6 method ID. - - -The evidence of true activity shown in Figure 8 could be argued either way. Level 6 processing does not attempt to define truth in the matter of borderline compounds or data anomalies, but rather attempts to identify concentration series for closer consideration. - -```{r eval = FALSE, echo = FALSE, message = FALSE} -rm(list=ls()) -library(htmlTable) -library(tcpl) -library(data.table) -``` - -```{r eval = TRUE, echo = FALSE, message = FALSE} - - -sample <- data.table (spid = c("Tox21_400088", "Tox21_303655", "Tox21_110011", "Tox21_400081", - "DMSO", "Tox21_400037"), - chid= c("20182", "22364", "23463", "24102", "21735", "20283"), - stkc = c("", "", "", "", "", ""), - stkc_unit = c("", "", "", "", "", ""), - tested_conc_unit= c("", "", "", "", "", ""), - spid_legacy = c("", "", "", "", "", "")) - -assay <- data.table(aid=numeric(), asid=numeric(), assay_name= character(), assay_desc= character(), timepoint_hr=numeric(), organism_id=numeric(), organism= character(), tissue= character(), cell_format= character(), cell_free_component_source= character(), cell_short_name= character(), cell_growth_mode= character(), assay_footprint= character(), assay_format_type= character(), assay_format_type_sub= character(), content_readout_type= character(), dilution_solvent= character(), dilution_solvent_percent_max= character() -) - -assay_component <- data.table(acid=numeric(), aid=numeric(), assay_component_name= character(), assay_component_desc= character(), assay_component_target_desc= character(), parameter_readout_type= character(), assay_design_type= character(), assay_design_type_sub = character(),biological_process_target = character(),detection_technology_type = character(),detection_technology_type_sub= character(), detection_technology= character(), signal_direction_type= character(),key_assay_reagent_type= character(), - key_assay_reagent = character(),technological_target_type= character(), technological_target_type_sub= character() ) - -assay_component_endpoint <- data.table(aeid=numeric(), acid=numeric(), assay_component_endpoint_name= character(), export_ready=numeric(), internal_ready= character(), assay_component_endpoint_desc= character(), assay_function_type= character(), normalized_data_type= character(), analysis_direction= character(), burst_assay= character(), key_positive_control= character(), signal_direction= character(), intended_target_type= character(), intended_target_type_sub= character(), intended_target_family= character(), intended_target_family_sub= character(), fit_all=numeric()) - -assay_component_map <- data.table(acid =numeric(), acsn = character()) - - - -assay_source <- data.table(asid=numeric(), assay_source_name= character(), assay_source_long_name= character(), assay_source_desc= character()) - -chemical <- data.table(chid = c("20182", "22364", "23463" , "24102", "21735","20283"), - casn = c("80-05-7", "521-18-6", "150-30-1", "22224-92-6", "67-68-5", "95-83-0"), - chnm = c("Bisphenol A", "5alpha-Dihydrotestosterone","Phenylalanine","Fenamiphos", -"Dimethyl sulfoxide","4-Chloro-1,2-diaminobenzene"), - dsstox_substance_id = c("DTXSID7020182", "DTXSID9022364", "DTXSID9023463", "DTXSID3024102", "DTXSID2021735", "DTXSID5020283"), - code = c("C80057", "C521186","C150301","C22224926", "C67685","C95830")) - - - - -mc0 <- data.table(m0id =numeric(), acid =numeric(), spid = character(), apid = character(), rowi =numeric(), - coli =numeric(), wllt = character(), wllq =numeric(), conc = character(), rval = character(), - srcf =character(), created_date = character(), modified_date = character(), - modified_by = character()) -mc1 <- data.table(m1id = character(),m0id =numeric(), acid = character(), cndx = character(), repi = character(), created_date = character(), - modified_date = character(), modified_by = character()) -mc2 <- data.table(m2id = character(),m0id =numeric(), acid = character(),m1id =numeric(), cval = character(), created_date = character(), - modified_date = character(), modified_by = character()) -mc3 <- data.table(m3id =numeric(), aeid =numeric(),m0id =numeric(), acid = character(),m1id =numeric(),m2id =numeric(), bval = character(), pval = character(), - logc = character(), resp = character(), created_date = character(), modified_date = character(), modified_by = character()) - -mc4 <- data.table(m4id =numeric(), aeid =numeric(), spid = character(), bmad = character(), resp_max = character(), resp_min = character(), max_mean = character(), max_mean_conc = character(), max_med = character(), max_med_conc = character(), logc_max = character(), logc_min = character(), cnst = character(), hill = character(), hcov = character(), gnls = character(), gcov = character(), cnst_er = character(), cnst_aic = character(), cnst_rmse = character(), cnst_prob = character(), hill_tp = character(), hill_tp_sd = character(), hill_ga = character(), hill_ga_sd = character(), hill_gw = character(), hill_gw_sd = character(), hill_er = character(), hill_er_sd = character(), hill_aic = character(), hill_rmse = character(), hill_prob = character(), gnls_tp = character(), gnls_tp_sd = character(), gnls_ga = character(), gnls_ga_sd = character(), gnls_gw = character(), gnls_gw_sd = character(), gnls_la = character(), gnls_la_sd = character(), gnls_lw = character(), gnls_lw_sd = character(), gnls_er = character(), gnls_er_sd = character(), gnls_aic = character(), gnls_rmse = character(), gnls_prob = character(), nconc = character(), npts = character(), nrep = character(), nmed_gtbl = character(), tmpi = character(), created_date = character(), modified_date = character(), modified_by = character()) - -mc5 <- data.table(m5id =numeric(), m4id =numeric(), aeid =numeric(), modl = character(), hitc = character(), fitc = character(), coff = character(), actp = character(), modl_er = character(), modl_tp = character(), modl_ga = character(), modl_gw = character(), modl_la = character(), modl_lw = character(), modl_prob = character(), modl_rmse = character(), modl_acc = character(), modl_acb = character(), modl_ac10 = character(), created_date = character(), modified_date = character(), modified_by = character()) - -mc6 <- data.table (m6id =numeric(), m5id =numeric(), m4id =numeric(), aeid =numeric(), mc6_mthd_id = character(), flag = character(), fval = character(), fval_unit = character(), created_date = character(), modified_date = character(), modified_by = character()) - - - -dir <- dbfile_temp -write.csv(mc0, file = file.path(dir,"mc0.csv"), row.names = F) -write.csv(mc1, file = file.path(dir,"mc1.csv"), row.names = F) -write.csv(mc2, file = file.path(dir,"mc2.csv"), row.names = F) -write.csv(mc3, file = file.path(dir,"mc3.csv"), row.names = F) -write.csv(mc4, file = file.path(dir,"mc4.csv"), row.names = F) -write.csv(mc5, file = file.path(dir,"mc5.csv"), row.names = F) -write.csv(mc6, file = file.path(dir,"mc6.csv"), row.names = F) -write.csv(sample, file = file.path(dir,"sample.csv"), row.names = F) -write.csv(assay, file = file.path(dir,"assay.csv"), row.names = F) -write.csv(assay_component, file = file.path(dir,"assay_component.csv"), row.names = F) -write.csv(assay_component_map, file = file.path(dir,"assay_component_map.csv"), row.names = F) -write.csv(assay_component_endpoint, file = file.path(dir,"assay_component_endpoint.csv"), row.names = F) -write.csv(assay_source, file = file.path(dir,"assay_source.csv"), row.names = F) -write.csv(chemical, file = file.path(dir,"chemical.csv"), row.names = F) -``` - - diff --git a/vignettes/Data_processing.Rmd b/vignettes/Data_processing.Rmd deleted file mode 100644 index f5468c0a..00000000 --- a/vignettes/Data_processing.Rmd +++ /dev/null @@ -1,1697 +0,0 @@ ---- -title: tcpl v3.0
Data Processing
-author: "Center for Computational Toxicology and Exposure, US EPA" -output: - prettydoc::html_pretty: - theme: architect - toc: yes - toc_depth: 4 -vignette: > - %\VignetteIndexEntry{tcpl v3.0 Data Processing} - %\VignetteEngine{knitr::rmarkdown} - %\usepackage[utf8]{inputenc} ---- - - - - - -```{css, echo=FALSE} -.scroll-100 { - max-height: 100px; - overflow-y: auto; -} - -.noticebox { - padding: 1em; - background: lightgray; - color: blue; - border: 2px solid black; - border-radius: 10px; -} -``` - -# R Packages - -```{r eval = TRUE, message = FALSE,warning=FALSE} -# Primary Packages # -library(tcpl) -library(tcplfit2) -# Data Formatting Packages # -library(data.table) -library(dplyr) -library(magrittr) -library(reshape2) -# Plotting Packages # -library(ggplot2) -library(gridExtra) -library(RColorBrewer) -library(colorspace) -library(viridis) -# Table Packages # -library(htmlTable) -library(kableExtra) -``` - - -```{r eval = TRUE, echo = FALSE, message = FALSE, results = "hide"} -# This chunk copies the tcplLite local directory to the temp directory used in installation -# to comply with CRAN policies on not writing to the installation directory -tmpdir <- tempdir() -#dbfile <- file.path(system.file(package = "tcpl"), "csv") -#file.copy(from = dbfile, tmpdir, recursive = TRUE) -dbfile_temp <- file.path(tmpdir, "csv") -dir.create(dbfile_temp, showWarnings = F) -tcplConf(db = dbfile_temp, drvr = 'tcplLite') - -``` - -# Introduction - -This vignette explains in the first section how to upload and process the newly-registered assay data through the data analysis pipeline using a small subset of ToxCast data. The tcpl R package provides three functions for adding new data: - -       **tcplRegister** -- to register a new assay element or chemical

-       **tcplUpdate** -- to change or add additional information for existing assay or chemical ids

-       **tcplWriteLvl0** -- to load formatted source data

- -# Uploading New Data - -Before writing any data to the tcpl database, the user has to register the assay and chemical information, i.e. assay identifiers (and minimal assay annotations) and chemical sample identifiers need to be available in the database before writing level 0 data to the database. All processing occurs by assay component or assay endpoint, depending on the processing type (single-concentration or multiple-concentration) and level. No data is stored at the assay or assay source level. The “assay” and “assay_source” tables store annotations to help in the processing and down-stream understanding of the data. Additional details for registering each assay element and updating annotations are provided within the assay registration vignette. - -## Chemicals - -With the minimal assay information registered, the next step is to register the necessary chemical and sample information with tcplRegister . The "chdat" dataset included in the package contains the sample and chemical information for the data that will be loaded. The following shows an example of how to load chemical information. Similar to the order in registering assay information, the user must first register chemicals, then register the samples that map to the corresponding chemical. - -```{r eval = TRUE} -## Obtain the Data ## -# Load the 'chdat' data from the package. -data(chdat, package = "tcpl") -# Convert 'chdat' object to a data.table. -setDT(chdat) -# View the first 6 rows of the table. -head(chdat) -``` - -```{r eval = TRUE, message = FALSE, warning=FALSE} -## Register the Chemicals ## -# Obtain chemicals already registered in the database. -cmap <- tcplLoadChem() -# Find chemicals in 'chdat' that are not registered yet. -chdat.register <- chdat[!(chdat$code %in% cmap$code)] -# Register the chemicals not yet in the database. -tcplRegister(what = "chid", - flds = chdat.register[, - unique(.SD), - .SDcols = c("casn", "chnm", "dsstox_substance_id", "code", "chid")]) -``` - -The "chdat" dataset contains a map of sample to chemical information, but chemical and sample information have to be registered separately because a chemical could potentially have multiple samples. Registering chemicals only takes a chemical CAS registry number ($\mathit{casn}$) and name ($\mathit{chnm}$). In the above example, only the unique chemicals were loaded. The $\mathit{casn}$ and $\mathit{chnm}$ fields have unique constraints; trying to register multiple chemicals with the same name or CAS registry number is not possible and will result in an error. With the chemicals registered and loaded, the samples can be registered by mapping the sample ID ($\mathit{spid}$) to the chemical ID. Note, the user needs to load the chemical information to get the chemical IDs then merge the new chemical IDs with the sample IDs from the original file by chemical name or CASRN. - -```{r eval = TRUE, message = FALSE} -## Register Sample IDs (spids) ## -tcplRegister(what = "spid", - flds = merge(chdat[ , list(spid, casn)], - chdat.register[ , list(casn, chid)], - by = "casn")[ , list(spid, chid)]) -``` - -Optionally, the user can subdivide the chemical IDs into different groups or libraries. For illustration, the chemical IDs will be arbitrarily divided into two chemical libraries, with the even numbered chemical IDs in group 1 and the odd numbered chemical IDs in group 2. - -```{r eval = FALSE} -## Register Chemical Libraries ## -# Subdivide even numbered chemicals in group 1. -grp1 <- cmap[chid %% 2 == 0, unique(chid)] -# Subdivide odd numbered chemicals in group 2. -grp2 <- cmap[chid %% 2 == 1, unique(chid)] -# Register the group 1 chemicals. -tcplRegister(what = "clib", - flds = list(clib = "group_1", chid = grp1)) -# Register the group 2 chemicals. -tcplRegister(what = "clib", - flds = list(clib = "group_2", chid = grp2)) -``` - -Chemical IDs can belong to more than one library, and will be listed as separate entries when loading chemical library information. The tcplLoadClib function provides more information about the ToxCast chemical library used for sample generation, and is only relevant to the MySQL version of invitrodb. - -```{r eval = FALSE} -tcplRegister(what = "clib", - flds = list(clib = "other", chid = 1:2)) -tcplLoadClib(field = "chid", val = 1:2) -``` - -## Source Data - -After registering the chemical and assay information, the data can be loaded into the tcpl local directory. The package includes two datasets from the ToxCast program, "scdat" and "mcdat", with a subset of single- and multiple-concentration data, respectively. The single- and multiple-concentration processing require the same level 0 fields; more information about level 0 pre-processing is in the Introduction vignette. - -```{r eval = FALSE} -## Obtain the Data ## -# Load the multi-concentration data from the package. -data(mcdat, package = 'tcpl') -# Convert 'mcdat' to a data.table. -setDT(mcdat) -``` - -After being pre-processed into the standard format as described in the tcpl introductory vignette, the data are now ready to be loaded into the database with the tcplWriteLvl0 function. The type argument is used throughout the package to distinguish the type of data/processing required: "sc" indicates single-concentration; "mc" indicates multiple-concentration. - -```{r eval = FALSE, message = FALSE} -# Write/load the 'mcdat' into the database. -tcplWriteLvl0(dat=mcdat, type ="mc") -``` - -The tcplLoadData function can be used to load the data from the MySQL database into the current R session. Furthermore, the tcplPrepOtpt function can be used in conjunction with tcplLoadData to prepare the data into a readable format as well as provide additional chemical and assay annotation information by querying the database. We refer the reader to the tcpl data retrieval vignette for further details. - -```{r eval = FALSE, message = FALSE} -# Load the level 0 data from the database to R. -tcplLoadData(lvl=0, fld="acid", val=1, type = "mc") -``` - -Notice in the loaded data, the $\mathit{acsn}$ is replaced by the correct $\mathit{acid}$ and the $\mathit{m0id}$ field is added. The "m#" -fields in the multiple-concentration data are the primary keys for each level of data. These primary keys link the various levels of data. All of the keys are auto-generated and will change anytime data are reloaded or processed. Note, the primary keys only change for the levels affected, e.g. if the user reprocesses level 1, the level 0 keys will remain the same. - -# Data Processing - -This section is intended to help the user understand the general aspects of how the data are processed before diving into the specifics of each processing level for both screening paradigms (i.e. processing types). The details of the two screening paradigms are provided in later sections. - -
- -![Conceptual overview of the ToxCast Pipeline functionality](img/Fig1_tcpl_overview.png) - -
- -All processing in the tcpl package occurs at the assay component or assay endpoint level. There is no capability within either screening paradigm to do any processing which combines data from multiple assay components or assay endpoints. Any combining of data must occur before or after the pipeline processing. For example, a ratio of two values could be processed through the pipeline if the user calculated the ratio during the custom pre-processing script and uploaded a single "component". - -Once the data are uploaded, data processing occurs through the tcplRun function for both single- and multiple-concentration screening. The tcplRun function can either take a single ID ($\mathit{acid}$ or $\mathit{aeid}$, depending on the processing type and level) or an $\mathit{asid}$. If given an $\mathit{asid}$, the tcplRun function will attempt to process all corresponding components/endpoints. When processing by $\mathit{acid}$ or $\mathit{aeid}$, the user must know which ID to give for each level (Table 1). - -The processing is sequential, and every level of processing requires successful processing at the antecedent level. Any processing changes will cause a "delete cascade," removing any subsequent data affected by the processing change to ensure complete data fidelity at any given time. For example, processing level 3 data for multiple-concentration data will cause the data from levels 4 through 6 to be deleted for the corresponding IDs. Level 6 is related to inspecting and flagging curve fits, though this processing step is not currently included in tcpl v3.0 it may be included in future versions. **Changing any method assignments will also trigger a delete cascade for any corresponding data** (more on method assignments below). - -The user must give a start and end level when using the tcplRun function. If processing more than one assay component or endpoint, the function will not stop if one component or endpoint fails. If a component or endpoint fails while processing multiple levels, the function will not attempt to process the failed component/endpoint in subsequent levels. When finished processing, the tcplRun function returns a list indicating the processing success of each id. For each level processed, the list will contain two elements: (1) "l#" a named Boolean vector where TRUE indicates successful processing, and (2) "l#_failed" containing the names of any ids that failed processing, where "#" is the processing level. - -The processing functions print messages to the console indicating the four steps of the processing. These steps include (1) data for the given assay component ID are loaded, (2) the data are processed, (3) data for the same ID in subsequent levels are deleted, and (4) the processed data is written to the database. The 'outfile' parameter in the tcplRun function gives the user the option of printing all the output text to a file. - -The tcplRun function can execute processing of multiple assay components/endpoints simultaneously. This is done with the internal utilization of the mclapply function from the parallel package. Parallel processing is done by id. Depending on the system environment and memory constraints, the user may wish to use more or less processing power. Users pipelining on a Windows operating system the default is $mc.cores = 1$, unless otherwise specified. Users pipelining on a Unix-based operating system the default is $mc.cores = NULL$ indicating the utilization of all cores except for one, which is necessary for 'overhead' processes. The user can specify more or less processing power by setting the "mc.cores" parameter in the tcplRun function to the desired level of processing power. **Note, the specification should meet the following criteria $1 \space \leq \space \mathit{mc.cores} \space \leq \space \mathit{detectCores()}-1$.** - -```{r warning = FALSE, echo = FALSE} -Type <- c('SC', 'SC', 'MC', 'MC', 'MC', 'MC', 'MC', 'MC') -Level <- c('Lvl1', 'Lvl2', 'Lvl1', 'Lvl2', 'Lvl3', 'Lvl4', 'Lvl5', 'Lvl6') -InputID <- c('acid', 'aeid', 'acid', 'acid', 'acid', 'aeid', 'aeid', 'aeid') -MethodID <- c('aeid', 'aeid', 'N/A', 'acid', 'aeid', 'N/A', 'aeid', 'aeid') -Table <- data.frame(Type, Level, InputID, MethodID) - -htmlTable(Table, - rnames = FALSE , - caption="Table 1: Processing checklist.", - tfoot = "The Input ID column indicates the ID used for each processing step; Method ID indicates the ID used for assigning methods for data processing, when necessary. SC = single-concentration; MC = multiple-concentration. Level 6 processing will not be possible in tcpl v3.0, but may be included in future versions.") - -``` - -The processing requirements vary by screening paradigm and level, which later sections cover in details. However, in general, many of the processing steps require specific methods to accommodate different experimental designs or data processing approaches. - -Notice from Table 1 that level 1 single-concentration processing (SC1) requires an $\mathit{acid}$ input (Table 1), but the methods are assigned by $\mathit{aeid}$. The same is true for MC3 processing. SC1 and MC3 are the normalization steps and convert $\mathit{acid}$ to $\mathit{aeid}$. (Only MC2 has methods assigned by $\mathit{acid}$.) The normalization process is discussed in the following section. - -## Methods - -To promote reproducibility, all method assignments must occur through the database and should come from the available list of methods for each processing level. In general, methods data are stored in the "_methods" and "_id" tables that correspond to the data-storing tables. For example, the "sc1" table is accompanied by the "sc1_methods" table which stores the available methods for SC1, and the "sc1_aeid" table which stores the method assignments and execution order. - -The tcpl package provides three functions to easily modify and load the method assignments for the given assay components or endpoints:
- -       **tcplMthdAssign** -- assigns methods to specified id(s)
- -       **tcplMthdClear** -- clears method assignments to specified id(s)
- -       **tcplMthdLoad** -- queries database and returns the method assignments for specified id(s)
- -       **tcplMthdList** -- queries database and returns available methods at specified level(s)
- -The following code blocks will give some examples of how to use the method-related functions. - -```{r eval= FALSE} -## Methods Assignment ## -# For illustrative purposes, assign level 2 MC methods to ACIDs 97, 98, and 99. -# First check for available methods. -mthds <- tcplMthdList(lvl = 2, type = "mc") -mthds[1:2] -# Assign some methods to ACID 97, 98, and 99. -tcplMthdAssign(lvl = 2, - id = 97:99, - mthd_id = c(3, 4, 2), - ordr = 1:3, - type = "mc") -# Check the assigned methods for ACID 97, 98, and 99 in the database. -tcplMthdLoad(lvl = 2, id = 97:99, type = "mc") - -# Methods can be cleared one at a time for the given id(s) -tcplMthdClear(lvl = 2, id = 99, mthd_id = 2, type = "mc") -# Check the assigned methods for the single id updated, namely ACID 99. -tcplMthdLoad(lvl = 2, id = 99, type = "mc") - -# Or all methods can be cleared for the given id(s) -tcplMthdClear(lvl = 2, id = 97:98, type = "mc") -# Check the assigned methods for the all updated ids, namely ACID 97 and 98. -tcplMthdLoad(lvl = 2, id = 97:98, type = "mc") -``` - -Later sections in this vignette provide examples for level specific methods assignment and details on the methods assigned prior to data processing with tcplRun at a particular level. It should be noted that most examples reflect "default" methods assigned, but one should consider the data at hand and all methods available for a specific level prior to assigning methods. - -## Data Normalization - -Data normalization occurs in both single- and multiple-concentration processing paradigms - levels 1 and 3, respectively. While the two paradigms use different methods, the normalization approach is the same for both single- and multiple-concentration processing. Data normalization does not have to occur within the package, and normalized data can be loaded into the database at level 0. **However, data must be zero-centered.** All data must be zero-centered after the normalization step of the pipeline. Thus, the data must either be zero-centered before processing occurs (in preprocessing) or the user must pick a methodology from the associated level 1 and 3 methods to zero-center the data before model fitting occurs. - -The tcpl package supports fold-change and a percent of control approaches to normalization. All data must be zero-centered. Therefore, in general fold-change data is log-transformed. Log-scale transformations for fold-change data is typically base 2 ($log_2$), but in some circumstances other bases may be more appropriate. - -Normalizing to a control requires three normalization methods:
-       1. one to define the baseline value,
-       2. one to define the control value, and
-       3. one to calculate percent of control ("resp.pc").

- -Normalizing to fold-change also requires three methods:
-       1. one to define the baseline value,
-       2. one to calculate the fold-change, and
-       3. one to log-transform the fold-change values ("resp.fc").

- -The ($\mathit{cval}$) is the corrected response value for a test well defined in level 2. Methods defining a baseline value ($\mathit{bval}$) have the "bval" prefix, methods defining the positive control value ($\mathit{pval}$) have the "pval" prefix, and "pval" may be set as 0 if no positive control wells are provided and measuring decreases in signal. Finally, methods that calculate or modify the final response value have the "resp" prefix. For example, "resp.log2" does a log-transformation of the response value using a base value of 2. The formulae for calculating the percent of control and fold-change response values are listed in equations 1 and 2, respectively. Note that the fold-change calculation divides by the baseline value and thus must have some non-zero values associated with the baseline to successfully calculate fold-change. - -$$ resp.pc = \frac{cval - bval}{pval - bval}*100 $$ - -$$ resp.fc = \frac{cval}{bval} $$ - -**Order matters when assigning normalization methods.** The $\mathit{bval}$, and $\mathit{pval}$ if normalizing as a percent of control, need to be calculated prior to calculating the response value. Table 2 shows some possible normalization schemes. - -```{r warning = FALSE, echo = FALSE} -output <- - matrix(c("1. bval.apid.nwlls.med", "2. resp.fc", "1. bval.apid.lowconc.med", "2. bval.apid.pwlls.med", -"3. resp.log2", "4. resp.mult.neg1", "3. resp.pc", "4. resp.multneg1 ", -"1. bval.apid.lowconc.med", "2. resp.fc", "1. bval.spid.lowconc.med", "2. pval.apid.mwlls.med", -"3. resp.log2", "4. \t", "3. resp.pc", "4. \t" , -"1. none", "2. resp.log10", "1. none", "2. resp.multneg1", -"3. resp.blineshift.50.spid", "4. \t", "3. \t", "4. \t"), - ncol=4, byrow = TRUE) - -htmlTable(output, - rnames = FALSE, - rgroup = c("Scheme 1", - "Scheme 2", "Scheme 3"), - n.rgroup = c(2,2), - cgroup = c("Fold-Change", "\\%Control"), - n.cgroup = c(2,2), - caption="Table 2: Example normalization method assignments.") - -``` - -If the data does not require any normalization, the "none" method must be assigned for normalization. The "none" method simply copies the input data to the response field. Without assigning "none", the response field will not get generated and the processing will not complete. - -The tcpl_v2 package only modeled responses in the positive direction. Therefore, a signal in the negative direction needed to be transformed to the positive direction during normalization. Creating multiple endpoints for one component was one way to enable multiple normalization approaches. Multiple normalization approaches were necessary when the assay component detected a signal in both positive and negative directions. Negative direction data was inverted by multiplying the final response values by ${-1}$ (see the "resp.mult.neg" methods in Table 2). tcpl_v3 onward will utilize the tcplFit2 package, which allows for bidirectional fitting, therefore the "resp.mult.neg" method is now only required in special use cases. - -In addition to the required normalization methods, the user can add additional methods to transform the normalized values. For example, the third fold-change example in Table 2 includes "resp.blineshift.50.spid", which corrects for baseline deviations by $\mathit{spid}$. A complete list of available methods, by processing type and level, can be listed with tcplMthdList . More information is available in the package documentation, and can be found by running ??tcpl::Methods . - -## Single-concentration Screening Data - -This section will cover the tcpl process for handling single-concentration data^[This section assumes a working knowledge of the concepts covered in the Data Processing and Data Normalization sections]. The goal of single-concentration processing is to identify potentially active compounds from a broad screen at a single concentration. After the data is loaded into the tcpl database, the single-concentration processing consists of 2 levels (Table 3). - - - -```{r warning = FALSE, echo = FALSE} -Level <- c(" Lvl 0", "Lvl 1 ", "Lvl 2 ") -Description <- c("Pre-processing: Vendor/dataset-specific pre-processing to organize heterogeneous raw data to the uniform format for processing by the *tcpl* package†", - "Normalize: Apply assay endpoint-specific normalization listed in the \'sc1_aeid\' table to the raw data to define response", - "Activity Call: Collapse replicates by median response, define the response cutoff based on methods in the \'sc2_aeid\' table, and determine activity" - ) - -output <- - data.frame(Level, Description) - -htmlTable(output, - - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - - align = 'l', - align.header = 'l', - caption="Table 3: Summary of the tcpl single-concentration pipeline.", - tfoot="† Level 0 pre-processing occurs outside the package and specifics are covered in the Introduction vignette.") - -``` - -### Level 1 - -Level 1 processing converts the assay component to assay endpoint(s) and defines the normalized-response value field ($\mathit{resp}$), logarithm-concentration field ($\mathit{logc}$), and optionally, the baseline value ($\mathit{bval}$) and positive control value ($\mathit{pval}$) fields. The purpose of level 1 is to normalize the raw values to either the percentage of a control or the fold-change from baseline. The normalization process is discussed in greater detail in the Data Normalization section. - -#### Methods Assignment - -Before assigning the methods below, the user needs to register the data for the single-concentration assay, as shown in the previous Register and Upload New Data section. - -Before beginning the normalization process, all wells with well quality ($\mathit{wllq}$) equal to 0 are removed. - -The first step in beginning the processing is to identify which assay endpoints stem from the assay component(s) being processed. - -```{r eval = FALSE} -# Load the 'aeid' values for 'acid = 2'. -tcplLoadAeid(fld = "acid", val = 2) -``` - -With the corresponding endpoints identified, the appropriate methods can be assigned. - -```{r eval = FALSE} -# Assign the level 1 methods to AEID 1 & 2. -tcplMthdAssign(lvl = 1, # processing level - id = 1:2, # assay endpoint ID's to assign methods - mthd_id = c(1, 11, 13), # method(s) to be assigned - ordr = 1:3, # order the method(s) should be applied - type = "sc") # the data/processing type -``` - -Above, methods 1, 11, and 13 were assigned for both endpoints. The method assignments instruct the processing to: (1) calculate $\mathit{bval}$ for each assay plate ID by taking the median of all data where the well type equals "n"; (2) calculate a fold-change with respect to the $\mathit{bval}$ (i.e. $\frac{resp}{\mathit{bval}}$); (3) log-transform the fold-change values with base 2. - -If a user needs to add a method to the end of a normalization sequence, as shown above, then the user can use a second method assignment statement. For example, suppose for AEID 2 only we need to indicate a change of directionality in the response and multiply all response values by $-1$. Then, the following code can be executed. **Reminder, the order of methods assignment matters, particularly in the normalization step.** - -```{r eval = FALSE} -# Assign a fourth step to the normalization processing - for AEID 2 only. -tcplMthdAssign(lvl = 1, # processing level - id = 2, # assay endpoint ID's to assign methods - mthd_id = 16, # method(s) to be assigned - ordr = 1, # order the method(s) should be applied - type = "sc") # the data/processing type -``` - -For a complete list of normalization methods see tcplMthdList(lvl = 1, type = "sc") or ?SC1\_Methods . - -```{r echo=FALSE, eval = FALSE} -# With the assay endpoints and normalization methods defined, the data are ready for level 1 processing. - -## Do level 1 processing for acid 1 -sc1_res <- tcplRun(id = 1, slvl = 1, elvl = 1, type = "sc") -``` - -**Note, though level 1 methods are assigned at the assay endpoint ID, processing takes an assay component ID as the input ID.** As mentioned previously, the user must assign normalization methods by assay endpoint, then do the processing by assay component. We will demonstrate in a later section how to run the processing step. When level 1 processing is performed tcpl will attempt to process all endpoints in the database for a given component. If one endpoint fails for any reason (e.g., does not have the appropriate methods assigned), the processing for the entire component fails. - -### Level 2 - -Level 2 processing defines the baseline median absolute deviation ($\mathit{bmad}$), collapses any replicates by sample ID, and determines the activity. - -#### Methods Assignment - -Before the data are collapsed by sample ID, the $\mathit{bmad}$ is calculated as the median absolute deviation of all treatment wells ($\mathit{wllt} = t$ - default option) or blank wells ($\mathit{wllt} = n$). The calculation to define $\mathit{bmad}$ is done once across the entire assay endpoint. **If additional data is added to the database for an assay component, the $\mathit{bmad}$ values for all associated assay endpoints will change.** Note, this $\mathit{bmad}$ definition is different from the $\mathit{bmad}$ definition used for multiple-concentration screening. - -$$ bmad_{sc} = 1.4826*median(\big | y_{i} - \tilde{y} \big |)$$ - -Where $y_i$ is the $i^{th}$ observation of all wells within a well type in the assay component and $\tilde{y}$ is the median across all $y_i$'s (see Table 4 for further details). The constant value, $1.4826$, is the default adjustment value used in the underlying R function to ensure $bmad$ is a consistent estimator of the standard deviation ($\sigma$) assuming the sample size ($N$) of the observations is large and they are normally distributed (i.e. Gaussian), see [mad() in R](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/mad) and [unbiased mad](https://aakinshin.net/posts/unbiased-mad/#references) for further details. - - - -```{r warning = FALSE, echo = FALSE} -## Create the sc BMAD calculation Table ## -# Specify column 1 in the table - Methods. -Method <- c(1,2) -# Specify column 2 in the table - Description. -Description <- c( - "Median absolute deviation (MAD) of all treatment wells across the assay component (acid).", - "Median absolute deviation (MAD) of all blank wells across the assay component (acid)." -) -# Specify column 3 in the table - Observations. -Observations <- c( - "$y_{i} = y_{(s,w)}$", # method 1 - "$y_{i} = y_{(s,w)}$" # method 2 -) -# Specify column 4 in the table - Observation ID. -ID <- c( - "$s \\in \\{1,...,n_{acid}\\}$, \n$w = t$", - "$s \\in \\{1,...,n_{acid}\\}$, \n$w = n$" -) -# Specify column 5 in the table - Details about the Observation ID. -Details <- c( - "$s$ indicates the sample id within an 'acid' & $w$ indicates the well type", - "$s$ indicates the sample id within an 'acid' & $w$ indicates the well type" -) -# Create the output table. -output <- - data.frame(Method,Description,Observations,ID,Details) -# Out put the table in an 'html' format. -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 4: Single concentration *baseline* estimation by method assignment in Level 2 processing." -) -``` - -To collapse the data by sample ID, the median response value of replicates within a concentration is calculated. (**Note**, in most cases each $\mathit{spid}$ will only have a single concentration level.) Data are then further collapsed by taking the maximum of those median values ($\mathit{max\_med}$). - -Once the data are collapsed, such that each assay endpoint-sample pair only has one value, the activity is determined. For a sample to get an active hit call, the $\mathit{max\_med}$ must be greater than a specified efficacy cutoff. The efficacy cutoff is determined by the level 2 methods. The efficacy cutoff value ($\mathit{coff}$) is defined as the maximum of all values given by the assigned level 2 methods. Failing to assign a level 2 method will result in every sample being called active. For a complete list of level 2 methods, see tcplMthdList(lvl = 2, type = "sc") or ?SC2\_Methods. - -```{r eval = FALSE} -# Assign a cutoff value of log2(1.2). -tcplMthdAssign(lvl = 2, # processing level - id = 1, # assay endpoint ID's to assign methods - mthd_id = 3, # method(s) to be assigned - type = "sc") # the data/processing type -``` - -In the example above, we are assigning level 2 methods such that the cutoff value is $log_2(1.2)$. Thus, if the maximum median value ($\mathit{max\_med}$) is greater than or equal to the efficacy cutoff ($\mathit{coff} = log_2(1.2)$), then the sample ID is considered active and the hit call ($\mathit{hitc}$) is set to 1. - -```{r echo=FALSE, eval = FALSE} -# With the methods assigned and the cutoff set, the data are ready for level 2 processing. - -## Do level 2 processing for acid 1 -sc2_res <- tcplRun(id = 1, slvl = 2, elvl = 2, type = "sc") -``` - -## Multiple-concentration Screening Data - -This section will cover the tcpl process for handling multiple-concentration data^[This section assumes a working knowledge of the concepts covered in the Data Processing and Data Normalization sections]. The goal of multiple-concentration processing is to estimate the activity, potency, efficacy, and other parameters for sample-assay pairs. After the data is loaded into the tcpl database, the multiple-concentration processing consists of six* levels (Table 5). - - - -```{r warning = FALSE, echo = FALSE} -Level <- c("Lvl 0 ", "Lvl 1", "Lvl 2", "Lvl 3", "Lvl 4", "Lvl 5", "Lvl 6") -Description <- c("Pre-processing: Vendor/dataset-specific pre-processing to organize heterogeneous raw data to the uniform format for processing by the *tcpl* package†", - "Index: Define the replicate and concentration indices to facilitate -all subsequent processing", - "Transform: Apply assay component (acid) specifc transformations -listed in the \'mc2_acid\' table to the raw data to define the -corrected data", -"Normalize: Apply assay endpoint (aeid) specifc normalization listed in -the \'mc3_aeid\' table to the corrected data to define response", -"Fit: Model the concentration-response data utilizing ten -objective curve-fitting functions from tcplfit2: (1) constant, (2) hill, (3) gain-loss, (4) polynomial-linear, (5) polynomial-quadratic, (6) power, (7) exponential-2, (8) exponential-3, (9) exponential-4, (10) exponential-5", -"Model Selection/Acitivty Call: Select the winning model, define -the response cutoff based on methods in the \'mc5_aeid\' table, and -determine activity", -"Flag: Flag potential false positive and false negative endings based -on methods in the \'mc6_aeid\' table‡" - ) - -output <- - data.frame(Level, Description) - -htmlTable(output, - - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - align = 'l', - align.header = 'l', - caption="Table 5: Summary of the tcpl multiple-concentration pipeline.", - tfoot="† Level 0 pre-processing occurs outside the package and specifics are covered in Introduction vignette. \n‡Level 6 processing *will not* be possible in tcpl v3.0, but may be included in future versions.") - -``` - -### Level 1 - -Level 1 processing defines the replicate and concentration index fields to facilitate downstream processing. Because of cost, availability, physicochemical, and technical constraints, screening-level efforts utilize numerous experimental designs and test compound (sample) stock concentrations. The resulting data may contain an inconsistent number of concentration groups, concentration values, and technical replicates. To enable quick and uniform processing, level 1 processing explicitly defines concentration and replicate indices, giving integer values $1 \dots N$ to increasing concentrations and technical replicates, where $1$ represents the lowest concentration or first technical replicate. - -To assign replicate and concentration indices, we assume one of two experimental designs. The first design assumes samples are plated in multiple concentrations on each assay plate, such that the concentration series all falls on a single assay plate. The second design assumes samples are plated in a single concentration on each assay plate, such that the concentration series falls across many assay plates. - -For both experimental designs, data are ordered by source file ($\mathit{srcf}$), assay plate ID ($\mathit{apid}$), column index ($\mathit{coli}$), row index ($\mathit{rowi}$), sample ID ($\mathit{spid}$), and concentration ($\mathit{conc}$). Concentration is rounded to three significant figures to correct for potential rounding errors. After ordering the data, we create a temporary replicate ID, identifying an individual concentration series. For test compounds in experimental designs with the concentration series on a single plate and all control compounds, the temporary replicate ID consists of the sample ID, well type ($\mathit{wllt}$), source file, assay plate ID, and concentration. The temporary replicate ID for test compounds in experimental designs with concentration series that span multiple assay plates is defined similarly, but does not include the assay plate ID. - -Once the data are ordered, and the temporary replicate ID is defined, the data are scanned from top to bottom and increment the replicate index ($\mathit{repi}$) every time a replicate ID is duplicated. Then, for each replicate, the concentration index ($\mathit{cndx}$) is defined by ranking the unique concentrations, with the lowest concentration starting at 1. - -```{r echo=FALSE, eval = FALSE, message = FALSE} -# The following demonstrates how to carry out the level 1 processing and look at the resulting data: - -## Do level 1 processing for acid 1 -mc1_res <- tcplRun(id = 1, slvl = 1, elvl = 1, type = "mc") -``` - -The resulting level 1 data can be loaded, after processing is complete, to check the processing was done appropriately. - -```{r eval = FALSE} -## Evaluate Level 1 Indexing ## -# Load the level 1 data from the database. -m1dat <- tcplLoadData(lvl = 1, - fld = "acid", - val = 1, - type = "mc") -# Prepare the data into a readable format. -m1dat <- tcplPrepOtpt(m1dat) -# Sort the data based on the concentration and replicate inidices. -setkeyv(m1dat, c("repi", "cndx")) -# Display the 'cndx' and 'repi' values. -m1dat[chnm == "Bisphenol A", - list(chnm, conc, cndx, repi)] -``` - -The package also contains a function, namely tcplPlotPlate , for visualizing the data at the assay plate level. This function can be used to visualize the data at levels 1 to 3. - -```{r eval = FALSE, warning = FALSE, message = FALSE, fig.width = 30, fig.height= 20} -tcplPlotPlate(dat = m1dat, apid = "TP0001915") -``` - - - - - -In the generated figure, the row and column indices are printed along the respective edges of the plate, with the raw observed values in each well represented by color. While the plate does not give sample ID information, the letter/number codes in the wells indicate the well type and concentration index, respectively. The plate display also shows the wells with poor quality (as defined by the well quality, $\mathit{wllq}$, field at level 0) with an "X." Plotting plates in subsequent levels of wells with poor quality will appear empty. The title of the plate display lists the assay component/assay endpoint and the assay plate ID ($\mathit{apid}$). - -### Level 2 - -Level 2 processing removes data where the well quality ($\mathit{wllq}$) equals 0 and defines the corrected value ($\mathit{cval}$) field. This level of processing also allows for any transformation of the raw values at the assay component level. Examples of transformation methods could range from basic logarithmic transformations, to complex spatial noise reduction algorithms. Currently, the tcpl package only consists of basic transformations, but could be expanded in future releases. Level 2 processing does not include normalization methods; normalization should be assigned and occur during level 3 processing. - -#### Methods Assignment - -Every assay component needs at least one transformation method assigned to complete level 2 processing. For the example data used in this vignette, no transformations are necessary at level 2. To allow level 2 processing to complete without performing any transformation, assign the "none" method to the assay component(s). - -```{r eval = FALSE, message = FALSE} -## Methods Assignment ## -# Assign the level 2 transformation method 'none' to ACID 1. -tcplMthdAssign(lvl = 2, # processing level - id =1, # assay component ID's to assign methods - mthd_id = 1, # method(s) to be assigned - ordr = 1, # order of the method(s) should be assigned - type = "mc") # the data/processing type -``` - -```{r echo=FALSE, eval = FALSE, warning = FALSE, message = FALSE} -# With the method assigned, the processing can be completed. - -## Do level 2 processing for acid 1 -mc2_res <- tcplRun(id = 1, slvl = 2, elvl = 2, type = "mc") -``` - -For the complete list of level 2 transformation methods currently available, see tcplMthdList(lvl = 2, type = "mc") or ?MC2\_Methods for more details. The coding methodology used to implement the methods is beyond the scope of this vignette, but, in brief, the method names in the database correspond to a function name in the list of functions returned by mc2\_mthds() (the mc2\_mthds function is not exported, and not intended for use by the user). Each of the functions in the list given by mc2\_mthds only return expression objects that the processing function called by tcplRun executes in the local function environment to avoid making additional copies of the data in memory. We encourage suggestions for new methods. - -### Level 3 - -Level 3 processing converts the assay component to assay endpoint(s) and defines the normalized-response value field ($\mathit{resp}$); log-scale concentration field ($\mathit{logc}$); and optionally, the baseline value ($\mathit{bval}$) and positive control value ($\mathit{pval}$) fields. The purpose of level 3 processing is to normalize the corrected values to either the percentage of a control or to fold-change from baseline. The normalization process is discussed in greater detail in the Data Normalization section. A primary distinction between level 2 and level 3 processing is that level 2 processes assay components and level 3 processes assay endpoints. The user must assign level 3 processing to assay endpoint identifiers. - -#### Methods Assignment - -The user first needs to check which assay endpoints stem from the the assay component queued for processing. - -```{r eval = FALSE} -# Look at the assay endpoints for acid 1. -tcplLoadAeid(fld = "acid", val = 1) -``` - -Now that we have the corresponding assay endpoints listed, the normalization methods can be assigned. - -```{r eval = FALSE, message = FALSE} -## Methods Assignment ## -# Assign the baseline calculation and normalization methods to AEID's 1 & 2. -tcplMthdAssign(lvl = 3, # processing level - id = 1:2, # assay endpoint ID to assign methods - mthd_id = c(17, 9, 7), # method(s) to be assigned - ordr = 1:3, # order the method(s) should be applied - type = "mc") # the data/processing type -``` - -Above, methods 17, 9, and 7 were assigned for both endpoints. The method assignments instruct the level 3 processing to: (1) calculate $\mathit{bval}$ for each assay plate ID by taking the median of all data where the well type equals "n" or the well type equals "t" and the concentration index is 1 or 2; (2) calculate a fold-change over $\mathit{bval}$; (3) log-transform the fold-change values with base 2. - -For a complete list of normalization methods see tcplMthdList(lvl = 3, type = "mc") or ?MC3\_Methods . - -```{r echo=FALSE, eval = FALSE,warning = FALSE, message = FALSE} -# With the assay endpoints and normalization methods defined, the data are ready for level 3 processing. - -## Do level 3 processing for acid 1 -mc3_res <- tcplRun(id = 1, slvl = 3, elvl = 3, type = "mc") -``` - -Notice that level 3 processing takes an assay component ID, not an assay endpoint ID, as the input ID. Though as mentioned in previous sections, the user must assign the normalization methods by assay endpoint. Then, the processing is done by assay component. The level 3 processing will attempt to process all endpoints in the database for a given component. If one endpoint fails for any reason (e.g., does not have appropriate methods assigned), the processing for the entire component fails. - -::: {.noticebox data-latex=""} - -**NOTE:** - -If the starting level (slvl) is less than 4, then 'id' is interpreted by tcplRun as an assay component id (acid). When slvl is greater than or equal to 4 the 'id' is interpreted as an assay endpoint id (aeid). The user must provide either an assay source id (asid) or 'id'. If an 'id' fails, no results are loaded into the database and the 'id' is not included in the cue for subsequent processing levels. - -::: - - -### Level 4 - -Level 4 processing splits the data into concentration-response series by sample and assay endpoint, then models the activity (i.e. response) of each series. Each series is modeled using the bi-directional fitting methods available in the tcplFit2 R package ([Sheffield et al., 2021](https://academic.oup.com/bioinformatics/article-abstract/38/4/1157/6428656?redirectedFrom=fulltext&login=true)). Bi-directional fitting directly models the activity in the concentration series without performing curve inversion (i.e. observed responses producing a 'negative/decreasing' trend with increasing concentration groups are multiplied by $-1$ to induce a 'positive/increasing' trend) as used in previous versions of tcpl . - -#### Pre-Modeling Processes - -Level 4 processing starts with the removal of well types with only one concentration (e.g. 'wllt = b'; empty/blank wells). Next, a noise-band is established for the assay endpoint using the baseline median absolute deviation ($\mathit{bmad}$). Here, the $\mathit{bmad}$ is calculated by the baseline response values which are assumed to be either untreated control wells (e.g. 'wllt = n'; neutral solvent wells like DMSO) *or* test samples from the two lowest concentrations (i.e. 'wllt = t' & concentration index is 1 or 2). The calculation to define $\mathit{bmad}$ is done once across the entire assay endpoint. **If additional data is added to the database for an assay component, the $\mathit{bmad}$ values for all associated assay endpoints will change.** - -$$ bmad_{mc} = 1.4826*median(\big | y_{i} - \tilde{y} \big |)$$ -Where $y_{i}$ is the $i^{th}$ baseline observation, defined based on the assigned method - see Table 6 for details, and $\tilde{y}$ is the median of all the baseline observations. The constant value, $1.4826$, is the default adjustment value used in the underlying R function to ensure $bmad$ is a consistent estimator of the standard deviation ($\sigma$) assuming the sample size ($N$) of the baseline observations is large and they are normally distributed (i.e. Gaussian), see [mad() in R](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/mad) and [unbiased mad](https://aakinshin.net/posts/unbiased-mad/#references) for further details. - -In tcpl_v3 onward, the new mc4 method "onesd.aeid.lowconc.twells" must also be assigned in order to calculate one standard deviation of baseline response, which is necessary for the calculation of the benchmark response (BMR) used both in the curve-fitting and hit-calling functions from tcplFit2 (i.e. tcplfit_core and tcplhit2_core , respectively). One standard deviation of the baseline response for an assay endpoint is estimated using the two lowest concentration groups of test samples across all chemicals. **It should be noted that the benchmark response (BMR) as defined will change for a single sample in a given assay endpoint as additional screening data are pipelined. Thus, the benchmark dose (BMD) estimate may change over time.** - -```{r warning = FALSE, echo = FALSE} -# First column with the method assignment index. -Method <- c( - 1,2,3 -) -# Second column with the general methods description. -Description <- c( - "Median absolute deviation (MAD) of all observations in the lowest two concentrations of across samples (spid) in the assay endpoint (aeid).", - "Median absolute deviation (MAD) of all observations in the solvent/untreated control observations across samples (spid) in the assay endpoint (aeid).", - "Standard deviation (SD) of all observations in the lowest two concentrations of across samples (spid) in the assay endpoint (aeid)." -) -# Third column with the observation information. -Observations <- c( - "$y_{i} = y_{(s,w,d)}$", # method 1 - "$y_{i} = y_{(s,w)}$", # method 2 - "$y_{i} = y_{(s,w,d)}$" # method 3 -) -# Fourth column with the observation ID information. -ID <- c( - "$s \\in \\{1,...,n_{aeid}\\}$, \n$w = t$, \n$d \\in \\{ 1,2 \\}$", - "$s \\in \\{1,...,n_{aeid}\\}$, \n$w = n$", - "$s \\in \\{1,...,n_{aeid}\\}$,\n$w = t$,\n$d \\in \\{ 1,2 \\}$" -) -# Fifth column with the details on the ID's. -Details <- c( - "$s$ indicates the sample id within an 'aeid', $w$ indicates the well type, & $d$ indicates the concentration group index", - "$s$ indicates the sample id within an 'aeid', $w$ indicates the well type", - "$s$ indicates the sample id within an 'aeid', $w$ indicates the well type, & $d$ indicates the concentration group index" -) -# Compile all of the information for the table. -output <- - data.frame(Method,Description,Observations,ID,Details) -# Export/print the table to an html rendered table. -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 6: Multiple concentration *baseline* variability estimation by method assignment in Level 4 processing." - ) -``` - -Before the model parameters are estimated, a set of summary values are calculated for each concentration series: - -* Minimum and maximum observed responses (resp_min & resp_max, respectively). -* Minimum and maximum concentrations (on the log-scale) (logc_min & logc_max, respectively). -* The total number of concentration groups (nconc). -* Total number of observed responses (i.e. data points in the concentration series) (npts). -* Number of replicates in concentration groups (nrep). -* The maximum mean and median responses along with the concentration at which -they occur (max_mean, max_med, max_mean_conc, & max_med_conc, respectively). -* The number of median responses greater than $3\mathit{bmad}$ (nmed_gtbl). - -When referring to the concentration series , the "mean" and "median" response values are defined as the mean or median of all observed response values at each concentration. In other words, the maximum median is the maximum of all median response values across the concentration groups in the series. - -The following code demonstrates how a user, when connected to a database with tcpl pipelined data, can load the level 3 multiple concentration data for a single assay endpoint (aeid). - -```{r eval=FALSE} -## Evaluate the Level 3 Data ## -# Load the level 3 data from the database. -mc3 <- tcplLoadData(lvl = 3, - type = 'mc', - fld = 'aeid', - val = 80) -# Prepare the data into a readable format. -mc3 <- tcplPrepOtpt(mc3) -# Display the data. -mc3 -``` - -For demonstration purposes, we provide the mc_vignette R data object within the tcpl package since the vignette is not directly connected to such a database. The mc_vignette object contains a subset of data from level 3 through 5 from the most recent version of the invitroDB database. The following code demonstrates how to load the example data object and accessing/storing the level 3 data in the mc3 object. - -```{r message=FALSE} -# Load the example data from the `tcpl` package. -data(mc_vignette,package = 'tcpl') - -# Allocate the level 3 example data to `mc3`. -mc3 <- mc_vignette[['mc3']] -``` - -Plot the concentration-response series for one of the example spid's in the mc3 object along with the summary estimates mentioned previously in the bullet list above. - -```{r fig.align='center',class.source="scroll-100",message=FALSE,fig.dim=c(8,10)} -## Obtain Data ## -# Obtain the level 4 example data. -mc4 <- mc_vignette[["mc4"]] -# Obtain the minimum response observed and the 'logc' group - 'resp_min'. -level3_min <- mc3 %>% - dplyr::group_by(spid,chnm) %>% - dplyr::filter(resp == min(resp)) %>% - dplyr::filter(spid == "01504209") -# Obtain the maximum response observed and the 'logc' group - 'resp_max'. -level3_max <- mc3 %>% - dplyr::group_by(spid,chnm) %>% - dplyr::filter(resp == max(resp)) %>% - dplyr::filter(spid == "01504209") -# Obtain the level 3 data and 'center' estimates for responses per 'logc' group. -level3_summary <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - dplyr::select(.,c(spid,chnm,logc,resp)) %>% - dplyr::group_by(spid,chnm,logc) %>% - dplyr::summarise(mean_resp = mean(resp),med_resp = median(resp)) -## Generate Individual Summary Plots ## -# Plot the mean responses for each log-concentration group. -A <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(data = .,aes(logc,resp))+ - geom_point(pch = 1,size = 2)+ - geom_point(data = level3_summary, - aes(x = logc,y = mean_resp, - col = 'mean responses'), - alpha = 0.75,size = 2)+ - scale_color_manual(values = 'paleturquoise3', - aesthetics = 'col')+ - labs(lty = "",colour = "")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+ - ggtitle("Mean Responses")+ - theme_bw()+ - theme(legend.position = 'bottom') -# Plot the median responses for each log-concentration group. -B <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(data = .,aes(logc,resp))+ - geom_point(pch = 1,size = 2)+ - geom_point(data = level3_summary, - aes(x = logc,y = med_resp, - col = 'median response'), - alpha = 0.75,size = 2)+ - scale_color_manual(values = 'hotpink', - aesthetics = 'col')+ - labs(lty = "",colour = "")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+ - ggtitle("Median Responses")+ - theme_bw()+ - theme(legend.position = 'bottom') -# Plot the maximum mean & median responses at the related log-concentration - -# 'max_mean' & 'max_mean_conc'. -C <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(data = .,aes(logc,resp))+ - geom_point(pch = 1,size = 2)+ - geom_point(data = dplyr::filter(mc4,spid == "01504209"), - aes(x = max_mean_conc,y = max_mean, - col = 'maximum mean response'), - alpha = 0.75,size = 2)+ - scale_color_manual(values = 'paleturquoise3', - aesthetics = 'col')+ - labs(lty = "",colour = "")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+ - ggtitle(label = "Maximum Mean Response")+ - theme_bw()+ - theme(legend.position = 'bottom') -# Plot the maximum mean & median responses at the related log-concentration - -# 'max_med' & 'max_med_conc'. -D <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(data = .,aes(logc,resp))+ - geom_point(pch = 1,size = 2)+ - geom_point(data = dplyr::filter(mc4,spid == "01504209"), - aes(x = max_med_conc,y = max_med, - col = "maximum median response"), - alpha = 0.75,size = 2)+ - scale_color_manual(values = 'hotpink', - aesthetics = 'col')+ - labs(lty = "",colour = "")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+ - ggtitle(label = "Maximum Median Response")+ - theme_bw()+ - theme(legend.position = 'bottom') -# Plot the minimum & maximum observed responses. -E <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(data = .,aes(logc,resp))+ - geom_point(pch = 1,size = 2)+ - geom_point(data = level3_min, - aes(x = logc,y = resp, - col = "minimum response"), - alpha = 0.75,size = 2)+ - geom_point(data = level3_max, - aes(x = logc,y = resp, - col = "maximum response"), - alpha = 0.75,size = 2)+ - scale_color_manual(values = c('red','blue'), - aesthetics = 'col')+ - labs(lty = "",colour = "")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+ - ggtitle(label = "Minimum & Maximum\nResponses")+ - theme_bw()+ - theme(legend.position = 'bottom') -# Plot the minimum & maximum experimental log-concentration groups - -# 'logc_min' & 'logc_max'. -G <- mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(data = .,aes(logc,resp))+ - geom_point(pch = 1,size = 2)+ - geom_vline(data = dplyr::filter(mc4,spid == "01504209"), - aes(xintercept = logc_min, - col = 'minimum concentration'), - lty = "dashed")+ - geom_vline(data = dplyr::filter(mc4,spid == "01504209"), - aes(xintercept = logc_max, - col = 'maximum concentration'), - lty = "dashed")+ - scale_color_manual(values = c('red','blue'), - aesthetics = 'col')+ - labs(lty = "",colour = "")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+ - ggtitle(label = "Minimum & Maximum\nConcentrations")+ - theme_bw()+ - theme(legend.position = 'bottom') -## Compile Summary Plots in One Figure ## -gridExtra::grid.arrange( - A,B,C,D,E,G, - nrow = 3,ncol = 2, - top = mc3[which(mc4[,spid] == "01504209"),aenm] -) -``` - -**Figure 1:** The plots in this figure illustrate the summary estimates calculated as part of the level 4 processing, which occurs prior to dose-response modeling. Each of the plots depict the observed concentration-response data with white circles, where the x-axis is base 10 log-transformed concentration values. The mean response values for each concentration group are depicted as turquoise circles in the upper left plot. Similarly, the upper right plot depicts the median response values for each concentration group with hot-pink circles. The middle two plots again depict mean and median responses, but only shows the maximum mean ($\mathit{max\_mean}$) and median ($\mathit{max\_med}$) response estimates (left and right plots, respectively). The bottom left plot depicts the minimum observed response value ($\mathit{min\_resp}$) with a blue circle and the maximum observed response value ($\mathit{max\_resp}$) with a red circle. Finally, the minimum ($\mathit{min\_logc}$) and maximum $\mathit{max\_logc}$ log10-scale concentrations are depicted, respectively, with blue and red vertical dashed lines. - -```{r eval=FALSE, echo=FALSE} -# Randomly selecting ATG AEID's. -atg.aeid <- tcplLoadAeid(fld = 'asid',val = 3) %>% - dplyr::filter(grepl(aenm,pattern = "_up$")) -atg.aeid -set.seed(1629) -sampid <- sample(atg.aeid[,aeid],size = 3,replace = FALSE) -``` - -```{r eval=FALSE, echo=FALSE} -# Load mc3 data -mc3 <- tcpl::tcplPrepOtpt( - tcpl::tcplLoadData( - lvl = 3L, - type = 'mc', - fld = 'aeid', - val = sampid - ) -) -``` - -#### Concentration-Response Modeling Details - -After the summary values are obtained for each concentration-response series, all ten parametric models available in tcplFit2 are used to fit each series. See Table 7 for model details. - -```{r warning = FALSE, echo = FALSE} -# First column - tcplfit2 available models. -Model <- c( - "Constant", "Linear", "Quadratic","Power", "Hill", "Gain-Loss", - "Exponential 2", "Exponential 3","Exponential 4", "Exponential 5" -) -# Second column - model abbreviations used in invitrodb & tcplfit2. -Abbreviation <- c( - "cnst", "poly1", "poly2","pow", "hill", "gnls", - "exp2", "exp3", "exp4", "exp5" -) -# Third column - model equations. -Equations <- c( - "$f(x) = 0$", # constant - "$f(x) = ax$", # linear - "$f(x) = a(\\frac{x}{b}+(\\frac{x}{b})^{2})$", # quadratic - "$f(x) = ax^p$", # power - "$f(x) = \\frac{tp}{1 + (\\frac{ga}{x})^{p}}$", # hill - "$f(x) = \\frac{tp}{(1 + (\\frac{ga}{x})^{p} )(1 + (\\frac{x}{la})^{q} )}$", # gain-loss - "$f(x) = a*(exp(\\frac{x}{b}) - 1)$", # exp 2 - "$f(x) = a*(exp((\\frac{x}{b})^{p}) - 1)$", # exp 3 - "$f(x) = tp*(1-2^{\\frac{-x}{ga}})$", # exp 4 - "$f(x) = tp*(1-2^{-(\\frac{x}{ga})^{p}})$" # exp 5 -) -# Fourth column - model parameter descriptions. -OutputParameters <- c( - "", # constant - "a (y-scale)", # linear, - "a (y-scale), b (x-scale)", # quadratic - "a (y-scale), p (power)", # power - "tp (top), ga (gain AC50), p (gain-power)", # hill - "tp (top), ga (gain AC50), p (gain power), la (loss AC50), q (loss power)", # gain-loss - "a (y-scale), b (x-scale)", # exp2 - "a (y-scale), b (x-scale), p (power)", # exp3 - "tp (top), ga (AC50)", # exp4 - "tp (top), ga (AC50), p (power)" # exp5 -) -# Fifth column - additional model details. -Details <- c( - "Parameters always equals 'er'.", # constant - "", # linear - "", # quadratic - "", # power - "Concentrations are converted internally to log10 units and optimized with f(x) = tp/(1 + 10^(p*(gax))), then ga and ga_sd are converted back to regular units before returning.", # hill - "Concentrations are converted internally to log10 units and optimized with f(x) = tp/[(1 + 10^(p*(gax)))(1 + 10^(q*(x-la)))], then ga, la, ga_sd, and la_sd are converted back to regular units before returning." , # gain-loss - "", # exp2 - "", # exp3 - "", # exp4 - "") # exp5 -# Consolidate all columns into a table. -output <- - data.frame(Model, Abbreviation, Equations, - OutputParameters, Details) -# Export/print the table into an html rendered table. -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 7: *tcplfit2* model details.", - tfoot = "Model descriptions are pulled from tcplFit2 manual at ." -) - -``` - -Each of these models assumes the background response is zero and the absolute response (or initial response) is increasing. Upon completion of the model fitting, each model gets a success designation: 1 if the model optimization converges, 0 if the optimization fails, and NA if 'nofit' was set to TRUE within tcplfit2_core function from tcplFit2 . Similarly, if the Hessian matrix was successfully inverted then 1 is returned to indicate a successful covariance calculation (cov); otherwise 0 is returned. Finally, in cases where 'nofit' was set to TRUE (within tcplFit2::tcplfit2_core ) or the model fit failed the Akaike information criterion (aic), root mean squared error (rme), model estimated responses (modl), model parameters (parameters), and the standard deviation of model parameters (parameter sds) are set to NA. A complete list of model output parameters is provided in Table 8 below. - -```{r warning = FALSE, echo = FALSE} -# First column - tcplfit2 additional fit parameters. -FitParameters <- c( - "er", "success", "cov", "aic", "rme", "modl", - "parameters", "parameters sds", "pars", "sds" -) -# Second column - description of additional fit parameters. -Description <- c( - "Error term","Success of Fit/Model Convergenece","Success of Covariance", - "Aikaike Information Criteria", "Root Mean Squared Error", - "Vector of Model Estimated Values at Given Concentrations", - "Model Parameter Values", "Standard deviation of Model Parameter Values", - "Vector of Parameter Names","Vectors of Parameter Standard Deviation Names" -) -# Consolidate all columns into a table. -output <- - data.frame(FitParameters, Description) -# Export/print the table into an html rendered table. -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - - caption="Table 8: Model output descriptions." , - tfoot = "Model output descriptions are pulled from tcplFit2 manual at ." -) -``` - -All models assume the error follows a Student's t-distribution with four degrees of freedom. Heavier (i.e. wider) tails in the t-distribution diminish the influence of outlier values, and produce more robust estimates than the more commonly used normal distribution. Robust model fitting removes the need to eliminate potential outliers prior to fitting. Maximum likelihood estimation is utilized in the model fitting algorithm to estimate model parameters for all available models in tcplFit2 . - -Let $t(z,\nu)$ be the Student's t-distribution with $\nu$ degrees of freedom, -$y_{i}$ be the observed response at the $i^{th}$ observation, and $\mu_{i}$ be -the estimated response at the $i^{th}$ observation. We calculate $z_{i}$ as: - - - $$ z_{i} = \frac{y_{i} - \mu_{i}}{exp(\sigma)}, $$ - - -where $\sigma$ is the scale term. Then the log-likelihood is
- - -$$ \sum_{i=1}^{n} [\ln\left(t(z_{i}, 4)\right) - \sigma]\mathrm{,} $$ - -where $n$ is the number of observations. - -The following set of plots provides a set of simulated concentration-response curves to illustrate the general curve shapes captured by the models included in tcplFit2. It should be noted, when fitting 'real-world' experimental data the resulting curve shapes are meant to minimize the error between the observed data and the concentration-response curve. Thus, the shape for each model fit may or may not reflect what is illustrated in Figure 2. - -```{r class.source="scroll-100",fig.align='center'} -## Example Data ## -# example fit concentration series -ex_conc <- seq(10^(min(mc3[,logc])),10^(max(mc3[,logc])),length.out = 100) - -## Obtain the Continuous Fit of Level 4 Model Estimates ## -fits <- data.frame( - # log-scale concentrations - logc = log10(ex_conc), - # parametric model fits from `tcplfit2` - constant = tcplfit2::cnst(ps = c(er = 0.1),ex_conc), - poly1 = tcplfit2::poly1(ps = c(a = 3.5,er = 0.1),x = ex_conc), - poly2 = tcplfit2::poly2(ps = c(a = 0.13,b = 2,er = 0.1),x = ex_conc), - power = tcplfit2::pow(ps = c(a = 1.23,p = 1.45,er = 0.1),x = ex_conc), - hill = tcplfit2::hillfn(ps = c(tp = 750,ga = 5,p = 1.76,er = 0.1), - x = ex_conc), - gnls = tcplfit2::gnls(ps = c(tp = 750,ga = 15,p = 1.45,la = 50,q = 1.34, - er = 0.1), - x = ex_conc), - exp2 = tcplfit2::exp2(ps = c(a = 0.45,b = 13.5,er = 0.1), - x = ex_conc), - exp3 = tcplfit2::exp3(ps = c(a = 1.67,b = 12.5,p = 0.87,er = 0.1), - x = ex_conc), - exp4 = tcplfit2::exp4(ps = c(tp = 895,ga = 15,er = 0.1),x = ex_conc), - exp5 = tcplfit2::exp5(ps = c(tp = 793,ga = 6.25,p = 1.25,er = 0.1), - x = ex_conc) -) %>% - reshape2::melt(data = .,measure.vars = c( - "constant", - "poly1","poly2","power", - "hill","gnls","exp2","exp3","exp4","exp5" - )) - -## Updated Colors ## -fit_cols <- - # choose 10 distinct colors - viridis::magma(n = 10,direction = 1) %>% - # darken the original colors to make them more visible - colorspace::darken(.,amount = 0.2) - -## Plot ## -fits %>% - ggplot()+ - geom_line(aes(x = logc,y = value,lty = variable,colour = variable))+ - facet_wrap(facets = "variable")+ - theme_bw()+ - labs(lty = "Models",colour = "Models")+ - scale_colour_manual(values = fit_cols)+ - ggtitle("General Shape of Models Included in `tcplfit2`")+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab("Response") -``` - -**Figure 2:** This figure contains simulated concentration-response curves to illustrate the general underlying curve shape covered by each of the models included in the tcplFit2 package and used on the back-end of the level 4 data processing in tcpl. Each sub-plot in the figure corresponds to a single parametric model included in the model fitting process and has a corresponding color and line type to accompany it. All sub-plots are plotted such that the x-axis represents the log-transformed concentration ($base=10$) and the y-axis represents the response values. - -#### Methods Assignment - -Level 4 does not utilize any assay endpoint-specific methods; the user only needs to run the tcplRun function. **Level 4 processing and all subsequent processing is done by assay endpoint, not assay component**. The previous section showed how to find the assay endpoints for an assay component using the tcplLoadAeid function. - -The example we include in this vignette for demonstrating the assignment of level 4 methods instructs the processing to (1) estimate the $\mathit{bmad}$ (mthd_id = 1) and (2) estimate one standard deviation [required] (mthd_id = 3), mentioned in the pre-modeling process section, for the specified set of assay endpoints. Here, method '1' specifies that the BMAD is estimated using the two lowest concentration groups of **treatment wells**. - -```{r eval=FALSE} -## Methods Assignment ## -# Assign the Level 4 Processing Methods to AEID 80. -tcplMthdAssign( - lvl = 4, # processing level - id = 80, # assay endpoint ID(s) to assign method(s) - mthd_id = c(1,3), # method(s) to be assigned - ordr = 1:2, # order the method(s) should be applied - type = "mc") # the data/processing type -``` - -```{r eval=FALSE,echo=FALSE} -# We show two example of how a user can assign methods using tcpl . First, we assign methods for a single assay endpoint. Second, we assign methods for all assay endpoints within an assay. Please note, the second approach can also be used for a subset of aeid's within an assay that is larger than one. - -## Obtain the 'aeid' Values ## -# here we are pulling attagene aeid's -atg.aeid <- tcpl::tcplGetAeid(name = "ATG") -## Assign the Level 4 Processing Methods for All AEID's ## -tcpl::tcplMthdAssign( - lvl = 4, - id = atg.aeid[,aeid], - mthd_id = c(1,3), # the set of methods to be assigned - ordr = 1:2, # order in which they should be assigned - type = "mc" - ) -``` - -```{r echo=FALSE, eval=FALSE} -# With the methods assigned, the level 4 processing can be completed for the desired set of assay endpoints (aeid). - -tcpl::tcplRun( - id = atg.aeid[,aeid], # assay endpoint id to pipeline - slvl = 4L, # level to start pipelining on - elvl = 4L, # level to end pipelining on - type = 'mc' # endpoint processing type - 'mc' = "multiple concentrations" -) -``` - -After level 4 data is processed, the user can load the model fit information from database. - -```{r eval=FALSE} -## Explore the Level 4 Data ## -# Load the level 4 data. -mc4 <- tcplLoadData(lvl = 4, - type = 'mc', - fld = 'aeid', - val = 80, - add.fld = TRUE) -# Prepare the data into a readable format. -mc4 <- tcplPrepOtpt(mc4) -# Display the data. -mc4 -``` - -A subset of this data is already available within the mc_vignette object. - -```{r} -# Allocate the level 4 data in `mc_vignette` to the `mc4` object. -mc4 <- mc_vignette[["mc4"]] -``` - -The level 4 data includes fields for each of the ten model fits as well as the ID fields. A complete list of level 4 fields is available in the Introduction vignette. The level 4 data fields with model fit information are prefaced by the model abbreviations (e.g. $\mathit{cnst}$, $\mathit{hill}$, $\mathit{gnls}$, $\mathit{poly1}$, etc.). The fields ending in $\mathit{success}$ indicates the convergence status of the model, where a value of 1 means the model converged and a value of 0 otherwise. NA values indicate the fitting algorithm did not attempt to fit the model. - -```{r eval = FALSE,echo=FALSE} -## Load the level 4 data -m4dat <- tcplPrepOtpt(tcplLoadData(lvl = 4, type = "mc")) -## List the first m4ids where the hill model converged -## for AEID 1 -m4dat[hill == 1 & aeid == 1, head(m4id)] -``` - -In Figure 3 we display the smoothed model fit results from level 4 with respect to the observed concentration-response series. - -```{r fig.align='center',fig.dim=c(8,5.5),class.source = "scroll-100"} -## Create a Sequence of Concentration Values within Observed Range ## -X <- seq( - 10^(mc4[which(mc4[,spid] == "01504209"),logc_min]), - 10^(mc4[which(mc4[,spid] == "01504209"),logc_max]), - length.out = 100 -) -## Obtain the Continuous Fit of Level 4 Model Estimates ## -# Apply each model fit to continous concentration values (X) and estimated -# parameters from 'tcplfit2'. -estDR <- mc4 %>% - dplyr::filter(spid == "01504209") %>% - dplyr::summarise( - cnst = tcplfit2::cnst(.[,c(cnst_er)],X), - poly1 = tcplfit2::poly1(.[,c(poly1_a,poly1_er)],X), - poly2 = tcplfit2::poly2(.[,c(poly2_a,poly2_b,poly2_er)],X), - power = tcplfit2::pow(.[,c(pow_a,pow_p,pow_er)],X), - hill = tcplfit2::hillfn(.[,c(hill_tp,hill_ga,hill_p)],X), - gnls = tcplfit2::gnls(.[,c(gnls_tp,gnls_ga,gnls_p,gnls_la,gnls_q,gnls_er)], - x = X), - exp2 = tcplfit2::exp2(.[,c(exp2_a,exp2_b,exp2_er)],x = X), - exp3 = tcplfit2::exp3(.[,c(exp3_a,exp3_b,exp3_p,exp3_er)],x = X), - exp4 = tcplfit2::exp4(.[,c(exp4_tp,exp4_ga,exp4_er)],x = X), - exp5 = tcplfit2::exp5(.[,c(exp5_tp,exp5_ga,exp5_p,exp5_er)],x = X) - ) -# Format data into a data.frame for ease of plotting. -estDR <- cbind.data.frame(X,estDR) %>% - reshape2::melt(data = .,measure.vars = c( - "cnst","poly1","poly2","power","hill","gnls","exp2","exp3","exp4","exp5" - )) - -## Updated Colors ## -fit_cols <- - # choose 10 distinct colors - viridis::magma(n = 10,direction = 1) %>% - # darken the original colors to make them more visible - colorspace::darken(.,amount = 0.2) - -## Plot the Model Fits from Level 4 ## -mc3 %>% - dplyr::filter(spid == "01504209") %>% - ggplot(.,aes(x = logc,y = resp))+ - geom_point(pch = 1,size = 2)+ - geom_line(data = estDR, - aes(x = log10(X),y = value,colour = variable,lty = variable))+ - labs(colour = "Models",lty = "Models")+ - scale_colour_manual(values = fit_cols)+ - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+# )+ - ggtitle( - label = paste("Level 4 Model Fits", - mc4[which(mc4[,spid] == "01504209"),dsstox_substance_id], - sep = "\n"), - subtitle = paste("Assay Endpoint: ", - mc4[which(mc4[,spid] == "01504209"),aenm]))+ - theme_bw() -``` - -**Figure 3:** This figure illustrates the results from the Level 4 analyses in the tcpl pipeline. The plot depicts the observed concentration-response data with white circles, where the x-axis is base 10 log-transformed concentration values. All the ten model fits are displayed and distinguished by color and line-type. - -Each of the models in Figure 3 have two model fit summary estimates, which include the Akaike Information Criterion (AIC) and the root mean square error (RMSE or RME). - -For the AIC, let $log(\mathcal{L}(\hat{\theta}, y))$ be the log-likelihood of the model $\hat{\theta}$ given the observed values $y$, and $K$ be the number of parameters in $\hat{\theta}$, then, - -$$\mathrm{AIC} = -2\log(\mathcal{L}(\hat{\theta}, y)) + 2K\mathrm{.} $$ - -The RMSE is given by - -$$\mathrm{RMSE} = \sqrt{\frac{\sum_{i=1}^{N} (y_{i} - \mu_{i})^2}{N}}\mathrm{,}$$ - -where $N$ is the number of observations, and $\mu_{i}$ and $y_{i}$ are the estimated and observed values at the $i^{th}$ observation, respectively. - -### Level 5 - -Level 5 processing determines the winning model and activity for the concentration series, bins all of the concentration series into categories, and calculates point-of-departure estimates based on the activity cutoff. - -#### Methods Assignment - -**The model with the lowest AIC value is selected as the winning model** ($\mathit{modl}$ ), and is used to determine the activity (or hit call) for the concentration series. If two models have equal AIC values, then the simpler model (i.e. model with fewer parameters) wins. Additionally, if the constant model describes the response best out of all the models fit then $\mathit{modl}$ is reported as 'none'. Table 9 provides a side-by-side comparison of AIC values from each of the ten model fits for the concentration-response series we include in the example dataset mc_vignette. - -```{r echo=FALSE} -# Obtain the AIC values from each of the model fits from -# the level 4 data. -mc4_aic <- mc4 %>% - dplyr::select(.,grep(colnames(.),pattern = "aic")) %>% - round(.,3) %>% - apply(.,MARGIN = 1,FUN = function(x){ - cell_spec(x,color = ifelse(x == min(x), - yes = "blue", - no = "black")) - }) %>% t() %>% - data.frame() %>% - cbind.data.frame(mc4[,dsstox_substance_id],.) -# Rename the columns. -colnames(mc4_aic) <- - colnames(mc4)[grep(colnames(mc4),pattern = "aic")] %>% - stringr::str_remove(.,pattern = "_aic") %>% c("dsstox_id",.) -# Export/display the table in an HTML format. -mc4_aic %>% - kbl( - escape = FALSE, - format = 'html', - centering = TRUE, - caption = "Table 9: AIC values from All Fits in Level 4. Values highlighted in blue indicate the winning model for the compound.") %>% - kable_styling( - font_size = 14, - c("striped","hover"), - full_width = FALSE - ) -``` - -The estimated parameters from the winning model are stored in their respective parameter fields at level 5. The activity of each concentration-response series is determined by calculating a continuous hit-call model that may be further binarized into active or inactive, depending on the level of stringency required by the user; herein, hitc < 0.9 are considered inactive. This cutoff was determined from extensive analysis of high-throughput transcriptomics (HTTr) data analyzed using tcplfit2, and comparison to known positive and negative reference chemicals. Continuous hitc in tcplfit2 (Sheffield et al., 2021; USEPA, 2022c) are defined as the product of three proportional weights: 1) the AIC of the winning model is better than the constant model (i.e. winning model is not fit to background noise), 2) at least one concentration has a median response that exceeds cutoff, and 3) the top from the winning model exceeds the cutoff. The constant model may never be selected as the winning model, but if the constant model has the lowest AIC compared to other models, the calculated continuous hitc will be zero. Users may interpret the continuous hitc into active or inactive designations based on different thresholds. Further testing through implementation of this new functionality may reveal appropriate thresholds for different applications or assays. - -The efficacy cutoff value ($\mathit{coff}$) is defined as the maximum of all values given by the methods assigned at level 5. When two or more methods (i.e. cutoff values) are applied for processing, the largest cutoff value is always selected as the cutoff for the endpoint. In the event only one method is applied, then that will serve as the efficacy cutoff for the endpoint. Failing to assign a level 5 method will result in every concentration series being called active. For a complete list of level 5 methods, see tcplMthdList(lvl = 5) or ?MC5\_Methods . - -The example we include in this vignette for demonstrating the assignment of level 5 methods specifies three different efficacy cutoff estimates for consideration. These efficacy cutoff estimates include $3*\mathit{bmad}$, $log_2(1.2)$, and $5*\mathit{bmad}$, which correspond to $\mathit{mthd\_id}$ assignments 1, 3, and 5 respectively. As mentioned previously, the largest of these three values will be selected as the cutoff for processing the endpoint. - -```{r eval=FALSE} -## Methods Assignment ## -# Assign the Level 5 Processing Methods to AEID 80. -tcplMthdAssign( - lvl = 5, # processing level - id = 80, # assay endpoint ID(s) to assign method(s) - mthd_id = c(1,3,5), # method(s) to be assigned - ordr = 1:3, # order the method(s) should be assigned - type = "mc") # the data/processing type -``` - -As described previously, since the continuous hit call is the product of three proportional weights, and the resulting value is between 0 and 1. The higher the hitcall (i.e. close to 1) the more plausible the concentration-response series indicates true biological activity in the measured response (i.e. 'active' hit). - -For each concentration series several point-of-departure (POD) estimates are calculated for the winning model. The major estimates include: (1) the activity concentration at the specified benchmark response (BMR) ($\mathit{bmd}$), (2) the activity concentration at $50\%$ of the maximal response ($\mathit{ac50}$), (3) the activity concentration at the efficacy cutoff ($\mathit{acc}$), (4) the activity concentration at $10\%$ of the maximal response, and (5) the concentration at $5\%$ of the maximal response. Though there are several other potency estimates calculated as part of the level 5 pipeline these five are the major POD estimates. The POD estimates mentioned in here are summarized in Figure 4. - - -```{r echo=FALSE, eval=FALSE} -# With the level 5 methods assigned, the data are ready for level 5 processing: - -tcpl::tcplRun( - id = atg.aeid[,aeid], # assay endpoint id to pipeline - slvl = 5L, # level to start pipelining on - elvl = 5L, # level to end pipelining on - type = 'mc' # endpoint processing type - 'mc' = "multiple concentrations" -) -``` - -After level 5 data processed, the user can load the model fit information from database. - -```{r eval=FALSE} -## Explore the Level 5 Data ## -# Load the level 5 data. -mc5 <- tcplLoadData(lvl = 5, - type = 'mc', - fld = 'aeid', - val = 80, - add.fld = TRUE) -# Prepare the data into a readable format. -mc5 <- tcplPrepOtpt(mc5) -# Display the data. -mc5 -``` - -A subset of this data is already available within mc_vignette object. - -```{r} -# Allocate the level 5 data in `mc_vignette` to the `mc5` object. -mc5 <- mc_vignette[["mc5"]] -``` - -The level 5 data includes fields for the best model fit, the POD estimates, other estimates from the best model fit, as well as the ID fields. A complete list of level 5 fields is available in the Introduction vignette. - -The user can visualize the model fitting results with tcpl using the tcplPlot functions, when connected to a database. The resulting figure is an interactive plot displaying the concentration-response series data, the ten curve fits from level 4 with the best model distiguished by color, and the AC50 estimate. - -```{r eval=FALSE} -## Plot the Interactive Level 5 Figure ## -# Obtain the `m4id` for AEID 80 and spid `01504209` -my_id <- tcplLoadData(lvl = 5, - fld = c('aeid','spid'), - val = list(80,'01504209'))$m4id -# Report the `m4id`. -my_id -# Generate the interactive concentration-response plot. -tcplPlot(lvl = 5,val = my_id,output = 'console') -``` - -In Figure 4, we provide an alternative visualization of the model fitting results from Level 4 and the best model as well as the potency estimates from Level 5 data. - -```{r fig.align='center',fig.dim=c(8,5.5),class.source = "scroll-100"} -## Obtain Data ## -# First, we need to obtain the subset of data related to spid = "01504209", -# which is our example spid. -mc3_ss <- mc3 %>% dplyr::filter(spid == "01504209") # Level 3 - conc-resp series -mc4_ss <- mc4 %>% dplyr::filter(spid == "01504209") # Level 4 - model fits -mc5_ss <- mc5 %>% dplyr::filter(spid == "01504209") # Level 5 - best fit & est. -# Next, we need to obtain the smooth curve estimate for the best model found -# in the Level 5 analyses of the `tcpl` pipeline. -estDR <- estDR %>% - dplyr::mutate(.,best_modl = ifelse(variable == mc5_ss[,modl], - yes = "best model",no = NA)) - -## Generate a Base Concentration-Response Plot ## -basePlot <- mc3_ss %>% - # Observed Concentration-Response Data - ggplot()+ - geom_point(aes(x = logc,y = resp),pch = 1,size = 2)+ - # Cutoff Band - geom_rect(data = mc5_ss, - aes(xmin = logc_min,xmax = logc_max,ymin = -coff,ymax = coff), - alpha = 0.15,fill = "skyblue")+ - # Best Model Fit - geom_line(data = dplyr::filter(estDR,variable == mc5_ss[,modl]), - aes(x = log10(X),y = value,color = mc5_ss[,modl]))+ - scale_colour_manual(values = c("royalblue3"),aesthetics = "color")+ - # Other Model Fits - geom_line(data = dplyr::filter(estDR,variable != mc5_ss[,modl]), - aes(x = log10(X),y = value,lty = variable), - alpha = 0.3,show.legend = TRUE)+ - # Legend Information - labs(lty = "Other Models",color = "Best Fit")+ - # Titles and Labels - xlab(expression(paste(log[10],"(Concentration) ",mu,"M")))+ - ylab(expression(paste(log[2],"(Fold Induction)")))+# )+ - ggtitle( - label = paste("Level 5 Best Model Fit", - mc4[which(mc4[,spid] == "01504209"),dsstox_substance_id], - sep = "\n"), - subtitle = paste("Assay Endpoint: ", - mc4[which(mc4[,spid] == "01504209"),aenm]))+ - # Background Plot Theme - theme_bw() - -## Potency Estimate Layers ## -# First, we need to obtain/assign colors for the potency estimates to be -# displayed. -potency_cols <- - # choose 5 distinct colors - viridis::plasma(n = 5,direction = -1) %>% - # darken the original colors to make them more visible - colorspace::darken(.,amount = 0.1) - -## Compile the Full Level 5 Plot ## -linePlot <- - # Start with the `basePlot` object. - basePlot + - # Next, add the various potency layers. - # BMD - geom_hline( - data = mc5_ss, - aes(yintercept = bmr), - col = potency_cols[1] - ) + - geom_segment( - data = mc5_ss, - aes(x = log10(bmd), xend = log10(bmd), y = -0.5, yend = bmr), - col = potency_cols[1] - ) + - geom_hline( - data = mc5_ss, - aes(yintercept = coff), - col = potency_cols[2] - ) + - geom_segment( - data = mc5_ss, - aes(x = log10(acc), xend = log10(acc), y = -0.5, yend = coff), - col = potency_cols[2] - ) + - geom_hline( - data = mc5_ss, - aes(yintercept = max_med * 0.5), - col = potency_cols[3] - ) + - geom_segment( - data = mc5_ss, - aes( - x = log10(ac50), xend = log10(ac50), - y = -0.5, yend = max_med * 0.5 - ), - col = potency_cols[3] - ) + - geom_hline( - data = mc5_ss, - aes(yintercept = max_med * 0.1), - col = potency_cols[4] - ) + - geom_segment( - data = mc5_ss, - aes( - x = log10(ac10), xend = log10(ac10), - y = -0.5, yend = max_med * 0.1 - ), - col = potency_cols[4] - ) + - geom_hline( - data = mc5_ss, - aes(yintercept = max_med * 0.05), - col = potency_cols[5] - ) + - geom_segment( - data = mc5_ss, - aes( - x = log10(ac5), xend = log10(ac5), - y = -0.5, yend = max_med * 0.05 - ), - col = potency_cols[5] - ) - - -# create data table for potency estimate points -mc5_points <- mc5_ss %>% - select(bmd, acc, ac50, ac10, ac5) %>% - tidyr::pivot_longer(everything(), names_to = "Potency Estimates") %>% - mutate(x = log10(value)) %>% - mutate(mc_color = potency_cols) %>% - mutate(`Potency Estimates` = toupper(`Potency Estimates`)) -yvals <- mc5_ss %>% - select(bmr, coff, max_med) %>% - tidyr::pivot_longer(everything()) %>% - select(value) %>% - mutate(reps = c(1, 1, 3)) %>% - tidyr::uncount(reps) %>% - mutate(y = value * c(1, 1, .5, .1, .05)) %>% - select(y) -mc5_points <- mc5_points %>% cbind(yvals) - -# add Potency Estimate Points and set colors -fullPlot <- linePlot + geom_point( - data = mc5_points, - aes(x = x, y = y, fill = `Potency Estimates`), shape = 21, cex = 2.5 -) + - scale_fill_manual(values = mc5_points %>% arrange(`Potency Estimates`) %>% pull(mc_color)) - - -## Display the Compiled Plot ## -fullPlot -``` - -**Figure 4:** This figure illustrates the results from the Level 5 analyses in the tcpl pipeline package including the best model fit and subsequent point-of-departure (POD) estimates. The light-blue shaded region represents the estimated efficacy cutoff ($\mathit{coff}$). Each of the concentration-response models fit in Level 4 are included in the plot, where the blue curve indicates the best model fit for the observed data (white circles) and the rest are depicted by the gray curves. The horizontal lines show the activity responses from which potency estimates of interest are defined, and the vertical lines show the corresponding POD estimates. The black point shows the AC~5~ (concentration producing $5 \%$ of the maximal response), the purple point shows the AC~10~ (concentration producing $10 \%$ of the maximal response), the yellow point shows the BMD (benchmark dose), the orange point shows the ACC (concentration producing a response at the efficacy cutoff), and the pink point shows the AC~50~ (concentration producing $50 \%$ of the maximal response). - -#### Fit Categories - -
![Fit Category Tree](img/Fig5_fitc_tree_10jul2023.png)
- -**Figure 5:** A hierarchical fit category ($\mathit{fitc}$) decision tree is used to bin each fit. Each fit falls into one leaf of the tree using the described logic with the final $\mathit{fitc}$ indicated with gray boxes. Abbreviations are defined as: $\mathit{conc}$ = concentration; $\mathit{hitc}$ = hit call; $\mathit{|top|}$ = absolute value of the modeled curve top; $\mathit{coff}$ = cutoff; $log_c(min)$ = minimum log~10~ concentration tested; $log_c(max)$ = maximum log~10~ concentration tested; AC~50~ = $50 \%$ activity concentration; AC~95~ = $95 \%$ activity concentration. - -After curve fitting, all concentration series are assigned a fit category ($\mathit{fitc}$) based on similar characteristics and shape. Logic is based on relative activity, efficacy, and potency comparisons as shown in Figure 5. For continuity purposes, $\mathit{fitc}$ numbering has been conserved from past tcpl versions. Grouping all series into $\mathit{fitc}$ enables quality control and can be useful in data cleaning applications, especially when considered with Level 6 flags. In invitrodb v3-3.5, a common filtering approach removed the least reproducible curve-fits, i.e. those with very low AC~50~ (below the screened $\mathit{conc}$ range) and low efficacy (within 1.2-fold of the cutoff) as well as 3+ flags. - -Fit category is largely based upon the relative efficacy and, in the case of actives, the location of the AC~50~ and concentration at $95 \%$ activity (an estimate of maximum activity concentration, AC~95~) compared to the tested concentration range. All concentration response curves are first split into active, inactive, or cannot determine. “Cannot determine” is indicative of exceptions that cannot be curve-fit, e.g. a concentration series with fewer than 4 concentrations. Active designations are determined for $\mathit{fitc}$ based on whether the $\mathit{hitc}$ surpasses the 0.90 threshold. For those series that are designated inactive with a $\mathit{hitc}$ less than 0.90, $\mathit{fitc}$ can be used to indicate to what extent the curve represents borderline inactivity via comparison of top modeled efficacy to the cutoff (i.e, the absolute value of the modeled top is less than 0.8 times the cutoff). - -For active curves, efficacy, as represented by the modeled top, is compared to 1.2 times the cutoff (less than or equal to, or greater than), thereby differentiating curves that may represent borderline activity from moderate activity. Active curves also have potency metrics estimated, e.g., AC~50~ and AC~95~ values, that can be compared to the range of concentrations screened to indicate curves for which potency estimates are more quantitatively informative. Curves for which the AC~50~ is less than or equal to the minimum concentration tested ($\mathit{fitc}$ = 36, 40) may indicate AC~50~ values that are less quantitatively informative than AC~50~ values within the concentration range screened. When the AC~50~ is greater than the minimum concentration tested but the AC~95~ is greater than or equal to the maximum concentration tested ($\mathit{fitc}$ = 38, 42), it is possible the maximum activity was not fully observed in the concentration range screened. $\mathit{Fitc}$ for curves where the AC~50~ and AC~95~ are both within the concentration range screened ($\mathit{fitc}$ = 37, 41) represent the most quantitatively informative AC~50~ values. - -$\mathit{Fitc}$ 36 describes a curve that is of low efficacy and with a low AC~50~, below the concentration range screened. These are more likely to be noise or less reproducible fits. $\mathit{Fitc}$ 41 and 42 are the ideal $\mathit{fitc}$ for reproducible curves, as demonstrated by these two $\mathit{fitc}$ comprising the majority of positive ($\mathit{hitc}$ > 0.9) curves in invitrodb v4.1. $\mathit{Fitc}$ 40 indicates a curve with at least moderate efficacy, but an AC~50~ below the concentration range screened. These chemicals may be positive or reference chemicals screened in the incorrect concentration window to observe their minimum activity. These curves may also represent high-confidence positives for which we have limited understanding of the slope of the concentration-response curve, and as such, the AC~50~ may be associated with more uncertainty. - - -### Level 6 - -In addition to the continuous $hitc$ and the $fitc$, cautionary flags on curve-fitting can provide context to interpret potential false positives (or negatives) in ToxCast data, enabling the user to decide the stringency with which to filter these targeted in vitro screening data. Cautionary flags on fitting were developed in previous versions of tcpl and have been stored at level 6. These flags are programmatically generated and indicate characteristics of a curve that need extra attention or potential anomalies in the curve or data. - -For example, a curve may be considered a single point hit with activity not at the highest concentration tested, but re-inspection of the flagged curve could indicate a potential false positive. Other flags may suggest borderline activity, overfitting, or cell viability assays that are fit with gain-loss as the winning model. It is important to note that flags have no effect on the $hitc$ or potency estimates, but they may indicate that a curve requires further examination to aid in data interpretation. For a full list of flags implemented and descriptions, refer to Table 10. - - -```{r lvl-6-flag-table, warning = FALSE, echo = FALSE} -# First column - Level 6 Method ID -Method <- c(5:11, 13:15, 17:20) - -# Second column - Level 6 Flag Names -FlagNames <- c("modl.directionality.fail", "singlept.hit.high", "singlept.hit.mid", - "multipoint.neg", "bmd.high", "noise", "border", "low.nrep", - "low.nconc", "gnls.lowconc", "efficacy.50", "ac50.lowconc", - "viability.gnls", "no.med.gt.3bmad") -# Third column - Level 6 Flag Descriptions -FlagDescription <- c("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 $count(resp < -1 * coff) < 2 * count(resp > coff)$. - If gain was winning directionality - $(top > 0)$, flag if $count(resp > coff) < 2 * count(resp < -1 * coff)$.", - "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 if modeled benchmark dose $(BMD)$ is greater than AC~50~ - (concentration at 50% maximal response). This is indicates high - variability in baseline response in excess of more than half of the maximal - response.", - "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)$; - $rmse > coff$", - "Flag series if borderline activity is suspected based on modeled top - parameter $(top)$ relative to cutoff $(coff)$; $|top| <= 1.2 * coff$ or - $|top|>= 0.8 * coff$.", - "Flag series if the average number of replicates per concentration is less than - 2; $nrep < 2$.", - "Flag series if 4 concentrations or less were tested; $nconc <= 4$.", - "Flag series where winning model is gain-loss $(gnls)$ and the gain AC~50~ is less - than the minimum tested concentration, and the loss AC~50~ is less than the mean - tested concentration.", - "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%; - intended for biochemical assays. If $hitc >= 0.9$ and $coff >= 5$, then flag when - $top < 50$ or $max\\_med < 50$. If $hitc >= 0.9$ and $coff < 5$, then flag when - $top < \\log_{2}(1.5)$ or $max\\_med < \\log_{2}(1.5)$.", - "Flag series with an active hit call $(hitc >= 0.9)$ if AC~50~ (concentration - at 50% maximal response) is less than the lowest concentration tested; if - $hitc >= 0.9$ and $AC_{50} < 10^{\\log_c(min)}$, 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 = 0$, where $nmed\\_gtbl$ is the number of medians greater than - $3 * bmad$.") - -# Consolidate all columns into a table. -output <- data.frame(Method, FlagNames, FlagDescription) - -# Export/print the table into an html rendered table. -htmlTable(output, - align = 'l', - align.header = 'l', - header = c("Method", "Name", "Description"), - rnames = FALSE, - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - - caption = "Table 10: Level 6 Methods - Cautionary Flags" #, - #tfoot = "Level 6 flag descriptions are pulled from ##SOURCE## ." -) -``` - - -## 'tcpl' Compiled Processing Examples - -In this section we provide a practical step-by-step example for single- and multiple-concentration data from methods assignment through data processing. - -### Single-concentration Data - -After level 0 (pre-processed data) is loaded into the database, we need to assign the data processing methods for each step. Once the methods for level 1 and 2 processing are assigned, then we can run the pipeline for processing and storing the data in a database. - -In the following code chunk, we demonstrate how to assign the methods for each step. - -```{r eval=FALSE} -## Methods Assignment ## -# Level 1 - Normalization -tcplMthdAssign(lvl = 1, # data level - id = 1:2, # assay component - mthd_id = c(1, 11, 13), # method(s) to be applied - ordr = 1:3, # order sequence for applied methods - type = "sc") # data type - single concentration - -# Level 2 - Bioactivity Hit Call -tcplMthdAssign(lvl = 2, # data level - id = 1, # assay component - mthd_id = 3, # method(s) to be applied - type = "sc") # data type - single concentration -``` - -Now that we have assigned methods for each level we can run pipeline with data with tcpl. - -```{r eval=FALSE} -## Pipeline Assay Components (acid's) from level 0 to 2. -sc_res <- tcplRun(id = 1, # assay component id to pipeline - type = "sc", # type of data being processed - slvl = 1, # level to start pipelining on - elvl = 2) # level to end pipelining on -``` - -### Multiple-concentration Data - -After level 0 multiple-concentration data is loaded into the database, we need to assign the data processing methods for each step. Once the methods for levels 1-5 processing are assigned, then we can run the pipeline for processing and storing the data in a database. **Note, if higher levels of processing are included in future versions of the pipeline, then these also should be assigned prior to running the pipeline.** - -In the following code chunk, we demonstrate how to assign the methods for each step. - -```{r eval=FALSE} -## Methods Assignment. -# Level 1 - Indexing -# * No methods need to be assigned. - -# Level 2 - Data Transformation -tcplMthdAssign(lvl = 2, # data level - id = 49, # assay component - mthd_id = c(3,4,2), # method(s) to be applied - ordr = 1:3, # the order method(s) are to be applied - type = "mc") # data type - multiple concentration - -# Level 3 - Normalization -tcplMthdAssign(lvl = 3, # data level - id = 80, # assay endpoint - mthd_id = 1, # method(s) to be applied - ordr = 1, # the order method(s) are to be applied - type = "mc") # data type - multiple concentration - -# Level 4 - Concentration-Response Modeling -tcplMthdAssign(lvl = 4, # data level - id = 80, # assay endpoint - mthd_id = c(1,3), # method(s) to be applied - ordr = 1:2, # the order method(s) are to be applied - type = "mc") # data type - multiple concentration - -# Level 5 - Best Model Fit -tcplMthdAssign(lvl = 5, # data level - id = 80, # assay endpoint - mthd_id = c(1,3,5), # method(s) to be applied - ordr = 1:3, # the order method(s) are to be applied - type = "mc") # data type - multiple concentration -``` - -Now that we have assigned methods for each level we can pipeline the data with tcpl. This can be done in two ways (a) from start to finish (i.e. Level 0 to 5) with the assay component ID (acid) or (b) Level 0 to 3 with the assay component ID (acid) and Level 4 to 5 with the assay endpoint ID (aeid). -Option A may be helpful in scenarios when the data are new to the pipeline, whereas Option B or derivatives of Option B may be helpful in making pipeline updates or corrections to data already pipelined and stored in the database. - -**Option A:** - -```{r eval=FALSE} -## Assign the Number of Processing Cores. -mycores <- 1 # DO NOT leverage parallel computing. - # Users that want to leverage parallel computing set to > 1, - # but less than the total number of cores (i.e. need at least - # 1 core open for overhead). Please see below. -# mycores <- parallel::detectCores() - 1 # Maximum allowed number of cores. - -## Pipeline Assay Components (acid's) from level 0 to 5. -mc_res <- tcpl::tcplRun( - id = atg.aeid[,acid], # assay component id to pipeline - type = "mc", # type of data being processed - slvl = 0L, # level to start pipelining on - elvl = 5L, # level to end pipelining on - mc.cores = mycores # number of computing cores -) -``` - -**Option B:** - -```{r eval=FALSE} -## Assign the Number of Processing Cores. -mycores <- 1 # DO NOT leverage parallel computing. - # Users that want to leverage parallel computing set to > 1. - -## Pipeline Assay Components (acid's) from level 0 to 3. -mc_res_0.3 <- tcpl::tcplRun( - id = atg.aeid[,acid], # assay component id to pipeline - type = "mc", - slvl = 0L, # level to start pipelining on - elvl = 3L, # level to end pipelining on - mc.cores = mycores # number of computing cores -) - -## Pipeline Assay Endpoints (aeid's) from level 4 to 5. -mc_res_4.5 <- tcpl::tcplRun( - id = atg.aeid[,aeid], # assay endpoint id to pipeline - type = "mc", - slvl = 4L, # level to start pipelining on - elvl = 5L, # level to end pipelining on - mc.cores = mycores # number of computing cores -) -``` diff --git a/vignettes/Data_retrieval.Rmd b/vignettes/Data_retrieval.Rmd deleted file mode 100644 index 323e5526..00000000 --- a/vignettes/Data_retrieval.Rmd +++ /dev/null @@ -1,651 +0,0 @@ ---- -title: tcpl v3.0
Data Retrieval
-author: "Center for Computational Toxicology and Exposure, US EPA" -output: - prettydoc::html_pretty: - theme: architect - toc: yes - toc_depth: 4 -vignette: > - %\VignetteIndexEntry{tcpl v3.0 Data Retrieval} - %\VignetteEngine{knitr::rmarkdown} - %\usepackage[utf8]{inputenc} ---- - - - - - - -```{css, echo=FALSE} -.scroll-100 { - max-height: 100px; - overflow-y: auto; -} - -.noticebox { - padding: 1em; - background: lightgray; - color: blue; - border: 2px solid black; - border-radius: 10px; -} -``` - -# R Packages - -```{r echo=TRUE, message=FALSE, warning=FALSE} -# Primary Packages # -library(tcpl) -library(tcplfit2) -# Data Formatting Packages # -library(dplyr) -library(magrittr) -# Plotting Packages # -library(ggplot2) -library(RColorBrewer) -library(colorspace) -library(viridis) -# Table Packages # -library(htmlTable) -library(kableExtra) -``` - - -# Introduction - -This vignette describes how the user can retrieve data from the ToxCast database, known as invitrodb, using tcpl. The MySQL version of the ToxCast database containing all the publicly available ToxCast data is available for download at: . - -::: {.noticebox data-latex=""} - -**NOTE:** - -Users must be connected to the ToxCast database (invitrodb), or a replicate of the database, to utilize many of these functions and execute the examples in this vignette. Please see the introductory vignette in this package for more details. - -::: - -## Overview of Key Functions - -To support different data retrieval needs within tcpl, there are a number of functions which query the database and return information to the local R session. - -## Overview of Data Nomenclature - -Throughout this vignette we will use abbreviated designations for data retrieved from the database or to refer to processing steps within tcpl. For data from single concentration assays we use 'SC.' 'MC' is used for assay data with multiple concentrations. A particular data or processing level is indicated by appending the level id/number to the end of the 'SC' or 'MC' designation. For example, if we are discussing single concentration data from level 2 processing, then we will use the abbreviation 'SC2.' - -### Assay Elements - -The tcplLoadAsid, tcplLoadAid, tcplLoadAcid, and tcplLoadAeid functions load relevant assay ids and names for the respective assay elements based on the user specified parameters. - -```{r tcplLoad, eval = FALSE} -# List all assay source IDs -tcplLoadAsid() -# Create table of all assay endpoint ids (aeids) per assay source -aeids <- tcplLoadAeid(fld="asid", # field to query on - val=14, # value for each field - # values should match their corresponding 'fld' - add.fld = c("aid", "anm", "acid", "acnm")) # additional fields to return -``` - -### Data - -The tcplQuery function allows a user to provide an SQL query to load data from the MySQL database into the R session. In the following chunk we provide an example, but any valid SQL query can replace the one provided in our example. - -```{r tcplquery, eval = FALSE} -# Load sample table using a MySQL query. -samples <- tcplQuery("SELECT * FROM sample;") -``` - -The tcplLoadData function can be used to load the data from the MySQL database into the R session. Further, the tcplPrepOtpt function can be used in combination with tcplLoadData to add useful chemical and assay annotation information, mapped to the retrieved data. - -```{r tcplPrepOtpt, eval=FALSE} -# Load multi concentration data from level 2, -# and map only the chemical annotation information. -mc2_fmtd <- tcplPrepOtpt( - tcplLoadData( - lvl = 2, # data level - fld = 'acid', # field to query on - val = 49, # value for each field - # values should match their corresponding 'fld' - type = 'mc' # data type - ), - ids = 'spid' # additional annotation fields to add - just chemical info - # - (Default): map assay and chemical annotation - # - 'acid' OR 'aeid': map only assay annotation - # - 'spid': map only chemical annotation -) -# Print the first 6 rows of 'mc2_fmtd' -head(mc2_fmtd) -``` - -When loading data, the user must indicate the applicable fields and ids for the corresponding data level of interest. Loading level 0 (SC0 and MC0), MC1, and MC2 data the assay component id ($\mathit{acid}$) will always be used. As described in Table 1 of the tcpl Data Processing vignette, SC1 and MC3 processing levels perform data normalization where assay component ids ($\mathit{acid}$) are converted to assay endpoint ids ($\mathit{aeid}$). Thus, the SC1 and MC3 data tables contain both $\mathit{acid}$ and ($\mathit{aeid}$) ID's. Data can be loaded using either id as long as it is properly specified. Loading SC2, MC4, and MC5, one should always use the assay endpoint id ($\mathit{aeid}$). Selected id(s) are based on the primary key within each table containing data. Examples of loading data are detailed in later sections. - -### Assay Annotations - -Assay source, assay, assay component, and assay endpoint are registered via tcpl scripting into a collection of tables. The database structure takes the annotations and organizes them as attributes of the assay conductors, the assays (i.e., experiments), the assay components (i.e., raw readouts), or the assay endpoints (i.e., normalized component data) enabling aggregation and differentiation of the data generated through ToxCast and Tox21. The annotations capture four types of information: - -i. Identification information -ii. Design information such as the technology, format, and objective aspects that decompress the assay’s innovations, -iii. Target information such as the target of technological measurement and the -biologically intended target, and -iv. Analysis information about how the data were processed and analyzed. - -```{r annotation_query_ex, eval = FALSE} -#load libraries and connections -library(RMySQL) -con <- dbConnect(drv = RMySQL::MySQL(), user="user", pass="pass", db="InvitroDB", host="host") -#query database using RMySQL: -#use source table to identify which ids are needed in subsequent queries. -tcplLoadAsid() -source <- tcplLoadAeid(fld="asid", val=1, add.fld = c("aid", "anm", "acid", "acnm")) -#select annotation and subset by ids or name -assay <- dbGetQuery(con, "SELECT * FROM invitrodb.assay where aid=1;") -component <- dbGetQuery(con, "SELECT * FROM invitrodb.assay_component;") -component <- subset(component, acid %in% source$acid) -endpoint <- dbGetQuery(con, "SELECT * FROM invitrodb.assay_component_endpoint;") -endpoint <- endpoint[grepl("ATG", endpoint$assay_component_endpoint_name),] -``` - -### Chemical Information - -The tcplLoadChem function returns chemical information for user specified parameters, e.g. the chemical name (chnm) and chemical id (chid). The tcplLoadClib function provides more information about the ToxCast chemical library used for sample generation. - -### Methods - -The tcplMthdList function returns methods available for processing at a specified level (i.e. step in the tcpl pipeline). The user defined function in the following code chunk utilizes the tcplMthdList function to retrieve and output all available methods for both the SC and MC data levels. - -```{r mthd_list, eval = FALSE} -# Create a function to list all available methods function (SC & MC). -method_list <- function() { - # Single Concentration - ## Level 1 - sc1 <- tcplMthdList(1, 'sc') - sc1[, lvl := "sc1"] - setnames(sc1, c("sc1_mthd", "sc1_mthd_id"), c("mthd", "mthd_id")) - ## Level 2 - sc2 <- tcplMthdList(2, 'sc') - sc2[, lvl := "sc2"] - setnames(sc2, c("sc2_mthd", "sc2_mthd_id"), c("mthd", "mthd_id")) - - # Multiple Concentration - ## Level 2 - mc2 <- tcplMthdList(2, 'mc') - mc2[, lvl := "mc2"] - setnames(mc2, c("mc2_mthd", "mc2_mthd_id"), c("mthd", "mthd_id")) - ## Level 3 - mc3 <- tcplMthdList(3, 'mc') - mc3[, lvl := "mc3"] - setnames(mc3, c("mc3_mthd", "mc3_mthd_id"), c("mthd", "mthd_id")) - ## Level 4 - mc4 <- tcplMthdList(4, 'mc') - mc4[, lvl := "mc4"] - setnames(mc4, c("mc4_mthd", "mc4_mthd_id"), c("mthd", "mthd_id")) - ## Level 5 - mc5 <- tcplMthdList(5, 'mc') - mc5[, lvl := "mc5"] - setnames(mc5, c("mc5_mthd", "mc5_mthd_id"), c("mthd", "mthd_id")) - # Compile the Output - mthd.list <- rbind(sc1, sc2, mc2, mc3, mc4, mc5) - mthd.list <- mthd.list[, c("lvl", "mthd_id", "mthd", "desc")] - # Return the Results - return(mthd.list) -} - -# Run the 'method_list' functions and store output. -amthds <- method_list() -# Print the available methods list. -amthds -``` - -The tcplMthdLoad function returns the method assignments for specified id(s). Later sections provide more detailed examples for utilizing the tcplMthdLoad function for individuals ids. - -# Retrieving Level 0 Data - -Prior to the pipeline processing provided in this package, all the data must go through pre-processing, i.e. raw data to database level 0 data. Pre-processing the data should transform data from heterogeneous assays into a uniform format. This is executed using dataset specific R scripts. After pre-processing is complete and the formatted data matches the level 0 format, it can be loaded into the database using tcplWriteLvl0, as described in the tcpl Data Processing vignette. The standard level 0 format is identical for both testing paradigms, SC or MC. Users can inspect the level 0 data and calculate assay quality metrics prior to running the processing pipeline. - -## Load SC0 Data - -```{r sc0, eval = FALSE} -# Load Level 0 single concentration data for a single acid to R. -sc0 <- tcplLoadData(lvl=0, # data level - fld="acid", # field to query on - val=1, # value for each field - # values should match their corresponding 'fld' - type = "sc") # data type - single concentration - -# Alternatively, load data in and format with tcplPrepOtpt. -sc0 <- tcplPrepOtpt(tcplLoadData(lvl=0, fld="acid", val=1, type = "sc")) -``` - -Since we are not able to connect to the database directly in this vignette, we have provided a sample dataset in the package to illustrate what the results should look like. - -```{r sc0_data_ex,warning=FALSE,message=FALSE} -# Load the example data from the package. -data(sc_vignette,package = 'tcpl') -# Save the single concentration level 0 data in the 'sc0' object. -sc0 <- sc_vignette[["sc0"]] -# Print the first 6 rows of the data. -head(sc0) %>% - # format output into a table - kbl() %>% - # format the output rendering to allow horizontal scrolling - scroll_box(width = "100%") %>% - # reduce the size of the table text to improve readability - kable_styling(font_size = 10) -``` - - -## Load MC0 Data - -```{r mc0, eval = FALSE} -# Load Level 0 multiple concentration data. -mc0 <- tcplPrepOtpt( - tcplLoadData(lvl=0, # data level - fld="acid", # field to query on - val=1, # value for each field - # values should match their corresponding 'fld' - type = "mc") # data type - multiple concentrations -) -``` - -We again can use one of the provided datasets in this package to demonstrate what the above results should look like. - -```{r mc0_data_ex,warning=FALSE,message=FALSE} -# Load the example data from the package. -data(mc_vignette,package = 'tcpl') -# Save the multiple concentration level 0 data in the 'mc0' object. -mc0 <- mc_vignette[["mc0"]] -# Print the first 6 rows of the data. -head(mc0) %>% - # format output into a table - kbl() %>% - # format the output rendering to allow horizontal scrolling - scroll_box(width = "100%") %>% - # reduce the size of the table text to improve readability - kable_styling(font_size = 10) -``` - -## Review MC assay quality - -The goal of this section is to provide example quantitative metrics, such as z-prime and coefficient of variance, to evaluate assay performance relative to controls. - -```{r mc0_aq, eval = FALSE} -# Create a function to review assay quality metrics using indexed Level 0 data. -aq <- function(ac){ - # obtain level 1 multiple concentration data for specified acids - dat <- tcplPrepOtpt(tcplLoadData(1L, "acid", aeids$acid, type="mc")) - - # keep only observations with good well quality (wllq = 1) - dat <- dat[wllq==1] - - # obtain summary values for data and remove missing data (i.e. NA's) - agg <- dat[ , - list( - # median response values (rval) of neutral wells (wllt = n) - nmed = median(rval[wllt=="n"], na.rm=TRUE), - # median absolute deviation (mad) of neutral wells (wllt = n) - nmad = mad(rval[wllt=="n"], na.rm=TRUE), - # median response values of positive control wells (wllt = p) - pmed = median(rval[wllt=="p"], na.rm=TRUE), - # median absolute deviation of positive control wells (wllt = p) - pmad = mad(rval[wllt=="p"], na.rm=TRUE), - # median response values of negative control wells (wllt = m) - mmed = median(rval[wllt=="m"], na.rm=TRUE), - # median absolute deviation of negative control wells (wllt = m) - mmad = mad(rval[wllt=="m"], na.rm=TRUE) - ), - # aggregate on assay component id, assay component name, - # and assay plate id - by = list(acid, acnm, apid)] - - # Z prime factor: separation between positive and negative controls, - # indicative of likelihood of false positives or negatives. - # - Between 0.5 - 1 are excellent, - # - Between 0 and 0.5 may be acceptable, - # - Less than 0 not good - # obtain the z-prime factor for positive controls and neutral - agg[ , zprm.p := 1 - ((3 * (pmad + nmad)) / abs(pmed - nmed))] - # obtain the z-prime factor for negative controls and neutral - agg[ , zprm.m := 1 - ((3 * (mmad + nmad)) / abs(mmed - nmed))] - - agg[ , ssmd.p := (pmed - nmed) / sqrt(pmad^2 + nmad^2 )] - agg[ , ssmd.m := (mmed - nmed) / sqrt(mmad^2 + nmad^2 )] - - # Coefficient of Variation (cv) of neutral control - # - Ideally should be under 25% - agg[ , cv := nmad / nmed] - - agg[ , sn.p := (pmed - nmed) / nmad] - agg[ , sn.m := (mmed - nmed) / nmad] - agg[ , sb.p := pmed / nmed] - agg[ , sb.m := mmed / nmed] - - agg[zprm.p<0, zprm.p := 0] - agg[zprm.m<0, zprm.m := 0] - - acqu <- agg[ , list( nmed = signif(median(nmed, na.rm = TRUE)), - nmad = signif(median(nmad, na.rm = TRUE)), - pmed = signif(median(pmed, na.rm = TRUE)), - pmad = signif(median(pmad, na.rm = TRUE)), - mmed = signif(median(mmed, na.rm = TRUE)), - mmad = signif(median(mmad, na.rm = TRUE)), - zprm.p = round(median(zprm.p, na.rm=TRUE),2), - zprm.m = round(median(zprm.m, na.rm=TRUE),2), - ssmd.p = round(median(ssmd.p, na.rm=TRUE),0), - ssmd.m = round(median(ssmd.m, na.rm=TRUE),0), - cv = round(median(cv, na.rm=TRUE),2), - sn.p = round(median(sn.p, na.rm=TRUE),2), - sn.m = round(median(sn.m, na.rm=TRUE),2), - sb.p = round(median(sb.p, na.rm=TRUE),2), - sb.m = round(median(sb.m, na.rm=TRUE),2) - ), by = list(acid, acnm)] - # Return the Results. - return(acqu) -} #per acid - -# Run the 'aq' function & store the output. -assayq <- aq(ac) -# Print the first 6 rows of the assay quality results. -head(assayq) -``` - -# Retrieving Processed Single-Concentration (SC) Data and Methods - -The goal of SC processing is to identify potentially active compounds from a large screen at a single concentration. After processing, users can inspect SC activity hit calls and the applied methods. - -## Load SC2 Data - -```{r sc2, eval = FALSE} -# Load Level 2 single concentration data for a single aeid. -sc2 <- tcplPrepOtpt( - tcplLoadData(lvl=2, # data level - fld="aeid", # id field to query on - val=3, # value for the id field - type = "sc") # data type - single concentration -) -# Alternatively, data for a set of aeids can be loaded with a vector of ids. -sc2 <- tcplPrepOtpt( - tcplLoadData(lvl=2, fld="aeid", val=aeids$aeid, type = "sc") -) -``` - -## Load SC Methods - -```{r sc2_mthd, eval = FALSE} -# Create a function to load methods for single concentration data processing -# steps for given aeids. -sc_methods <- function(aeids) { - # load the level 1 methods assigned for the single concentration aeid's - sc1_mthds <- tcplMthdLoad(lvl=1, type ="sc", id=aeids$aeid) - # aggregate the method id's by aeid - sc1_mthds<- aggregate(mthd_id ~ aeid, sc1_mthds, toString) - # reset the names of the sc1_mthds object - setnames(sc1_mthds, "mthd_id", "sc1_mthd_id") - - # load the level 2 methods assigned for the single concentration aeid's - sc2_mthds <- tcplMthdLoad(lvl=2, type ="sc", id=aeids$aeid) - # aggregate the method id's by aeid - sc2_mthds<- aggregate(mthd_id ~ aeid, sc2_mthds, toString) - # reset the names of the sc2_mthds object - setnames(sc2_mthds, "mthd_id", "sc2_mthd_id") - - # Compile the Output - methods <- merge( merge(aeids, sc1_mthds, by = "aeid", all = TRUE), - sc2_mthds, by = "aeid", all = TRUE ) - # Return the Results - return(methods) -} - -# Run the 'sc_methods' function and store the output. -smthds <- sc_methods(aeids) - -# Print the assigned sc methods. -smthds -``` - -# Retrieving Processed Multi-Concentration (MC) Data and Methods - -The goal of MC processing is to estimate the hitcall, potency, efficacy, and other curve-fitting parameters for sample-assay endpoint pairs. After processing, users can inspect the activity hitcalls, model parameters, concentration-response plots, and the applied methods for the multiple concentration data. - -## Load MC5 Data - -```{r mc5_data, eval = FALSE} -# Load Level 5 MC data summary values for a set of aeids. -# (NOTE: As before, the user can obtain data for individual aeids.) -mc5 <- tcplPrepOtpt( - tcplLoadData(lvl=5, # data level - fld="aeid", # fields to query on - val=aeids$aeid, # value for each field - # values should match their corresponding 'fld' - type = "mc") # data type - MC -) - -# For tcpl v3.0.0 and future releases, to output mc5_param information with -# the default mc5 results then 'add.fld' must be set to TRUE. -# (NOTE: Default for add.fld is FALSE, unless otherwise specified.) -mc5 <- tcplPrepOtpt( - tcplLoadData(lvl=5, # data level - fld="aeid", # fields to query on - val=aeids$aeid, # value for each field - # values should match their corresponding 'fld' - type = "mc", # data type - multiple concentration - add.fld=TRUE) # return additional parameters from mc5_param - ) -``` - -## Load MC Methods - -```{r mc5_methods, eval = FALSE} -# Create a function to load methods for MC data processing -# for select aeids. -mc_methods <- function(aeids) { - # acid - ## load the methods assigned to level 2 for given acids - mc2_mthds <- tcplMthdLoad(2,aeids$acid) - ## aggregate the assigned methods by acid - mc2_mthds<- aggregate(mthd_id ~ acid, mc2_mthds, toString) - ## rename the columns for the 'mc2_mthds' object - setnames(mc2_mthds, "mthd_id", "mc2_mthd_id") - - # aeid - ## load the methods assigned to level 3 for given aeids - mc3_mthds <- tcplMthdLoad(3,aeids$aeid) - ## aggregate the assigned methods by aeid - mc3_mthds<- aggregate(mthd_id ~ aeid, mc3_mthds, toString) - ## rename the columns for the 'mc3_mthds' object - setnames(mc3_mthds, "mthd_id", "mc3_mthd_id") - ## load the methods assigned to level 4 for given aeids - mc4_mthds <- tcplMthdLoad(4,aeids$aeid) - ## aggregate the assigned methods by aeid - mc4_mthds<- aggregate(mthd_id ~ aeid, mc4_mthds, toString) - ## rename the columns for 'mc4_mthds' object - setnames(mc4_mthds, "mthd_id", "mc4_mthd_id") - ## load the methods assigned to level 5 for given aeids - mc5_mthds <- tcplMthdLoad(5,aeids$aeid) - ## aggregate the assigned methods by aeid - mc5_mthds<- aggregate(mthd_id ~ aeid, mc5_mthds, toString) - ## rename the columns for 'mc5_mthds' object - setnames(mc5_mthds, "mthd_id", "mc5_mthd_id") - - # Compile the Results. - ## merge the aeid information with the level 2 methods by acid - acid.methods <- merge(aeids, mc2_mthds,by.x = "acid", by.y = "acid") - ## merge the level 3, 4, and 5 methods by aeid - mthd35 <- merge( - merge(mc3_mthds, mc4_mthds, by = "aeid", all = TRUE), - mc5_mthds, by = "aeid", all = TRUE - ) - ## merge all methods information by aeid - methods <- merge(acid.methods, mthd35,by.x = "aeid", by.y = "aeid") - # Print the Results. - print(methods) - # Return the Results. - return(methods) -} - -# Run the 'methods' function and store the output. -mmthds <- mc_methods(aeids) - -# Print the assigned mc methods. -mmthds -``` - -# Plotting - -tcplPlot is tcpl’s single flexible plotting function, allowing for interactive yet consistent visualization of concentration-response curves via customizable parameters. As a standalone plotting utility built with the R library plotly to display the additional curve-fitting models, tcplPlot implements the R library plumber to provide representational state transfer-application programming interface (REST API) functionality. The tcplPlot function requires the selection of a level (`lvl`), field (`fld`), and value (`val`) to load the necessary data and display the associated plots. Level 4, `lvl = 4`, plots the concentration-response series fit by all models. Level 5, `lvl = 5`, extends Level 4 plotting by highlighting the winning model with activity hit call presented. Level 6 multi-concentration plotting, including lists of flags, are not currently supported by tcplPlot. Moreover, only multi-concentration plotting is currently supported. - -Customization of output is possible by specifying parameters, including `output`, `verbose`, `multi`, `by`, `fileprefix`, `nrow`, `ncol`, and `dpi`. - -- The `output` parameter indicates how the plots will be presented. In addition to outputs viewable with the R console, tcplPlot supports a variety of publication-quality file type options, including raster graphics (PNG, JPG, and TIFF) to retain color quality when printing to photograph and vector graphics (SVG and PDF) to retain image resolution when scaled to large formats. - -- The `verbose` parameter results in a plot that includes a table containing potency and model performance metrics; `verbose = FALSE` is default and the only option in console outputs. When `verbose = TRUE` the model aic values are listed in descending order and generally the winning model will be listed first. - -- The `multi` parameter allows for single or multiple plots per page. `multi = TRUE` is the default option for PDF outputs, whereas `multi = FALSE` is the only option for other outputs. If using the parameter option `multi = TRUE`, the default number of plots per page is set by the `verbose` parameter. The default number of plots per page is either 6 plots per page (`verbose = FALSE`) or 4 plots per page (`verbose = TRUE`). - -- The `by` parameter indicates how files should be divided, typically by $aeid$ or $spid$. - -- The `fileprefix` parameter allows the user to set a custom filename prefix. The standard filename is tcplPlot_sysDate().output (example: tcplPlot_2023_08_02.jpg) or, if `by` parameter is set, tcplPlot_sysDate()_by.output (example: tcplPlot_2023_08_02_aeid_80.pdf). When a `fileprefix` is assigned the default _tcplPlot_ prefix is replaced with the new filename. (example: myplot_2023_08_02_aeid_80.pdf or myplot_2023_08_02.jpg). - -- The `nrow` parameter specifies the number of rows for the multiple plots per page; this is 2 by default. The `ncol` parameter specifies the number of columns for the multiple plots per page; this is 3 by default. If `verbose = FALSE`, `ncol` is 2. `nrow` and `ncol` can customize the number of plots included per page. Both `nrow` and `ncol` must be greater than 0. While there is no hard coded upper limit to the number of rows and columns, the underlying technology has a dimension limitation of `nrow = 9` and `ncol = 7`. - -- The `dpi` parameter specifies image print resolution for image file output types (PNG, JPG, TIFF, SVG); this is 600 by default. - -The following examples demonstrate tcplPlot functionality through available the variety of customization options: - -## Output PDF of Verbose, Multiple Plots per Page, by AEID and/or SPID - -The following two examples produce plots of Level 5 MC data for the selected $aeids$. A new pdf is generated for each endpoint. Filtering can be applied if only plots for a subset of samples ($spids$) are desired. - -```{r mc_plot_pdf_aeid, eval = FALSE} -# Plot Level 5 MC data for aeids 3157-3159 and outputs plots separate pdfs by aeid. -tcplPlot(lvl = 5, # data level - fld = "aeid", # field to query on - val = 3157:3159, # values must be listed for each corresponding 'fld' - by = "aeid", # parameter to divide files - multi = TRUE, # multiple plots per page - output 4 per page - verbose = TRUE, # output all details if TRUE - output = "pdf") # output as pdf - -# Loading required mc_vignette data for example below -data(mc_vignette, package = 'tcpl') -mc5 <- mc_vignette[["mc5"]] - -# Plot Level 5 MC data from the mc_vignette R data object for a single aeid 80 and -# spids "TP0001652B01", 01504209", "TP0001652D01", "TP0001652A01", and "1210314466" -tcplPlot(lvl = 5, # data level - fld = c("aeid", "spid"), # field to query on - val = list(mc5$aeid, mc5$spid), # values must be listed for each corresponding 'fld' - by = "aeid", # parameter to divide files - multi = TRUE, # multiple plots per page - output 4 per page - verbose = TRUE, # output all details - output = "pdf", # output as pdf - fileprefix = "output_pdf") # prefix of the filename -``` -
![Plots with parameters: output = "pdf", multi = TRUE, and verbose = TRUE for aeid 80 and spids "TP0001652B01", 01504209", "TP0001652D01", "TP0001652A01", and "1210314466"](img/output_pdf.png)
- -## Output Image File (JPG) of Single Verbose Plot, by AEID and SPID - -This example illustrates a Level 5 verbose plot for a single endpoint and single sample of output type “jpg”. - -```{r mc_plot_jpg, eval = FALSE} -# Plot a verbose plot of Level 5 MC data for single aeid 80 and spid 01504209 and -# output as jpg. -tcplPlot(lvl = 5, # data level - fld = c('aeid','spid'), # field to query on - val = list(80,'01504209'), # values must be listed for each corresponding 'fld' - # values should match their corresponding 'fld' - multi = FALSE, # single plot per page - verbose = TRUE, # output all details - output = "jpg", # output as jpg - fileprefix = "output_jpg") -``` - -
![Plot generated with parameters: output = "jpg" and verbose = TRUE for aeid 80 and spid 01504209](img/output_jpg.jpg)
- -## Output to Console, by M4ID or AEID and SPID - -Due to the dynamic nature of _m#_ids, the first example code chunk does not include a corresponding plot. Here, the $m4id$ value (482273) corresponds with the mc_vignette R data object. To run test this code, a valid $m4id$ value must be supplied. - -The second example includes a level 5 plot for one endpoint and one sample of output type “console”. Only 1 concentration series can be output in console at a time. -```{r mc_plot_console, eval = FALSE} -# Create Level 4 plot for a single m4id. -tcplPlot(lvl = 4, # data level - fld = "m4id", # field to query on - val = 482273, # values must be listed for each corresponding 'fld' - multi = FALSE, # single plot - verbose = FALSE, # do not output all details - output = "console") # output in R console - -# Plot of Level 5 MC data for single aeid (80) and spid (01504209) -# and output to console. -tcplPlot(lvl = 5, # data level - fld = c('aeid','spid'), # field to query on - val = list(80, '01504209'), # values must be listed for each corresponding 'fld' - multi = FALSE, # single plot - verbose = FALSE, # do not output all details - output = "console") # output in R console -``` -
![Plot generated with parameters: output = "console" for aeid 80 and spid 01504209](img/output_console.png)
- - -# Additional Examples - -Below are a few case examples for retrieving various bits of information from the database. - -## Load Data for a Specific Chemical - -In this example, we illustrate the necessary steps for extracting information about the compound *Bisphenol A* found within the database. The user will define the chemical of interest, isolate all associated sample ids ($\mathit{spids}$), and then load all data for the given chemical. - -```{r BPA, eval = FALSE} -# Provide the chemical name and assign to 'chnm'. -chnm <- 'Bisphenol A' -# Load the chemical data from the database. -chem <- tcplLoadChem(field = 'chnm',val = chnm) -# Load mc5 data from the database for the specified chemical. -BPA.mc5 <- tcplLoadData(lvl = 5, # data level - fld = 'spid', # field to query on - val = chem[,spid], # value for each field (fld) - type = 'mc') # data type - MC -``` - -## Plot Sample Subset - -In this example, we illustrate how to plot by endpoint for a sample subset, as opposed to plotting all samples tested within an endpoint. The user will load data for the select endpoints, isolate the samples of interest, and then plot by endpoint for the sample subset. - -```{r spid_plot, eval=FALSE} -# Load Level 5 multiple concentration data summary values for select aeids. -mc5 <- tcplPrepOtpt( - tcplLoadData(lvl=5, # data level - fld='aeid', # id field to query on - val=tcplLoadAeid(fld="asid",val = 25)$aeid, # value for each field - type='mc', # data type - MC - add.fld=TRUE) # return additional parameters from mc5_param - ) - -# Identify sample subset. -spid.mc5 <- mc5[spid %in% c("EPAPLT0018N08", "EPAPLT0023A16", "EPAPLT0020C11", - "EPAPLT0018B13","EPAPLT0018B14","EPAPLT0018B15"),] - -# Plot by endpoint for sample subset. -tcplPlot(lvl = 5, # data level - fld = c("spid","aeid"), # fields to query on - val = list( # value for each field, must be same order as 'fld' - spid.mc5$spid, # sample id's - spid.mc5$aeid # assay endpoint id's - ), - by = "aeid", # parameter to divide files - multi = TRUE, # multiple plots per page - output 6 per page if TRUE - verbose = TRUE, # output all details if TRUE - output = "pdf", # output as pdf - fileprefix = "output/upitt") # prefix of the filename -``` diff --git a/vignettes/Introduction_Appendices.Rmd b/vignettes/Introduction_Appendices.Rmd index cfa7b92d..4a6a0a1c 100644 --- a/vignettes/Introduction_Appendices.Rmd +++ b/vignettes/Introduction_Appendices.Rmd @@ -1,95 +1,121 @@ --- -title: The ToxCast(TM) Analysis Pipeline(tcpl)
An R Package for Processing and Modeling Chemical Screening Data (Version 3.0)
-author: "Center for Computational Toxicology and Exposure, US EPA" +title: "tcpl: The ToxCast Data Analysis Pipeline
*Supporting Accessible Bioactivity Data for Toxicology*" +author: US EPA's Center for Computational Toxicology and Exposure ccte@epa.gov output: - prettydoc::html_pretty: - theme: architect - toc: yes - toc_depth: 4 + rmdformats::readthedown: + fig_retina: false +params: + my_css: css/rmdformats.css vignette: > - %\VignetteIndexEntry{The ToxCast(TM) Analysis Pipeline(tcpl) An R Package for Processing and Modeling Chemical Screening Data (Version 3.0)} + %\VignetteIndexEntry{1. Introduction to tcpl and invitrodb} %\VignetteEngine{knitr::rmarkdown} %\usepackage[utf8]{inputenc} ---- - - - - +```{css, code = readLines(params$my_css), hide=TRUE, echo = FALSE} +``` ```{r, echo = FALSE, message = FALSE, warning = FALSE} - +#devtools::load_all() #use this instead of lbrary(tcpl) when dev versions are installed locally +library(tcpl) +library(tcplfit2) +# Data Formatting Packages # +library(data.table) +library(dplyr) +library(magrittr) +library(reshape2) +library(knitr) +# Plotting Packages # +library(ggplot2) +library(gridExtra) +library(RColorBrewer) +library(colorspace) +library(viridis) +# Table Packages # library(htmlTable) +library(kableExtra) ``` +```{r setup, include = FALSE} +library(httptest) +start_vignette("api") +``` + + + # Introduction -This vignette provides an overview of the tcpl package, including set up, database structure, and pre-processing. Assay registration, data processing, and data retrieval are topics covered in separate vignettes. +This vignette provides an overview of the tcpl package, including set up, [Database Structure](#db), [Pre-processing Requirements](#lvl0-preprocessing), [Assay and Chemical Registration](#register), [Data Processing](#data_process), [Data Interpretation](#data_interp), and [Data Retrieval with invitrodb and via API](#data_retrieval). # Overview -The ToxCast pipeline ( tcpl ) is an R package that manages, curve-fits, plots, and stores ToxCast data to populate its linked MySQL database, InvitroDB. The U.S. Environmental Protection Agency (EPA) ToxCast^TM^ program includes in vitro medium- and high-throughput screening assays for the prioritization and hazard characterization of thousands of chemicals of interest. These assays comprise Tier 2-3 of the new Computational Toxicology Blueprint, and employ automated chemical screening technologies, to evaluate the effects of chemical exposure on living cells and biological macromolecules, such as proteins (Thomas et al., 2019). More information on the ToxCast program can be found at . +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 [U.S. Environmental Protection Agency (EPA)'s Toxicity Forecaster (ToxCast^TM^) program](https://www.epa.gov/comptox-tools/toxicity-forecasting-toxcast) includes *in vitro* medium- and high-throughput screening (HTS) assays for the prioritization and hazard characterization of thousands of chemicals of interest. Targeted and confirmatory assays (like ToxCast assays) comprise Tiers 2-3 of the Computational Toxicology Blueprint ([Thomas et al., 2019](https://pubmed.ncbi.nlm.nih.gov/30835285/)), and employ automated chemical screening technologies to evaluate the effects of chemical exposure on living cells and biological macromolecules, such as proteins. -This flexible analysis pipeline is capable of efficiently processing and storing large volumes of data. The diverse data, received in heterogeneous formats from numerous vendors, are transformed to a standard computable format and loaded into the tcpl database by vendor-specific R scripts. Once data is loaded into the database, ToxCast utilizes generalized processing functions provided in this package to process, normalize, model, qualify, and visualize the data. +The tcpl package is a flexible analysis pipeline is capable of efficiently processing and storing large volumes of data. The diverse data, received in heterogeneous formats from numerous vendors, are transformed to a standard computable format via [Level 0 Preprocessing](#lvl0-preprocessing) then loaded into the database by vendor-specific R scripts. Describing the specific transformations may be outside the scope of this package, but can be done for virtually any chemical screening effort, provided the data includes the minimum required information. Once data is loaded into the database, generalized processing functions provided in this package process, normalize, model, qualify, and visualize the data.
-![Conceptual overview of the ToxCast Pipeline functionality](img/Fig1_tcpl_overview.png) +![Conceptual overview of the ToxCast Pipeline](img/Fig1_tcpl_overview.png){width=100%}
-The original tcplFit() functions performed basic concentration response curve fitting. Processing with tcpl_v3 and beyond depends on the stand-alone tcplFit2 package to allow a wider variety of concentration-response models when using invitrodb in the 4.0 schema and beyond.^[Using tcpl_v3 with the schema from invitrodb versions 2.0-3.5 will still default to tcplFit() modeling with constant, Hill, and gain-loss] The main set of extensions includes all of the concentration-response models that are contained in the program BMDExpress. These include polynomial, exponential and power functions in addition to the original Hill, gain-loss and constant models. Similar to the program BMDExpress, tcplFit2 curve-fitting uses a defined Benchmark Response (BMR) level to estimate a benchmark dose (BMD), which is the concentration where the curve-fit intersects with this BMR threshold. One final addition was to let the hitcall value be a continuous number ranging from 0 to 1 (in contrast to binary hitcall values from tcplFit() . While developed primarily for ToxCast, the tcpl package is written to be generally applicable to the chemical-screening community. +The original tcplFit() functions performed basic concentration response curve fitting. Processing with tcpl v3 and beyond depends on the stand-alone tcplFit2 package to allow a wider variety of concentration-response models when using invitrodb in the 4.0 schema and beyond. Using tcpl_v3 with the schema from invitrodb versions 2.0-3.5 will still default to tcplFit() modeling with constant, Hill, and gain-loss. The main improvement provided by updating to using tcplFit2 is inclusion of concentration-response models like those contained in the program [BMDExpress2](https://github.com/auerbachs/BMDExpress-2). These models include polynomial, exponential, and power functions in addition to the original Hill, gain-loss, and constant models. Similar to the program [BMDExpress](https://www.sciome.com/bmdexpress/), tcplFit2 curve-fitting uses a defined Benchmark Response (BMR) level to estimate a benchmark dose (BMD), which is the concentration where the curve-fit intersects with this BMR threshold. One final addition was to let the hit call value be a continuous number ranging from 0 to 1 (in contrast to binary hit call values from tcplFit() ). While developed primarily for ToxCast, the tcpl package is written to be generally applicable to the chemical-screening community. -The tcpl package includes processing functionality for two screening paradigms: (1) single-concentration screening and (2) multiple-concentration screening. Single-concentration screening consists of testing chemicals at one concentration, often for the purpose of identifying potentially active chemicals to test in the multiple-concentration format. Multiple-concentration screening consists of testing chemicals across a concentration range, such that the modeled activity can give an estimate of potency, efficacy, etc. +The tcpl package includes processing functionality for two screening paradigms: (1) single-concentration (SC) and (2) multiple-concentration (MC) screening. SC screening consists of testing chemicals at one to three concentrations, often for the purpose of identifying potentially active chemicals to test in the multiple-concentration format. MC screening consists of testing chemicals across a concentration range, such that the modeled activity can give an estimate of potency, efficacy, etc. -Prior to the pipeline processing provided in this package, all the data must go through pre-processing (level 0). Level 0 pre-processing utilizes dataset-specific R scripts to process the heterogeneous data into a uniform format and to load the uniform data into the tcpl database. Level 0 pre-processing is outside the scope of this package, but can be done for virtually any high-throughput or high-content chemical screening effort, provided the resulting data includes the minimum required information. +In addition to storing the data, the tcpl database stores every processing and analysis decision at the assay component or assay endpoint level to facilitate transparency and reproducibility. For the illustrative purposes of this vignette, we have included a CSV version of the tcpl database containing a small subset of data from the ToxCast program. tcplLite is no longer supported by tcpl because tcplfit2 can be used to curve-fit data and make hit calls independent of invitrodb, available at . tcplLite relied on flat files structured like invitrodb to produce curve-fitting and summary information like hit calls and AC50 values. Functionally tcplfit2 replaces tcplLite because interested stakeholders can now curve-fit data and reproduce curve-fitting results independent of the invitrodb schema. For the ToxCast program, it is still important to use invitrodb when curve-fitting as invitrodb serves as a data resource for tracking pipelining decisions and providing a dataset for many interested stakeholders. Using tcpl, the user can upload, process, and retrieve data by connecting to a MySQL database. Additionally, past versions of the ToxCast database, containing all the publicly available ToxCast data, are available for download at: . -In addition to storing the data, the tcpl database stores every processing and analysis decision at the assay component or assay endpoint level to facilitate transparency and reproducibility. For the illustrative purposes of this vignette and others, we have included a CSV version of the tcpl database containing a small subset of data from the ToxCast program. tcplLite is no longer supported by tcpl because tcplFit2 can be used to curve-fit data and make hitcalls independent of invitrodb, available at . tcplLite relied on flat files structured like invitrodb to produce curve-fitting and summary information like hitcalls and AC50 values. Functionally tcplFit2 replaces tcplLite because interested stakeholders can now curve-fit data and reproduce curve-fitting results independent of the invitrodb schema. For the ToxCast program it is still important to use invitrodb when curve-fitting as invitrodb serves as a data resource for tracking pipelining decisions and providing a dataset for many interested stakeholders. Using tcpl, the user can upload, process, and retrieve data by connecting to a MySQL database. Additionally, past versions of the ToxCast database, containing all the publicly available ToxCast data, are available for download at: . +# ToxCast Publications +Check out the following publications for additional information on the overall [US EPA's Toxicity Forecaster (ToxCast) Program](https://www.epa.gov/comptox-tools/toxicity-forecasting-toxcast). Assay-specific publications describing assay design or results are available in the assay_references and citations tables. -# Package Settings +* [Feshuk et al., 2023](https://www.frontiersin.org/journals/toxicology/articles/10.3389/ftox.2023.1275980): The ToxCast pipeline: updates to curve-fitting approaches and database structure +* [Filer et al.,2017](https://pubmed.ncbi.nlm.nih.gov/27797781/): tcpl: the ToxCast pipeline for high-throughput screening data +* [Sheffield et al., 2021](https://doi.org/10.1093/bioinformatics/btab779): tcplfit2: an R-language general purpose concentration–response modeling package +* [Judson et al., 2016](https://doi.org/10.1093/toxsci/kfw148): Analysis of the Effects of Cell Stress and Cytotoxicity on In Vitro Assay Activity Across a Diverse Chemical and Assay Space +# Connection Configuration -First, it is highly recommended for users to utilize the data.table package. The tcpl package utilizes the data.table package for all data frame-like objects. tcpl is dependent on the following two packages: tcplFit2 and plotly . The user must install and load them prior to loading the tcpl package. -```{r eval=TRUE, message=FALSE} -library(data.table) -library(plotly) -library(tcplfit2) +First, it is highly recommended for users to utilize the data.table package. The tcpl package utilizes the data.table package for all data frame-like objects. + +```{r eval=FALSE, message=FALSE} +library(data.table) # recommended for interacting with tcpl data frame-like objects library(tcpl) -## Store the path for the tcpl directory for loading data -pkg_dir <- system.file(package = "tcpl") +``` + +After loading tcpl, the function tcplConf is used to establish connection to a database server or the API. While a typical database connection requires 5 parameters to be provided, using an API connection requires the user to only specify password (`pass`) and driver (`drvr`): +```{r setup-api, eval=FALSE} +tcplConf(pass = "API key provided by emailing CTX API support at ccte_api@epa.gov", + drvr = "API") ``` + +::: {.noticebox data-latex=""} + +**NOTE:** When tcpl is loaded, the default configuration sets the options to tcpl's application API key to support new users testing out the package. This default API key is not intended for regular users; instead, it is highly recommended to obtain a personal API key to also access other CTX APIs. For this, send an email request to CTX API support at . + +::: + Every time the package is loaded in a new R session, a message similar to the following will print showing the default package settings: ```{r eval = FALSE} -tcpl (v1.3) loaded with the following settings: - TCPL_DB: C:/Users/user/R-3.4.4/library/tcpl/csv +tcpl (v3.1.0) loaded with the following settings: + TCPL_DB: NA TCPL_USER: NA - TCPL_HOST: NA - TCPL_DRVR: NA -Default settings stored in TCPL.conf. See ?tcplConf for more information. + TCPL_HOST: https://api-ccte.epa.gov/bioactivity + TCPL_DRVR: API +Default settings stored in tcpl config file. See ?tcplConf for more information. ``` -The package consists of five settings: +Establishing a database connection utilizes the following settings: -1. $TCPL_DB points to the tcpl database (either the path to the CSV directory, as in the given example above, or the name of the MySQL database), -2. $TCPL_USER stores the username for accessing the database, -3. $TCPL_PASS stores the password for accessing the database, -4. $TCPL_HOST points to the MySQL server host, and -5. $TCPL_DRVR indicates which database driver is used ("MySQL"). tcplLite is no longer supported and it is recommended to use tcplFit2 package for stand-alone applications. +1. $TCPL_DB points to the tcpl database (if using "MySQL" drvr), +2. $TCPL_USER stores the username for accessing the database (if using "MySQL" drvr), +3. $TCPL_PASS stores the password for accessing the database (if using "MySQL" drvr) or API key (if connecting to CTX APIs), +4. $TCPL_HOST points to the MySQL server host (if using "MySQL" drvr) or API url (if connecting to CTX APIs), and +5. $TCPL_DRVR indicates which database driver is used ("MySQL", "API"). tcplLite is no longer supported and it is recommended to use the tcplFit2 package for stand-alone applications. -Refer to ?tcplConf for more information. At any time, users can check the settings using tcplConfList() . An example of database settings using tcpl would be as follows: +Refer to ?tcplConf for more information. At any time, users can check the settings using tcplConfList(). An example of database settings using tcpl would be as follows: ```{r eval = FALSE} tcplConf(db = "invitrodb", @@ -99,27 +125,33 @@ tcplConf(db = "invitrodb", drvr = "MySQL") ``` + tcplConfList will list connection information. Note, tcplSetOpts will only make changes to the parameters given. The package is always loaded with the settings stored in the TCPL.config file located within the package directory. The user can edit the file, such that the package loads with the desired settings, rather than having to call the tcplSetOpts function every time. The TCPL.config file has to be edited whenever the package is updated or re-installed. With no TCPL.config file available, the package defaults to an "API" connection configuration with the [CTX APIs](https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis). - tcplConfList will list connection information. Note, tcplSetOpts will only make changes to the parameters given. The package is always loaded with the settings stored in the TCPL.config file located within the package directory. The user can edit the file, such that the package loads with the desired settings, rather than having to call the tcplSetOpts function every time. The TCPL.config file has to be edited whenever the package is updated or re-installed. - -# Database Structure +# Database Structure {#db} The following contains reference tables that describe the structure and fields found in the tcpl populated database. The first sections describe the data-containing tables, followed by sections describing the additional annotation tables. +
+ +![General representation of the invitrodb Schema](img/schema.png){width=100%} + +
+ In general, the single-concentration data and accompanying methods are found in the "sc#" tables, where the number indicates the processing level. Likewise, the multiple-concentration data and accompanying methods are found in the "mc#" tables. Each processing level that has accompanying methods will also have tables with the "_methods" and "_id" naming scheme. For example, the database contains the following tables: "mc5" storing the data from multiple-concentration level 5 processing, "mc5_methods" storing the available level 5 methods, and "mc5_aeid" storing the method assignments for level 5. Note, the table storing the method assignments for level 2 multiple-concentration processing is called "mc2_acid", because MC2 methods are assigned by assay component ID. There are two additional tables, "sc2\_agg" and "mc4\_agg," that link the data in tables "sc2" and "mc4" to the data in tables "sc1" and "mc3," respectively. This is necessary because each entry in the database before SC2 and MC4 processing represents a single value; subsequent entries represent summary/modeled values that encompass many values. To know what values were used in calculating the summary/modeled values, the user must use the "\_agg" look-up tables. -When using tcpl_v3 with invitrodb schemas v2.0-v3.5, tcplFit model data are structured in mc4 and mc5 tables that are in wide format with a fixed number of columns based on 3 curvefitting models (see documentation associated with tcpl_v2.1 ). When using tcpl_v3 with invitrodb schemas v4.0 or later, mc4 and mc5 tables have been updated to reflect having mc4_param and mc5_param tables. Tables should be reviewed together: mc4 captures summary values calculated for each concentration series, whereas mc4_param includes parameters for all models in long format. mc5 selects the winning model and activity hit call, whereas mc5_param includes model parameters from selected winning (hit) model in long format. These schema changes provide a way to continually expand modeling capabilities in tcpl . +When using tcpl_v3 with invitrodb schemas v2.0-v3.5, tcplFit model data are structured in mc4 and mc5 tables that are in wide format with a fixed number of columns based on 3 curve-fitting models (see documentation associated with tcpl_v2.1 ). When using tcpl v3+ with invitrodb schemas v4+, mc4 and mc5 tables have been updated to reflect having mc4_param and mc5_param tables. Tables should be reviewed together: mc4 captures summary values calculated for each concentration series, whereas mc4_param includes parameters for all models in long format. mc5 selects the winning model and activity hit call, whereas mc5_param includes model parameters from selected winning (hit) model in long format. These schema changes provide a way to continually expand modeling capabilities in tcpl . Each of the methods tables have fields analogous to $\mathit{mc5\_mthd\_id}$, $\mathit{mc5\_mthd}$, and $\mathit{desc}$. These fields represent the unique key for the method, the abbreviated method name (used to call the method from the corresponding mc5\_mthds function), and a brief description of the method, respectively. The method assignment tables will have fields analogous to $\mathit{mc5\_mthd\_id}$ matching the method ID from the methods tables, an assay component or assay endpoint ID, and possibly an $\mathit{exec\_ordr}$ field indicating the order in which to execute the methods. The method and method assignment tables will not be listed in the tables below to reduce redundancy. Many of the tables also include the $\mathit{created\_date}$, $\mathit{modified\_date}$, and $\mathit{modified\_by}$ fields that store helpful information for tracking changes to the data. These fields will not be discussed further or included in the tables below. -Many of the tables specific to the assay annotation are populated semi-manually based on expert curation of information on assay design; these tables of assay annotation are not currently utilized by the tcpl package, but instead act as meta-data for users. The full complexity of the assay annotation used by the ToxCast program is beyond the scope of this vignette and the tcpl package. Additionally, assay description documents for ToxCast assays can be found at: . +Many of the tables specific to the assay annotation are populated semi-manually based on expert curation of information on assay design; these tables of assay annotation are not currently utilized by the tcpl package, but instead act as meta-data for users. The full complexity of the assay annotation used by the ToxCast program is somewhat beyond the scope of this vignette and the tcpl package. Additionally, a compiled report of assay description documents are available on the [ToxCast Downloadable Data page.](https://www.epa.gov/comptox-tools/exploring-toxcast-data) + +## Level 0 {#lvl0-table} +The "mc0" and "sc0" tables are identical, other than containing $\mathit{m0id}$ rather than $\mathit{s0id}$, respectively. See the [Level 0 Pre-processing section](#lvl0-preprocessing) for more information. -## Single-concentration Data-containing Tables - ```{r warning = FALSE, echo = FALSE} Field <- c("s0id ", "acid", "spid", "apid", "rowi", "coli", "wllt", "wllq", "conc", "rval", "srcf") Description <- c("Level 0 ID", @@ -128,177 +160,124 @@ Description <- c("Level 0 ID", "Assay plate ID", "Assay plate row index", "Assay plate column index", - "Well type†", - "1 if the well quality was good, else 0;", + "Well type", + "Well quality: 1 was good, else 0", "Concentration is micromolar", - "Raw assay component value/readout from vendor", - "Filename of the source file containing the data" - ) - -output <- - data.frame(Field, Description) + "Raw assay component value or readout", + "Filename of the source file containing the data") -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 1: Fields in sc0 table.", - tfoot="†Information about the different well types is available in Appendix B.") +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +Information about the different well types is available in Level 0 Pre-processing section. + +## SC Data-containing Tables + +## - Level 1 ```{r warning = FALSE, echo = FALSE} -Field <- c("s1id ", "s0id", "acid", "aeid", "logc", "bval", "pval", "resp") +Field <- c("s1id ", "s0id", "acid", "aeid", "conc", "bval", "pval", "resp") Description <- c("Level 1 ID", "Level 0 ID", "Assay component ID", "Assay component endpoint ID", - "Log base 10 concentration", + "Concentration is micromolar", "Baseline value", "Positive control value", - "Normalized response value" - - ) - -output <- - data.frame(Field, Description) + "Normalized response value" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 2: Fields in sc1 table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - -```{r warning = FALSE, echo = FALSE} -Field <- c("aeid ", "s0id", "s1id", "s2id") -Description <- c("Assay component endpoint ID", - "Level 0 ID", - "Level 1 ID", - "Level 2 ID" - - ) - -output <- - data.frame(Field, Description) - -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 3: Fields in sc2_agg table." -) - -``` - +## - Level 2 ```{r warning = FALSE, echo = FALSE} -Field <- c("s2id ", "aeid", "spid", "bmad", "max_med", "hitc", "coff", "tmpi") +Field <- c("s2id ", "aeid", "spid", "bmad", "max_med", "coff", "hitc", "tmpi") Description <- c("Level 2 ID", "Assay component endpoint ID", "Sample ID", "Baseline median absolute deviation", "Maximum median response value", - "Hit-/activity-call: 1 if active, 0 if inactive†", "Efficacy cutoff value", - "Ignore, temporary index used for uploading purposes" - ) + "Binary hit call value: 1 if active, 0 if inactive", + "Ignore, temporary index used for uploading purposes" ) + +output <- data.frame(Field, Description) + +kable(output)%>% + kable_styling("striped") +``` + +## - Aggregated IDs +```{r warning = FALSE, echo = FALSE} +Field <- c("aeid ", "s0id", "s1id", "s2id") +Description <- c("Assay component endpoint ID", + "Level 0 ID", + "Level 1 ID", + "Level 2 ID" ) output <- data.frame(Field, Description) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 4: Fields in sc2 table.", - tfoot = "† As sc data are not curve-fit, the hitcalling procedure performed at sc2 remains binary (hitc=1 or hitc=0)." -) - +kable(output)%>% + kable_styling("striped") ``` - +## - Representative Samples ```{r warning = FALSE, echo = FALSE} Field <- c("s2id", "chid_rep") Description <- c("Level 2 ID", - "Representative sample designation for a tested chemical: 1 if representative sample, else 0" - ) - -output <- - data.frame(Field, Description) + "Representative sample designation for a tested chemical: 1 if representative sample, else 0") -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 5: Fields in sc2_chid.", - - -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` +See the [Data Interpretation>Representative Samples section](#chid) for more details. + +## MC Data-containing Tables -## Multiple-concentration Data-containing Tables - -The "mc0" table, other than containing $\mathit{m0id}$ rather than $\mathit{s0id}$, is identical to the "sc0" described in the section above. +## - Level 1 ```{r warning = FALSE, echo = FALSE} Field <- c("m1id", "m0id", "acid", "cndx", "repi") Description <- c("Level 1 ID", "Level 0 ID", "Assay component ID", "Concentration index", - "Replicate index" - ) - -output <- - data.frame(Field, Description) + "Replicate index" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 6: Fields in mc1 table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +## - Level 2 ```{r warning = FALSE, echo = FALSE} Field <- c("m2id", "m0id", "acid", "m1id", "cval") Description <- c("Level 2 ID", "Level 0 ID", "Assay component ID", "Level 1 ID", - "Corrected value" - ) - -output <- - data.frame(Field, Description) + "Corrected value" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 7: Fields in mc2 table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - + +## - Level 3 ```{r warning = FALSE, echo = FALSE} -Field <- c("m3id", "aeid", "m0id", "acid", "m1id", "m2id", "bval", "pval", "logc", "resp") +Field <- c("m3id", "aeid", "m0id", "acid", "m1id", "m2id", "bval", "pval", "conc", "resp") Description <- c("Level 3 ID", "Assay endpoint ID", "Level 0 ID", @@ -307,23 +286,16 @@ Description <- c("Level 3 ID", "Level 2 ID", "Baseline value", "Positive control value", - "Log base 10 concentration", - "Normalized response value" - ) - -output <- - data.frame(Field, Description) + "Concentration is micromolar", + "Normalized response value") -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 8: Fields in mc3 table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - + +## - Aggregated IDs ```{r warning = FALSE, echo = FALSE} Field <- c("aeid", "m0id", "m1id", "m2id", "m3id", "m4id") Description <- c( @@ -331,27 +303,18 @@ Description <- c( "Level 1 ID", "Level 2 ID", "Level 3 ID", - "Level 4 ID" - - ) - -output <- - data.frame(Field, Description) + "Level 4 ID" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 9: Fields in mc4_agg table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - + +## - Level 4 {#mc4} ```{r warning = FALSE, echo = FALSE} -Field <- c("m4id", "aeid", "spid", "bmad", "resp_max", "resp_min", "max_mean", "max_mean_conc", "max_med", "max_med_conc", "logc_max", "logc_min", - "nconc", "npts", "nrep", "nmed_gtbl", "tmpi") +Field <- c("m4id", "aeid", "spid", "bmad", "resp_max", "resp_min", "max_mean", "max_mean_conc", "min_mean", "min_mean_conc", "max_med", "max_med_conc", "min_med", "min_med_conc", "max_med_diff", "max_med_diff_conc", "conc_max", "conc_min", "nconc", "npts", "nrep", "nmed_gtbl_pos", "nmed_gtbl_neg", "tmpi") Description <- c("Level 4 ID", @@ -360,34 +323,33 @@ Description <- c("Level 4 ID", "Baseline median absolute deviation", "Maximum response value", "Minimum response value", - "Maximum mean response value", - "Log concentration at *max_mean*", - "Maximum median response value", - "Log concentration at *max_med*", - "Maximum log concentration tested", - "Minimum log concentration tested", - "Number of concentrations tested ", + "Maximal mean response at a given concentration", + "Corresponding concentration of *max_mean*", + "Minimum mean response value at a given concentration", + "Corresponding concentration of *min_mean*", + "Maximum median response value at a given concentration", + "Corresponding concentration of *max_med*", + "Minimum median response value at a given concentration", + "Corresponding concentration of *min_med*", + "Absolute difference between maximal and minimal median response at a given concentration", + "Absolute difference between corresponding concentration of max_med and min_med", + "Maximum concentration tested", + "Minimum concentration tested", + "Number of concentrations tested", "Number of points in the concentration series", "Number of replicates in the concentration series", - "Number of median values greater than *3bmad*", - "Ignore, temporary index used for uploading purposes" - ) - -output <- - data.frame(Field, Description) + "Number of median response values greater than baseline of 3 * *bmad*", + "Number of median response values less than baseline of -3 * *bmad*", + "Ignore, temporary index used for uploading purposes" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 10: Fields in mc4 table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") %>% + kableExtra::scroll_box(width="100%", height="400px") ``` - - +## - Level 4 Parameters ```{r warning = FALSE, echo = FALSE} Field <- c("m4id", "aeid", "model", "model_param", "model_val") @@ -395,157 +357,168 @@ Description <- c("Level 4 ID", "Assay endpoint ID", "Model that was fit", "Key for the parameter that was fit with the corresponding model", - "Value for the associated key in the corresponding model" - ) + "Value for the associated key in the corresponding model") -output <- - data.frame(Field, Description) - -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 11: Fields in mc4_param table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +## - Level 5 {#mc5} ```{r warning = FALSE, echo = FALSE} - Field <- c("m5id", "m4id", "aeid", "modl", "hitc", "fitc", "coff", "actp", "model_type") - Description <- c("Level 5 ID", "Level 4 ID", "Assay endpoint ID", "Winning model", - "Hit-/activity-call, generally a continuous value from 0 to 1 if using *tcplFit2* fitting†" , + "Activity hitcall" , "Fit category", "Efficacy cutoff value", "Activity probability (1 - *const_prob* not used with *tcplFit2*)", - "Model type placeholder for use when number of fitting methodologies increases" - ) + "Model type. Options include:
+ 2: Bidirectional: Data is fit bidirectionally.
+ 3: Gain: Data is fit bidirectionally, but gain is the intended direction of response. Hitcalls (hitc) for winnings models is multiplied by -1 for models fit in the negative analysis direction.
+ 4: Loss: Data is fit bidirectionally, but loss is the intended direction of response. Hitcalls (hitc) for winnings models is multiplied by -1 for models fit in the positive analysis direction." ) -output <- - data.frame(Field, Description) +output <- data.frame(Field, Description) htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 12: Fields in mc5 table.", - tfoot = "† The continuous hitcalls produced resultant to *tcplFit2* curve-fitting are described in more detail in library(tcplFit2) and Sheffield et al. 2021 (https://doi.org/10.1093/bioinformatics/btab779)." -) - + align='l', + align.header='l', + rnames=FALSE, + css.cell=' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ') ``` +See the [Data Interpretation>Hit Calls](#hitc) section for more details. +## - Level 5 Parameters {#mc5_param} ```{r warning = FALSE, echo = FALSE} Field <- c("m5id", "aeid", "hit_param", "hit_val") Description <- c("Level 5 ID", "Assay endpoint ID", "Key for the parameter that was fit with winning model", - "Value for the associated key in the winning model" - ) - -output <- - data.frame(Field, Description) + "Value for the associated key in the winning model" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 13: Fields in mc5_param table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +## - Representative Samples ```{r warning = FALSE, echo = FALSE} Field <- c("m5id", "chid_rep") Description <- c("Level 5 ID", - "Representative sample designation for a tested chemical: 1 if representative sample, else 0" - ) - -output <- - data.frame(Field, Description) + "Representative sample designation for a tested chemical: 1 if representative sample, else 0" ) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 14: Fields in mc5_chid." ) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` -## Assay and Auxiliary Annotation Tables - -The definition of an "assay" is, for the purposes of this package, broken into: +See the [Data Interpretation>Representative Samples section](#chid) for more details. + +## - Level 6 +```{r warning = FALSE, echo = FALSE} +Field <- c("m6id", "m5id", "m4id", "aeid", "mc6_mthd_id", "flag") -**assay_source**: the vendor/origination of the data +Description <- c("Level 6 ID", + "Level 5 ID", + "Level 4 ID", + "Assay endpoint ID", + "Level 6 method ID", + "Short flag description to be displayed in data retrieval and plotting. Extended description available in MC6_Methods table." ) -**assay**: the procedure to generate the component data +output <- data.frame(Field, Description) -**assay_component**: the raw data readout(s) +kable(output)%>% + kable_styling("striped") +``` -**assay_component_endpoint**: the normalized component data +See the [Data Interpretation>Flags](#flags) section for more details. -Each assay element is represented by a separate table in the tcpl database. In general, we refer to an "assay_component_endpoint" as an "assay endpoint." As we move down the hierarchy, each additional layer may have a one-to-many relationship with the previous layer. For example, an assay source can include multiple assays. Given bidirectional fitting in tcpl_v3 , in many cases, a single assay endpoint may be derived from each component, as the "up" and "dn" curve-fitting directions will no longer be separated into different assay endpoints. +## - Level 7 +```{r warning = FALSE, echo = FALSE} +Field <- c("m7id", "m4id", "aeid", "potency_val_type", "aed_type", "aed_val", "aed_val_unit", "interindividual_var_perc", "httk_model", "invitrodb_version", "httk_version") -All processing occurs by assay component or assay endpoint, depending on the processing type (single-concentration or multiple-concentration) and level. No data are stored at the assay or assay source level. The “assay” and “assay_source” tables store annotations to help in the processing and down-stream understanding of the data. +Description <- c("Level 7 ID", + "Level 4 ID", + "Assay endpoint ID", "Potency value type used in the calc_mc_oral_equiv() calculation", + "Descriptive vector that begins with “aed,” followed by potency metric used, followed by a short name of the httk model used, ending with the percentile from the modeled population with respect to interindividual variability", + "Numeric value of the AED", + "Unit associated with AED, mg/kg/day", "Interindividual variability percentile, either 50th or 95th", + "The httk model used; 3-compartment steady state (3compartmentss) or pbtk; note that all models used here were for adult humans.", + "invitrodb version of data", + "Version of [httk R package](https://CRAN.R-project.org/package=httk) used" ) + +output <- data.frame(Field, Description) + +kable(output)%>% + kable_styling("striped") +``` -Throughout the package, the levels of assay hierarchy are defined and referenced by their primary keys (IDs) in the tcpl database: $\mathit{asid}$ (assay source ID), $\mathit{aid}$ (assay ID), $\mathit{acid}$ (assay component ID), and $\mathit{aeid}$ (assay endpoint ID). In addition, the package abbreviates the fields for the assay hierarchy names. The abbreviations mirror the abbreviations for the IDs with "nm" in place of "id" in the abbreviations, e.g. assay\_component\_name is abbreviated $\mathit{acnm}$. +See the [Data Interpretation>Adminstered Equivalent Doses](#aed) section for more details. -A full description of the assay annotation is beyond the scope of this vignette. The fields pertinent to the tcpl package are listed in the tables below. +## Assay and Auxiliary Annotation Tables + +The fields pertinent to the tcpl package are listed in the tables below. More specifics on assay and auxiliary annotations will be provided in later sections. - ```{r warning = FALSE, echo = FALSE} -Field <- c("assay", "assay_component", "assay_component_endpoint", "assay_component_map", "assay_reagent**", "assay_reference**", "assay_source", "chemical", "chemical_library", "citations**", "gene**", "intended_target**", "organism**", "sample") +Table <- c("assay_source", "assay", "assay_component", "assay_component_endpoint", "assay_component_map", "assay_descriptions**", "assay_reagent**", "assay_reference**", "chemical", "chemical_analytical_qc**", "chemical_lists", "citations**", "gene**", "intended_target**", "organism**", "sample") -Description <- c("Assay-level annotation", +Description <- c("Assay source-level annotation", "Assay-level annotation", "Assay component-level annotation", "Assay endpoint-level annotation", "Assay component source names and their corresponding assay component ids", + "Additional assay descriptions curated per OECD Guidance Document 211 (GD211)", "Assay reagent information", "Map of citations to assay", - "Assay source-level annotation", "List of chemicals and associated identifiers", - "Map of chemicals to different chemical libraries", + "Analytical QC information curated at the chemical substance or sample level to inform applicability domain", + "Lists of chemicals and their presence in curated chemical lists", "List of citations", "Gene identifiers and descriptions", "Intended assay target at the assay endpoint level", "Organism identifiers and descriptions", - "Sample ID information and chemical ID mapping") + "Sample identifiers and chemical provenance information") -output <- - data.frame(Field, Description) +output <- data.frame(Table, Description) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - caption="Table 15: List of annotation tables.", - tfoot = "** indicates tables not currently used by the *tcpl* package", - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ' -) +kable(output)%>% + kable_styling("striped") +``` + +** indicates tables may have limited tcpl functionality, but data is still retrievable via tcplQuery. + +## - Assay Source {#asid} +```{r warning = FALSE, echo = FALSE} +Field <- c("asid", "assay_source_name", "assay_source_long_name", "assay_source_desc") + +Description <- c("Assay source ID. Required for registration.", + "Assay source name, typically an abbreviation of the assay_source_long_name and abbreviated \"asnm\" within the package. Required for registration", + "Full assay source name", + "Assay source description" + ) + +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +## - Assay {#aid} ```{r warning = FALSE, echo = FALSE} -Field <- c("aid", "asid†", "assay_name†", "assay_desc", "timepoint_hr", +Field <- c("aid", "asid;", "assay_name", "assay_desc", "timepoint_hr", "organism_id", "organism",'tissue',"cell_format", 'cell_free_component_source', 'cell_short_name', 'cell_growth_mode', - "assay_footprint†", + "assay_footprint", "assay_format_type" , "assay_format_type_sub" , "content_readout_type", @@ -553,44 +526,37 @@ Field <- c("aid", "asid†", "assay_name†", "assay_desc", "timepoint "dilution_solvent_percent_max") Description <- c("Assay ID", - "Assay source ID", - "Assay name (abbreviated \"anm\" within the package)", + "Assay source ID. Required for registration.", + "Assay name, abbreviated \"anm\" within the package. Required for registration.", "Assay description", "Treatment duration in hours", - "NCBI taxonomic identifier, available here ", - "Organism of origin", - "Tissue of origin", "Description of cell format", - "Description of source for targeted cell-free components", - "Abbreviation of cell line", - "Cell growth modality", - "Microtiter plate size", - "General description of assay format", - "Specific description of assay format" , - "Description of well characteristics being measured", - "Solvent used in sample dilution", - "Maximum percent of dilution solvent used, from 0 to 1.") - -output <- - data.frame(Field, Description) - -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - caption="Table 16: Fields in assay.", - tfoot = "† Required fields for registration", - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ' -) - + "NCBI taxonomic identifier, available at https://www.ncbi.nlm.nih.gov/taxonomy", + "Organism of origin", + "Tissue of origin", "Description of cell format", + "Description of source for targeted cell-free components", + "Abbreviation of cell line", + "Cell growth modality", + "Microtiter plate size. Required for registration.", + "General description of assay format", + "Specific description of assay format" , + "Description of well characteristics being measured", + "Solvent used in sample dilution", + "Maximum percent of dilution solvent used, from 0 to 1") + +output <- data.frame(Field, Description) + +kable(output)%>% + kable_styling("striped") %>% + kableExtra::scroll_box(width="100%", height="400px") ``` - +## - Assay Component {#acid} ```{r warning = FALSE, echo = FALSE} -Field <- c("acid", "aid†", "assay_component_name†", "assay_component_desc", "assay_component_target_desc", "parameter_readout_type","assay_design_type", "assay_design_type_sub", "biological_process_target", "detection_technology_type", "detection_technology_type_sub", "detection_technology", "key_assay_reagent_type", "key_assay_reagent", "technological_target_type", "technological_target_type_sub") +Field <- c("acid", "aid", "assay_component_name", "assay_component_desc", "assay_component_target_desc", "parameter_readout_type","assay_design_type", "assay_design_type_sub", "biological_process_target", "detection_technology_type", "detection_technology_type_sub", "detection_technology", "key_assay_reagent_type", "key_assay_reagent", "technological_target_type", "technological_target_type_sub") Description <- c("Assay component ID", - "Assay ID", - "Assay component name (abbreviated \"acnm\" within the package)", + "Assay ID. Required for registration.", + "Assay component name, abbreviated \"acnm\" within the package. Required for registration.", "Assay component description", "Assay component target description. Generally includes information about mechanism of action with assay target, how disruption is detected, or significance of target disruption.", "Description of parameters measured", @@ -603,221 +569,302 @@ Description <- c("Assay component ID", "Type of critical reactant being measured", "Critical reactant measured", "General description of technological target measured in assay platform", - "Specific description of technological target measured in assay platform" - ) + "Specific description of technological target measured in assay platform") -output <- - data.frame(Field, Description) - -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - tfoot = "† Required fields for registration", - caption="Table 17: Fields in assay_component." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") %>% + kableExtra::scroll_box(width="100%", height="400px") ``` - +## - Assay Component Endpoint {#aeid} ```{r warning = FALSE, echo = FALSE} -Field <- c("asid†", "assay_source_name†", "assay_source_long_name", "assay_source_desc") +Field <- c("aeid", "acid", "assay_component_endpoint_name", "assay_component_endpoint_desc", "assay_function_type", "normalized_data_type", "burst_assay", "key_positive_control", "signal_direction", "intended_target_type", "intended_target_type_sub", "intended_target_family", "intended_target_family_sub", "cell_viability_assay") + +Description <- c("Assay component endpoint ID", + "Assay component ID. Required for registration.", + "Assay component endpoint name, abbreviated \"aenm\" within the package. Required for registration.", + "Assay component endpoint description", + "Description of targeted mechanism and the purpose of the analyzed readout in relation to others from the same assay", + "Normalization approach for which the data is displayed", + "Indicator if endpoint is included in the burst distribution (1) or not (0); Burst phenomenon can describe confounding activity, such as cytotoxicity due to non-specific activation of many targets at certain concentrations. Required for registration.", + "Tested chemical sample expected to produce activity; Used to assess assay validity", + "Directionality of raw data signals from assay (gain or loss); Defines analysis direction", + "General group of intended targets measured", + "Specific subgroup of intended targets measured", + "Family of intended target measured; Populated on ToxCast chemical activity plot within CompTox dashboard", + "Specific subfamily of intended target measured", + "Indicator of the impact of cytotoxicity in confounding (1) or no cytotoxic impact (0)" ) -Description <- c("Assay source ID", - "Assay source name (typically an abbreviation of the assay_source_long_name, abbreviated \"asnm\" within the package)", - "Full assay source name", - "Assay source description" - ) +output <- data.frame(Field, Description) -output <- - data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") %>% + kableExtra::scroll_box(width="100%", height="400px") +``` -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - tfoot = "† Required fields for registration", - caption="Table 18: Fields in assay_source." -) +See the [Data Interpretation>Cytotoxicity Burst Distribution](#burst) section for more details on "burst_assay". + +## - Assay Component Map +```{r warning = FALSE, echo = FALSE} +Field <- c("acid", "acsn") + +Description <- c("Assay component ID", + "Assay component source name" ) + +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +## - Assay Descriptions {#gd211} ```{r warning = FALSE, echo = FALSE} -Field <- c("aeid", "acid", "assay_component_endpoint_name", "assay_component_endpoint_desc", "assay_function_type", "normalized_data_type†", "burst_assay†", "key_positive_control", "signal_direction", "intended_target_type", "intended_target_type_sub", "intended_target_family", "intended_target_family_sub", "fit_all†", "cell_viability_assay") +Field <- c("aeid", "assay_title", "assay_objectives", "assay_throughput", "scientific_principles", "biological_responses", "analytical_description", + "basic_procedures", "experimental_system", "xenobiotic_biotransformation", "proprietary_elements") -Description <- c("Assay component endpoint ID", - "Assay component ID", - "Assay component endpoint name (abbreviated \"aenm\" within the package)", - "Assay component endpoint description", - "Description of targeted mechanism and the purpose of the analyzed readout in relation to others from the same assay", - "Normalization approach for which the data is displayed", - "Indicator if endpoint is included in the burst distribution (1) or not (0); Burst phenomenon can describe confounding activity, such as cytotoxicity due to non-specific activation of many targets at certain concentrations", - "Tested chemical sample expected to produce activity; Used to assess assay validity", - "Directionality of raw data signals from assay (gain or loss); Defines analysis direction", - "General group of intended targets measured", - "Specific subgroup of intended targets measured", - "Family of intended target measured; Populated on ToxCast chemical activity plot within CompTox dashboard", - "Specific subfamily of intended target measured", - "Indicator if all results should be fit, regardless of whether max_med surpasses 3bmad cutoff (1) or not (0)", - "Indicator of the impact of cytotoxicity in confounding (1) or no cytotoxic impact (0)" ) +Description <- c("Assay component endpoint ID", + "Short and descriptive title for the assay; opposed to assay component endpoint name", + "Purpose of the test method: Inserted after assay_component_target_desc; the claimed purpose and rationale for intended use of the method (e.g. alternative to an existing method, screening, provision of novel information in regulatory decision-making, mechanistic information, adjunct test, replacement, etc.) should be explicitly described and documented. The response measured in the assay should be put in the context of the biology/physiology leading to the in vivo response or effect. If the biological activity or response refers to a key event or molecular initiating event (MIE), provide a short description indicating what key event within an existing or developing AOP, or in relation to a mechanism or mode of action, the assay is aiming to characterize (i.e. which level of biological organization the assay may be attributed (e.g. sub-cellular, cellular, tissue, organ or individual), and where the assay might fit in the context of an existing regulatory hazard (i.e. adverse outcome). In the absence of any AOP, provide an indication of the plausible linkage between the mechanism(s) the assay is measuring and the resulting hazard endpoint.", + "Information about the throughput of the assay: Indicate the throughput of the assay to provide an indication of likely resource intensity e.g. low (manual assay, one chemical tested at a time), lowmoderate, moderate, moderate-high, high throughput (e.g. in 96 well-plate and higher), and qualify with e.g. approximate number of chemicals/concentrations per run. If appropriate indicate whether a manual assay could be run in a higher throughput mode.", + "Scientific principle of the method: Provide the scientific rationale, supported by bibliographic references to articles, for the development of the assay. A summary description of the scientific principle including the biological/physiological basis and relevance (e.g. modeling of a specific organ) and/or mechanistic basis (e.g. modeling a particular mechanism by biochemical parameters) should be described. If possible, indicate what the anchor point is within an AOP.", + "Response and Response Measurement: Response here makes reference to any biological effect, process, or activity that can be measured. Specify precisely and describe the response and its measurement, e.g. corneal opacity measured using an opacitometer; half maximal activity concentration (AC50) derived from a competitive binding assay in human estrogen receptor assay or from the up-regulation of the proinflammatory antiangiogenic chemokine CXCL10.", + "Data analysis: Comment on the response value in terms of a boundary or range to provide a context for interpretation.", + "Description of the experimental system exposure regime: Provide a summary description of the essential information pertaining to the exposure regime (dosage and exposure time including observation frequency) of the test compounds to the experimental system including information on metabolic competence if appropriate; number of doses/concentrations tested or testing range, number of replicates, the use of control(s) and vehicle. Also, describe any specialized equipment needed to perform the assay and measure the response. Indicate whether there might be potential solubility issues with the test system, and solutions proposed to address the issue.", + "Tissue, cells or extracts utilised in the assay and the species source: indicate the experimental system for the activity or response being measured.", "Metabolic competence of the test system: Describe and discuss the extent to which the test system can be considered metabolically competent, either by itself, or with the addition of an enzymatic fraction, if appropriate. Provide reference if available.", + "Status of method development and uses: Compile information for the following sections if appropriate. Considerations could include: i) Development status: Indicate if the assay is still under development, and the estimated timeline for completion as far as possible ii) Known uses: Summarise the current and/or past use of the assay by different laboratories iii) Evaluation study: Summarise the main conclusions or refer to individual protocol if available iv) Validation study: Indicate participation in a formal validation study/studies and summarise the conclusions and their outcomes or refer to the individual protocol if available v) Regulatory use: Provide details of any potential regulatory application and of the toxicological hazard endpoint being addressed by the assay.") + +output <- data.frame(Field, Description) + +kable(output)%>% + kable_styling("striped") %>% + kableExtra::scroll_box(width="100%", height="400px") +``` -output <- - data.frame(Field, Description) +See the [Data Interpretation>Assay Description Documents](#add) section for more details. -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 19: Fields in assay_component_endpoint.", - tfoot = "† Required fields for registration" -) +## - Chemical +```{r warning = FALSE, echo = FALSE} +Field <- c("chid", "casn", "chnm", "dsstox_substance_id") +Description <- c("Chemical ID", "CAS Registry Number", "Chemical name", + "Unique identifier from U.S. EPA Distributed Structure-Searchable Toxicity (DSSTox) Database") + +output <- data.frame(Field, Description) + +kable(output)%>% + kable_styling("striped") ``` - -```{r warning = FALSE, echo = FALSE} -Field <- c("acid", "acsn") +Chemical ID is the DSSTox GSID within the ToxCast data, but can be any integer and will be auto-generated (if not explicitly defined) for newly registered chemicals. -Description <- c("Assay component ID", - "Assay component source name" - ) +## - Chemical Lists +```{r warning = FALSE, echo = FALSE} +Field <- c("chemical_lists_id", "chid", "dsstox_substance_id", "list_acronym", "list_name", "list_desc") -output <- - data.frame(Field, Description) +Description <- c("Chemical List ID", "Chemical ID", "Unique identifier from U.S. EPA Distributed Structure-Searchable Toxicity (DSSTox) Database", + "Chemical list acronym", "Chemical list name", "Chemical list description") -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 20: Fields in assay_component_map table." -) +output <- data.frame(Field, Description) +kable(output)%>% + kable_styling("striped") ``` - +## - Sample ```{r warning = FALSE, echo = FALSE} -Field <- c("chid", "casn", "chnm", "dsstox_substance_id") +Field <- c("spid", "chid", "stkc", "stkc_unit", "tested_conc_unit", "bottle_barcode", "source", + "bottle_type", "lot_number", "purity_percentage", "solubility") -Description <- c("Chemical ID†", - "CAS Registry Number", - "Chemical name", - "Unique identifier from U.S. EPA Distributed Structure-Searchable Toxicity (DSSTox) Database" - ) +Description <- c("Sample ID", + "Chemical ID", + "Stock concentration" , + "Stock concentration unit", + "The concentration unit for the concentration values in the data-containing tables", + "Bottle barcode of sample", "Source (i.e. manufacturer or supplier) of procured bottle", + "Type of bottle, which can reflect storage condition", "Lot or batch number of bottle", + "Reported purity percentage from bottle Certificate of Analysis (CoA)", "Solubility") -output <- - data.frame(Field, Description) +output <- data.frame(Field, Description) -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 21: Fields in chemical table." , - tfoot = "† This is the DSSTox GSID within the ToxCast data, but can be any integer and will be auto-generated (if not explicitly defined) for newly registered -chemicals" -) +kable(output)%>% + kable_styling("striped") +``` +The stock concentration fields in the "sample" table allow the user to track the original concentration when the neat sample is solubilized in vehicle before any serial dilutions for testing purposes. The US EPA's ChemTrack application and database supports chemical procurement and sample management for ToxCast *in vitro* screening efforts. + +# Assay Registration {#register} + +This section provides an overview of assay registration process for the tcpl package. Before writing and processing any data to the tcpl database, the user has to register the assay and chemical information, i.e. assay identifiers (and minimal assay annotations) and chemical sample identifiers need to be available in the database before any data processing. + +## Assay Nomenclature + +The definition of an "assay" is, for the purposes of this package, broken into:
+ +* **assay_source**: the vendor/origination of the data +* **assay**: the procedure to generate the component data +* **assay_component**: the raw data readout(s) +* **assay_component_endpoint**: the normalized component data + +Assay source, assay, assay component, and assay endpoint are registered via tcpl scripting into a collection of tables. These assay element tables broadly describe who conducted the assay, what platform was used, what was being measured (raw readout), and how the measurement was interpreted (normalized component data). A hierarchical structure of the assay elements is as follows: assay source > assay > assay component > assay component endpoint. +As one moves down the hierarchy, each additional level has a ‘one-to-many’ relationship with the previous level. For example, an assay component can have multiple assay endpoints, but an assay endpoint can derive only from a single assay component. + +## Minimum Required Fields +Throughout the tcpl R package, the levels of assay hierarchy are defined and referenced by their auto-incremented primary keys in the tcpl database: $\mathit{asid}$ (assay source ID), $\mathit{aid}$ (assay ID), $\mathit{acid}$ (assay component ID), and $\mathit{aeid}$ (assay endpoint ID). These abbreviations mirror the abbreviations for the identifiers (ids) with “nm” in place of “id” in the abbreviations, e.g. assay\_component\_name is abbreviated $\mathit{acnm}$. + +All processing occurs by assay component or assay endpoint, depending on the processing type (single-concentration or multiple-concentration) and level. No data is stored at the assay or assay source level. The “assay” and “assay_source” tables store annotations to help in the processing and down-stream understanding of the data. Additional details for registering each assay element and updating annotations are provided below. In addition to each assay element’s id, the minimal registration fields in order to ‘pipeline’ are: + +* assay_source_name (asnm) +* assay_name (anm) +* assay_footprint +* assay_component_name (aenm) +* assay_component_endpoint_name (aenm) +* normalized_data_type + +## Assay Source +[Assay source](#asid) refers to the vendor or origination of the data. **To register an assay source, an unused $\mathit{asid}$ must be selected to prevent overwriting of existing data.** When adding a new assay source, this should be an abbreviation, as subsequent levels will build on this assay source name. +```{r eval = FALSE, message = FALSE} +tcplLoadAsid() +tcplRegister(what = "asid", flds = list(asid = 1, asnm = "Tox21")) ``` +The **tcplRegister** function takes the abbreviation for $\mathit{assay\_source\_name}$, but the function will also take the unabbreviated form. The same is true of the **tcplLoadA-** functions, which load the information for the assay annotations stored in the database. - -```{r warning = FALSE, echo = FALSE} -Field <- c("chid", "clib") +## Assay -Description <- c("Chemical ID", - "Chemical library" - ) +[Assay](#aid) refers to the procedure, conducted by some vendor, to generate the component data. **To register an assay, an $\mathit{asid}$ must be provided to map the assay to the correct assay source.** One source may have many assays. To ensure consistency of the naming convention, first check how other registered assays within the assay source were conducted and named. The assay names follow an abbreviated and flexible naming convention of *Source_Assay*. Notable assay design features to describe the assay include: -output <- - data.frame(Field, Description) +* Technology (i.e., detection technology), +* Format (e.g., organism, tissue, cell short name, or cell free component source name), +* Target (i.e., intended target, intended target family, gene), or +* Objective aspects (e.g., timepoint or assay footprint). -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 22: Fields in chemical_library table." - -) +The most distinguishing features will be selected to create a succinct assay name. Variation depends on the assay itself as well as other assays provided by the vendor. If multiple features are needed to describe an assay, order will be based on relative importance in describing the assay and the assay’s relation to other assays provided by the vendor to limit confusion. “Source_Technology_Format_Target” is a commonly used naming order. However, if one target is screened on different assay platforms by the vendor, “Source_Target_Technology” is a more appropriate naming convention. This is the case for the Tox21 assays. Additional features may be relevant, including agonist or antagonist mode, or “Follow-up” if the assay is a secondary specificity assay. Conversely, some assays utilize a cell-based format to screen a functional profile of targets. These assays follow a naming convention, *Source_Format*, where specific target information is defined at the component and endpoint level. Bioseek and Attagene are sources that provide cell-based assays. Considering the diversity of the data sources and high throughput assays in ToxCast, a flexible naming approach is best used in conjunction with subject matter expert discretion. +```{r eval = FALSE, message = FALSE} +tcplLoadAid(what = "asid", val = 1) +tcplRegister(what = "aid", flds = list(asid = 1, anm = "TOX21_ERa_BLA_Agonist", assay_footprint = "1536 well")) +``` +When registering an assay ($\mathit{aid}$), the user must give an $\mathit{asid}$ to map the assay to the correct assay source. Registering an assay, in addition to an assay\_name ($\mathit{anm}$) and $\mathit{asid}$, requires $\mathit{assay\_footprint}$. The $\mathit{assay\_footprint}$ field is used in the assay plate visualization functions (discussed later) to define the appropriate plate size. The $\mathit{assay\_footprint}$ field can take most string values, but only the numeric value will be extracted, e.g. the text string "hello 384" would indicate to draw a 384-well microtitier plate. Values containing multiple numeric values in $\mathit{assay\_footprint}$ may cause errors in plotting plate diagrams. + +## Assay Component +[Assay component](#acid), or “component” for short, describes the raw data readouts. Like the previous level, one assay may have many components. **To register an assay component and create an $\mathit{acid}$, an $\mathit{aid}$ must be provided to map the component to the correct assay.** The assay component name will build on its respective assay name, to describe the specific feature being measured in each component. If there is only one component, the component name can be the same as the assay name. If there are multiple components measured in an assay, understanding the differences, and how one component may relate to another within an assay, are important naming considerations to prevent confusion. Assay component names will usually follow the naming convention of *Source_Assay_Component*, where “Component” is a brief description of what is being measured. +```{r eval = FALSE, message = FALSE} +tcplLoadAcid(what = "asid", val = 1, add.fld = c("aid", "anm")) +tcplRegister(what = "acid", flds = list(aid = 1, acnm = "TOX21_ERa_BLA_Agonist_ratio")) +``` +The final piece of assay information needed is the assay component source name (abbreviated $\mathit{acsn}$), stored in the "assay_component_map" table. The assay component source name is intended to simplify level 0 pre-processing by defining unique character strings (concatenating information if necessary) from the source files that identify the specific assay components. An assay component can have multiple $\mathit{acsn}$ values, but an $\mathit{acsn}$ must be unique to one assay component. Assay components can have multiple $\mathit{acsn}$ values to minimize the amount of data manipulation required (and therefore potential errors) during the level 0 pre-processing if assay source files change or are inconsistent. The unique character strings ($\mathit{acsn}$) get mapped to $\mathit{acid}$. +```{r eval = FALSE, message = FALSE} +tcplRegister(what = "acsn", flds = list(acid = 1, acsn = "TCPL-MC-Demo")) ``` - -```{r warning = FALSE, echo = FALSE} -Field <- c("spid", "chid", "stkc", "stkc_unit", "tested_conc_unit") +## Assay Component Endpoint -Description <- c("Sample ID", - "Chemical ID", - "Stock concentration" , - "Stock concentration unit", - "The concentration unit for the concentration values in the data-containing tables" - ) +[Assay component endpoint](#aeid), or “endpoint” for short, represents the normalized component data. **To register an endpoint and create an $\mathit{aeid}$, an $\mathit{acid}$ must be provided to map the endpoint to the correct component.** In past tcpl versions, each component could have up to two endpoints therefore endpoint names would express directionality (*_up/_down*). tcpl v3+ allows bidirectional fitting to capture both the gain and loss of signal. Therefore with tcpl v3+ , the endpoint name will usually be the same as the component name. +```{r eval = FALSE, message = FALSE} +tcplLoadAeid(fld = "asid", val = 1, add.fld = c("aid", "anm", "acid", "acnm")) +tcplRegister(what = "aeid", flds = list(acid = 1, aenm = "TOX21_ERa_BLA_Agonist_ratio", normalized_data_type = "percent_activity", export_ready = 1, burst_assay = 0)) +``` +Registering an assay endpoint also requires the $\mathit{normalized\_data\_type}$ field. The normalized_data_type is used when plotting and currently, the package supports the following values: percent_activity, log2_fold_induction, log10_fold_induction, and fold_induction. Any other values will be treated as "percent_activity." -output <- - data.frame(Field, Description) +Other required fields to register an assay endpoint do not have to be explicitly defined and will default to 0 if not provided. These fields represent Boolean values (1 or 0, 1 being TRUE ). The $\mathit{export\_ready}$ field indicates (1) the data is done and ready for export or (0) still in progress. The $\mathit{burst\_assay}$ field is specific to multiple-concentration processing and indicates (1) the assay endpoint is included in the burst distribution calculation or (0) not. -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 23: Fields in sample table." +## Naming Revision +There are circumstances where assay, assay component, and assay endpoint names change. The $\mathit{aid}$, $\mathit{acid}$, and $\mathit{aeid}$ are considered more stable in the database, and these auto-incremented keys should not change. To revise naming for assay elements, the correct id must be specified in the **tcplUpdate** statement to prevent overwriting data. + +```{r eval = FALSE, message = FALSE} +tcplUpdate(what = "acid", flds = list(aid = 1, acnm = "TOX21_ERa_BLA_Agonist_ratio")) +``` + +Reasons for name changes could include: + +* Feedback from subject matter experts or assay data generators; +* Clarifications on cell line and cell line drift; +* Addition of new assay data that makes the old naming convention insufficient, such as antagonist assays run with different concentrations of an agonist; or +* Laboratory or Center reorganizations. + +Thus, users should be advised that while assay naming is used to infer information about the biology of the assay, assay naming will change over time to reflect progress in building ToxCast as a data resource. + +# Chemical Registration + +With the minimal assay information registered, the next step is to register the necessary chemical and sample information with **tcplRegister**. The **tcplLoadChem** function returns all chemical information or can be filtered for user specified parameters, e.g. the chemical name (chnm) and chemical id (chid). + +The "chdat" example below contains the sample and chemical information for the data that will be loaded. The following shows an example of how to load chemical information. Similar to the order in registering assay information, the user must first register chemicals, then register the samples that map to the corresponding chemical. + +```{r echo=FALSE} +# example set of chemical/sample information +chdat <- data.table( + spid = c("Tox21_400088","Tox21_303655","Tox21_110011","Tox21_400081","DMSO","Tox21_400037"), + casn = c("80-05-7","521-18-6","150-30-1","22224-92-6","67-68-5","95-83-0"), + chnm = c("Bisphenol A","5alpha-Dihydrotestosterone","Phenylalanine","Fenamiphos","Dimethyl sulfoxide","4-Chloro-1,2-diaminobenzene"), + dsstox_substance_id = c("DTXSID7020182","DTXSID9022364","DTXSID9023463","DTXSID3024102","DTXSID2021735","DTXSID5020283"), + code = c("C80057","C521186","C150301","C22224926","C67685","C95830"), + chid = c("20182","22364","23463","24102","21735","20283") ) +chdat +``` + +```{r eval = FALSE} +## Register the Chemicals ## +# Obtain chemicals already registered in the database. +cmap <- tcplLoadChem() +# Find chemicals in 'chdat' that are not registered yet. +chdat.register <- chdat[!(chdat$code %in% cmap$code)] +# Register the chemicals not yet in the database. +tcplRegister(what = "chid", flds = chdat.register[,unique(.SD), .SDcols = c("casn", "chnm", "dsstox_substance_id", "code", "chid")]) +``` + +The "chdat" dataset contains a map of sample to chemical information, but chemical and sample information have to be registered separately because a chemical could potentially have multiple samples. Registering chemicals only takes a chemical CAS registry number ($\mathit{casn}$) and name ($\mathit{chnm}$). In the above example, only the unique chemicals were loaded. The casn and chnm fields have unique constraints; trying to register multiple chemicals with the same name or CAS registry number is not possible and will result in an error. With the chemicals registered and loaded, the samples can be registered by mapping the sample ID ($\mathit{spid}$) to the chemical ID. Note, the user needs to load the chemical information to get the chemical IDs then merge the new chemical IDs with the sample IDs from the original file by chemical name or CASRN. + +```{r eval = FALSE, message = FALSE} +tcplRegister(what = "spid", + flds = merge(chdat[ , list(spid, casn)], + chdat.register[ , list(casn, chid)], by = "casn")[ , list(spid, chid)]) +``` + +## Chemical Lists +Optionally, the user can subdivide the chemical IDs based on presence in different chemical lists using **tcplLoadChemList**. These chemical lists are curated by the US EPA in the Distributed Structure-Searchable Toxicity (DSSTox) database. Chemicals can belong to more than one chemical list, and will be listed as separate entries when loading chemical list information. +```{r eval = FALSE} +tcplLoadChemList(field = "chid", val = 1:2) ``` -The stock concentration fields in the "sample" table allow the user to track the original concentration when the neat sample is solubilized in vehicle before any serial dilutions for testing purposes. The US EPA's ChemTrack application and database supports chemical procurement and sample management for ToxCast in vitro screening efforts. -# Level 0 Pre-processing +# Level 0 Pre-Processing {#lvl0-preprocessing} + +Level 0 pre-processing can be done on virtually any high-throughput screening application to prepare data for ToxCast data processing. In the ToxCast program, level 0 processing is done in R by vendor/dataset-specific scripts. The individual R scripts act as the "laboratory notebook" for the data, with all pre-processing decisions clearly commented and explained. The standard Level 0 format to enter the pipeline is identical between testing paradigms, single concentration ("SC") and multi-concentration ("MC") as described in the [Database Structure>Level 0 section](#lvl0-table). -Level 0 pre-processing can be done on virtually any high-throughput/high-content screening application. In the ToxCast program, level 0 processing is done in R by vendor/dataset-specific scripts. The individual R scripts act as the "laboratory notebook" for the data, with all pre-processing decisions clearly commented and explained. The standard Level 0 format to enter the pipeline is identical between testing paradigms, single concentration (sc) and multi-concentration (mc). +Level 0 pre-processing reformats the raw, source data into the standard format for the pipeline, and also can make manual transformations to the data as pre-normalization steps. All manual transformations to the data should be very well documented with justification. Common examples of manual transformations include fixing a sample ID typo, or changing well quality value(s) to 0 after finding obvious problems like a plate row/column missing an assay reagent. -Level 0 pre-processing has to reformat the raw data into the standard format for the pipeline, and also can make manual transformations to the data as pre-normalization steps. All manual transformations to the data should be very well documented with justification. Common examples of manual transformations include fixing a sample ID typo, or changing well quality value(s) to 0 after finding obvious problems like a plate row/column missing an assay reagent. +Each row in the level 0 pre-processing data represents one well-assay component combination, containing 11 fields. The only field in level 0 pre-processing not stored at level 0 is the assay component source name ($\mathit{acsn}$). The assay component source name should be some concatenation of data from the assay source file that identifies the unique assay components. When the data are loaded into the database, the assay component source name is mapped to assay component ID through the assay_component_map table in the database. Assay components can have multiple assay component source names, but each assay component source name can only map to a single assay component. -Each row in the level 0 pre-processing data represents one well-assay component combination, containing 11 fields. The only field in level 0 pre-processing not stored at level 0 is the assay component source name ($\mathit{acsn}$). The assay component source name should be some concatenation of data from the assay source file that identifies the unique assay components. When the data are loaded into the database, the assay component source name is mapped to assay component ID through the assay\_component\_map table in the tcpl database. Assay components can have multiple assay component source names, but each assay component source name can only map to a single assay component. +## Required Fields - ```{r warning = FALSE, echo = FALSE} -Field <- c("acsn", "spid", "cpid", "apid", "rowi", - "coli", "wllt", "wllq", "conc", "rval", "srcf") +Field <- c("'acsn' or 'acid'", "spid", "apid", "rowi", "coli", "wllt", "wllq", "conc", "rval", "srcf") -Description <- c("Assay component source name", +Description <- c("Assay component source name can be used to map to assay component ID, or acid can be directly provided", "Sample ID", - "Chemical plate ID" , "Assay plate ID", "Assay plate row index, as an integer", "Assay plate column index, as an integer", "Well type", - "1 if the well quality was acceptable, else 0", + "Well quality: 1 was good, else 0", "Concentration in micromolar", "Raw assay component value or readout from vendor", - "Filename of the source file containing the data" - ) -`N/A` <- c("No", "No", "Yes", "Yes","Yes","Yes", "No", "No", "No†", "Yes‡", "No") - -output <- - data.frame(Field, Description, `N/A`) + "Filename of the source file containing the data" ) +Required_NA_allowed <- c("No", "No", "Yes","Yes","Yes", "No", "No", "No", "Yes", "No") -htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - - caption="Table 24: Required fields in level 0 pre-processing." , - tfoot = "The N/A column indicates whether the field can be N/A in the pre-processed data. - † In past versions of *tcpl*, there were some exceptions where concentrations could be N/A. For *tcpl_v3*, conc values must be numeric for processing since N/A values will result in processing error. - ‡If the raw value is N/A, well quality must be 0." -) +output <- data.frame(Field, Description, Required_NA_allowed) +kable(output)%>% + kable_styling("striped") ``` -The well type field is used in the processing to differentiate controls from test compounds in numerous applications, including normalization and definition of the assay noise level. Currently, the tcpl package includes the eight well types in Table 29. Package users are encouraged to suggest new well types and methods to better accommodate their data. +The N/A column indicates whether the field can be NULL in the pre-processed data when writing Level 0. In past versions of tcpl, there were some exceptions where concentrations could be NULL. All conc values must be numeric for processing. For blank and neutral control wells, NULL concs will automatically be set to zero if not provided. If other concs are NULL, user will get a warning and be unable to write Level 0. Additionally, if the raw value is NULL, well quality must be 0. + +The well type (wllt) field is used to differentiate wells in numerous applications, including normalization and definition of the assay noise level. Package users are encouraged to utilize additional well types (for example, well types "x", "y", "z") or suggest new methods to better accommodate their data. - +## Well Types ```{r warning = FALSE, echo = FALSE} `Well Type` <- c("t", "c", "p", "n", "m", "o", "b", "v") @@ -828,56 +875,2547 @@ Description <- c("Test compound", "Loss-of-signal control in multiple concentrations", "Loss-of-signal control in single concentration", "Blank well", - "Viability control" - ) + "Viability control" ) +output <- data.frame(`Well Type`, Description) + +kable(output)%>% + kable_styling("striped") +``` +Before writing and processing any data to the database, the user must [register the assay and chemical](#register) information, as described above. tcpl includes three functions for adding new data: -output <- - data.frame(`Well Type`, Description) +* **tcplRegister**: to register a new assay element or chemical +* **tcplUpdate**: to change or add additional information for existing assay or chemical ids +* **tcplWriteLvl0**: to load formatted source Level 0 data +The final step in level 0 pre-processing is to load the data into the database. The **tcplWriteLvl0** function loads data into the database by checking each required field for expected input, such as correct class or registered sample IDs and concentration values for test wells. Assay component source name, if provided, will map to the appropriate acid. The type argument is used throughout the package to distinguish the screening paradigm (SC or MC) and therefore processing required. + +```{r eval = FALSE, message = FALSE} +# Write/load the 'mcdat' into the database. +tcplWriteLvl0(dat = mcdat, type = "mc") +``` + +As a check to confirm data has been written, the **tcplLoadData** function is used to load data from the database into user's R session. Furthermore, the **tcplPrepOtpt** function can be used in conjunction with tcplLoadData to prepare the data in a readable format with additional chemical and assay annotation information. See [Data Retrieval](#data_retrieval) sections for further details. + +```{r eval = FALSE, message = FALSE} +# Load the level 0 data from the database to R. +tcplLoadData(lvl = 0, fld = "acid", val = 1, type = "mc") +tcplPrepOtpt(tcplLoadData(lvl = 0, fld = "acid", val = 1, type = "mc")) +``` + +In the loaded Level 0 data, $\mathit{acsn}$ is replaced with correct $\mathit{acid}$ and the $\mathit{m0id}$ field is added. These "m#" fields in MC data are primary keys for each level of data and can link the various levels of data. All keys are auto-generated and will change anytime data are reprocessed. Note, the primary keys only change for the levels affected, e.g. if the user reprocesses level 1, the level 0 keys will remain the same. + +# Data Processing {#data_process} + +## Overview + +All processing in the tcpl package occurs at the assay component or assay endpoint level. There is no capability in either SC or MC processing to combine data from multiple assay components or assay endpoints. Any combining of data must occur before or after processing. For example, a ratio of two raw values could be processed if the user calculated the ratio during the custom pre-processing and uploaded values as a single "component". + +Once the Level 0 data are loaded, data processing occurs via the **tcplRun** function for both SC and MC multiple-concentration screening. tcplRun can either take a single ID ($\mathit{acid}$ or $\mathit{aeid}$, depending on the processing type and level) or an $\mathit{asid}$. If given an asid, the tcplRun function will attempt to process all corresponding components/endpoints. When processing by acid or aeid, the user must supply correct [ID for each level](#lvl_ids). + +The processing is sequential, and every level of processing requires successful processing at the antecedent level. Any processing changes will trigger a "delete cascade," removing any subsequent data affected by the processing change to ensure complete data fidelity. For example, processing level 3 data will first require data from levels 4 through 6 to be deleted for the corresponding IDs. **Changing method assignments will also trigger a delete cascade for any corresponding data.** + +For tcplRun, the user must supply a starting level (slvl) and ending level (elvl). There are four phases of processing, as reflected by messages printed in console: (1) data for the given IDs are loaded, (2) the data are processed, (3) data for the same ID in subsequent levels are deleted, and (4) the processed data is written to the database. The 'outfile' parameter can give the user the option of print this output text to a file. If an id fails while processing multiple levels, the function will not attempt to process the failed ids in subsequent levels. When finished processing, a list indicating the processing success of each ID is returned. For each level processed, the list will contain two elements: (1) "l#" a named Boolean vector where TRUE indicates successful processing, and (2) "l#_failed" containing the names of any ids that failed processing, where "#" is the processing level. + +Processing of multiple assay components or endpoints can be executed simultaneously. This is done with the internal utilization of the mclapply function from the parallel package. Parallel processing is done by id. Depending on the system environment and memory constraints, the user may wish to use more or less processing power. For processing on a Windows operating system, the default is $mc.cores = 1$, unless otherwise specified. For processing on a Unix-based operating system, the default is $mc.cores = NULL$ i.e. to utilize all cores except for one, which is necessary for 'overhead' processes. The user can specify more or less processing power by setting the "mc.cores" parameter to the desired level. **Note, this specification should meet the following criteria $1 \space \leq \space \mathit{mc.cores} \space \leq \space \mathit{detectCores()}-1$.** + +## Level IDs {#lvl_ids} + +```{r warning = FALSE, echo = FALSE} +Type <- c('SC', 'SC', 'MC', 'MC', 'MC', 'MC', 'MC', 'MC') +Level <- c('Lvl1', 'Lvl2', 'Lvl1', 'Lvl2', 'Lvl3', 'Lvl4', 'Lvl5', 'Lvl6') +InputID <- c('acid', 'aeid', 'acid', 'acid', 'acid', 'aeid', 'aeid', 'aeid') +MethodID <- c('aeid', 'aeid', 'N/A', 'acid', 'aeid', 'N/A', 'aeid', 'aeid') +output <- data.frame(Type, Level, InputID, MethodID) + +kable(output)%>% + kable_styling("striped") +``` + +In this table, the Input ID column indicates the ID used for each processing step where Method ID indicates the ID used for assigning methods for data processing, when necessary. SC1 requires an $\mathit{acid}$ input, but the methods are assigned by $\mathit{aeid}$. The same is true for MC3 processing. SC1 and MC3 are the normalization steps and convert $\mathit{acid}$ to $\mathit{aeid}$. Only MC2 has methods assigned by $\mathit{acid}$. + +The processing requirements vary by screening paradigm and level, which later sections cover in detail. However, in general, specific method assignments will be required to accommodate different experimental designs or data processing approaches. + +## Methods + +To promote reproducibility, all method assignments are saved in the database and utilize methods described in the available list of methods for each processing level. In general, methods data are stored in the "_methods" and "_id" tables for each corresponding level. For example, the "sc1" table is accompanied by the "sc1_methods" table which stores the available list of methods for SC1, and the "sc1_aeid" table which stores the method assignments and execution order. + +There are three functions to easily modify and load method assignments:
+ +* **tcplMthdAssign** -- assigns methods to specified id(s) +* **tcplMthdClear** -- clears method assignments to specified id(s) +* **tcplMthdLoad** -- queries database and returns the method assignments for specified id(s)
+* **tcplMthdList** -- queries database and returns available methods at specified level(s)
+ +The following code blocks provides examples of the method-related functions: + +```{r eval= FALSE} +## Methods Assignment ## +# For illustrative purposes, assign level 2 MC methods to ACIDs 97, 98, and 99. +# First check for available methods. +mthds <- tcplMthdList(lvl = 2, type = "mc") +mthds[1:2] +# Assign some methods to ACID 97, 98, and 99. +tcplMthdAssign(lvl = 2, + id = 97:99, + mthd_id = c(3, 4, 2), + ordr = 1:3, + type = "mc") +# Check the assigned methods for ACID 97, 98, and 99 in the database. +tcplMthdLoad(lvl = 2, id = 97:99, type = "mc") + +# Methods can be cleared one at a time for the given id(s) +tcplMthdClear(lvl = 2, id = 99, mthd_id = 2, type = "mc") +# Check the assigned methods for the single id updated, namely ACID 99. +tcplMthdLoad(lvl = 2, id = 99, type = "mc") + +# Or all methods can be cleared for the given id(s) +tcplMthdClear(lvl = 2, id = 97:98, type = "mc") +# Check the assigned methods for the all updated ids, namely ACID 97 and 98. +tcplMthdLoad(lvl = 2, id = 97:98, type = "mc") +``` + +Later sections of this vignette provide level-specific method assignment examples and more details on the methods themselves. Most examples will reflect commonly-used methods assigned, but one should consider the data at hand and all methods available for the level prior to assigning. + +## Data Normalization {#data_norm} + +Data normalization occurs in both SC and MC processing paradigms at levels 1 and 3, respectively. While the two paradigms use different methods, the normalization approach is the same for both. Data normalization does not have to occur within the package as pre-normalized data can be loaded into the database at Level 0. **However, data must be zero-centered.** Thus, the data must either be zero-centered in [Level 0 pre-processing](#lvl0-preprocessing) or the user must pick a methodology from the associated level 1 and 3 methods to zero-center the data before model fitting occurs. + +Fold-change and a percent of control are typical approaches to normalization. Given data must be zero-centered, fold-change data in general is log-transformed. Log-scale transformations for fold-change data is typically base 2 ($log_2$), but other bases may be more appropriate in some circumstances. + +Normalizing to a percent of control requires three normalization methods: + +1. one to define the baseline value, +2. one to define the control value, and +3. one to calculate percent of control ("resp.pc"). + +Normalizing to fold-change also requires three methods: +1. one to define the baseline value, +2. one to calculate the fold-change, and +3. one to log-transform the fold-change values ("resp.fc"). + +($\mathit{cval}$) is the corrected response value for a test well defined in MC2. Methods defining a baseline value ($\mathit{bval}$) have the "bval" prefix, methods defining the positive control value ($\mathit{pval}$) have the "pval" prefix. Pval may be set as 0 if no positive control wells are provided and measuring decreases in signal. Finally, methods that calculate the final response value have the "resp" prefix. For example, "resp.log2" does a log-transformation of the response value using a base value of 2. The formulae for calculating the percent of control and fold-change response are listed in equations 1 and 2, respectively. Note that the fold-change calculation divides by the baseline value and thus must have some non-zero values associated with the baseline to successfully calculate fold-change. + +$$ resp.pc = \frac{cval - bval}{pval - bval}*100 $$ + +$$ resp.fc = \frac{cval}{bval} $$ + +**Order matters when assigning normalization methods.** The $\mathit{bval}$, and $\mathit{pval}$ if normalizing as a percent of control, need to be calculated prior to calculating the response value. Examples of normalization schemes are presented below: + +```{r warning = FALSE, echo = FALSE} +Normalization <- c('', 'Fold Change', '%Control') +Scheme_1 <- c('Scheme 1', '1. bval.apid.nwlls.med
2. resp.fc
3. resp.log2
4. resp.mult.neg1', + '1. bval.apid.lowconc.med
2. bval.apid.pwlls.med
3. resp.pc
4. resp.multneg1') +Scheme_2 <- c('Scheme 2', '1. bval.apid.lowconc.med
2. resp.fc
3. resp.log2', + '1. bval.spid.lowconc.med
2. pval.apid.mwlls.med
3. resp.pc') +Scheme_3 <- c('Scheme 3', '1. none
2. resp.log10
3. resp.blineshift.50.spid', + '1. none
2. resp.multneg1') + +output <- t(data.frame(Normalization, Scheme_1, Scheme_2, Scheme_3)) + +# Export/print the table to an html rendered table. htmlTable(output, - align = 'l', - align.header = 'l', - rnames = FALSE , - css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', - caption="Table 25: Well types" -) + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', + caption = "Examples of Normalization Schemes" + ) +``` + +If the data does not require any normalization, the "none" method will be assigned. The "none" method simply copies the input data to the response field. Without assigning "none", the response field will not get generated and processing will fail. + +With tcpl v2 , responses were only fit in the positive analysis direction. Therefore, a signal in the negative direction needed to be "flipped" to the positive direction during normalization. Multiple endpoints stemming from one component were created to enable multiple normalization approaches when the assay measured gain and loss of signal. Negative direction data was inverted by multiplying the final response values by ${-1}$ via the "resp.multneg1" methods. For tcpl v3 onward, the tcplFit2 package is utilized which allows for bidirectional fitting, meaning the "resp.multneg1" method is now only required in special cases. + +In addition to the required normalization methods, the user can apply additional methods to transform the normalized values. For example, "resp.blineshift.50.spid" corrects for baseline deviations by $\mathit{spid}$. A complete list of available methods, by processing type and level, can be accessed with tcplMthdList. More information is also available in package documentation, `??tcpl::Methods`. + +## SC Data Processing +The goal of single-concentration processing is to identify potentially active compounds from a broad screen at a single concentration. SC processing consists of 2 levels: + +```{r warning = FALSE, echo = FALSE} +Level <- c(" Lvl 0", "Lvl 1 ", "Lvl 2 ") +Description <- c("Pre-processing: Vendor/dataset-specific pre-processing to organize heterogeneous raw data to the uniform format for processing by the *tcpl* package", + "Normalize: Apply assay endpoint-specific normalization listed in the \'sc1_aeid\' table to the raw data to define response", + "Activity Call: Collapse replicates by median response, define the response cutoff based on methods in the \'sc2_aeid\' table, and determine activity" ) + +output <- data.frame(Level, Description) + +kable(output)%>% + kable_styling("striped") +``` + +## > Level 1 + +Level 1 processing converts the assay component to assay endpoint(s), defines the normalized-response value ($\mathit{resp}$), and optionally, derives the baseline value ($\mathit{bval}$) and positive control value ($\mathit{pval}$). The purpose of level 1 is to normalize the raw values to either the percentage of a control or fold-change from baseline. + +## - Methods Assignment + +The first step in beginning the processing is to identify which assay endpoints stem from the assay component(s) being processed. With the corresponding endpoints identified, the appropriate methods can be assigned. + +```{r eval = FALSE} +# Load the 'aeid' values for acid 2 ## +tcplLoadAeid(fld = "acid", val = 2) + +# Assign the level 1 methods to aeid 1 and 2 ## +tcplMthdAssign(lvl = 1, # processing level + id = 1:2, # assay endpoint ID's to assign methods + mthd_id = c(1, 11, 13), # method(s) to be assigned + ordr = 1:3, # order the method(s) should be applied + type = "sc") # the data/processing type +``` + +Above, methods 1, 11, and 13 were assigned for both endpoints. The method assignments instruct the processing to: (1) calculate $\mathit{bval}$ for each assay plate ID by taking the median of all data where the well type equals "n"; (2) calculate a fold-change with respect to the $\mathit{bval}$ (i.e. $\frac{resp}{\mathit{bval}}$); (3) log-transform the fold-change values with base 2. For a complete list of normalization methods see tcplMthdList(lvl = 1, type = "sc") or ?SC1\_Methods . + +If a user needs to add a method to the end of a normalization sequence, as shown above, then the user can use a second method assignment statement. For example, if AEID 2 should indicate a change of directionality to be more biologically interpretable, all responses can be multiplied by $-1$. **Reminder, the order of methods assignment matters, particularly in the normalization step.** + +```{r eval = FALSE} +# Assign a fourth step to the normalization processing - for AEID 2 only. +tcplMthdAssign(lvl = 1, # processing level + id = 2, # assay endpoint ID's to assign methods + mthd_id = 16, # method(s) to be assigned + ordr = 4, # order the method(s) should be applied + type = "sc") # the data/processing type +``` + +With the normalization methods defined, the data are ready for SC1 processing. Before normalization occurs within tcplRun, all wells with well quality ($\mathit{wllq}$) 0 are removed. + +```{r echo=FALSE, eval = FALSE} +## SC1 processing for acid 1 ## +tcplRun(id = 1, slvl = 1, elvl = 1, type = "sc") +``` + +## > Level 2 + +Level 2 processing defines the baseline median absolute deviation ($\mathit{bmad}$), collapses any replicates by sample ID (spid), and determines the activity. + +## - Methods Assignment + +Before the data are collapsed by spid, the $\mathit{bmad}$ is calculated as the median absolute deviation of all treatment wells ($\mathit{wllt} = t$ - default option) or neutral control wells ($\mathit{wllt} = n$). The calculation defines $\mathit{bmad}$ for the entire endpoint. **If additional data is added, the bmad for the associated endpoints will be recalculated.** Note, this $\mathit{bmad}$ equation is different from MC screening. + +$$ bmad_{sc} = 1.4826*median(\big | y_{i} - \tilde{y} \big |)$$ + +Where $y_i$ is the $i^{th}$ observation of all wells within a well type in the assay component and $\tilde{y}$ is the median across all $y_i$'s. The constant value, $1.4826$, is the default adjustment value used in the underlying R function to ensure $bmad$ is a consistent estimator of the standard deviation ($\sigma$) assuming the sample size ($N$) of the observations is large and they are normally distributed (i.e. Gaussian), see [mad() in R](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/mad) and [unbiased mad](https://aakinshin.net/posts/unbiased-mad/#references) for further details. + +```{r warning = FALSE, echo = FALSE} +## Create the sc BMAD calculation Table ## +# Specify column 1 in the table - Methods. +Method <- c(1,2) +# Specify column 2 in the table - Description. +Description <- c("Median absolute deviation (MAD) of all treatment wells across the assay component (acid).", + "Median absolute deviation (MAD) of all blank wells across the assay component (acid).") +# Specify column 3 in the table - Observations. +Observations <- c( + "$y_{i} = y_{(s,w)}$", # method 1 + "$y_{i} = y_{(s,w)}$" # method 2 + ) +# Specify column 4 in the table - Observation ID. +ID <- c( + "$s \\in \\{1,...,n_{acid}\\}$, \n$w = t$", + "$s \\in \\{1,...,n_{acid}\\}$, \n$w = n$") +# Specify column 5 in the table - Details about the Observation ID. +Details <- c( "$s$ indicates the sample id within an 'acid' & $w$ indicates the well type", + "$s$ indicates the sample id within an 'acid' & $w$ indicates the well type") +# Create the output table. +output <- data.frame(Method,Description,Observations,ID,Details) + +kable(output)%>% + kable_styling("striped") +``` + +To collapse the data by spid, the median response of replicates at each concentration index is calculated. SC data screening involves testing at 1-3 concentrations, which is insufficient for fitting. Data are then further collapsed by taking the maximum of those median values ($\mathit{max\_med}$). Once collapsed, such that each endpoint-sample has one value, the activity is determined. For an active hit call (hitc), the sample's $\mathit{max\_med}$ must be greater than a specified efficacy cutoff ($\mathit{coff}$). + +In the below code, methods are assigned such that the cutoff value is $log_2(1.2)$. Thus, if the maximum median value ($\mathit{max\_med}$) is greater than or equal to the efficacy cutoff ($\mathit{coff} = log_2(1.2)$), then the sample ID is considered active and the hit call ($\mathit{hitc}$) is set to 1. The coff is defined as the maximum of all values given by the assigned level 2 methods. Failing to assign a level 2 method will result in every sample being called active. For a complete list of level 2 methods, see tcplMthdList(lvl = 2, type = "sc") or ?SC2\_Methods. With the methods assigned and the cutoff set, the data are ready for SC2 processing. + +```{r eval = FALSE} +# Assign a cutoff value of log2(1.2) ## +tcplMthdAssign(lvl = 2, # processing level + id = 1, # assay endpoint ID's to assign methods + mthd_id = 3, # method(s) to be assigned + type = "sc") # the data/processing type + +## SC2 processing for acid 1 ## +sc2_res <- tcplRun(id = 1, slvl = 2, elvl = 2, type = "sc") +``` + +Sometimes it is necessary to prevent hitcalling for responses in the biologically irrelevant direction. SC2 contains two methods for overwriting the $\mathit{max\_med}$ value. If applied, negative hitcalls will be given for any $\mathit{max\_med}$ greater or less than cutoff in the biologically unintended direction, by comparing the $\mathit{max\_med}$ to either the positive or negative cutoff instead examining absolute values. + +```{r warning = FALSE, echo = FALSE} +Method <- c(25,27) +Method_Name <- c( "ow_bidirectional_gain", "ow_bidirectional_loss") +Description <- c( + "Reponses in in the positive direction only are biologically relevant, therefore 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.", + "Responses in the negative direction only are biologically relevant, therefore 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.") + +output <- data.frame(Method,Method_Name,Description) + +kable(output)%>% + kable_styling("striped") +``` + +## MC Data Processing + +The goal of multiple-concentration processing is to estimate the activity, potency, efficacy, and other parameters for sample-assay pairs. +```{r warning = FALSE, echo = FALSE} +Level <- c("Lvl 0 ", "Lvl 1", "Lvl 2", "Lvl 3", "Lvl 4", "Lvl 5", "Lvl 6", "Lvl 7") +Description <- c("Pre-processing: Vendor/dataset-specific pre-processing to organize heterogeneous raw data to the uniform format for processing by the *tcpl* package", + "Index: Define the replicate and concentration indices to facilitate +all subsequent processing", + "Transform: Apply assay component (acid) specifc transformations +listed in the \'mc2_acid\' table to the raw data to define the +corrected data", +"Normalize: Apply assay endpoint (aeid) specifc normalization listed in +the \'mc3_aeid\' table to the corrected data to define response", +"Fit: Model the concentration-response data utilizing ten +objective curve-fitting functions from tcplfit2: (1) constant, (2) hill, (3) gain-loss, (4) polynomial-linear, (5) polynomial-quadratic, (6) power, (7) exponential-2, (8) exponential-3, (9) exponential-4, (10) exponential-5", +"Model Selection/Acitivty Call: Select the winning model, define +the response cutoff based on methods in the \'mc5_aeid\' table, and +determine activity", +"Flag: Flag potential false positive and false negative fits", +"Extrapolate: Convert bioactive concentrations to Adminstered Equivalent Doses" ) +output <- data.frame(Level, Description) + +kable(output)%>% + kable_styling("striped") +``` + +## > Level 1 + +Level 1 processing defines the replicate and concentration index fields to facilitate downstream processing. Because of cost, availability, physicochemical, and technical constraints, screening efforts may utilize different experimental designs. The resulting data may contain an inconsistent number of concentration groups, concentration values, and technical replicates. To enable quick and uniform processing, level 1 processing explicitly defines concentration and replicate indices as $1 \dots N$ for increasing concentrations and technical replicates, where $1$ represents the lowest concentration or first technical replicate. + +To assign replicate and concentration indices, we assume one of two experimental designs. The first design assumes samples are plated in multiple concentrations on each assay plate, such that the concentration series all fall on a single assay plate. The second design assumes samples are plated in a single concentration on each assay plate, such that the concentration series falls across many assay plates. + +For both experimental designs, data are ordered by source file ($\mathit{srcf}$), assay plate ID ($\mathit{apid}$), column index ($\mathit{coli}$), row index ($\mathit{rowi}$), sample ID ($\mathit{spid}$), and concentration ($\mathit{conc}$). Concentration is rounded to three significant figures to correct for potential rounding errors. After ordering the data, a temporary replicate ID is created for each concentration series. For test compounds in experimental designs with the concentration series on a single plate and all control compounds, the temporary replicate ID consists of the sample ID, well type ($\mathit{wllt}$), source file, assay plate ID, and concentration. The temporary replicate ID for test compounds in experimental designs with concentration series that span multiple assay plates is defined similarly, but does not include the assay plate ID. + +Once the data are ordered, and the temporary replicate ID is defined, the data are scanned from top to bottom and the replicate index ($\mathit{repi}$) incremented every time a replicate ID is duplicated. Then, for each replicate, the concentration index ($\mathit{cndx}$) is defined by ranking the unique concentrations, with the lowest concentration starting at 1. No methods need to be applied and the following demonstrates how to carry out the MC1 processing and look at the resulting data: + +```{r echo=FALSE, eval = FALSE, message = FALSE} +## MC1 processing for acid 1 ## +mc1_res <- tcplRun(id = 1, slvl = 1, elvl = 1, type = "mc") + +## Evaluate MC1 Indexing ## +# Load the level 1 data from the database. +m1dat <- tcplLoadData(lvl = 1, + fld = "acid", + val = 1, + type = "mc") +# Prepare the data into a readable format. +m1dat <- tcplPrepOtpt(m1dat) +# Sort the data based on the concentration and replicate inidices. +setkeyv(m1dat, c("repi", "cndx")) +# Display the 'cndx' and 'repi' values. +m1dat[chnm == "Bisphenol A", list(chnm, conc, cndx, repi)] +``` + +The package also contains a function, **tcplPlotPlate** , for visualizing the data at the assay plate level. This function can be used to visualize the data at levels 1 to 3. + +```{r eval = FALSE, warning = FALSE, message = FALSE, fig.width = 30, fig.height= 20} +tcplPlotPlate(dat = m1dat, apid = "4009721") +``` + +![Design of Assay Plate 4009721](img/plotplate.png) + +*In the generated figure, the row and column indices are printed along the respective edges of the plate, with the raw observed values in each well represented by color. While the plate does not give sample ID information, the letter/number codes in the wells indicate the well type and concentration index, respectively. Wells with poor well quality (`wllq==0` in Level 0) will display with an "X." The title of the plate display lists the assay component/assay endpoint and the assay plate ID ($\mathit{apid}$).* + +## > Level 2 + +Level 2 processing removes data where the well quality ($\mathit{wllq}$) equals 0 and defines the corrected value ($\mathit{cval}$) field. MC2 also allows for additional transformation of the raw values at the assay component level. Examples of transformations include basic arithmetic manipulations to complex spatial noise reduction algorithms, such as aggregation across biological replicates. + +## - Methods Assignment + +Every assay component needs at least one transformation method assigned to complete level 2 processing, even if no transformations are necessary. In the following example, the "none" method will be assigned so MC2 processing can be completed. + +```{r eval = FALSE, message = FALSE} +## Methods Assignment ## +# Assign the level 2 transformation method 'none' to ACID 1. +tcplMthdAssign(lvl = 2, # processing level + id = 1, # assay component ID's to assign methods + mthd_id = 1, # method(s) to be assigned + ordr = 1, # order of the method(s) should be assigned + type = "mc") # the data/processing type + +## MC2 processing for acid 1 ## +mc2_res <- tcplRun(id = 1, slvl = 2, elvl = 2, type = "mc") +``` + +For the complete list of level 2 transformation methods currently available, see tcplMthdList(lvl = 2, type = "mc") or ?MC2\_Methods for more details. The coding methodology used to implement the methods is beyond the scope of this vignette, but, in brief, the method names in the database correspond to a function name in the list of functions returned by mc2\_mthds() (the mc2\_mthds function is not exported, and not intended for use by the user). Each of the functions in the list given by mc2\_mthds only return expression objects that the processing function called by tcplRun executes in the local function environment to avoid making additional copies of the data in memory. We encourage suggestions for new methods. + +## > Level 3 + +Level 3 processing converts the assay component to assay endpoint(s) and defines the normalized-response value field ($\mathit{resp}$); and optionally, the baseline value ($\mathit{bval}$) and positive control value ($\mathit{pval}$) fields. MC3 processing normalizes the corrected values to either the percentage of a control or to fold-change from baseline. The normalization process is discussed in greater detail in the [Data Normalization](#data_norm) section. A primary distinction between MC2 and MC3 processing is [ID for each level](#lvl_ids). + +## - Methods Assignment + +The user first needs to check which assay endpoints stem from the the assay component queued for processing. With the corresponding aeids identified, the normalization methods can be assigned. In the following example, methods 17, 9, and 7 were assigned for both endpoints. These methods involve: (1) calculating $\mathit{bval}$ for each assay plate ID by taking the median of all data where the well type equals "n" or the well type equals "t" and the concentration index is 1 or 2; (2) calculating a fold-change over $\mathit{bval}$; (3) log-transforming the fold-change values with base 2. For a complete list of normalization methods see tcplMthdList(lvl = 3, type = "mc") or ?MC3\_Methods . With normalization methods defined, the data are ready for MC3 processing. + +```{r eval = FALSE} +# Look at the assay endpoints for acid 1 ## +tcplLoadAeid(fld = "acid", val = 1) + +## Methods Assignment ## +# Assign the baseline calculation and normalization methods to aeids 1 and 2. +tcplMthdAssign(lvl = 3, # processing level + id = 1:2, # assay endpoint ID to assign methods + mthd_id = c(17, 9, 7), # method(s) to be assigned + ordr = 1:3, # order the method(s) should be applied + type = "mc") # the data/processing type + +## MC3 processing for acid 1 ## +mc3_res <- tcplRun(id = 1, slvl = 3, elvl = 3, type = "mc") ``` -The final step in level 0 pre-processing is loading the data into the tcpl database. The tcpl package includes the tcplWriteLvl0 function to load data into the database. The tcplWriteLvl0 function maps the assay component source name to the appropriate assay component ID, checks each field for the correct class, and checks the database for the sample IDs with well type "t." Each test compound sample ID must be included in the tcpl database before loading data. The tcplWriteLvl0 also checks each test compound for concentration values. +Notice that MC3 processing takes an acid, not an aeid, as the input ID. As mentioned in previous sections, the user must will assign MC3 normalization methods by aeid then process by acid. The MC3 processing will attempt to process all endpoints for a given component. If one endpoint fails for any reason (e.g., does not have appropriate methods assigned), the processing for the entire component fails. -# Appendix +::: {.noticebox data-latex=""} -## A: Cytotoxicity Distribution +**NOTE:** -Recognizing the substantial impact of cytotoxicity in confounding high-throughput and high-content screening results, the tcpl package includes methodology for defining chemical-specific cytotoxicity estimates. Our observations based on ToxCast data suggest a complex, and not-yet fully understood cellular biology that includes non-specific activation of many targets as cells approach death. For example, a chemical may induce activity in an estrogen-related assay, but if that chemical also causes activity in hundreds of other assays at or around the same concentration as cytotoxicity, should the chemical be called an estrogen agonist? The tcplCytpPt function provides an estimate of chemical-specific cytotoxicity points to provide some context to the "burst" phenomenon. +The user can provide either an assay source id (asid) or 'id' within tcplRun . If the starting level (slvl) is less than 4, then 'id' is interpreted as an acid. When slvl is greater than or equal to 4 the 'id' is interpreted as an aeid. If an 'id' fails, no results are loaded into the database and the 'id' is not included in the cue for subsequent processing levels. -The cytotoxicity point is simply the median AC$_{50}$ for a set of assay endpoints, either given by the user or defined within the tcpl database. By default, the tcplCytoPt function uses the assay endpoints listed in the $\mathit{burst\_assay}$ field of the "assay\_component\_endpoint" table, where 1 indicates including the assay endpoint in the calculation. The "burst" assay endpoints can be identified by running tcplLoadAeid(fld = "burst\_assay", val = 1) . +::: -In addition to the cytotoxicity point, tcplCytoPt provides two additional estimates: (1) the MAD of the AC$_{50}$ ($\mathit{modl\_ga}$) values used to calculate the cytotoxicity point, and (2) the global MAD. Note, only active assay endpoints (where the hit call, $\mathit{hitc}$, equals $1$) are included in the calculations. Once the burst distribution (cytotoxicity point and MAD) is defined for each chemical, the global burst MAD is defined as the median of the MAD values. Not every chemical may be tested in every "burst" assay, so the user can determine the minimum number of tested assays as a condition for the MAD value for a particular chemical to be included in the global MAD calculation. By default, if "aeid" is the vector of assay endpoints used in the calculation, tcplCytoPt requires the chemical to be tested in at least floor(0.8 * length(aeid)) assay endpoints to be included in the calculation. The user can specify to include all calculated MAD values (note, there must be at least two active assay endpoints to calculate the MAD) by setting 'min.test' to FALSE . The 'min.test' parameter also accepts a number, allowing the user to explicitly set the requirement. +## > Level 4 -The global MAD gives an estimate of overall cytotoxicity window, and allows for a cytotoxicity distribution to be determined for chemicals with less than two active "burst" assay endpoints. The cytotoxicity point for chemicals with less than two active "burst" endpoints is set to the value given to the 'default.pt' parameter. By default, the tcplCytoPt assigns 'default.pt' to 3.^[$10^3 = 1000$, therefore, when using micromolar units, $3$ is equivalent to $1$ millimolar. $1$ millimolar was chosen as an arbitrary high concentration (outside the testing range for ToxCast data), based on the principle that all compounds are toxic if given in high enough concentration.] +Level 4 processing models the activity of each concentration-response series. Each series is bidirectionally fit using methods available in the tcplfit2 R package ([Sheffield et al., 2021](https://doi.org/10.1093/bioinformatics/btab779)). Bidirectional fitting means curve inversion is not necessary as in past versions (i.e. observed 'negative/decreasing' responses multiplied by $-1$). -## B: Build Variable Matrices +## -- Pre-Modeling Processes -The tcplVarMat function creates chemical-by-assay matrices for the level 4 and level 5 data. When multiple sample-assay series exist for one chemical, a single series is selected by the tcplSubsetChid function. See ?tcplSubsetChid for more information.
+Level 4 processing establishes a noise-band for the endpoint using the baseline median absolute deviation ($\mathit{bmad}$). Here, the $\mathit{bmad}$ is calculated by the baseline response values, either untreated control wells (e.g. 'wllt = n'; neutral solvent wells like DMSO) *or* test samples from the two lowest concentrations (i.e. 'wllt = t' & concentration index is 1 or 2). The $\mathit{bmad}$ calculation is done across the entire endpoint. **If additional data is added, the $\mathit{bmad}$ values for all associated assay endpoints is recalculated.** - 1. "modl\_ga" -- The $\log_{10}\mathit{AC_{50}}$ (in the gain direction) for the winning model.
- 2. "hitc" -- The hit call for the winning model.
- 3. "m4id" -- The m4id, listing the concentration series selected by tcplSubsetChid . - 4. "zscore" -- The z-score (described below). - 5. "tested\_sc" -- $1$ or $0$, $1$ indicating the chemical/assay pair was tested in the single-concentration format. - 6. "tested\_mc" -- $1$ or $0$, $1$ indicating the chemical/assay pair was tested in the multiple-concentration format. - 7. "ac50" -- a modified AC$_{50}$ table (in non-log units) where assay/chemical pairs that were not tested, or tested and had a hit call of $0$ or $-1$ have the value $1e6$. - 8. "neglogac50" -- $-\log_{10}\frac{\mathit{AC_{50}}}{1e6}$ where assay/chemical pairs that were not tested, or tested and had a hit call of $0$ or $-1$ have the value $0$. +$$ bmad_{mc} = 1.4826*median(\big | y_{i} - \tilde{y} \big |)$$ +Where $y_{i}$ is the $i^{th}$ baseline observation as defined by the assigned method and $\tilde{y}$ is the median of all the baseline observations. The constant value, $1.4826$, is the default adjustment value used in the underlying R function to ensure $bmad$ is a consistent estimator of the standard deviation ($\sigma$) assuming the sample size ($N$) of the baseline observations is large and they are normally distributed (i.e. Gaussian), see [mad() in R](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/mad) and [unbiased mad](https://aakinshin.net/posts/unbiased-mad/#references) for more details. -The z-score calculation is based on the output from tcplCytoPt (Appendix C), and is calculated for each AC$_{50}$ value as follows: -$$ -\mathit{z-score} = -\frac{\mathit{modl\_ga} - \mathit{cyto\_pt}}{\mathit{global\_mad}}\mathrm{,} -$$ -Note: the burst z-score values are multiplied by -1 to make values that are more potent relative to the burst distribution a higher positive z-score. +One standard deviation of baseline response is also calculated, since it is necessary for the calculation of the benchmark response (BMR) in both the curve-fitting and hit-calling functions from tcplfit2 , tcplfit_core and tcplhit2_core , respectively. One standard deviation of the baseline response will be estimated using the two lowest concentration groups of test samples or neutral control wells across all chemicals, depending on $bmad$ method selected. **BMR, like bmad, may change if additional data is added. Thus, the BMD estimates may also change.** See the [Data Interpretation>Benchmark Dose](#bmd) section for more details. -In addition, additional matrices can be defined by the 'add.vars' parameter in the tcplCytoPt function. The 'add.vars' function will take any level 4 or level 5 field and create the respective matrix. +```{r warning = FALSE, echo = FALSE} +# First column with the method assignment index. +Method <- c(1,2) +# Second column with the general methods description. +Description <- c( + "Median absolute deviation (MAD) of all observations in the lowest two concentrations of across samples (spid) in the assay endpoint (aeid).
+ Standard deviation (SD) of all observations in the lowest two concentrations of across samples (spid) in the assay endpoint (aeid).", + "Median absolute deviation (MAD) of all observations in the solvent/untreated control observations across samples (spid) in the assay endpoint (aeid).
+ Standard deviation (SD) of all observations solvent/untreated control observations of across samples (spid) in the assay endpoint (aeid)." +) +# Third column with the observation information. +Observations <- c( + "$y_{i} = y_{(s,w,d)}$", # method 1 + "$y_{i} = y_{(s,w)}$" # method 2 +) + +# Fourth column with the observation ID information. +ID <- c( + "$s \\in \\{1,...,n_{aeid}\\}$, \n$w = t$, \n$d \\in \\{ 1,2 \\}$", + "$s \\in \\{1,...,n_{aeid}\\}$, \n$w = n$" +) + +# Fifth column with the details on the ID's. +Details <- c( + "$s$ indicates the sample id within an 'aeid', $w$ indicates the well type, & $d$ indicates the concentration group index", + "$s$ indicates the sample id within an 'aeid', $w$ indicates the well type") + +# Compile all of the information for the table. +output <- data.frame(Method,Description,Observations,ID,Details) + +# Export/print the table to an html rendered table. +htmlTable(output, + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ' ) +``` + +Before the model parameters are estimated, a set of summary values are calculated for each concentration-response series: + +* Minimum and maximum observed responses (resp_min & resp_max, respectively). +* Minimum and maximum concentrations (conc_min & conc_max, respectively). +* The total number of concentration groups (nconc). +* Total number of observed responses (i.e. data points in the concentration series) (npts). +* Number of replicates in concentration groups (nrep). +* The maximum mean and median responses along with the concentration at which +they occur (max_mean, max_med, max_mean_conc, & max_med_conc, respectively). +* The minimum mean and median responses along with the concentration at which +they occur (min_mean, min_med, min_mean_conc, & min_med_conc, respectively). +* The maximum median difference response -- the greater distance to 0 of max_med +and min_med -- along with the concentration at which it occurs (max_med_diff & +max_med_diff_conc, respectively) +* The number of median responses greater than $3*\mathit{bmad}$ or less than $-3*\mathit{bmad}$ (nmed_gtbl_pos & nmed_gtbl_neg, respectively). + +The "mean" and "median" response values are defined as the mean or median of all observed response values at each concentration. In other words, the maximum median is the maximum of all median response values across all concentrations in the series. Similarly, the minimum median is the true minimum (or max in the negative direction) of all median response values across the concentrations in the series. + +The following code demonstrates how to load the MC3 data for a single aeid. + +```{r eval=FALSE} +## Evaluate the MC3 Data ## +# Load the MC3 data from the database. +mc3 <- tcplLoadData(lvl = 3, + type = 'mc', + fld = 'aeid', + val = 80) +# Prepare the data into a readable format. +mc3 <- tcplPrepOtpt(mc3) +``` + +For demonstration purposes, the mc_vignette R data object is provided in the package since the vignette is not directly connected to such a database. The mc_vignette object contains a subset of data from levels 3 through 5 from invitrodb v4.2. The following code loads the example mc3 data object, then plots the concentration-response series for an example spid with the summary estimates indicated. + +```{r fig.align='center',message=FALSE,message=FALSE,fig.dim=c(8,10),eval = FALSE} +# Load the example data from the `tcpl` package. +data(mc_vignette, package = 'tcpl') +# Allocate the level 3 example data to `mc3`. +mc3_example <- mc_vignette[['mc3']] +# level 3 does not store logc anymore, create it for plotting purposes +mc3_example[, logc := log10(conc)] +# Obtain the MC4 example data. +mc4_example <- mc_vignette[["mc4"]] +# Obtain the minimum response observed and the 'logc' group - 'resp_min'. +level3_min <- mc3_example %>% + dplyr::group_by(spid, chnm) %>% + dplyr::filter(resp == min(resp)) %>% + dplyr::filter(spid == "01504209") +# Obtain the maximum response observed and the 'logc' group - 'resp_max'. +level3_max <- mc3_example %>% + dplyr::group_by(spid, chnm) %>% + dplyr::filter(resp == max(resp)) %>% + dplyr::filter(spid == "01504209") +# Obtain the level 3 data and 'center' estimates for responses per 'logc' group. +level3_summary <- mc3_example %>% + dplyr::filter(spid == "01504209") %>% + dplyr::select(., c(spid, chnm, logc, resp)) %>% + dplyr::group_by(spid, chnm, logc) %>% + dplyr::summarise(mean_resp = mean(resp), med_resp = median(resp)) + +## Generate Individual Summary Plots ## +# Plot the mean responses for each log-concentration group. +A <- mc3_example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(data = ., aes(logc, resp)) + + geom_point(pch = 1, size = 2) + + geom_point(data = level3_summary, + aes(x = logc, y = mean_resp, + col = 'mean responses'), + alpha = 0.75,size = 2) + + scale_color_manual(values = 'paleturquoise3', + aesthetics = 'col') + + labs(lty = "", colour = "")+ + xlab(expression(paste(log[10],"(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) + + ggtitle("Mean Responses") + + theme_bw() + + theme(legend.position = 'bottom') +# Plot the median responses for each log-concentration group. +B <- mc3_example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(data = .,aes(logc,resp)) + + geom_point(pch = 1, size = 2) + + geom_point(data = level3_summary, + aes(x = logc, y = med_resp, + col = 'median response'), + alpha = 0.75, size = 2) + + scale_color_manual(values = 'hotpink', + aesthetics = 'col') + + labs(lty = "", colour = "")+ + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) + + ggtitle("Median Responses") + + theme_bw() + + theme(legend.position = 'bottom') +# Plot the maximum mean & median responses at the related log-concentration - +# 'max_mean' & 'max_mean_conc'. +C <- mc3_example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(data = .,aes(logc, resp)) + + geom_point(pch = 1, size = 2) + + geom_point(data = dplyr::filter(mc4, spid == "01504209"), + aes(x = log10(max_mean_conc), y = max_mean, + col = 'maximum mean response'), + alpha = 0.75, size = 2)+ + scale_color_manual(values = 'paleturquoise3', + aesthetics = 'col') + + labs(lty = "", colour = "")+ + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) + + ggtitle(label = "Maximum Mean Response") + + theme_bw() + + theme(legend.position = 'bottom') +# Plot the maximum mean & median responses at the related log-concentration - +# 'max_med' & 'max_med_conc'. +D <- example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(data = ., aes(logc, resp)) + + geom_point(pch = 1, size = 2) + + geom_point(data = dplyr::filter(mc4, spid == "01504209"), + aes(x = log10(max_med_conc), y = max_med, + col = "maximum median response"), + alpha = 0.75, size = 2)+ + scale_color_manual(values = 'hotpink', + aesthetics = 'col') + + labs(lty = "", colour = "") + + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) + + ggtitle(label = "Maximum Median Response") + + theme_bw() + + theme(legend.position = 'bottom') +# Plot the minimum & maximum observed responses. +E <- mc3_example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(data = ., aes(logc, resp)) + + geom_point(pch = 1, size = 2) + + geom_point(data = level3_min, + aes(x = logc, y = resp, + col = "minimum response"), + alpha = 0.75, size = 2) + + geom_point(data = level3_max, + aes(x = logc, y = resp, + col = "maximum response"), + alpha = 0.75, size = 2) + + scale_color_manual(values = c('red', 'blue'), + aesthetics = 'col') + + labs(lty = "", colour = "") + + xlab(expression(paste(log[10], "(Concentration) ", mu,"M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) + + ggtitle(label = "Minimum & Maximum\nResponses") + + theme_bw() + + theme(legend.position = 'bottom') +# Plot the minimum & maximum experimental log-concentration groups - +# 'logc_min' & 'logc_max'. +G <- mc3_example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(data = ., aes(logc, resp)) + + geom_point(pch = 1, size = 2) + + geom_vline(data = dplyr::filter(mc4, spid == "01504209"), + aes(xintercept = log10(conc_min), + col = 'minimum concentration'), + lty = "dashed") + + geom_vline(data = dplyr::filter(mc4, spid == "01504209"), + aes(xintercept = log10(conc_max), + col = 'maximum concentration'), + lty = "dashed") + + scale_color_manual(values = c('red', 'blue'), + aesthetics = 'col') + + labs(lty = "", colour = "") + + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) + + ggtitle(label = "Minimum & Maximum\nConcentrations") + + theme_bw() + + theme(legend.position = 'bottom') +## Compile Summary Plots in One Figure ## +gridExtra::grid.arrange( + A,B,C,D,E,G, + nrow = 3, ncol = 2, + top = mc3[which(mc4[,spid] == "01504209"), aenm] +) +``` + +*These plots illustrate summary estimates calculated as part of the level 4 processing, which occurs prior to dose-response modeling. Each plot depicts the observed concentration-response data as white circles, where the x-axis is base 10 log-transformed concentration values. In the upper plots, the mean response values for each concentration group is depicted as turquoise circles (left) where as median response values for each concentration group are hot-pink circles (right). The middle plots depict mean and median responses, but only shows the maximum mean ($\mathit{max\_mean}$) and median ($\mathit{max\_med}$) response estimates (left and right, respectively). The minimum observed response ($\mathit{min\_resp}$) is depicted with a blue circle and the maximum observed response value ($\mathit{max\_resp}$) with a red circle (left lower). Finally, the minimum ($\mathit{min\_logc}$) and maximum $\mathit{max\_logc}$ log10-scale concentrations are depicted, respectively, with blue and red vertical dashed lines (right lower).* + +## - Concentration-Response Modeling Details + +After summary values are obtained for each concentration-response series, all parametric models in tcplFit2 are fit to each series. Available model details are provided below: + +```{r warning = FALSE, echo = FALSE} +# First column - tcplfit2 available models. +Model <- c( + "Constant", "Linear", "Quadratic","Quadratic","Power", "Hill", "Gain-Loss", + "Exponential 2", "Exponential 3","Exponential 4", "Exponential 5" +) +# Second column - model abbreviations used in invitrodb & tcplfit2. +Abbreviation <- c( + "cnst", "poly1", "poly2-monotonic only","poly2-biphasic","pow", "hill", "gnls", + "exp2", "exp3", "exp4", "exp5" +) +# Third column - model equations. +Equations <- c( + "$f(x) = 0$", # constant + "$f(x) = ax$", # linear + "$f(x) = a(\\frac{x}{b}+(\\frac{x}{b})^{2})$", # quadratic + "$f(x) = b1*x + b2*x^{2}$", # biphasic poly2 + "$f(x) = ax^p$", # power + "$f(x) = \\frac{tp}{1 + (\\frac{ga}{x})^{p}}$", # hill + "$f(x) = \\frac{tp}{(1 + (\\frac{ga}{x})^{p} )(1 + (\\frac{x}{la})^{q} )}$", # gain-loss + "$f(x) = a*(exp(\\frac{x}{b}) - 1)$", # exp 2 + "$f(x) = a*(exp((\\frac{x}{b})^{p}) - 1)$", # exp 3 + "$f(x) = tp*(1-2^{\\frac{-x}{ga}})$", # exp 4 + "$f(x) = tp*(1-2^{-(\\frac{x}{ga})^{p}})$" # exp 5 +) +# Fourth column - model parameter descriptions. +OutputParameters <- c( + "", # constant + "a (y-scale)", # linear, + "a (y-scale)
b (x-scale)", # quadratic + "a (y-scale)
b (x-scale)", # quadratic + "a (y-scale)
p (power)", # power + "tp (top)
ga (gain AC50)
p (gain-power)", # hill + "tp (top)
ga (gain AC50)
p (gain power)
la (loss AC50)
q (loss power)", # gain-loss + "a (y-scale)
b (x-scale)", # exp2 + "a (y-scale)
b (x-scale)
p (power)", # exp3 + "tp (top)
ga (AC50)", # exp4 + "tp (top)
ga (AC50)
p (power)" # exp5 +) +# Fifth column - additional model details. +Details <- c( + "Parameters always equals 'er'.", # constant + "", # linear + "", # quadratic + "", # biphasic poly2 + "", # power + "Concentrations are converted internally to log10 units and optimized with f(x) = tp/(1 + 10^(p*(gax))), then ga and ga_sd are converted back to regular units before returning.", # hill + "Concentrations are converted internally to log10 units and optimized with f(x) = tp/[(1 + 10^(p*(gax)))(1 + 10^(q*(x-la)))], then ga, la, ga_sd, and la_sd are converted back to regular units before returning." , # gain-loss + "", # exp2 + "", # exp3 + "", # exp4 + "") # exp5 +# Consolidate all columns into a table. +output <- + data.frame(Model, Abbreviation, Equations, + OutputParameters, Details) +# Export/print the table into an html rendered table. +htmlTable(output, + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ' +) + +``` + +Most models in tcplfit2 assume the background response is zero and the absolute response (or initial response) is increasing. In other words, these models fit a monotonic curve in either direction. The polynomial 2 (poly2) model is an exception with two parameterization options. The biphasic parameterization is what is used in tcpl . A biphasic poly2 model fits responses that are increasing first and then decreasing, and vice versa (assuming the background response is zero). *If biphasic responses are not reasonable, data can be fit using the monotonic-only parameterization in a standalone application of tcplfit2_core with the parameter biphasic=FALSE assigned. This argument is not available in tcpl.* All data is fit bidirectionally then responses in unintended direction may be indicated with negative hit calls if ["overwrite" MC5 methods](#mc5) are applied. + +Upon completion of model fitting, each model gets a success designation: 1 if the model optimization converges, 0 if the optimization fails, and NA if 'nofit' was set to TRUE within tcplFit2::tcplfit2_core function. Similarly, if the Hessian matrix was successfully inverted then 1 indicates a successful covariance calculation (cov); otherwise 0 is returned. Finally, in cases where 'nofit' was set to TRUE (within tcplFit2::tcplfit2_core ) or the model fit failed the Akaike information criterion (aic), root mean squared error (rme), model estimated responses (modl), model parameters (parameters), and the standard deviation of model parameters (parameter sds) are set to NA. A complete list of model output parameters is provided below: + +```{r warning = FALSE, echo = FALSE} +# First column - tcplfit2 additional fit parameters. +FitParameters <- c("er", "success", "cov", "aic", "rme", "modl", + "parameters", "parameters sds", "pars", "sds") +# Second column - description of additional fit parameters. +Description <- c( + "Error term","Success of Fit/Model Convergenece","Success of Covariance", + "Akaike Information Criteria", "Root Mean Squared Error", + "Vector of Model Estimated Values at Given Concentrations", + "Model Parameter Values", "Standard deviation of Model Parameter Values", + "Vector of Parameter Names","Vectors of Parameter Standard Deviation Names") +# Consolidate all columns into a table. +output <- data.frame(FitParameters, Description) +# Export/print the table into an html rendered table. +kable(output)%>% + kable_styling("striped") +``` + +Maximum likelihood estimation is utilized in the model fitting algorithm to estimate model parameters for all models. Even though tcplfit2 allows the maximum likelihood estimation to assume the error follows a normal or Student's t-distribution, tcpl assumes the error always follows a t-distribution with four degrees of freedom. Heavier (i.e., wider) tails in the t-distribution diminish the influence of outlier values, and produce more robust estimates than the more commonly used normal distribution. Robust model fitting removes the need to eliminate potential outliers prior to fitting. + +Let $t(z,\nu)$ be the Student's t-distribution with $\nu$ degrees of freedom, +$y_{i}$ be the observed response at the $i^{th}$ observation, and $\mu_{i}$ be +the estimated response at the $i^{th}$ observation. We calculate $z_{i}$ as: + + $$ z_{i} = \frac{y_{i} - \mu_{i}}{exp(\sigma)}, $$ + +where $\sigma$ is the scale term. Then the log-likelihood is
+ +$$ \sum_{i=1}^{n} [\ln\left(t(z_{i}, 4)\right) - \sigma]\mathrm{,} $$ + +where $n$ is the number of observations. + +The following plots provide simulated concentration-response curves to illustrate the general curve shapes captured by tcplFit2 models. When fitting 'real-world' experimental data, the resulting curve shapes will minimize the error between the observed data and the concentration-response curve. Thus, the shape for each model fit may or may not reflect what is illustrated below: + +```{r class.source="scroll-100",fig.align='center'} +## Example Data ## +# example fit concentration series +ex_conc <- seq(0.03, 100, length.out = 100) + +## Obtain the Continuous Fit of Level 4 Model Estimates ## +fits <- data.frame( + # log-scale concentrations + logc = log10(ex_conc), + # parametric model fits from `tcplfit2` + constant = tcplfit2::cnst(ps = c(er = 0.1), ex_conc), + poly1 = tcplfit2::poly1(ps = c(a = 3.5, er = 0.1),x = ex_conc), + poly2.mono.only = tcplfit2::poly2(ps = c(a = 0.13, b = 2, er = 0.1), x = ex_conc), + poly2.biphasic = tcplfit2::poly2bmds(ps = c(b1 = 14, b2 = -0.1, er = 0.1), x = ex_conc), + power = tcplfit2::pow(ps = c(a = 1.23, p = 1.45, er = 0.1), x = ex_conc), + hill = tcplfit2::hillfn(ps = c(tp = 750, ga = 5, p = 1.76, er = 0.1), x = ex_conc), + gnls = tcplfit2::gnls(ps = c(tp = 750, ga = 15, p = 1.45, la = 50, q = 1.34, er = 0.1), + x = ex_conc), + exp2 = tcplfit2::exp2(ps = c(a = 0.45, b = 13.5, er = 0.1), x = ex_conc), + exp3 = tcplfit2::exp3(ps = c(a = 1.67, b = 12.5, p = 0.87, er = 0.1), x = ex_conc), + exp4 = tcplfit2::exp4(ps = c(tp = 895, ga = 15, er = 0.1), x = ex_conc), + exp5 = tcplfit2::exp5(ps = c(tp = 793, ga = 6.25, p = 1.25, er = 0.1), x = ex_conc) +) %>% + reshape2::melt(data = .,measure.vars = c( + "constant", + "poly1","poly2.mono.only","poly2.biphasic","power", + "hill","gnls","exp2","exp3","exp4","exp5" + )) + +## Updated Colors ## +fit_cols <- + # choose 10 distinct colors + viridis::magma(n = 11, direction = 1) %>% + # darken the original colors to make them more visible + colorspace::darken(., amount = 0.2) + +## Plot ## +fits %>% + ggplot() + + geom_line(aes(x = logc, y = value, lty = variable, colour = variable)) + + facet_wrap(facets = "variable") + + theme_bw() + + labs(lty = "Models", colour = "Models") + + scale_colour_manual(values = fit_cols) + + ggtitle("General Shape of Models Included in `tcplfit2`") + + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab("Response") +``` + +*This figure contains simulated concentration-response curves to illustrate the general underlying curve shape covered by each of the models included in the tcplfit2 package and used on the back-end of the level 4 data processing in tcpl. Each sub-plot in the figure corresponds to a single parametric model included in the model fitting process and has a corresponding color and line type to accompany it. All sub-plots are plotted such that the x-axis represents the log-transformed concentration ($base=10$) and the y-axis represents the response values.* + +## - Methods Assignment + +For demonstrating the assignment of MC4 methods, method '1' will be specified to calculate that the $bmad$ and estimate one standard deviation of baseline using the two lowest concentration groups of **treatment wells** (well type, or wllt, equal to "t"). + +Two examples of MC4 method assignments are provided below: (1) for a single assay endpoint and (2) all assay endpoints in containing string using **tcplGetAeid** . The assignment in the second approach can adapted for any subset of aeids. + +```{r eval=FALSE} +## Methods Assignment #1 ## +# Assign the MC4 processing methods to aeid 80 +tcplMthdAssign( + lvl = 4, # processing level + id = 80, # assay endpoint ID(s) to assign method(s) + mthd_id = c(1), # method(s) to be assigned + ordr = 1, # order the method(s) should be applied + type = "mc") # the data/processing type + +## Methods Assignment #2 ## +# Obtain the 'aeid' Values for all endpoints containing "ATG" string. +# "ATG" is the abbreviated assay source name of Attagene. +atg.aeid <- tcpl::tcplGetAeid(name = "ATG") +## Assign the MC4 processing methods for subset of aeids +tcpl::tcplMthdAssign( lvl = 4, + id = atg.aeid[, aeid], + mthd_id = c(1), ordr = 1, type = "mc") +``` + +With the methods assigned, the MC4 processing can be completed for the desired set of aeids. After MC4 is processed, the user can load the model fit information from database. + +```{r echo=FALSE, eval=FALSE} +# MC4 Processing for subset of aeids # +tcpl::tcplRun( id = atg.aeid[, aeid], slvl = 4L, elvl = 4L, type = 'mc' ) + +# Load the Mc4 data +mc4 <- tcplLoadData(lvl = 4, type = 'mc', fld = 'aeid', val = 80, add.fld = TRUE) +# Prepare the data into a readable format +mc4 <- tcplPrepOtpt(mc4) +``` + +A subset of MC4 data is available within the mc_vignette object. + +The level 4 data includes fields for each of the ten model fits as well as the ID fields, as defined [here](#mc4). Model fit information are prefaced by the model abbreviations (e.g. $\mathit{cnst}$, $\mathit{hill}$, $\mathit{gnls}$, $\mathit{poly1}$, etc.). The fields ending in $\mathit{success}$ indicate the convergence status of the model, where 1 means the model converged, 0 otherwise. NA values indicate the fitting algorithm did not attempt to fit the model. Smoothed model fits of the concentration-response data from the MC4 data object are displayed below: + +```{r fig.align='center',fig.dim=c(8,5.5),class.source = "scroll-100", warnings=FALSE, message=FALSE} +# Load the example data from the `tcpl` package. +data(mc_vignette, package = 'tcpl') +# Allocate the level 3 example data to `mc3`. +mc3_example <- mc_vignette[['mc3']] +# level 3 does not store logc anymore, create it for plotting purposes +mc3_example[, logc := log10(conc)] +# Obtain the MC4 example data. +mc4_example <- mc_vignette[["mc4"]] + +## Create a Sequence of Concentration Values within Observed Range ## +X <- seq( + mc4_example[which(mc4_example[, spid] == "01504209"), conc_min], + mc4_example[which(mc4_example[, spid] == "01504209"), conc_max], + length.out = 100 +) +## Obtain the Continuous Fit of Level 4 Model Estimates ## +# Apply each model fit to continous concentration values (X) and estimated +# parameters from 'tcplfit2'. +estDR <- mc4_example %>% + dplyr::filter(spid == "01504209") %>% + dplyr::reframe( + cnst = tcplfit2::cnst(.[, c(cnst_er)], x = X), + poly1 = tcplfit2::poly1(.[, c(poly1_a, poly1_er)], x = X), + poly2 = tcplfit2::poly2(.[, c(poly2_a, poly2_b, poly2_er)], x = X), + power = tcplfit2::pow(.[, c(pow_a, pow_p, pow_er)], x = X), + hill = tcplfit2::hillfn(.[, c(hill_tp, hill_ga, hill_p)], x = X), + gnls = tcplfit2::gnls(.[, c(gnls_tp, gnls_ga, gnls_p, gnls_la, gnls_q, gnls_er)], x = X), + exp2 = tcplfit2::exp2(.[,c(exp2_a, exp2_b, exp2_er)], x = X), + exp3 = tcplfit2::exp3(.[,c(exp3_a, exp3_b, exp3_p, exp3_er)], x = X), + exp4 = tcplfit2::exp4(.[,c(exp4_tp, exp4_ga, exp4_er)], x = X), + exp5 = tcplfit2::exp5(.[,c(exp5_tp, exp5_ga, exp5_p, exp5_er)], x = X) ) +# Format data into a data.frame for ease of plotting. +estDR <- cbind.data.frame(X, estDR) %>% + reshape2::melt(data = .,measure.vars = c( + "cnst", "poly1", "poly2", "power", "hill", "gnls", "exp2", "exp3", "exp4", "exp5")) + +## Updated Colors ## +fit_cols <- + # choose 10 distinct colors + viridis::magma(n = 10,direction = 1) %>% + # darken the original colors to make them more visible + colorspace::darken(., amount = 0.2) + +## Plot the Model Fits from Level 4 ## +mc3_example %>% + dplyr::filter(spid == "01504209") %>% + ggplot(.,aes(x = logc, y = resp))+ + geom_point(pch = 1, size = 2)+ + geom_line(data = estDR, + aes(x = log10(X), y = value, colour = variable, lty = variable)) + + labs(colour = "Models", lty = "Models") + + scale_colour_manual(values = fit_cols) + + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) +# )+ + ggtitle( + label = paste("Level 4 Model Fits", + mc4_example[which(mc4_example[,spid] == "01504209"), dsstox_substance_id], + sep = "\n"), + subtitle = paste("Assay Endpoint: ", + mc4_example[which(mc4_example[, spid] == "01504209"), aenm])) + + theme_bw() +``` + +*The plot depicts the observed concentration-response data with white circles, where the x-axis is base 10 log-transformed concentration values. All the ten model fits are displayed and distinguished by color and line-type.* + +How well the model is fitting the data (i.e. goodness of fit) can be approximated by the Akaike Information Criterion (AIC) and the root mean square error (RMSE or RME). For the AIC, let $log(\mathcal{L}(\hat{\theta}, y))$ be the log-likelihood of the model $\hat{\theta}$ given the observed values $y$, and $K$ be the number of parameters in $\hat{\theta}$, then, + +$$\mathrm{AIC} = -2\log(\mathcal{L}(\hat{\theta}, y)) + 2K\mathrm{.} $$ + +The RMSE is given by + +$$\mathrm{RMSE} = \sqrt{\frac{\sum_{i=1}^{N} (y_{i} - \mu_{i})^2}{N}}\mathrm{,}$$ + +where $N$ is the number of observations, and $\mu_{i}$ and $y_{i}$ are the estimated and observed values at the $i^{th}$ observation, respectively. + +## > Level 5 + +Level 5 processing determines the winning model and activity for the concentration series, bins all of the concentration series into fitc categories, and calculates various potency estimates. + +## - Methods Assignment + +**The model with the lowest AIC value is selected as the winning model** ($\mathit{modl}$ ), and is used to determine the activity (or hit call) for the concentration series. If two models have equal AIC values, then the simpler model (i.e. model with fewer parameters) wins. Additionally, if the constant model describes the response best out of all the models fit then $\mathit{modl}$ is reported as 'none'. An example of side-by-side comparison of AIC values from each of the ten model fits for the example dataset mc_vignette is provided. + +```{r echo=FALSE} +# Obtain the MC4 example data. +mc4_example <- mc_vignette[["mc4"]] +# Obtain the AIC values from each of the model fits from +# the level 4 data. +mc4_aic <- mc4_example %>% + dplyr::select(., grep(colnames(.),pattern = "aic")) %>% + round(.,3) %>% + apply(.,MARGIN = 1, FUN = function(x){ + cell_spec(x,color = ifelse(x == min(x), + yes = "blue", + no = "black")) + }) %>% t() %>% + data.frame() %>% + cbind.data.frame(mc4_example[,dsstox_substance_id],.) +# Rename the columns. +colnames(mc4_aic) <- + colnames(mc4_example)[grep(colnames(mc4_example),pattern = "aic")] %>% + stringr::str_remove(.,pattern = "_aic") %>% c("dsstox_id",.) +# Export/display the table in an HTML format. +mc4_aic %>% + kbl( + escape = FALSE, + format = 'html', + centering = TRUE) %>% + kable_styling( + font_size = 14, + c("striped", "hover"), + full_width = FALSE + ) +``` + +The summary values and estimated parameters from the winning model are stored in the respective [mc5](#mc5) and [mc5_param](#mc5_param) tables. The activity of each concentration-response series is determined by calculating a continuous hit call that may be further binarized into active or inactive, depending on the level of stringency required by the user; herein, hitc < 0.9 are considered inactive. The efficacy cutoff value ($\mathit{coff}$) is defined as the maximum of all values given by the methods assigned at level 5. When two or more methods (i.e. cutoff values) are applied for processing, the largest cutoff value is always selected as the cutoff for the endpoint. In the event only one method is applied, then that will serve as the efficacy cutoff for the endpoint. Failing to assign a level 5 method will result in every concentration series being called active. For a complete list of level 5 methods, see tcplMthdList(lvl = 5) or ?MC5\_Methods . See the [Data Interpretation](#hitc) section for more details on hit calls and cutoff. + +While the ToxCast pipeline supports bidirectional fitting, sometimes it is necessary to censor the hitc of curves fit in the biologically irrelevant direction. There are two methods for overwriting the hitc value, and if applied, these will overwrite the hitc value for any biologically irrelevant curve by flipping the hitc to a negative value. + +```{r warning = FALSE, echo = FALSE} +Method <- c(27,28) +Method_Name <- c("ow_bidirectional_loss", "ow_bidirectional_gain") +Description <- c( + "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." +) +# Compile all of the information for the table. +output <- data.frame(Method,Method_Name,Description) +# Export/print the table to an html rendered table. +htmlTable(output, + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', + caption="Table 11: Level 5 overwrite (ow) methods for hitcalls in unintended direction." + ) +``` + +The example we include in this vignette for demonstrating the assignment of level 5 methods specifies three different efficacy cutoff estimates for consideration. These efficacy cutoff estimates include $3*\mathit{bmad}$, $log_2(1.2)$, and $5*\mathit{bmad}$, which correspond to $\mathit{mthd\_id}$ assignments 1, 3, and 5 respectively, and the largest of these three values will be selected as the cutoff for the endpoint. With the methods assigned, the data are ready for MC5 processing. + +```{r eval=FALSE} +# Assign the MC5 Processing Methods to aeid 80 +tcplMthdAssign( + lvl = 5, # processing level + id = 80, # assay endpoint ID(s) to assign method(s) + mthd_id = c(1, 3, 5), # method(s) to be assigned + ordr = 1:3, # order the method(s) should be assigned + type = "mc") # the data/processing type + +#MC5 processing for aeid 80 +tcpl::tcplRun( + id = atg.aeid[, aeid], # assay endpoint id to pipeline + slvl = 5L, # level to start pipelining on + elvl = 5L, # level to end pipelining on + type = 'mc' # endpoint processing type - 'mc' = "multiple concentrations" +) + +# Load MC 5 data for aeid 80 +mc5 <- tcplLoadData(lvl = 5, + type = 'mc', + fld = 'aeid', + val = 80, + add.fld = TRUE) +# Prepare the data into a readable format. +mc5 <- tcplPrepOtpt(mc5) +``` + +A subset of MC5 data is available in the mc_vignette object, and includes fields for the best model fit, the potency estimates, other estimates from the best model fit, as well as the ID fields. The user can visualize the model fitting results using the tcplPlot functions. See the [Data Retrieval with invitrodb and via API](#data_retrieval) sections for more information. +```{r} +# Allocate the level 5 data in `mc_vignette` to the `mc5` object. +mc5_example <- mc_vignette[["mc5"]] +``` + +For demonstrative purposes, an alternative visual of the model fits from MC4 and the best model as well as the potency estimates from MC5 data is produced below.{#mc5_plot} + +```{r fig.align='center',fig.dim=c(8,5.5),class.source = "scroll-100"} +## Obtain Data ## +# Load the example data from the `tcpl` package. +data(mc_vignette,package = 'tcpl') +# Allocate the level 3 example data to `mc3`. +mc3_example <- mc_vignette[['mc3']] +# level 3 does not store logc anymore, create it for plotting purposes +mc3_example[, logc := log10(conc)] +# Obtain the MC4 example data. +mc4_example <- mc_vignette[["mc4"]] +# Obtain the MC4 example data. +mc5_example <- mc_vignette[["mc5"]] +# First, we need to obtain the subset of data related to spid = "01504209", +# which is our example spid. +mc3_ss <- mc3_example %>% dplyr::filter(spid == "01504209") # Level 3 - conc-resp series +mc4_ss <- mc4_example %>% dplyr::filter(spid == "01504209") # Level 4 - model fits +mc5_ss <- mc5_example %>% dplyr::filter(spid == "01504209") # Level 5 - best fit & est. +# Next, we need to obtain the smooth curve estimate for the best model found +# in the Level 5 analyses of the `tcpl` pipeline. +# See Level 4 example above for how estDR is calculated. +estDR <- estDR %>% + dplyr::mutate(., best_modl = ifelse(variable == mc5_ss[, modl], + yes = "best model", no = NA)) + +## Generate a Base Concentration-Response Plot ## +basePlot <- mc3_ss %>% + # Observed Concentration-Response Data + ggplot()+ + geom_point(aes(x = logc,y = resp),pch = 1,size = 2) + + # Cutoff Band + geom_rect(data = mc5_ss, + aes(xmin = log10(conc_min), xmax = log10(conc_max), ymin = -coff, ymax = coff), + alpha = 0.15, fill = "skyblue") + + # Best Model Fit + geom_line(data = dplyr::filter(estDR, variable == mc5_ss[,modl]), + aes(x = log10(X), y = value,color = mc5_ss[,modl])) + + scale_colour_manual(values = c("royalblue3"), aesthetics = "color") + + # Other Model Fits + geom_line(data = dplyr::filter(estDR,variable != mc5_ss[, modl]), + aes(x = log10(X), y = value, lty = variable), + alpha = 0.3, show.legend = TRUE) + + # Legend Information + labs(lty = "Other Models", color = "Best Fit") + + # Titles and Labels + xlab(expression(paste(log[10], "(Concentration) ", mu, "M"))) + + ylab(expression(paste(log[2], "(Fold Induction)"))) +# )+ + ggtitle( + label = paste("Level 5 Best Model Fit", + mc4_ss[which(mc4_ss[, spid] == "01504209"), dsstox_substance_id], + sep = "\n"), + subtitle = paste("Assay Endpoint: ", + mc4_ss[which(mc4_ss[,spid] == "01504209"), aenm])) + + # Background Plot Theme + theme_bw() + +## Potency Estimate Layers ## +# First, we need to obtain/assign colors for the potency estimates to be displayed. +potency_cols <- + # choose 5 distinct colors + viridis::plasma(n = 5, direction = -1) %>% + # darken the original colors to make them more visible + colorspace::darken(., amount = 0.1) + +## Compile the Full Level 5 Plot ## +linePlot <- + # Start with the `basePlot` object. + basePlot + + # Next, add the various potency layers. + # BMD + geom_hline( + data = mc5_ss, + aes(yintercept = bmr), + col = potency_cols[1] + ) + + geom_segment( + data = mc5_ss, + aes(x = log10(bmd), xend = log10(bmd), y = -0.5, yend = bmr), + col = potency_cols[1] + ) + + geom_hline( + data = mc5_ss, + aes(yintercept = coff), + col = potency_cols[2] + ) + + geom_segment( + data = mc5_ss, + aes(x = log10(acc), xend = log10(acc), y = -0.5, yend = coff), + col = potency_cols[2] + ) + + geom_hline( + data = mc5_ss, + aes(yintercept = max_med * 0.5), + col = potency_cols[3] + ) + + geom_segment( + data = mc5_ss, + aes( + x = log10(ac50), xend = log10(ac50), + y = -0.5, yend = max_med * 0.5 + ), + col = potency_cols[3] + ) + + geom_hline( + data = mc5_ss, + aes(yintercept = max_med * 0.1), + col = potency_cols[4] + ) + + geom_segment( + data = mc5_ss, + aes( + x = log10(ac10), xend = log10(ac10), + y = -0.5, yend = max_med * 0.1 + ), + col = potency_cols[4] + ) + + geom_hline( + data = mc5_ss, + aes(yintercept = max_med * 0.05), + col = potency_cols[5] + ) + + geom_segment( + data = mc5_ss, + aes( + x = log10(ac5), xend = log10(ac5), + y = -0.5, yend = max_med * 0.05 + ), + col = potency_cols[5] + ) + +# create data table for potency estimate points +mc5_points <- mc5_ss %>% + select(bmd, acc, ac50, ac10, ac5) %>% + tidyr::pivot_longer(everything(), names_to = "Potency Estimates") %>% + mutate(x = log10(value)) %>% + mutate(mc_color = potency_cols) %>% + mutate(`Potency Estimates` = toupper(`Potency Estimates`)) +yvals <- mc5_ss %>% + select(bmr, coff, max_med) %>% + tidyr::pivot_longer(everything()) %>% + select(value) %>% + mutate(reps = c(1, 1, 3)) %>% + tidyr::uncount(reps) %>% + mutate(y = value * c(1, 1, .5, .1, .05)) %>% + select(y) +mc5_points <- mc5_points %>% cbind(yvals) + +# add Potency Estimate Points and set colors +fullPlot <- linePlot + geom_point( + data = mc5_points, + aes(x = x, y = y, fill = `Potency Estimates`), shape = 21, cex = 2.5 +) + + scale_fill_manual(values = mc5_points %>% arrange(`Potency Estimates`) %>% pull(mc_color)) + +## Display the Compiled Plot ## +fullPlot +``` + +* Each of the concentration-response models fit in MC4 are included in the plot, where the blue curve indicates the best model fit for the observed data (white circles) and the rest are depicted by the gray curves. The light-blue shaded region represents the estimated efficacy cutoff ($\mathit{coff}$). The horizontal lines show the activity response levels from which potency estimates of interest are defined, and the vertical lines show the corresponding potency estimates. The black point shows the AC~5~ (concentration producing $5 \%$ of the maximal response), the purple point shows the AC~10~ (concentration producing $10 \%$ of the maximal response), the yellow point shows the BMD (benchmark dose), the orange point shows the ACC (concentration producing a response at the efficacy cutoff), and the pink point shows the AC~50~ (concentration producing $50 \%$ of the maximal response).* + +Additional information on derivations on potency estimates is found in [Data Interpretation>Potency Estimates](#potency). After curve fitting, all concentration series are also assigned a fit category ($\mathit{fitc}$) based on similar characteristics and shape. See the [Data Interpretation>Fit Category](#fitc) section for more details. + +## - Level 6 + +In addition to the continuous $hitc$ and the $fitc$, cautionary flags on curve-fitting can provide context to interpret potential false positives (or negatives) in ToxCast data, enabling the user to decide the stringency with which to filter these targeted in vitro screening data. These flags are programmatically generated and indicate characteristics of a curve that need extra attention or potential anomalies in the curve or data. See the [Data Interpretation>Flags](#flags) section for more details. + +## - Level 7 +For invitrodb v4.2 onward, a new mc7 table contains pre-generated AED values using several potency metrics from invitrodb and a subset of models from the High-throughput Toxicokinetics R package httk. AEDs are generated in a separate script using the [httk R package](https://CRAN.R-project.org/package=httk). This is done separately due to the resource-intensive nature of running the Monte Carlo simulations to get estimates of plasma concentration for the median (50th %-ile) and most sensitive (95th %-ile) toxicokinetic individuals. Moreover, this is applied to both the 3-compartment steady state (3compartments) model and the physiologically-based toxicokinetic (pbtk) model for all chemicals included in invitrodb v4.2 (generation of the table as configured in the current code took 24h using 40 cores). See the [Administered Equivalent Dose](#aed) section. + +## Compiled Processing Examples + +This section includes a practical applications for single- and multiple-concentration data, from methods assignment through data processing. + +## - SC Data + +After SC0 is loaded into the database, SC1 and SC2 methods can be assigned. Once assigned, data can be processed. + +```{r eval=FALSE, class.source = "scroll-300"} +## Methods Assignment +tcplMthdAssign(lvl = 1, id = 1:2, mthd_id = c(1, 11, 13), ordr = 1:3, type = "sc") +tcplMthdAssign(lvl = 2, id = 1, mthd_id = 3, type = "sc") +## SC0-2 Processing by acid +tcplRun(id = 1, type = "sc", slvl = 0, elvl = 2) +``` + +## - MC Data + +After MC0 is loaded into the database, methods can be assigned. Once assigned, data can be processed. This can be done in two ways: (A) from start to finish (i.e. Level 0 to 5) with the assay component ID (acid) or (B) Level 0 to 3 with the assay component ID (acid) and Level 4 to 5 with the assay endpoint ID (aeid). Option A may be helpful if data needs to be processed completely, whereas Option B or derivatives of Option B may be helpful when adjusting methods. + +```{r eval=FALSE} +## Methods Assignment +# No MC1 methods needed +tcplMthdAssign(lvl = 2, id = 1, mthd_id = c(3,4,2), ordr = 1:3, type = "mc") +tcplMthdAssign(lvl = 3, id = 2, mthd_id = 1, ordr = 1, type = "mc") +tcplMthdAssign(lvl = 4, id = 2, mthd_id = 1, ordr = 1:2, type = "mc") +tcplMthdAssign(lvl = 5, id = 2, mthd_id = c(1,3,5), ordr = 1:3, type = "mc") +tcplMthdAssign(lvl = 5, id = 2, mthd_id = c(1,3,5), ordr = 1:3, type = "mc") + +## Assign the Number of Processing Cores. +mycores <- 1 # If users do NOT want to leverage parallel computing. +# Users that want to leverage parallel computing set to > 1, but less than the total number of cores +# (i.e. need at least 1 core open for overhead). If not provided, this will be assumed. +# "parallel::detectCores()" can be run to understand the maximum allowed number of cores. + +## Option A: MC0-5 Processing by acid +tcplRun(id = 80, type = "mc", slvl = 0L, elvl = 5L, mc.cores = 20) + +##Option B: MC0-3 Processing by acid, followed by MC4-6 by aeid +tcplRun(id = list$acid, type = "mc", slvl = 0L, elvl = 3L) +tcplRun(id = list$aeid, type = "mc", slvl = 4L, elvl = 5L) +``` + +# Data Interpretation {#data_interp} +After fitting, a continuous hit call (hitc) is calculated as the product of three proportional weights. Several potency estimates are also calculated for the winning model, including activity concentrations at specified levels of response, such as concentration at 50% of maximal activity (AC50) and concentration at activity observed at the cutoff (ACC), and a benchmark dose (BMD) at a specified benchmark response (BMR). This section will review the statistics behind the activity and potency estimates available for each concentration-response series and how the user may interpret these values alongside other available information, such as fit categories, representative samples, and cytotoxicity burst thresholds. Overall, this Data Interpretation section seeks to enhance user confidence in reviewing and using ToxCast data for different tasks. + +## Hit Calls {#hitc} +In tcpl v2, activity hit calls (hitc) were binary, where 0 was negative, 1 was positive, and −1 corresponded to concentration-response series that tcpl was “unable to fit” (e.g., <4 concentrations). In tcpl v3 onwards, the hitc is the product of three proportional weights, and the resulting continuous value is between 0 and 1, though the values are not normally distributed and tend to approach 0 or 1. Hitcalls that approach 1 indicate concentration-response series with biological activity in the measured response (i.e. 'active' hit). $Hitc$ is typically binarized into active or inactive designations, depending on the level of stringency required by the user. For current ToxCast work, a $hitc$ greater than or equal to 0.90 is labeled active, whereas anything less was considered inactive. This threshold of 0.90 was based on other $tcplfit2$ implementations with in vitro screening data [(Nyffeler et al., 2023)](https://doi.org/10.1016/j.taap.2023.116513) and reflects the apparent bimodal nature of the $hitc$ distribution, where a preponderance of the $hitc$ fall between 0 and 0.1 and 0.9 and 1.0. Users may interpret the continuous $hitc$ into active or inactive designations based on different thresholds. Further testing through implementation of this new functionality may reveal appropriate thresholds for different applications or assays. The “unable to fit” series now appear as model “none” with a $hitc$ of 0 (inactive). Negative $hitc$ in tcpl v3.2 correspond to curves that suggest biological activity in an unintended direction, as further described below. + +Continuous $hitc$ as defined in [tcplfit2 R package](https://CRAN.R-project.org/package=tcplfit2) is calculated as the product of three proportional weights representing the confidence that: + +* $p1$: “the winning AIC value is less than that of the constant model.” + * Determine whether the constant model – if allowed to win – is a better fit than the winning model – i.e., is the winning model essentially flat or not.The constant model may never be selected as the winning model, but if the constant model has the lowest AIC compared to other models, the calculated continuous hitc will be zero. +* $p2$: “at least one median response is greater than the cutoff.” + * At least one dose group has a central tendency of the response values “outside” the cutoff band (consider bi-directional). Response is greater than cutoff in “+” direction and less than cutoff in “–” direction. +* $p3$: “the top of the fitted curve is above the cutoff” + * Determine whether the predicted maximal response exceeds the cutoff, i.e. the response corresponding to the effect size of interest. + +See [Sheffield et al., 2021](https://doi.org/10.1093/bioinformatics/btab779) for more information on tcplfit2. + +## Cutoff +The cutoff is a user-defined level of efficacy that corresponds to statistical and/or biological relevant change from baseline for each assay endpoint. All versions of tcpl provide methods for estimation of the baseline sampling variability, or noise around the assay controls, including calculation of the median absolute deviation over all response values given by wells that may represent baseline response (the BMAD), such as the neutral or vehicle control or the first two concentrations in the concentration series for all chemicals screened as defined by Level 4 methods. Users define mc5 methods depending on assay and data type, with some common cutoff thresholds used to establish a cutoff including $3*BMAD$, 20% percent change, or 1.2*log10 fold-change. Operationally in tcpl, the efficacy cutoff value ($\mathit{coff}$) is defined as the maximum of all values given by the methods assigned at level 5. When two or more methods (i.e. cutoff values) are applied for processing, the largest cutoff value is always selected as the cutoff for the endpoint. In the event only one method is applied, then that will serve as the efficacy cutoff for the endpoint. Failing to assign a level 5 method will result in every concentration series being called active. For a complete list of level 5 methods, see tcplMthdList(lvl = 5) or ?MC5\_Methods. + +## Potency Estimates {#potency} +Curve-fitting enables determination of various metrics of potency, i.e., concentrations at which some amount of *in vitro* bioactivity is expected to occur, as illustrated [above](#mc5_plot). This includes Activity Concentrations at Specified Response and Benchmark Dose (BMD), which vary in the mathematical approach for computing these values, noting that logic for computation of the BMD is controlled in the R package `tcplfit2`. + +## - Activity Concentrations at Specified Response + +An activity concentration is the estimated concentration inducing a specified level of response (activity). A common potency metric used from tcpl is the activity concentration at 50% of maximal activity, or **AC50**. The default baseline region is defined as ± $3*BMAD$⁠, and the ACB is the concentration at which the model first reaches a default of $3*BMAD$⁠, whereas ACC is defined as the concentration at which the model reaches the user-defined cutoff. Note that potency metrics such as **AC50** are reported even if the hit call is inactive if a non-constant model could be fit to the data. + +All versions of tcpl output the activity concentrations as described in Table 2. + +```{r warning = FALSE, echo = FALSE} +Activity_Concentration_uM <- c("AC5", "AC10", "AC20", "AC50", "ACB", "ACC", "AC1SD") +Specified_Level_of_Response <- c("Concentration at 5% of the maximal response", + "Concentration at 10% of the maximal response", + "Concentration at 20% of the maximal response", + "Concentration at 50% of the maximal response", + "Concentration at baseline of 3*BMAD", + "Concentration at the user-defined cutoff", + "Concentration at 1 standard deviation from baseline") + +output <- data.frame(Activity_Concentration_uM, Specified_Level_of_Response) + +kable(output)%>% + kable_styling("striped") +``` + +## - Benchmark Dose {#bmd} + +A Benchmark Dose (BMD) is the activity concentration observed at the Benchmark Response (BMR) level. In the current implementation of tcpl and tcplfit2, BMR is only defined as 1.349 standard deviations of baseline response in the two lowest concentrations of treatment wells or neutral controls wells, as defined by Level 4 methods. tcpl uses the following definitions and assumptions for setting the BMR: + +BMR is a change from the mean response at baseline $(𝜇(𝑏))$ by some multiple $(𝑐)$ of the standard deviation of the baseline $(𝑠𝑑(𝑏))$. + +
+ +$𝜇(𝑏)+𝑐∗𝑠𝑑(𝑏)=𝐵𝑀𝑅=𝜇(𝐵𝑀𝐷)$ + +
+ +Here, the baseline $(𝑏)$ is defined as samples from the two lowest concentrations across chemicals within an assay endpoint and the $𝑐=1.349a$ [(Yang et al., 2017)](https://doi.org/10.1186/1471-2164-8-387). + +A 90% confidence interval around the BMD, bounded by the benchmark dose lower bound (BMDL) and the benchmark dose upper bound (BMDU), is also computed and provided to reflect the uncertainty in the BMD estimate. The calculation of these confidence intervals will occasionally fail due to a singular matrix inverse, and in these cases, BMDU and BMDL will not be reported. This case occurs when the data are especially noisy and the confidence interval around the BMD approaches infinity. The winning model may return a $\mathit{bmd}$ estimate that falls outside of the tested concentration range, so bounds are placed to censor the estimate values. The lower and upper bounds for $\mathit{bmd}$ estimates are $0.1*\text{the lowest test concentration}$ and $10*\text{the the highest test concentration}$, respectively. If the calculated $\mathit{bmd}$ estimate is below or above the lower or the upper bounds, the value at the bound will be returned as the bounded $\mathit{bmd}$ estimate instead. + +## Fit Categories {#fitc} + +
![Fit Category Tree](img/Fig5_fitc_tree_10jul2023.png)
+ +A hierarchical fit category ($\mathit{fitc}$) decision tree is used to bin each fit as shown in Figure 2. Each fit falls into one leaf of the tree using the described logic with the final $\mathit{fitc}$ indicated with gray boxes. Abbreviations are defined as: $\mathit{conc}$ = concentration; $\mathit{hitc}$ = hit call; $\mathit{|top|}$ = absolute value of the modeled curve top; $\mathit{coff}$ = cutoff; $log_c(min)$ = minimum log~10~ concentration tested; $log_c(max)$ = maximum log~10~ concentration tested; AC~50~ = $50 \%$ activity concentration; AC~95~ = $95 \%$ activity concentration. + +After curve fitting, all concentration series are assigned a fit category ($\mathit{fitc}$) based on similar characteristics and shape. Logic is based on relative activity, efficacy, and potency comparisons as shown in Figure 5. For continuity purposes, $\mathit{fitc}$ numbering has been conserved from past tcpl versions. Grouping all series into $\mathit{fitc}$ enables quality control and can be useful in data cleaning applications, especially when considered with Level 6 flags. In invitrodb v3-3.5, a common filtering approach removed the least reproducible curve-fits, i.e. those with very low AC~50~ (below the screened $\mathit{conc}$ range) and low efficacy (within 1.2-fold of the cutoff) as well as 3+ flags. However, preliminary investigation into invitrodb v4.1-4.2 has suggested that removing curve fits with 4 or more flags, or possibly filtering based on specific flags in combination with fitc such as fitc 36, may be a more appropriate filtering approach due to changes in curve fitting and flags in invitrodb v4 and beyond. The stringency of filtering for flags should be explored in a fit-for-purpose way. + +Fit category is largely based upon the relative efficacy and, in the case of actives, the location of the AC~50~ and concentration at $95 \%$ activity (an estimate of maximum activity concentration, AC~95~) compared to the tested concentration range. All concentration response curves are first split into active, inactive, or cannot determine. “Cannot determine” is indicative of exceptions that cannot be curve-fit, e.g. a concentration series with fewer than 4 concentrations. Active designations are determined for $\mathit{fitc}$ based on whether the $\mathit{hitc}$ surpasses the 0.90 threshold. For those series that are designated inactive with a $\mathit{hitc}$ less than 0.90, $\mathit{fitc}$ can be used to indicate to what extent the curve represents borderline inactivity via comparison of top modeled efficacy to the cutoff (i.e, the absolute value of the modeled top is less than 0.8 times the cutoff). + +For active curves, efficacy, as represented by the modeled top, is compared to 1.2 times the cutoff (less than or equal to, or greater than), thereby differentiating curves that may represent borderline activity from moderate activity. Active curves also have potency metrics estimated, e.g., AC~50~ and AC~95~ values, that can be compared to the range of concentrations screened to indicate curves for which potency estimates are more quantitatively informative. Curves for which the AC~50~ is less than or equal to the minimum concentration tested ($\mathit{fitc}$ = 36, 40) may indicate AC~50~ values that are less quantitatively informative than AC~50~ values within the concentration range screened. When the AC~50~ is greater than the minimum concentration tested but the AC~95~ is greater than or equal to the maximum concentration tested ($\mathit{fitc}$ = 38, 42), it is possible the maximum activity was not fully observed in the concentration range screened. $\mathit{Fitc}$ for curves where the AC~50~ and AC~95~ are both within the concentration range screened ($\mathit{fitc}$ = 37, 41) represent the most quantitatively informative AC~50~ values. + +$\mathit{Fitc}$ 36 describes a curve that is of low efficacy and with a low AC~50~, below the concentration range screened. These are more likely to be noise or less reproducible fits. $\mathit{Fitc}$ 41 and 42 are the ideal $\mathit{fitc}$ for reproducible curves, as demonstrated by these two $\mathit{fitc}$ comprising the majority of positive ($\mathit{hitc}$ > 0.9) curves in invitrodb v4.1. $\mathit{Fitc}$ 40 indicates a curve with at least moderate efficacy, but an AC~50~ below the concentration range screened. These chemicals may be positive or reference chemicals screened in the incorrect concentration window to observe their minimum activity. These curves may also represent high-confidence positives for which we have limited understanding of the slope of the concentration-response curve, and as such, the AC~50~ may be associated with more uncertainty. + +## Flags (Level 6) {#flags} + +In addition to the continuous $hitc$ and the $fitc$, cautionary flags on curve-fitting can provide context to interpret potential false positives (or negatives) in ToxCast data, enabling the user to decide the stringency with which to filter these targeted in vitro screening data. Cautionary flags on fitting were developed in previous versions of tcpl and have been stored at Level 6. These flags are programmatically generated and indicate characteristics of a curve that need extra attention or potential anomalies in the curve or data. + +For example, a curve may be considered a single point hit with activity not at the highest concentration tested, but re-inspection of the flagged curve could indicate a potential false positive. Other flags may suggest borderline activity, overfitting, or cell viability assays that are fit with gain-loss as the winning model. It is important to note that flags have no effect on the $hitc$ or potency estimates, but they may indicate that a curve requires further examination to aid in data interpretation. A full list of flags implemented and descriptions is presented below: + +```{r lvl-6-flag-table, warning = FALSE, echo = FALSE} +# First column - Level 6 Method ID +Method <- c(5:11, 13:15, 17:20) + +# Second column - Level 6 Flag Names +FlagNames <- c("modl.directionality.fail", "singlept.hit.high", "singlept.hit.mid", + "multipoint.neg", "bmd.high", "noise", "border", "low.nrep", + "low.nconc", "gnls.lowconc", "efficacy.50", "ac50.lowconc", + "viability.gnls", "no.med.gt.3bmad") +# Third column - Level 6 Flag Descriptions +FlagDescription <- c("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 $count(resp < -1 * coff) < 2 * count(resp > coff)$. + If gain was winning directionality + $(top > 0)$, flag if $count(resp > coff) < 2 * count(resp < -1 * coff)$.", + "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 if modeled benchmark dose $(BMD)$ is greater than AC~50~ + (concentration at 50% maximal response). This is indicates high + variability in baseline response in excess of more than half of the maximal + response.", + "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)$; + $rmse > coff$", + "Flag series if borderline activity is suspected based on modeled top + parameter $(top)$ relative to cutoff $(coff)$; $|top| <= 1.2 * coff$ or + $|top|>= 0.8 * coff$.", + "Flag series if the average number of replicates per concentration is less than + 2; $nrep < 2$.", + "Flag series if 4 concentrations or less were tested; $nconc <= 4$.", + "Flag series where winning model is gain-loss $(gnls)$ and the gain AC~50~ is less + than the minimum tested concentration, and the loss AC~50~ is less than the mean + tested concentration.", + "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%; + intended for biochemical assays. If $hitc >= 0.9$ and $coff >= 5$, then flag when + $top < 50$ or $max\\_med < 50$. If $hitc >= 0.9$ and $coff < 5$, then flag when + $top < \\log_{2}(1.5)$ or $max\\_med < \\log_{2}(1.5)$.", + "Flag series with an active hit call $(hitc >= 0.9)$ if AC~50~ (concentration + at 50% maximal response) is less than the lowest concentration tested; if + $hitc >= 0.9$ and $AC_{50} < 10^{\\log_c(min)}$, 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)$ or less than baseline as defined by -3 times $bmad$; both $nmed\\_gtbl\\_pos$ and $nmed\\_gtbl\\_neg = 0$, where $nmed\\_gtbl\\_pos$ is the number of median response values $> 3 * bmad$ and $nmed\\_gtbl\\_neg$ is the number of median response values $< -3 * bmad$.") + +# Consolidate all columns into a table. +output <- data.frame(Method, FlagNames, FlagDescription) + +htmlTable(output, + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ' ) +``` + +## Representative Samples {#chid} + +Multiple samples of the same chemical (many spids per chid) may be tested for a given assay endpoint. The **tcplSubsetChid** function subsets multiple-concentration Level 5 (MC5) or single-concentration Level 2 (SC2) data to select the "best" single tested sample to represent that chemical for a given endpoint. The function uses a series of logic to select the "representative sample" in MC and SC. Representative sample designation for a tested chemical are stored in the MC5_chid and SC2_chid tables, where 1 indicates if ID (M5ID or S2ID, respectively) is a representative sample, else 0. + +### MC Representative Samples +To select a representative sample in MC, a "consensus hitc" is made by taking the mean of all binarized sample hitc, with ties defaulting to active. After the chemical-wise hitc is made, the samples corresponding to chemical-wise hit call are logically ordered using the fit category, the number of the flags, and AC50, then the first sample for every chemical is selected. This logic prioritizes active over inactive hit calls when there is a disagreement among samples, but then attempts to pick the representative sample with the highest quality curve, with the goal of minimizing false negatives. Logic encompasses the following: + +1. Hitc are first binarized to active (1) or inactive (0), where hitc >= 0.9 is deemed active. Mean of the binarized hitc across samples is calculated for the chemical. Representative sample must match mean activity call (active or inactive), where a mean activity hit call >= 0.5 is considered active. +2. Samples are prioritized first by [Fit Categories](#fitc). Generally AC50 values within concentration range (fitc = 37, 41) are prioritized over AC50 values above concentration range (fitc = 38, 42) then AC50 values below concentration range (fitc = 36, 40) +4. Samples are then sorted based on number of flags. Curve fits for samples with fewer flags are prioritized. +5. Finally, if all things are equal, the sample with a lower AC50 is selected over higher AC50. + +### SC Representative Samples +To select a representative sample in SC, a "consensus hitc" is made by taking the mean of all sample hitc, with ties defaulting to active. After the chemical-wise hitc is made, the samples in the consensus hitc are ordered based on lowest concentration tested and the sample with the maximum median response is selected. + +## Variable Matrices + +The tcplVarMat function creates chemical-by-endpoint matrices, combining summary information for single-concentration and/or multiple-concentration screening. Such a matrix can be useful for understanding which chemicals were tested, and what hit calls and potency values resulted from this screening. For example, one might ask, "Which chemicals were screened in either single-concentration or multi-concentration for some assay endpoint, and if MC screening was performed, what potency was estimated for any observed activity?" + +For variable matrices from tcplVarMat , a representative sample is selected using the tcplSubsetChid function in cases where a chemical-by-endpoint was tested in multiple samples (performed separately for multiple-concentration or single-concentration screening). When multiple sample-assay series exist for one chemical, a single series is selected by the tcplSubsetChid function. See the [Representative Samples section](#chid) for more information.
+ + 1. "ac50" -- The active concentration at 50% maximal response ($\mathit{AC_{50}}$) for the winning model.
+ 2. "ac50_verbose" -- The $\mathit{AC_{50}}$ for the winning model, with text inserted in place for some situations touched on below.
+ 3. "acc" -- The active concentration at user-defined cutoff ($\mathit{ACC}$ ) for the winning model.
+ 4. "acc_verbose" -- The $\mathit{ACC}$ for the winning model, with text inserted in place for some situations touched on below.
+ 5. "mc_hitc" -- The hit-call for the winning model in multiple-concentration (MC) screening.
+ 6. "sc_hitc" -- The hit-call in single concentration (SC) screening.
+ +tcplVarMat produces matrices of combined sc-mc output. For the $\mathit{AC_{50}}$ and $\mathit{ACC}$ matrices specifically, values are inserted in place to show complete views of what was tested and what the results. Further, "ac50_verbose" and "acc_verbose" replace such values with text. $\mathit{AC_{50}}$ and $\mathit{ACC}$ are: + +- Value as reported when the chemical is tested in MC and positive +- 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". +- Left as NULL if chemical is not tested in either MC or SC. + +Both SC and MC data are required for tcplVarMat. As a result, the "API" driver is not currently supported for invitrodb v4.1 since it does not return SC data. + +In addition, additional matrices can be defined by the 'add.vars' parameter. The 'add.vars' parameter will take any Level 4 or 5 field and create the respective matrix. + +```{r varmat_use, eval = FALSE} +# create matrices with all chemicals and assays; the entire database +varmat <- tcplVarMat() +# create matrices using a subset of chemicals and/or aeids +aeids <- c(80) +dtxsid <- c("DTXSID80379721", "DTXSID10379991", "DTXSID7021106", "DTXSID1026081") +varmat <- tcplVarMat(aeid = aeids, dsstox_substance_id = dtxsid) +# create extra matrices by adding vars +varmat <- tcplVarMat(aeid = aeids, add.vars = c("m4id", "resp_max", "max_med")) +``` + +**tcplVarMat** returns 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). To export this list, save to a .xlsx. Each matrix will have its own sheet. + +```{r varmat_save, eval = FALSE} +library(writexl) +write_xlsx(varmat, path = "varmat_output.xlsx") +``` + +## Cytotoxicity Burst Distribution{#burst} +Estimates of chemical concentrations that elicit cytotoxicity and/or cell stress have been informative for contextualizing bioactivity screening data in ToxCast by providing information on the likelihood that these data may be confounded by assay interference resulting from cytotoxicity and/or cell stress, particularly when a parallel or in-well estimate of cell viability is unavailable. As such, general estimates of the median and lower bound concentrations that might elicit cytotoxicity and/or cell stress in vitro have previously been calculated using the **tcplCytoPt** function, which considers activity across a suite of cell-based assays based on updates to previous work [(Judson et al., 2016)](https://pubmed.ncbi.nlm.nih.gov/27605417/). + +The burst threshold can be used to infer activity above or below an estimated threshold of generalized cell stress and/or cytotoxicity, where users can define the degree of difference between some observed bioactivity and estimates of cell stress and/or cytotoxicity needed in order to discern "selective" activity (i.e., bioactivity thought to occur independently of cell stress and/or cytotoxicity) vs. "non-selective" activity (i.e., bioactivity that appears to occur concomitantly with estimates of the concentration needed for cell stress and/or cytotoxicity). + +These estimated concentration threshold values have been released in the “cytotox” table of invitrodb and are also provided on the CompTox Chemicals Dashboard (CCD) Bioactivity Summary Plot, as shown in the BPA example below. + +
+ +![](img/CCD_BPA_Bioactivity_ToxCast_TOP.png) +![Figure 3: ToxCast Summary Plot of BPA on CCD](img/CCD_BPA_Bioactivity_ToxCast_BOTTOM.png) + +
tcplCytoPt function uses the assay endpoints listed in the $\mathit{burst\_assay}$ field of the "assay\_component\_endpoint" table, where 1 indicates including the assay endpoint in the calculation. The "burst" assay endpoints can be identified by running tcplLoadAeid(fld = "burst\_assay", val = 1) . + +### Implementation +The cytotoxicity point is the median AC$_{50}$ for a set of assay endpoints defined within the tcpl database. tcplCytoPt outputs estimates in logged and unlogged concentration units. In addition to the cytotoxicity point (cytotox_median), a lower bound estimate (cytotox_lower_bnd) is defined by the cytotoxicity point minus 3 times the calculated global median absolute deviation (cytotox_median_um $- 3 * globalMAD$). This global MAD represents the typical amount of variance observed in AC$_{50}$ values for chemicals screened in many cell stress/cytotoxicity assays, giving us a means of estimating a lower bound on the concentration window that may result in cell stress/cytotoxicity across a number of cell lines and assay technologies. + +A cytotox_median is computed for any chemical in the database screened with at least two active hit calls and an active hit in at least 5% of burst assay endpoints screened from the set of assay endpoints defined as "burst" related (90 assay endpoints in invitrodb v4.2). If a chemical is a hit in fewer than 5% of burst assay endpoints screened or is a hit in only 1 assay endpoint, the default cytotox_median (3 on the log10 scale or 1000 micromolar on the arithmetic scale) will be assigned because we lack enough data to compute a median and assume some estimate of variance in cell stress/cytotoxicity data. $10^3 = 1000$, therefore, when using micromolar units, $3$ is equivalent to $1$ millimolar. $1$ millimolar was chosen as an arbitrary high concentration given it's outside the typical testing range for ToxCast data and based on the principle that all compounds are toxic if given in high enough concentration. + +In contrast, for a chemical to be included in a computation of the global median absolute deviation (global_MAD), the chemical must be screened in a higher number of burst assays. The global MAD is an estimate of the variance expected for a chemical tested in many cytotoxicity and cell stress assays, currently defined as greater than or equal to 60 assay endpoints annotated as “burst” endpoints and with an active hit call in at least 5% of "burst" assay endpoints tested. This typically includes chemicals that were highly screened in a multitude of assays, based on inclusion in initial ToxCast Phase I and II chemical screening. Additional filtering of burst assay data was also required to ensure only losses in cell viability were included and any cell proliferation responses were excluded (for a subset of bidirectional endpoints in the set of burst assay endpoints). + +## Assay Description Documents {#add} +Given ToxCast includes a heterogeneous set of assays across a diverse biological space, annotations in the database help flexibly aggregate and differentiate processed data whereas assay documentation aligned with international standardization efforts can make ToxCast data more useful and interpretable for use in decision-making. The [OECD Guidance Document 211 (GD211)](https://ntp.niehs.nih.gov/sites/default/files/iccvam/suppdocs/feddocs/oecd/oecd-gd211-2014-508.pdf) is a standard for comprehensive assay documentation describing non-guideline in vitro test methods and their interpretation. This template is intended to harmonize non-guideline, *in vitro* method descriptions to allow assessment of the relevance of the test method for biological responses of interest and the quality of the data produced. Unlike the assay element annotations which are often short in a standardized format or use a controlled term list, the assay_descriptions fields have no character limit for text. A compiled report of these assay description documents are available on the [ToxCast Downloadable Data page](https://www.epa.gov/comptox-tools/exploring-toxcast-data). + +## Adminstered Equivalent Doses (Level 7) {#aed} +The highest level assumption in the *in vitro* to *in vivo* extrapolation (IVIVE) approach employed here is that the *in vitro* bioactive concentration in a ToxCast assay endpoint is roughly equivalent to a human plasma concentration *in vivo*. For a review of IVIVE and httk models for it, please see: [Breen et al, 2021](https://pubmed.ncbi.nlm.nih.gov/34056988/) + +For invitrodb v4.2 onward, a new MC7 table contains pre-generated AED values using several potency metrics from invitrodb and a subset of models from the High-throughput Toxicokinetics R package httk . As implemented, this MC7 table provides users with pre-calculated estimates of the *in vivo* human administered dose (mg/kg/day) based on the *in vitro* bioactive concentrations as seen in ToxCast screening data. + +### Implementation +AEDs are generated in a separate .R script using the [httk R package](https://CRAN.R-project.org/package=httk) because of the resource-intensive nature of running the Monte Carlo simulations to get estimates of plasma concentration for the median (50th %-ile) and most sensitive (95th %-ile) toxicokinetic individuals for both the 3-compartment steady state (3compartmentss) model and the physiologically-based toxicokinetic (pbtk) model. Given the large number of chemicals and endpoints included in invitrodb v4.2, generation of the MC7 table as configured with the options below took 24 hours using 40 cores. + +### Options Applied + +```{r aed_table, warning = FALSE, echo = FALSE} +Parameter <- c("Library(httk)", "httk::calc_mc_oral_equiv()", "httk models used", "httk and QSPRs", "Potency metrics used for httk::calc_mc_oral_equiv()", "Filters on m4id") +Options_Applied <- c("Version 2.3.1", + "species = ‘Human’
+ restrictive.clearance=T
+ output.units=’mgpkgpday’
+ Caco2.options, which revise the fraction bioavailable using estimates of absorption and gut permeability, were kept as default (Caco2.options = list(Caco2.Pab.default = 1.6, Caco2.Fabs=TRUE, Caco2.Fgut=TRUE, overwrite.invivo=FALSE, keepit100=FALSE))", + "*3compartmentss*: employs 3 compartments and steady-state assumption with 1 mg/kg/day dosing, assumes clearance = 1/plasma concentration at steady state. When fraction unbound is unavailable, model assumes it is just a very small number
+ *pbtk*: multi-compartment model that does not assume steady-state kinetics. Requires estimates of intrinsic clearance and fraction unbound; not available for quite as many chemicals as 3compartmentss", +"Quantitative structure property relationships is loaded via load_sipes2017(), load_pradeep2020(), and load_dawson2021() to be able to make AED estimates for as many chemicals as possible.", + "ac50, acc, bmd", + "Hitc >= 0.9
+Number of mc6 flags is < 4
+Fit category is not 36. This removes borderline responses resulting in ac50 below the concentration range screened, which is not considered to be quantitatively informative. +.") + +# Compile all of the information for the table. +output <- data.frame(Parameter, Options_Applied) + +# Export/print the table to an html rendered table. +htmlTable(output, + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', + caption = "Options Applied when extrapolating Adminstered Equivalent Doses." + ) +``` + +## Analytical QC and Applicability Domain + +There is high value in understanding the outcomes of solubilization and chemical stability in the vehicle chosen to solubilize the chemical, i.e. a chemical's applicability domain for *in vitro* screening. This informs what chemicals and samples should screened in future experiments. It also helps inform future structural models to understand which chemicals will be stable and detectable in solubilization, and further provide insight into possible degradation products that could be synthesized or purchased. Most critically, this information promotes understanding of uncertainty in estimates of initial experimental concentration of chemicals. + +To establish a resource of applicability domain information at the substance and sample level, a retrospective analysis of the analytical QC data for the ToxCast/Tox21 chemical library was conducted. This involved reviewing legacy reports from gas chromatography-mass spectrometry (GCMS), liquid chromatography-mass spectrometry (LCMS), and Nuclear Magnetic Resonance (NMR) experiments. Additional Analytical QC, such as for the PFAS chemical library, and integration efforts are ongoing. + +```{r warning = FALSE, echo = FALSE} +Field <- c("dtxsid", "chnm", "spid", "qc_level", "pass_or_caution", "t0", "t4", +"call", "annotation", "flags", "average_mass", "log10_vapor_pressure_OPERA_pred", "logKow_octanol_water_OPERA_pred") + +Description <- c("Unique identifier from U.S. EPA Distributed Structure-Searchable Toxicity (DSSTox) Database", + "Chemical name", "Sample ID", "Level of analytical QC: substance or sample", + "Indication of analytical QC pass or caution. Considered caution unless T0 or T4 in (A, B), or T0 and T4 are I with S call", + "Grade at T0 (Time zero: Compounds freshly taken out of freezer). Grade options include:
+ **A**: Molecular Weight (MW) Confirmed, Purity >90%
+ **B**: MW Confirmed, Purity 75-90%
+ **C**: MW Confirmed, Purity 50-75%
+ **D**: CAUTION Purity <50%
+ **Ac**: Purity > 90% CAUTION Low Conc. 5-30% of expected value
+ **Bc**: Purity 75-90% CAUTION, Low Conc. 5-30% of expected value
+ **Cc**: Purity 50-75% CAUTION, Low Conc. 5-30% of expected value
+ **Fc**: CAUTION Very Low Conc. <5% of expected value. Biological Activity Unreliable
+ **Z**: MW Confirmed, No Purity Info
+ **I**: ISOMERS Two or more isomers detected
+ **M**: DEFINED MIXTURE Two or more components
+ **F**: CAUTION Incorrect MW. Biological Activity Unreliable
+ **Fns**: CAUTION No Sample Detected. Biological Activity Unreliable
+ **U**: Unknown/Inconclusive
+ **ND**: Not Determined
+ **W**: Sample Withdrawn", + "Grade at T4 (Time 4 months: Compounds kept at room temperature for 4 months). Same options at T0.", + "Call options include:
+ **S**: Stable
+ **T**: CAUTION Chemical transformation
+ **L**: CAUTION Physical loss
+ **X**: CAUTION Unstable, reason undetermined", +"Annotation note from analytical QC manual curation", +"Interpretative flags set based on observed substance or sample level QC (T0, T4, calls) or physicochemical properties. Flag options incude:
+**Room temperature stability decreases over time**: T0 in (A, B, C) *AND* call is in (T,L,X))
+**Low concentration possible**: T0 *OR* T4 in (Ac,Bc,Cc). Call may be pass or caution depending on T0
+**Extreme loss at room temperature over time**: T0 in (A, B, C) *AND* t4 in (Fc, Fns)
+**Missing data for room temperature stability**: T4 in (U,ND,NA,Z,W)
+**Initial purity between 75-90%**: T0 in (B, Bc)
+**Initial purity between 50-75%**: T0 in (C,Cc)
+**Likely fail**: t0 in (D, F, Fns, W) OR T0 in (Z) & T4 in (D, F,Fc,Fns)
+**Examine physicochemical properties**: Predicted log10-VP >= 1 *OR* logKow >= 6.5
+**Confirmed isomer or mixture**: T0 in (M,I) *AND* T4 in (M,ND,I)
+**Missing purity information**: T0 in (Z) *AND* T4 in (A,Ac,B,C)", +"Mass", +"OPERA predicted log10 vapor pressure", +"OPERA predicted Octanol-water partition coefficient") + +output <- data.frame(Field, Description) + +htmlTable(output, + align = 'l', + align.header = 'l', + rnames = FALSE , + css.cell = ' padding-bottom: 5px; vertical-align:top; padding-right: 10px;min-width: 5em ', + caption = "Table 4: Fields in the Chemical_Analytical_QC Table.") + +``` + +# Data Retrieval in invitrodb {#data_retrieval} + +## Retrieving Assay Element IDs + +The **tcplLoadAsid, tcplLoadAid, tcplLoadAcid**, and **tcplLoadAeid** functions load relevant assay ids and names for the respective assay elements based on the user specified parameters. + +```{r tcplLoad, eval = FALSE} +# List all assay source IDs +tcplLoadAsid() +# Create table of all assay endpoint ids (aeids) per assay source +aeids <- tcplLoadAeid(fld = "asid", # field to query on + val = 14, # value for each field + add.fld = c("aid", "anm", "acid", "acnm")) # additional fields to return +``` + +## Retrieving Assay Annotations + +Assay source, assay, assay component, and assay endpoint are registered via tcpl scripting into a collection of tables. The database structure takes the annotations and organizes them as attributes of the assay conductors, the assays (i.e., experiments), the assay components (i.e., raw readouts), or the assay endpoints (i.e., normalized component data) enabling aggregation and differentiation of the data generated through ToxCast and Tox21 (or other relevant partners). The annotations capture four types of information: + +i. Identification information +ii. Design information such as the technology, format, and objective aspects that decompress the assay’s innovations, +iii. Target information, such as the target of technological measurement, +biological intended target, and biological process, and +iv. Analysis information about how the data were processed and analyzed. + +```{r annotation_query_ex, eval = FALSE} +# Select annotation and subset by ids or name, ex. +assay <- tcplQuery("SELECT * FROM invitrodb.assay where aid=1;") +component <- tcplQuery("SELECT * FROM invitrodb.assay_component;") +component <- subset(component, acid %in% source$acid) +endpoint <- tcplQuery("SELECT * FROM invitrodb.assay_component_endpoint;") +endpoint <- endpoint[grepl("ATG", endpoint$assay_component_endpoint_name),] + +# Or select all annotations by joining multiple tables +annotations <- tcplQuery("SELECT * FROM invitrodb.assay + INNER JOIN invitrodb.assay_source on assay.asid=assay_source.asid + INNER JOIN invitrodb.assay_component on assay_component.aid=assay.aid + INNER JOIN invitrodb.assay_component_endpoint on assay_component_endpoint.acid=assay_component.acid;") +``` + +## Retrieving Chemical Information + +The **tcplLoadChem** function returns all chemical information or can be filtered for user specified parameters, e.g. the chemical name (chnm) and chemical id (chid). The **tcplLoadChemList** function allows the user to subdivide the chemical IDs based on presence in different chemical lists. These chemical lists are curated by the US EPA in the Distributed Structure-Searchable Toxicity (DSSTox) database. Chemicals can belong to more than one chemical list, and will be listed as separate entries when loading chemical list information. + +```{r eval = FALSE} +tcplLoadChem() +tcplLoadChemList(field = "chid", val = 1:2) +``` + +## Retrieving Methods + +The **tcplMthdList** function returns methods available for processing at a specified level (i.e. step in the tcpl pipeline). The user defined function in the following code chunk retrieves and outputs all available methods for both the SC and MC data levels. + +```{r mthd_list, fig.align='center',class.source="scroll-100",message=FALSE, eval=FALSE} +# Create a function to list all available methods function (SC & MC). +method_list <- function() { + # Single Concentration + ## Level 1 + sc1 <- tcplMthdList(1, 'sc') + sc1[, lvl := "sc1"] + setnames(sc1, c("sc1_mthd", "sc1_mthd_id"), c("mthd", "mthd_id")) + ## Level 2 + sc2 <- tcplMthdList(2, 'sc') + sc2[, lvl := "sc2"] + setnames(sc2, c("sc2_mthd", "sc2_mthd_id"), c("mthd", "mthd_id")) + + # Multiple Concentration + ## Level 2 + mc2 <- tcplMthdList(2, 'mc') + mc2[, lvl := "mc2"] + setnames(mc2, c("mc2_mthd", "mc2_mthd_id"), c("mthd", "mthd_id")) + ## Level 3 + mc3 <- tcplMthdList(3, 'mc') + mc3[, lvl := "mc3"] + setnames(mc3, c("mc3_mthd", "mc3_mthd_id"), c("mthd", "mthd_id")) + ## Level 4 + mc4 <- tcplMthdList(4, 'mc') + mc4[, lvl := "mc4"] + setnames(mc4, c("mc4_mthd", "mc4_mthd_id"), c("mthd", "mthd_id")) + ## Level 5 + mc5 <- tcplMthdList(5, 'mc') + mc5[, lvl := "mc5"] + setnames(mc5, c("mc5_mthd", "mc5_mthd_id"), c("mthd", "mthd_id")) + # Compile the Output + mthd.list <- rbind(sc1, sc2, mc2, mc3, mc4, mc5) + mthd.list <- mthd.list[, c("lvl", "mthd_id", "mthd", "desc")] + # Return the Results + return(mthd.list) +} + +# Run the 'method_list' functions and store output. +amthds <- method_list() +# Print the available methods list. +amthds +``` + +The **tcplMthdLoad** function returns the method assignments for specified id(s). Later sections provide more detailed examples for utilizing the tcplMthdLoad function for individuals ids. + +## Retrieving Data + +The **tcplQuery** function allows a user to provide an SQL query to load data from the MySQL database into the R session. In the following chunk we provide an example, but any valid SQL query can replace the one provided. Please review [Database Structure](#db) section to help construct these queries. + +```{r tcplquery, eval = FALSE} +# Load sample table using a MySQL query. +samples <- tcplQuery("SELECT * FROM sample;") +``` + +The **tcplLoadData** function can be used to load the data from the MySQL database into the R session. Further, the **tcplPrepOtpt** function can be used in combination with tcplLoadData to add useful chemical and assay annotation information, mapped to the retrieved data. + +When loading data, the user must indicate the applicable fields and ids for the corresponding data level of interest. Loading level 0 (SC0 and MC0), MC1, and MC2 data the assay component id ($\mathit{acid}$) will always be used. As described in [Data Processing](#data_process) sections, SC1 and MC3 processing levels perform data normalization where assay component ids ($\mathit{acid}$) are converted to assay endpoint ids ($\mathit{aeid}$). Thus, the SC1 and MC3 data tables contain both $\mathit{acid}$ and ($\mathit{aeid}$) ID's. Data can be loaded using either id as long as it is properly specified. Loading SC2, MC4, 5, and 6 always use ($\mathit{aeid}$). Selected id(s) are based on the primary key within each table containing data. + +::: {.noticebox data-latex=""} + +**NOTE:** There is no need to use earlier versions of tcpl to load data from an earlier version of invitrodb. In tcpl v3.2 onwards, tcplLoadData is fully backwards compatible with any version of invitrodb. + +::: + +## Retrieving Level 0 Data + +Prior to the pipeline processing provided in this package, all the data must go through pre-processing, i.e. raw data to database level 0 data. The standard level 0 format is identical for both testing paradigms, SC or MC, as described [here](#lvl0-preprocessing). Users can inspect the level 0 data and calculate assay quality metrics prior to running the processing pipeline. + +## - Load SC0 Data + +```{r sc0, eval = FALSE} +# Load Level 0 single concentration (SC0) data for a single acid to R. +sc0 <- tcplLoadData(lvl = 0, fld = "acid", val = 1, type = "sc") # data type - single concentration +# Alternatively, load data in and format with tcplPrepOtpt. +sc0 <- tcplPrepOtpt(tcplLoadData(lvl = 0, fld = "acid", val = 1, type = "sc")) +``` + +## - Load MC0 Data + +```{r mc0, eval = FALSE} +# Load Level 0 multiple concentration (MC0) data. +mc0 <- tcplPrepOtpt(tcplLoadData(lvl = 0, fld = "acid", val = 1, type = "mc")) +``` + +## - Review MC assay quality + +The goal of this section is to provide example quantitative metrics, such as z-prime and coefficient of variance, to evaluate assay performance relative to controls. + +```{r mc0_aq, fig.align='center', class.source = "scroll-100", message=FALSE, eval=FALSE} +# Create a function to review assay quality metrics using indexed Level 0 data. +aq <- function(ac){ + # obtain level 1 multiple concentration data for specified acids + dat <- tcplPrepOtpt(tcplLoadData(1L, "acid", aeids$acid, type = "mc")) + + # keep only observations with good well quality (wllq = 1) + dat <- dat[wllq == 1] + + # obtain summary values for data and remove missing data (i.e. NA's) + agg <- dat[ , + list( + # median response values (rval) of neutral wells (wllt = n) + nmed = median(rval[wllt == "n"], na.rm = TRUE), + # median absolute deviation (mad) of neutral wells (wllt = n) + nmad = mad(rval[wllt == "n"], na.rm = TRUE), + # median response values of positive control wells (wllt = p) + pmed = median(rval[wllt == "p"], na.rm = TRUE), + # median absolute deviation of positive control wells (wllt = p) + pmad = mad(rval[wllt == "p"], na.rm = TRUE), + # median response values of negative control wells (wllt = m) + mmed = median(rval[wllt == "m"], na.rm = TRUE), + # median absolute deviation of negative control wells (wllt = m) + mmad = mad(rval[wllt == "m"], na.rm = TRUE) + ), + # aggregate on assay component id, assay component name, + # and assay plate id + by = list(acid, acnm, apid)] + + # Z prime factor: separation between positive and negative controls, + # indicative of likelihood of false positives or negatives. + # - Between 0.5 - 1 are excellent, + # - Between 0 and 0.5 may be acceptable, + # - Less than 0 not good + # obtain the z-prime factor for positive controls and neutral + agg[ , zprm.p := 1 - ((3 * (pmad + nmad)) / abs(pmed - nmed))] + # obtain the z-prime factor for negative controls and neutral + agg[ , zprm.m := 1 - ((3 * (mmad + nmad)) / abs(mmed - nmed))] + + agg[ , ssmd.p := (pmed - nmed) / sqrt(pmad^2 + nmad^2)] + agg[ , ssmd.m := (mmed - nmed) / sqrt(mmad^2 + nmad^2)] + + # Coefficient of Variation (cv) of neutral control + # - Ideally should be under 25% + agg[ , cv := nmad / nmed] + + agg[ , sn.p := (pmed - nmed) / nmad] + agg[ , sn.m := (mmed - nmed) / nmad] + agg[ , sb.p := pmed / nmed] + agg[ , sb.m := mmed / nmed] + + agg[zprm.p<0, zprm.p := 0] + agg[zprm.m<0, zprm.m := 0] + + acqu <- agg[ , list( nmed = signif(median(nmed, na.rm = TRUE)), + nmad = signif(median(nmad, na.rm = TRUE)), + pmed = signif(median(pmed, na.rm = TRUE)), + pmad = signif(median(pmad, na.rm = TRUE)), + mmed = signif(median(mmed, na.rm = TRUE)), + mmad = signif(median(mmad, na.rm = TRUE)), + zprm.p = round(median(zprm.p, na.rm = TRUE), 2), + zprm.m = round(median(zprm.m, na.rm = TRUE), 2), + ssmd.p = round(median(ssmd.p, na.rm = TRUE), 0), + ssmd.m = round(median(ssmd.m, na.rm = TRUE), 0), + cv = round(median(cv, na.rm = TRUE), 2), + sn.p = round(median(sn.p, na.rm = TRUE), 2), + sn.m = round(median(sn.m, na.rm = TRUE), 2), + sb.p = round(median(sb.p, na.rm = TRUE), 2), + sb.m = round(median(sb.m, na.rm = TRUE), 2) + ), by = list(acid, acnm)] + # Return the Results. + return(acqu) +} #per acid + +# Run the 'aq' function & store the output. +assayq <- aq(ac) +``` + +## Retrieving SC Data and Methods + +The goal of SC processing is to identify potentially active compounds from a large screen at a single concentration. After processing, users can inspect SC activity hit calls and the applied methods. + +## - Load SC2 Data + +```{r sc2, eval = FALSE} +# Load Level 2 single concentration data for a single aeid. +sc2 <- tcplPrepOtpt(tcplLoadData(lvl = 2, fld = "aeid", val = 3, type = "sc")) +# Alternatively, data for a set of aeids can be loaded with a vector of ids. +sc2 <- tcplPrepOtpt(tcplLoadData(lvl = 2, fld = "aeid", val = aeids$aeid, type = "sc")) +``` + +## - Load SC Methods + +```{r sc2_mthd, fig.align='center',class.source="scroll-100",message=FALSE, eval=FALSE} +# Create a function to load methods for single concentration data processing +# steps for given aeids. +sc_methods <- function(aeids) { + # load the level 1 methods assigned for the single concentration aeid's + sc1_mthds <- tcplMthdLoad(lvl = 1, type = "sc", id = aeids$aeid) + # aggregate the method id's by aeid + sc1_mthds<- aggregate(mthd_id ~ aeid, sc1_mthds, toString) + # reset the names of the sc1_mthds object + setnames(sc1_mthds, "mthd_id", "sc1_mthd_id") + + # load the level 2 methods assigned for the single concentration aeid's + sc2_mthds <- tcplMthdLoad(lvl = 2, type = "sc", id = aeids$aeid) + # aggregate the method id's by aeid + sc2_mthds<- aggregate(mthd_id ~ aeid, sc2_mthds, toString) + # reset the names of the sc2_mthds object + setnames(sc2_mthds, "mthd_id", "sc2_mthd_id") + + # Compile the Output + methods <- merge( merge(aeids, sc1_mthds, by = "aeid", all = TRUE), + sc2_mthds, by = "aeid", all = TRUE ) + # Return the Results + return(methods) +} + +# Run the 'sc_methods' function and store the output. +smthds <- sc_methods(aeids) +``` + +## Retrieving MC Data and Methods + +The goal of MC processing is to estimate the hitcall, potency, efficacy, and other curve-fitting parameters for sample-assay endpoint pairs. After processing, users can inspect the activity hitcalls, model parameters, concentration-response plots, and the applied methods for the MC data. + +## - Load MC5 Data + +```{r mc5_data, eval = FALSE} +# Load Level 5 MC data summary values for a set of aeids. +# Note: to output mc5_param information with the mc5 results, +# 'add.fld' is set to TRUE by default. +mc5 <- tcplPrepOtpt(tcplLoadData(lvl = 5, fld = "aeid", val = aeids$aeid, type = "mc")) +``` + +## - Load MC Methods + +```{r mc5_methods, fig.align='center',class.source="scroll-100",message=FALSE, eval=FALSE} +# Create a function to load methods for MC data processing +# for select aeids. +mc_methods <- function(aeids) { + # acid + ## load the methods assigned to level 2 for given acids + mc2_mthds <- tcplMthdLoad(2, aeids$acid) + ## aggregate the assigned methods by acid + mc2_mthds<- aggregate(mthd_id ~ acid, mc2_mthds, toString) + ## rename the columns for the 'mc2_mthds' object + setnames(mc2_mthds, "mthd_id", "mc2_mthd_id") + + # aeid + ## load the methods assigned to level 3 for given aeids + mc3_mthds <- tcplMthdLoad(3, aeids$aeid) + ## aggregate the assigned methods by aeid + mc3_mthds<- aggregate(mthd_id ~ aeid, mc3_mthds, toString) + ## rename the columns for the 'mc3_mthds' object + setnames(mc3_mthds, "mthd_id", "mc3_mthd_id") + ## load the methods assigned to level 4 for given aeids + mc4_mthds <- tcplMthdLoad(4, aeids$aeid) + ## aggregate the assigned methods by aeid + mc4_mthds<- aggregate(mthd_id ~ aeid, mc4_mthds, toString) + ## rename the columns for 'mc4_mthds' object + setnames(mc4_mthds, "mthd_id", "mc4_mthd_id") + ## load the methods assigned to level 5 for given aeids + mc5_mthds <- tcplMthdLoad(5, aeids$aeid) + ## aggregate the assigned methods by aeid + mc5_mthds<- aggregate(mthd_id ~ aeid, mc5_mthds, toString) + ## rename the columns for 'mc5_mthds' object + setnames(mc5_mthds, "mthd_id", "mc5_mthd_id") + + # Compile the Results. + ## merge the aeid information with the level 2 methods by acid + acid.methods <- merge(aeids, mc2_mthds, by.x = "acid", by.y = "acid") + ## merge the level 3, 4, and 5 methods by aeid + mthd35 <- merge( + merge(mc3_mthds, mc4_mthds, by = "aeid", all = TRUE), + mc5_mthds, by = "aeid", all = TRUE + ) + ## merge all methods information by aeid + methods <- merge(acid.methods, mthd35, by.x = "aeid", by.y = "aeid") + # Print the Results. + print(methods) + # Return the Results. + return(methods) +} + +# Run the 'methods' function and store the output. +mmthds <- mc_methods(aeids) +``` + +## Plotting + +**tcplPlot** is tcpl’s single flexible plotting function, allowing for interactive yet consistent visualization of concentration-response curves via customizable parameters. The standalone plotting utility is built with the R libraries plotly and ggplot2 to display the additional curve-fitting models. The tcplPlot function requires the selection of a field (`fld`), and value (`val`) to load the necessary data and display the associated plots. Level `lvl` selection is no longer required and is replaced by `type`. Customization of output is possible by specifying the following parameters: + +```{r warning = FALSE, echo = FALSE} +Field <- c("type", "fld", "val", "compare.val", "output", "verbose", "multi", "by", + "fileprefix", "'nrow' and 'ncol'", "dpi", "flag", "yuniform", "yrange", "dat") +Description <- c("'MC' assumed as default. type = 'mc' plots available MC data fit by all models and highlights the winning model with activity hit call presented whereas type = 'sc' plots available SC data including response values, maximum median, and cutoff with activity hit call presented.", + "Required parameter for field to query on", + "Required parameter for values to query on that must be listed for each corresponding 'fld'", + "Parameter is used to generate comparison or dual plots. Using the same field(s) as `val`, supply a list or vector of values for each field to be plot one-to-one alongside val. Since tcplPlot matches ids between val and compare.val, `compare.val` must be the same length as `val` and the order `val` and `compare.val` are given will be maintained in the output. The default value is `compare.val = NULL` where the plots will be individual; if it is set, tcplPlot will attempt to generate comparison plots. For example, if fld = m4id and the user supplies three m4ids to `val`, `compare.val` must also contain three m4ids, where the first element of each `val` parameter are plot together, the second elements together, etc.", + "Parameter indicates how the plots will be presented. In addition to outputs viewable with the R `console`, tcplPlot supports a variety of publication-quality file type options, including raster graphics (`PNG`, `JPG`, and `TIFF`) to retain color quality when printing to photograph and vector graphics (`SVG` and `PDF`) to retain image resolution when scaled to large formats. For a more customizable option, an indivdiual plot can be output in environment as a `ggplot`", + "Parameter results in a plot that includes a table containing potency and model performance metrics; `verbose = FALSE` is default and the only option in console outputs. When `verbose = TRUE` the model aic values are listed in descending order and generally the winning model will be listed first.", + "Parameter allows for single or multiple plots per page. `multi = TRUE` is the default option for PDF outputs, whereas `multi = FALSE` is the only option for other outputs. If using the parameter option `multi = TRUE`, the default number of plots per page is set by the `verbose` parameter. The default number of plots per page is either 6 plots per page (`verbose = FALSE`) or 4 plots per page (`verbose = TRUE`).", + "Parameter indicates how files should be divided, typically by $aeid$ or $spid$", + "Parameter allows the user to set a custom filename prefix. The standard filename is tcplPlot_sysDate().output (example: tcplPlot_2023_08_02.jpg) or, if `by` parameter is set, tcplPlot_sysDate()_by.output (example: tcplPlot_2023_08_02_aeid_80.pdf). When a `fileprefix` is assigned the default _tcplPlot_ prefix is replaced with the new filename.", + "The 'nrow' parameter specifies the number of rows for the multiple plots per page; this is 2 by default. The `ncol` parameter specifies the number of columns for the multiple plots per page; this is 3 by default. If `verbose = FALSE`, `ncol` is 2. `nrow` and `ncol` can customize the number of plots included per page. Both `nrow` and `ncol` must be greater than 0. While there is no hard coded upper limit to the number of rows and columns, the underlying technology has a dimension limitation of `nrow = 9` and `ncol = 7`.", + "Parameter specifies image print resolution for image file output types (PNG, JPG, TIFF, SVG); this is 600 by default.", + "Parameter is used for toggling the output of Level 6 flags. The default option is `flag = FALSE`. If `type = 'sc`, setting `flag = TRUE` will result in warning, since invitrodb does not store flags for single-concentration data.", + "Parameter is used for toggling automatic uniform y-axis scaling. The default option is `yuniform = FALSE`. If set to `TRUE`, tcplPlot will set each plot's y-axis range to be the minimum and maximum of response values and cutoffs across every requested plot. For example, when plotting a percent activity endpoint if the maximal response was 100% and minimal was -50%, while the cutoff was 20%, the y-axis range for every plot will be set to be from -50% to 100%. This is most useful for across-plot interpretation.", + "Parameter is used for toggling user-specified uniform y-axis scaling. `yrange` is required to be an integer of length 2: c(min,max). By default, c(NA,NA) will not set any uniform range. For example, when plotting a percent activity endpoint, the user may wish to set the range to c(-100,100) so every plot is contained to -100% and 100%. ", + "Parameter permits the user to supply plot-ready data rather than automatically loading it within tcplPlot. Use cases include plotting across multiple database connections or using tcplPlot to plot other tcplfit2-fit data. See the advanced comparison plotting section and ?tcplPlotLoadData for more information.") + +output <- data.frame(Field, Description) + +knitr::kable(output) %>% kable_styling("striped") %>% + kableExtra::scroll_box(width="100%", height="400px") +``` + +The following examples demonstrate tcplPlot functionality through available the variety of customization options: + +## - Output PDF of Verbose, Multiple Plots per Page, by AEID and/or SPID + +The following two examples produce plots of MC data for the selected $aeids$. A new pdf is generated for each endpoint. Filtering can be applied if only plots for a subset of samples ($spids$) are desired. + +```{r mc_plot_pdf_aeid, eval = FALSE} +# Plot MC data for aeids 3157-3159 and outputs plots separate pdfs by aeid. +tcplPlot(type = "mc", # not required; "mc" is default + fld = "aeid", # field to query on + val = 3157:3159, # values should match their corresponding 'fld' + by = "aeid", # parameter to divide files + multi = TRUE, # multiple plots per page - output 4 per page + verbose = TRUE, # output all details if TRUE + output = "pdf") # output as pdf + +# Loading required mc_vignette data for example below +data(mc_vignette, package = 'tcpl') +mc5 <- mc_vignette[["mc5"]] + +# Plot MC data from the mc_vignette R data object for a single aeid 80 and +# spids "TP0001652B01", 01504209", "TP0001652D01", "TP0001652A01", and "1210314466" +tcplPlot(fld = c("aeid", "spid"), # field to query on + val = list(mc5$aeid, mc5$spid), # values must be listed for each corresponding 'fld' + by = "aeid", multi = TRUE, verbose = TRUE, flags = TRUE, yrange = c(-0.5, 1.5), + output = "pdf", fileprefix = "output_pdf") +``` +
![Plots with parameters: output = "pdf", multi = TRUE, and verbose = TRUE for aeid 80 and spids "TP0001652B01", 01504209", "TP0001652D01", "TP0001652A01", and "1210314466"](img/output_pdf.png){width=80%}
+ +## - Output Image File (JPG) of Single Verbose Plot, by AEID and SPID + +This example illustrates an MC verbose plot for a single endpoint-sample of output type “jpg”. + +```{r mc_plot_jpg, eval = FALSE} +# Plot a verbose plot of MC data for single aeid 80 and spid 01504209 and +# output as jpg. +tcplPlot(type = "mc", fld = c('aeid','spid'), val = list(80,'01504209'), multi = FALSE, + verbose = TRUE, flags = TRUE, output = "jpg", fileprefix = "output_jpg") +``` + +
![Plot generated with parameters: output = "jpg" and verbose = TRUE for aeid 80 and spid 01504209](img/output_jpg.jpg){width=80%}
+ +## - Output to Console, by M4ID or AEID and SPID + +Due to the dynamic nature of _m#_ ids, the first example code chunk does not include a corresponding plot. Here, the $m4id$ value (482273) corresponds with the mc_vignette R data object. To run test this code, a valid $m4id$ value must be supplied. + +The second example includes a level 5 plot for one endpoint and one sample of output type “console”. Only 1 concentration series can be output in console at a time. +```{r mc_plot_console, eval = FALSE} +# Create MC plot for a single m4id. +tcplPlot(type = "mc", fld = "m4id", val = 482273, + multi = FALSE, verbose = FALSE, output = "console") + +# Plot of MC data for single aeid (80) and spid (01504209) +# and output to console. +tcplPlot(type = "mc", fld = c('aeid','spid'), val = list(80, '01504209'), + multi = FALSE, verbose = FALSE, output = "console") +``` +
![Plot generated with parameters: output = "console" for aeid 80 and spid 01504209](img/output_console.png){width=80%}
+ +## - Output PDF of Single Concentration Plots, Multiple Plots per Page, by AEID + +Single concentration plotting is enabled by setting `type = "sc"`. The example below plots all samples for one endpoint. + +```{r sc_plot_pdf_aeid, eval = FALSE} +# Plot SC data for aeid 704 and outputs plots separate pdfs by aeid. +tcplPlot(type = "sc", fld = "aeid", val = 704, multi = TRUE, + verbose = TRUE, output = "pdf", fileprefix = "sc_output") +``` +
![Single concentration plots with parameters: type = "sc", output = "pdf", multi = TRUE, and verbose = TRUE for aeid 704 ](img/sc_output.png){width=80%}
+ +## Comparison Plotting + +## - Output PDF of Multiple Comparison Plots per Page, by AEID and SPID + +The “compare"/dual-plot feature can be used by supplying a list or vector of the same length to `val` and `compare.val`. In the example below, plots are generated for 4 samples that appear in two different endpoints. These 4 samples are compared one-to-one. + +```{r plot_compare, eval = FALSE} +spids <- c("EPAPLT0108M13", "EPAPLT0108H01", "EPAPLT0108C17", "EPAPLT0106J20") +# default parameters used here: type = "mc" +tcplPlot(fld = c("spid", "aeid"), # field(s) to query on + val = list(spids, 3074), # values must be listed for each corresponding `fld` + compare.val = list(spids, 3076), # length must equal that of 'val' + output = "pdf", verbose = TRUE, multi = TRUE, flags = TRUE, + yuniform = TRUE, fileprefix = "plot_compare") +``` + +
![Plots with parameters: output = "pdf", verbose = TRUE, multi = TRUE, flags = TRUE, and yuniform = TRUE for spids "EPAPLT0108M13", "EPAPLT0108H01", "EPAPLT0108C17", "EPAPLT0106J20" across two different endpoints (aeids 3074 and 3076)](img/plot_compare.png){width=80%}
+ +## - Output PDF of Multiple Comparison Plots per Page, by AEID and SPID + +The “compare"/dual-plot feature can also be used with single concentration plotting. In the example below, plots are generated for 6 samples that appear in two different endpoints. These 4 samples are compared one-to-one. + +```{r sc_plot_compare, eval = FALSE} +spids <- c("MLS", "DMSO", "Tox21_400088", "Tox21_200265", "Tox21_200001", "Tox21_200266") +# Plot comparison across two different endpoints with same samples +tcplPlot(type = "sc", fld = c("spid","aeid"), val = list(spids, 3017), + compare.val = list(spids, 3018), # length must equal that of 'val' + output = "pdf", verbose = TRUE, multi = TRUE, fileprefix = "sc_plot_compare") +``` + +
![Single concentration plots with parameters: type = "sc", output = "pdf", verbose = TRUE, and multi = TRUE for spids "MLS", "DMSO", "Tox21_400088", "Tox21_200265", "Tox21_200001", "Tox21_200266" across two different endpoints (aeids 3017 and 3018)](img/sc_plot_compare.png){width=80%}
+ +## Advanced Comparison Plotting + +tcplPlot supports advanced comparison plotting across data connections. If working on a local invitrodb instance, additional dose-response data may be available, data reprocessed, methods adjusted, etc. Users may wish to compare data released in different versions, such as comparing CTX Bioactivity API data or versioned database (invitrodb v4.1 and later) to one's local invitrodb database. + +Using the utility function **tcplPlotLoadData** while connected to one data source, users can switch to a new data configuration and pass along data via tcplPlot’s `dat` parameter and use `compare.val` for their new connection's data. + +```{r plot_standalone, eval = FALSE} +# tcplConf() configured with some connection like invitrodb v4.1 or CTX APIs +plot_data <- tcplPlotLoadData(lvl = 5, fld = "aeid", val = 704, type = "mc", flags = TRUE) + +# fill with different database connection information +tcplConf(user = "", pass = "", db = "invitrodb", drvr = "MySQL", host = "") + +# Plot comparisons of aeid 704 from one database version to another and output to pdf +tcplPlot(dat = plot_data, # previously loaded data from tcplPlotLoadData() + fld = "aeid", val = 704, # include as copy of 'val' from tcplPlotLoadData() + compare.val = 704, # length must equal that of 'val', assumes aeid has not gained any samples + output = "pdf", verbose = TRUE, multi = TRUE, flags = TRUE, fileprefix = "plot_compare") +``` + +
![Comparison plots with parameters: dat = plot_data from tcplPlotLoadData(), output = "pdf", verbose = TRUE, multi = TRUE, and flags = TRUE for comparison of aeid 704 to current database version](img/API_plot_standalone.png){width=80%}
+ +## Additional Examples + +Below are some additional example code chunks for retrieving various bits of information from the database. + +## - Load Data for a Specific Chemical + +In this example, steps for extracting information about the compound *Bisphenol A* found within the database are illustrated. The user will define the chemical of interest, isolate all associated sample ids ($\mathit{spids}$), and then load all data for the given chemical. + +```{r BPA, eval = FALSE} +# Provide the chemical name and assign to 'chnm'. Synonyms will not be matched, so other chemical identifiers may be more appropriate to query. +chnm <- 'Bisphenol A' +# Load the chemical data from the database. +chem <- tcplLoadChem(field = 'chnm', val = chnm) +# Load mc5 data from the database for the specified chemical. +BPA.mc5 <- tcplLoadData(lvl = 5, fld = 'spid', val = chem[, spid], type = 'mc') +``` + +## - Plot Sample Subset + +In this example, plotting by endpoint for a sample subset, as opposed to plotting all samples tested within an endpoint, is illustrated. The user will load data for the select endpoints, isolate the samples of interest, and then plot by endpoint for the sample subset. + +```{r spid_plot, eval=FALSE} +# Load MC% data summary values for select aeids +mc5 <- tcplPrepOtpt(tcplLoadData(lvl = 5, fld = 'aeid', val = tcplLoadAeid(fld = "asid", val = 25)$aeid, type = 'mc', add.fld = TRUE)) + +# Identify sample subset. +spid.mc5 <- mc5[spid %in% c("EPAPLT0018N08", "EPAPLT0023A16", "EPAPLT0020C11", "EPAPLT0018B13", "EPAPLT0018B14", "EPAPLT0018B15"),] + +# Plot by endpoint for sample subset. +tcplPlot(fld = c("spid", "aeid"), val = list(spid.mc5$spid, spid.mc5$aeid), by = "aeid", multi = TRUE, verbose = TRUE, output = "pdf", fileprefix = "output/upitt") +``` + +# Data Retrieval via API + +To support different ToxCast data retrieval needs, there are a number of tcpl functions that can be used to query the API and return information to a local R environment. Abbreviations may be used to refer to processing steps or data. **Single-concentration "SC" assay data is not currently available via API.** "MC" describes multiple-concentration assay data. A particular data or processing level is indicated by appending the level id/number to the end of the SC or MC designation. For example, multiple concentration data from level 3 processing uses the abbreviation MC3. + +## Assay Elements + +The **tcplLoadAsid, tcplLoadAid, tcplLoadAcid**, and **tcplLoadAeid** functions load relevant ids and names for the respective assay elements based on the user specified parameters whether user has database or API connection. + +## Data + +**tcplQueryAPI** is a general querying function which is flexible enough to handle most kinds of queries users may have for the API. Unlike tcplQuery, tcplQueryAPI does not accept a MySQL query but instead has a few arguments which can be set to mimic a request to the various API endpoints. tcplQueryAPI is used mostly as a helper function to other tcplLoad functions, but is available to users for more specific and/or personalized requests. + +```{r tcplQueryAPI, eval = FALSE} +# Request and load all assays+annotations for specified asid +data <- tcplQueryAPI(resource = "data", # resource to query from API, either 'data' or 'assay' + fld = "aeid", val = 891, # field and val to query on + return_fld = c("spid", "chnm", "hitcall")) # specify the return fields, leave NULL for all fields +``` + +The **tcplLoadData** function can be used to load data from the CTX APIs into the R environment. **Only MC levels 3, 4, 5, 6, and 'agg' are currently available via the API**. To add chemical and assay annotation information, and data from every level mapped to the retrieved data, set `add.fld = TRUE` (this is the default). The output with `add.fld = FALSE` will look as similar to the tcplLoadData output by level from a database connection, though some less known columns may not be available and the column order may differ. + +When loading data, the user must indicate the applicable fields and ids which are query-able via the CTX Bioactivity API. These such fields are limited to "aeid", "m4id", "spid", and "dtxsid", and any other fields will result in error. While supplying multiple ids (through `val`) are valid, multiple fields are not. Combinations of fields are currently not supported with tcplLoadData using an API connection. tcplLoadData will return whatever data is found, and list in output if any val(s) were not found or contain no data to be returned. Examples of loading data are detailed in later sections. + +## Assay Annotations + +Assay source, assay, assay component, and assay endpoint are registered via tcpl scripting into a collection of database tables within invitrodb. For the API, these tables were joined to create a singular "assay" annotations view, which can be returned using tcplQueryAPI. + +```{r annotation_query_api_ex, eval = FALSE} +# Load all assays and their annotations +assays <- tcplQueryAPI(resource = "assay") +``` + +## Retrieving Processed MC Data and Annotations + +As described in greater detail within the Data Processing sections, a goal of MC processing is to derive the efficacy and potency estimates for for each modeled endpoint-sample dose response. API data is available for levels 3 through 6, herein users can inspect the MC data including efficacy and potency estimates, model parameters, raw concentration response values, cautionary flags, and applied methods. + +## Data + +Loading data is completed for a given endpoint (aeid), sample (spid), chemical (dtxsid), or endpoint-sample (m4id) by specifying "fld". Set add.fld = FALSE is the option used to limit fields to those which are defaults for each level when loading from invitrodb directly. Leaving add.fld = TRUE (default) will return all available fields, i.e. all information from levels 3 through 6. + +## - By id +```{r data_by_aeid} +# Load MC5 data by aeid +mc5 <- tcplLoadData(lvl = 5, # data level + fld = "aeid", # fields to query on + val = 704, # values should match their corresponding 'fld' + type = "mc", # default. Note: sc data is not available on APIs yet + add.fld = FALSE) # restrict to just level 5 parameters +``` + +```{r, echo=FALSE} +knitr::kable(head(mc5))%>% + kableExtra::kable_styling("striped") %>% + kableExtra::scroll_box(width = "100%") +``` + +```{r data_by_id, eval=FALSE} +## Load MC5 data by spid +mc5 <- tcplLoadData(lvl=5, fld = "spid", val = "TP0000904H05", type = "mc", add.fld = FALSE) + +## Load MC5 data by m4id +mc5 <- tcplLoadData(lvl=5, fld = "m4id", val = 1842443, type = "mc", add.fld = FALSE) + +## Load MC data by dtxsid +mc5 <- tcplLoadData(lvl=5, fld = "dtxsid", val = "DTXSID30944145", type = "mc", add.fld = FALSE) +``` + +## - By level + +In addition to level 5 data, levels 3, 4, 6, and 'agg' are available to pull from the API. + +```{r data_level_3, eval=FALSE} +## Load MC3. This returns m4id, spid, conc, aeid, logc, resp +mc3 <- tcplLoadData(lvl = 3, fld = "m4id", val = 1842443, type = "mc", add.fld = FALSE) + +## Load MC4. This returns m4id, spid, bmad, resp_max, resp_min, max_mean, max_mean_conc, +# max_med, max_med_conc, logc_max, logc_min, nconc, npts, nrep, nmed_gtbl +mc4 <- tcplLoadData(lvl = 4, fld = "m4id", val= 1842443, type = "mc", add.fld = FALSE) + +## Load MC6. This returns mc5 parameters plus flags +mc6 <- tcplLoadData(lvl = 6, fld = "m4id", val = 1842443, type = "mc", add.fld = FALSE) + +## Load MC4 agg. This returns mc3 and mc4 parameters +agg <- tcplLoadData(lvl = "agg", fld = "m4id", val = 1842443, type = "mc", add.fld = FALSE) + +## Load data with add.fld = TRUE to return all available processed data fields +all_fields <- tcplLoadData(lvl = 3, val = 1842443, type = "mc", add.fld = TRUE) +``` + +## Assay Annotations + +The tcplLoadAsid, tcplLoadAid, tcplLoadAcid, and tcplLoadAeid functions load relevant assay ids and names for the respective assay elements based on the user specified parameters. + +### Load aeid + +tcplLoadAeid is used to load endpoint id (aeid) and endpoint name (aenm) as well any mapped annotations. Any annotations field can be used in the "fld" and "val" parameters to produce an annotations subset. Users may consider reviewing all annotations via tcplQueryAPI(resource = "assay") if unsure which values to supply. + +```{r load_aeid} +# load aeid and aenm for given acid +aeid <- tcplLoadAeid(fld = "acid", val = 400) +print(aeid) +``` + +Users may subset on as many fields as desired. tcplLoadAeid joins the criteria with multiple `fld` and `val` as an “AND” rather than “OR”, meaning the subset returns rows where all are TRUE. `val` has the same length that `fld`. To combine fields of different types (i.e. numeric and string), or of different element lengths, ensure all values are provided in appropriate length lists. + +```{r load_aeid_plus} +# subset all aeids by using multiple fields -- val must be same length in list form! +aeids <- tcplLoadAeid(fld = c("intended_target_type", "detection_technology_type"), + val = list("protein", c("Colorimetric", "Fluorescence"))) # list length == 2! +``` +The above example subsets to endpoints where intended target type is "protein" and detection_technology_type is "colorimetric" or "fluorescence". + +### Load acid + +Similar to tcplLoadAeid, tcplLoadAcid loads assay component id (acid) and assay component name (acnm) as well as any specified annotation fields. Like tcplLoadAeid, output can be subset with as many `fld` and `val` as desired. + +```{r load_acid} +# load acid and acnm for given aeid +acid <- tcplLoadAcid(fld = "aeid", val = c(663,891)) + +# subset all acids by using multiple fields -- val must be same length in list form! +acids <- tcplLoadAcid(fld = c("organism", "tissue"), + val = list("rat", "liver"), + add.fld = c("aeid", "aid", "asid", "signal_direction")) +``` + +### Load aid + +Similar to tcplLoadAeid, tcplLoadAid loads assay id (aid) and assay name (anm) as well as any specified annotation fields. Like tcplLoadAeid, output can be subset with as many `fld` and `val` as desired. + +```{r load_aid, eval=FALSE} +# Load aid and anm for given aeid +aid <- tcplLoadAid(fld = "aeid", val = 663) + +# Subset all aids by using multiple fields -- val must be same length in list form! +aids <- tcplLoadAid(fld = c("organism", "tissue"), + val = list("rat", "liver"), + add.fld = c("aeid", "acid", "asid", "signal_direction")) +``` + +### Load asid + +Similar to tcplLoadAeid, tcplLoadAsid loads assay source id (asid) and assay source name (asnm) as well as any specified annotation fields. Like tcplLoadAsid, output can be subset with as many `fld` and `val` as desired. + +```{r load_asid, eval=FALSE} +# Load asid and asnm for given aeid +asid <- tcplLoadAsid(fld = "aeid", val = 663) + +# Subset all asids by using multiple fields -- val must be same length in list form! +asids <- tcplLoadAsid(fld = c("organism", "tissue"), + val = list("rat", "liver"), + add.fld = c("aeid", "acid", "asid", "signal_direction")) +``` + +### Load unit + +To load the normalized data type, or response unit, use tcplLoadUnit. This function does not require `fld` and `val` parameters, but uses `aeid` as input. tcplLoadUnit is typically used as an internal function for plotting. + +```{r load_unit} +# Load resp_unit for given aeid +unit <- tcplLoadUnit(aeid = c(663, 891)) +``` + +## Sample and Chemical information + +### Load concentration unit + +tcplLoadConcUnit is used to load the concentration unit for a specific `spid` or multiple `spid`s. This is typically used as an internal function for plotting. + +```{r load_conc_unit} +# Load conc_unit for given spid +conc_unit <- tcplLoadConcUnit(spid = "TP0000904H05") +print(conc_unit) +``` + +### Load chemical info + +tcplLoadChem is used to load the chemical information for a specific `spid` or multiple `spid`s. Notice tcplLoadChem uses `field` instead of `fld`. + +```{r load_chem} +# Load chem_info for given spid +chem_info <- tcplLoadChem(field = "spid", val = "TP0000904H05") +print(chem_info) +``` + +## Plotting + +tcplPlot is tcpl’s single flexible plotting function, allowing for interactive and consistent visualization of concentration-response curves via customizable parameters. For more details on implementation, parameters and specific customization instructions, refer to the main Data Retrieval section. This section will instead focus on the limitations of plotting using the CTX APIs as a data connection. + +As with loading data via tcplLoadData, the user must indicate the applicable fields and ids which are query-able via the CTX Bioactivity API. These such fields are limited to “aeid”, “m4id”, “spid”, and “dtxsid”, and any other fields input will result in error. + +While supplying multiple ids (through val) is valid, supplying multiple fields is not. For example, if fld = "spid", no aeid can be specified, meaning every matching spid will be plotted. If fld = "aeid", every sample within the given endpoint(s) will be plotted. If fld = "m4id", only one plot will output for every each m4id input. Combinations of fields are currently not supported with tcplPlot using API connections. Therefore, if looking for a specific aeid and spid combo, one should determine the corresponding m4id, like so: + +## - Output Image File (JPG) of Single Verbose Plot, by M4ID + +```{r plot_aeid_spid, eval = FALSE} +# Load all matching spids and then subset using the aeid desired to find m4id +mc5 <- tcplLoadData(lvl = 5, + fld = "spid", + val = "TP0000904H05", + type = "mc", + add.fld = FALSE) # 8 rows of data +m4id <- mc5[aeid == 714]$m4id # subset to 1 aeid extract m4id + +# Default parameters used here: fld = "m4id", type = "mc" (type can never be "sc" when connected to API) +tcplPlot(val = m4id, output = "jpg", verbose = TRUE, flags = TRUE) +``` + +
![API-sourced plot with parameters: output = "jpg", verbose = TRUE, and flags = TRUE for m4id 1847540](img/API_plot_1847540.jpg){#id .class width=75% height=75%} + +
+ +## - Output PDF of Multiple Comparison Plots per Page, by M4ID + +The “compare"/dual-plot feature can be used by supplying a list of m4ids to `val` and `compare.val`. These lists must be the same length! + +```{r plot_m4id_compare, eval = FALSE} +# Using the data pulled in the previous code chunk 'mc5' +m4id <- mc5$m4id # create m4id vector length == 8 + +# Default parameters used here: fld = "m4id", type = "mc" (type can never be "sc" when connected to API) +tcplPlot(val = m4id[1:4], compare.val = m4id[5:8], output = "pdf", verbose = TRUE, multi = TRUE, + flags = TRUE, yuniform = TRUE, fileprefix = "API_plot_compare") +``` + +
![API-sourced plots with parameters: output = "pdf", verbose = TRUE, multi = TRUE, flags = TRUE, and yuniform = TRUE for m4ids 1833668, 1834094, 1836233, and 1836494, compared with m4ids 1839401, 1842443, 1847540, and 1850045](img/API_plot_compare.png){#id .class width=75% height=75%}
+ +## - Output PDF of Verbose, Multiple Plots per Page, by AEID + +Supply `fld = "aeid"` to plot every curve available in the API for the given endpoint(s). + +```{r plot_aeid, eval = FALSE} +# plot all curves across endpoint(s) +tcplPlot(fld = "aeid", val = 704, output = "pdf", verbose = TRUE, + multi = TRUE, yrange = c(-100,100), fileprefix = "API_plot_704") +``` + +
![API-sourced plots with parameters: output = "pdf", verbose = TRUE, multi = TRUE, and yrange = c(-100,100) for aeid 704](img/API_plot_704.png){#id .class width=75% height=75%}
+ +## Advanced Comparison Plotting + +tcplPlot has been updated for advanced comparison plotting across data connections. If working on a local invitrodb instance, additional dose-response data may be available, data reprocessed, methods adjusted, etc. Users may wish to compare data released in different versions, such as comparing API data or versioned database (invitrodb v4.1 and later) to one's local invitrodb database. Using the utility function tcplPlotLoadData while connected to the API, users can pass along data via tcplPlot’s `dat` parameter and use `compare.val` for their database data as described above. + +# Example Integrations with Other Computational Toxicology Tools + +## Evaluate ToxCast AEDs for a single chemical and target + +This section will explore how one can compare in vivo Points of Departure (PODs) from the [Toxicity Reference Database (ToxRefDB)](https://www.epa.gov/comptox-tools/downloadable-computational-toxicology-data#AT) with administered equivalent doses (AEDs) from ToxCast *in vitro* bioactivity data from invitrodb. The process can be adapted for any given chemical and target depending on available data in either database. + +The following example will consider "[Pentachlorophenol (PCP, DTXSID7021106)](https://comptox.epa.gov/dashboard/chemical/details/DTXSID7021106)" and "liver toxicity". This pesticide was selected at random to showcase workflow, but the process can be adapted for any given chemical and target depending on available data in either database. + +### Consider ToxRefDB *in vivo* toxicity benchmarks as POD-Traditional + +First, export ToxRefDB batch download results for any chemical from the [CompTox Chemicals Dashboard](https://comptox.epa.gov/dashboard/batch-search) Batch Search or [CTX Hazard APIs](https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis). Check out the [ctxR R Client package]() for more guidance on interacting with the CTX APIs. + +After loading all chemical-specific data for "Pentachlorophenol", filter results to only include "liver"-related effects. Next identify the observed lowest effect (significantly different from control in source document i.e. treatment related=1) and lowest observed adverse (deemed adverse by study reviewer in source document i.e. critical_effect=1) effect levels at minimum dose_adjusted (mg/kg/day) value. +```{r txrf-data-liver-subset, eval=FALSE} +toxref_chnm_liver <- toxref_batch_download_chnm %>% + filter(endpoint_target == 'liver') + +toxref_chnm_liver_lel <- toxref_chnm_liver %>% + summarise(lel = min(dose_adjusted[treatment_related == 1]), + loael = min(dose_adjusted[critical_effect == 1])) +``` + +### Consider ToxCast *in vitro* bioactivity data as POD-NAM + +First, query the invitrodb database for all assay annotations, and filter results to consider only "liver" derived tissue-based endpoints. + +```{r txct-annotations-liver-subset, warning=FALSE, eval=FALSE} +toxcast_annotations_subset <- tcplLoadAeid(fld = "tissue", val = "liver", add.fld = "tissue") +``` + +For this subset of endpoints of targeted interest, pull assay results (mc5-mc6) for the chemical "Pentachlorophenol" +```{r txct-data-pull, fig.align='center',class.source="scroll-100",message=FALSE, eval=FALSE} +# Load the chemical data from the database +chnm <- 'Pentachlorophenol' +chem <- tcplLoadChem(field = 'chnm', val = chnm) + +# Load mc5 data from the database for the specified chemical +mc5 <- tcplLoadData(lvl = 5, fld = 'spid', val = chem[, spid], type = 'mc') + +#Join with level 6 flag information +mc6 <- tcplPrepOtpt(tcplLoadData(lvl = 6, fld = 'm4id', val = mc5$m4id, type = 'mc')) +setDT(mc6) +mc6_mthds <- mc6[ , .( mc6_mthd_id = paste(mc6_mthd_id, collapse=",")), by = m4id] +mc6_flags <- mc6[ , .( flag = paste(flag, collapse=";")), by = m4id] +mc5$mc6_flags <- mc6_mthds$mc6_mthd_id[match(mc5$m4id, mc6_mthds$m4id)] +mc5[, flag.length := ifelse(!is.na(mc6_flags), + count.fields(textConnection(mc6_flags), sep = ','), NA)] + +# filter the potency and activity using coarse filters related to hitc, flags, fitc +mc5[hitc >= 0.9 & flag.length < 3, use.me := 1] +mc5[hitc >= 0.9 & is.na(flag.length), use.me := 1] +mc5[hitc >= 0.9 & flag.length >= 3, use.me := 0] +mc5[fitc %in% c(36, 45), use.me := 0] +mc5[hitc < 0.9, use.me := 0] +mc5[use.me == 0, ac50 := as.numeric(NA)] +mc5[use.me == 0, hitc := 0] +mc5[hitc == 0, ac50 := as.numeric(NA)] +mc5[hitc >= 0.9, ac50_uM := ifelse(!is.na(ac50), ac50, NA)] + +#Filter to only liver endpoints +toxcast_mc5_liver <- mc5[aeid %in% toxcast_annotations_subset$aeid,] +``` + +Obtain a summary of the ToxCast AC50 values with the 5th and 50th percentiles, as well as the mean. + +```{r httk-prep, eval=FALSE} +# Calculating summary statistics for ac50 values for httk processing to calculate AED +toxcast_mc5_liver_summary <- toxcast_mc5_liver[,list( + p5.ac50uM = quantile(ac50_uM, probs = c(0.05), na.rm = T), + p50.ac50uM = quantile(ac50_uM, probs = c(0.50), na.rm = T), + mean.ac50uM = mean(ac50_uM, na.rm = T))] +``` + +[Administered Equivalent Doses](#aed) can be accessed from Level 7, or calculated *ad hoc* using the [High-throughput Toxicokinetics R package (httk)](https://CRAN.R-project.org/package=httk). Potency estimates and model options can be adjusted based on use case. In this example, modeling assumptions when estimating the AEDs with httk were: + +- Species options include ‘Rat’, ‘Rabbit’, ’Dog’, ’Mouse’ or default ‘Human' +- Which quantile from Monte Carlo steady-state simulation (for Css)? The scaling factor is the inverse of the steady state plasma concentration (Css) predicted for a 1 mg/kg/day exposure dose rate. This simulates variability and propagates uncertainty to calculate an upper 95th percentile Css,95 for individuals who get higher plasma concentrations from the same exposure, i.e. 95th concentration quantile produces the 5th dose quantile (most sensitive measure).; +- Restrictive clearance indicates the chemical is protein-bound such that it is relatively unavailable for hepatic metabolism or renal excretion; whereas, non-restrictive clearance assumes the chemical rapidly disassociates from the protein for metabolism and excretion + +```{r httk-aed, warning=FALSE, message=FALSE, eval=FALSE} +# Generate AEDs +toxcast_aed_liver_summary <- toxcast_mc5_liver_summary %>% + summarize(aed.p5ac50.hu.css.50 = calc_mc_oral_equiv(conc=p5.ac50uM, + dtxsid = 'DTXSID7021106', which.quantile = c(0.95), + species ='Human', restrictive.clearance = T, + output.units = 'mgpkgpday', model = '3compartmentss'), + aed.p50ac50.hu.css.50 = calc_mc_oral_equiv(conc = p50.ac50uM, + dtxsid = 'DTXSID7021106', which.quantile = c(0.95), + species = 'Human', restrictive.clearance = T, + output.units = 'mgpkgpday', model = '3compartmentss'), + aed.meanac50.hu.css.50 = calc_mc_oral_equiv(conc = mean.ac50uM, + dtxsid = 'DTXSID7021106', which.quantile = c(0.95), + species = 'Human', restrictive.clearance = T, + output.units = 'mgpkgpday', model = '3compartmentss')) +``` + +### Compare POD-Traditional with POD-NAM + +POD-Traditional (ToxRefDB LEL and LOAEL) and POD-NAM (ToxCast-derived AEDs for 5%, 50%, and mean AC50 values) can be compared once converted to to mg/kg/day units. +``` {r compare, echo=FALSE} +#create comparison table +POD <- c("ToxRefDB LEL", + "ToxRefDB LOAEL", + "ToxCast AED at 5th percentile AC50", + "ToxCast AED at 50th percentile/median AC50", + "ToxCast AED at mean AC50") +Value <- c("1.5", + "1.5", + "2.273744", + "7.666872", + "16.09772") + +Table <- as.data.table(t(data.frame(POD, Value))) +setnames(Table, as.character(Table[1,])) +Table <- Table[-1,] + +kable(Table)%>% + kable_styling("striped") +``` + +For the "Pentachlorophenol liver toxicity" example provided here, the POD estimated from ToxRefDB (POD-Traditional) is more protective compared to the lowest summary estimate from ToxCast (POD-NAM) + +## Apply ToxCast to examine EcoTox hazard for a single chemical + +ToxCast data are predominantly based on mammalian models, but still may have value in ecological risk assessments. This section will explore how one may review ToxCast derived values in combination with curated values from [Ecotoxicology (ECOTOX) Knowledgebase](https://cfpub.epa.gov/ecotox/) as well as cross-species applicability through [Sequence Alignment to Predict Across Species Susceptibility (SeqAPASS)](https://seqapass.epa.gov/seqapass/) tool. The process can be adapted for any given chemical and target depending on available data in either database. + +### Consider POD-NAM and POD-Traditional +Repeat steps outlined above. This example will utilize a new chemical of interest: [17alpha-Ethinylestradiol (EE2, DTXSID5020576)](https://comptox.epa.gov/dashboard/chemical/invitrodb/DTXSID5020576). Consider ToxCast and ToxRefDB to set POD-NAM and POD-Traditional, respectively. + +```{r txct-data-pull2, fig.align='center',class.source="scroll-100",message=FALSE, eval=FALSE} +# identify the lel and loaels from toxref chemical subset +toxref_chnm_POD<-toxref_chnm_EE2 %>% + summarise(lel=min(dose_adjusted[treatment_related==1]), + loael=min(dose_adjusted[critical_effect==1])) + +# Load the chemical data from the database +chem <- tcplLoadChem(field = 'dsstox_substance_id',val = "DTXSID5020576") + +# Load mc5 data from the database for the specified chemical +mc5 <- tcplLoadData(lvl = 5, # data level + fld = 'spid', # field to query on + val = chem[,spid], # value for each field (fld) + type = 'mc') # data type - MC + +#Join with level 6 flag information +mc6 <- tcplPrepOtpt(tcplLoadData(lvl = 6, fld = 'm4id', val = mc5$m4id, type = 'mc')) +setDT(mc6) +mc6_mthds <- mc6[ , .( mc6_mthd_id = paste(mc6_mthd_id, collapse = ",")), by = m4id] +mc6_flags <- mc6[ , .( flag = paste(flag, collapse = ";")), by = m4id] +mc5$mc6_flags <- mc6_mthds$mc6_mthd_id[match(mc5$m4id, mc6_mthds$m4id)] +mc5[, flag.length := ifelse(!is.na(mc6_flags), + count.fields(textConnection(mc6_flags), sep =','), NA)] + +# filter the potency and activity using coarse filters related to hitc, flags, fitc +mc5[hitc >= 0.9 & flag.length < 3, use.me := 1] +mc5[hitc >= 0.9 & is.na(flag.length), use.me := 1] +mc5[hitc >= 0.9 & flag.length >= 3, use.me := 0] +mc5[fitc %in% c(36,45), use.me := 0] +mc5[hitc < 0.9, use.me := 0] +mc5[use.me == 0, ac50 := as.numeric(NA)] +mc5[use.me == 0, hitc := 0] +mc5[hitc == 0, ac50 := as.numeric(NA)] +mc5[hitc >= 0.9,ac50_uM := ifelse(!is.na(ac50), ac50, NA)] + +# Calculating summary statistics for ac50 values for httk processing to calculate AED +toxcast_mc5_EE2_summary <- mc5[,list( + p5.ac50uM = quantile(ac50_uM, probs = c(0.05), na.rm=T), + p50.ac50uM = quantile(ac50_uM, probs = c(0.50), na.rm=T), + mean.ac50uM = mean(ac50_uM, na.rm=T))] + +# Generate AEDs +toxcast_aed_EE2_summary <- toxcast_mc5_EE2_summary %>% + summarize(aed.p5ac50.hu.css.50 = calc_mc_oral_equiv(conc = p5.ac50uM, + dtxsid = 'DTXSID5020576', which.quantile = c(0.95), + species ='Human', restrictive.clearance = T, + output.units = 'mgpkgpday', model = '3compartmentss'), + aed.p50ac50.hu.css.50 = calc_mc_oral_equiv(conc = p50.ac50uM, + dtxsid = 'DTXSID5020576', which.quantile = c(0.95), + species ='Human', restrictive.clearance = T, + output.units='mgpkgpday', model='3compartmentss'), + aed.meanac50.hu.css.50 = calc_mc_oral_equiv(conc=mean.ac50uM, + dtxsid = 'DTXSID5020576', which.quantile = c(0.95), + species = 'Human', restrictive.clearance = T, + output.units = 'mgpkgpday', model = '3compartmentss'), + aed.minac50.aeid807.hu.css.50 = calc_mc_oral_equiv(conc = 0.0002448276, + dtxsid = 'DTXSID5020576', which.quantile = c(0.95), + species ='Human', restrictive.clearance = T, + output.units = 'mgpkgpday', model = '3compartmentss')) +``` + +``` {r compare2, echo=FALSE} +#create comparison table +POD <- c("ToxRefDB LEL", + "ToxRefDB LOAEL", + "ToxCast AED at 5th percentile AC50", + "ToxCast AED at 50th percentile/median AC50", + "ToxCast AED at mean AC50") +Value <- c("0.00012", + "0.00021", + "2.26e-07", + "0.00661", + "0.01994") + +Table <- as.data.table(t(data.frame(POD, Value))) +setnames(Table, as.character(Table[1,])) +Table <- Table[-1,] + +kable(Table)%>% + kable_styling("striped") +``` +These summary POD-NAM values are calculated using all ToxCast endpoints. Additional inspection of individual endpoints and annotations may be warranted. Utilize the SeqAPASS column to filter to endpoints annotated with SeqAPASS protein targets, i.e. enter “NP_” into SeqAPASS search box. + +
![Filtering CCD’s Bioactivity Summary Grid for SeqAPASS protein targets](img/ccd_seqapass_filter.png)
+ +### Consider SeqAPASS +The [SeqAPASS](https://seqapass.epa.gov/seqapass/) tool has been developed to predict a species relative intrinsic susceptibility to chemicals with known molecular targets (e.g., pharmaceuticals, pesticides) as well as evaluate conservation of molecular targets in high-throughput screening assays (i.e., ToxCast), molecular initiating events (MIEs), and early key events in the adverse outcome pathway (AOP) framework as a means to extrapolate such knowledge across species. After copying the NCBI protein Accession numbers for ToxCast endpoints of interest, visit the SeqAPASS web interface to understand potential for cross-species comparison. Note that new users will need to request a free log-in to access this resource and should review the [SeqAPASS User Guide](https://www.epa.gov/comptox-tools/seqapass-user-guide) for example workflows. + +### Consider EcoTox +The ECOTOX widget in SeqAPASS gives the user the option to create a species and chemical filter that will link out to ECOTOX. The widget allows for rapid access of curated empirical toxicity data from the [ECOTOXicology (ECOTOX) Knowledgebase](https://cfpub.epa.gov/ecotox/) that can be compared to sequence-based predictions of chemical susceptibility from SeqAPASS results. + +All curated endpoint data may not be relevant for comparison and weight of relevance of these species-specific endpoints may also depend on SeqAPASS percent similarity. Additionally, ECOTOX records often cannot always be easily converted into mg/kg/day internal dose values for comparison. This is especially true for the non-dietary exposures, such as the aqueous exposures, where there are no chemical concentration measurements in the organisms across different species and life stages observed. These are considerations that can be further explored by reviewing the curated information and source documents. + +### Compare +An example of cross species extrapolation is described in [Vliet et al, 2023](https://doi.org/10.1093/toxsci/kfad038). Overall, this study demonstrates a framework for utilizing bioinformatics and existing data to build weight of evidence for cross-species extrapolation and provides a technical basis for extrapolating data to prioritize hazard in non-mammalian vertebrate species. + +```{r, include=FALSE} +end_vignette() +``` diff --git a/vignettes/api/0/api-ccte.epa.gov/bioactivity/assay.json b/vignettes/api/0/api-ccte.epa.gov/bioactivity/assay.json new file mode 100644 index 00000000..9adbfe12 --- /dev/null +++ b/vignettes/api/0/api-ccte.epa.gov/bioactivity/assay.json @@ -0,0 +1,161 @@ +[ + { + "aeid": 891, + "assayComponentEndpointName": "CEETOX_H295R_11DCORT", + "exportReady": 1, + "internalReady": 1, + "assayComponentEndpointDesc": "Data from the assay component CEETOX_H295R_11DCORT was analyzed into 1 assay endpoint. This assay endpoint, CEETOX_H295R_11DCORT, was analyzed with bidirectional fitting relative to DMSO as the negative control and baseline of activity. Using a type of inducible reporter, gain or loss-of-signal activity using HPLC-MS-MS was used to understand synthesis of 11-Deoxycortisol in H295R cell line at 48hr of chemical exposure. To generalize the intended target to other relatable targets, this assay endpoint is annotated to the steroid hormone intended target family, where the subfamily is glucocorticoids.", + "assayFunctionType": "detection of steroid hormone", + "normalizedDataType": "log2_fold_induction", + "burstAssay": 0, + "keyPositiveControl": "Prochloraz;Forskolin", + "signalDirection": "bidirectional", + "intendedTargetType": "molecular messenger", + "intendedTargetTypeSub": "11-Deoxycortisol", + "intendedTargetFamily": "steroid hormone", + "intendedTargetFamilySub": "glucocorticoids", + "cellViabilityAssay": 0, + "dataUsability": 1, + "acid": 586, + "assayComponentName": "CEETOX_H295R_11DCORT", + "assayComponentDesc": "CEETOX_H295R_11DCORT is one of 23 assay component(s) measured or calculated from the CEETOX_H295R assay. It is designed to make measurements of hormone induction, a form of inducible reporter, as detected with absorbance signals by HPLC-MS-MS technology.", + "assayComponentTargetDesc": null, + "parameterReadoutType": "single", + "assayDesignType": "inducible reporter", + "assayDesignTypeSub": "hormone induction", + "biologicalProcessTarget": "regulation of steroid hormone biosynthetic process", + "detectionTechnologyType": "Spectrophotometry", + "detectionTechnologyTypeSub": "Absorbance", + "detectionTechnology": "HPLC-MS-MS", + "keyAssayReagentType": "inducer", + "keyAssayReagent": null, + "technologicalTargetType": "molecular messenger", + "technologicalTargetTypeSub": "11-Deoxycortisol", + "aid": 370, + "assayName": "CEETOX_H295R", + "assayDesc": "CEETOX_H295R is a cell-based, multiplexed-readout assay that uses H295R, a human adrenal gland cell line, with measurements taken at 48 hours after chemical dosing in a 96-well plate.", + "timepointHr": 48.0, + "organismId": 9606, + "organism": "human", + "tissue": "adrenal gland", + "cellFormat": "cell line", + "cellFreeComponentSource": "", + "cellShortName": "H295R", + "cellGrowthMode": "adherent", + "assayFootprint": "microplate: 96-well plate", + "assayFormatType": "cell-based", + "assayFormatTypeSub": "cell-based format", + "contentReadoutType": "multiplexed", + "dilutionSolvent": "DMSO", + "dilutionSolventPercentMax": 0.1, + "asid": 8, + "assaySourceName": "CEETOX", + "assaySourceLongName": "Ceetox/OpAns", + "assaySourceDesc": "Ceetox, a part of Cyprotex, is a Contract Research Organization (CRO) that in coordination with OpAns, an analytical laboratory, provide ADME-tox services.", + "gene": { + "geneId": 145, + "geneName": "nuclear receptor subfamily 3, group C, member 1 (glucocorticoid receptor)", + "description": null, + "geneSymbol": "NR3C1", + "organismId": 1, + "trackStatus": "live", + "entrezGeneId": 2908, + "officialSymbol": "NR3C1", + "officialFullName": "nuclear receptor subfamily 3, group C, member 1 (glucocorticoid receptor)", + "uniprotAccessionNumber": "P04150" + }, + "assayList": { + "name": "EDSP steroidogenesis", + "description": "Steroidogenesis pathway assays used in EDSP" + }, + "citations": { + "doi": "doi: 10.1093/toxsci/kfw002", + "url": "https://pubmed.ncbi.nlm.nih.gov/26781511/", + "pmid": 26781511, + "title": "High-Throughput Screening of Chemical Effects on Steroidogenesis Using H295R Human Adrenocortical Carcinoma Cells", + "author": "Karmaus AL, Toole CM, Filer DL, Lewis KC, Martin MT", + "citation": "Karmaus AL, Toole CM, Filer DL, Lewis KC, Martin MT. High-Throughput Screening of Chemical Effects on Steroidogenesis Using H295R Human Adrenocortical Carcinoma Cells. Toxicol Sci. 2016 Apr;150(2):323-32. doi: 10.1093/toxsci/kfw002. Epub 2016 Jan 18. PMID: 26781511; PMCID: PMC4809454.", + "otherId": "0", + "citationId": 245, + "otherSource": "" + } + }, + { + "aeid": 663, + "assayComponentEndpointName": "NVS_GPCR_rAdra1_NonSelective", + "exportReady": 1, + "internalReady": 1, + "assayComponentEndpointDesc": "Data from the assay component NVS_GPCR_rAdra1_NonSelective was analyzed into 1 assay endpoint. This assay endpoint, NVS_GPCR_rAdra1_NonSelective, was analyzed in the positive analysis fitting direction relative to DMSO as the negative control and baseline of activity. \r\nUsing a type of binding reporter, loss-of-signal activity can be used to understand changes in the binding as they relate to the gene Adra1a. \r\nFurthermore, this assay endpoint can be referred to as a primary readout, because the performed assay has only produced 1 assay endpoint. \r\nTo generalize the intended target to other relatable targets, this assay endpoint is annotated to the gpcr intended target family, where the subfamily is rhodopsin-like receptor.", + "assayFunctionType": "binding", + "normalizedDataType": "percent_activity", + "burstAssay": 0, + "keyPositiveControl": "Phentolamine mesylate", + "signalDirection": "loss", + "intendedTargetType": "protein", + "intendedTargetTypeSub": "receptor", + "intendedTargetFamily": "gpcr", + "intendedTargetFamilySub": "rhodopsin-like receptor", + "cellViabilityAssay": 0, + "dataUsability": 1, + "acid": 400, + "assayComponentName": "NVS_GPCR_rAdra1_NonSelective", + "assayComponentDesc": "NVS_GPCR_rAdra1_NonSelective is one of one assay component(s) measured or calculated from the NVS_GPCR_rAdra1_NonSelective assay. It is designed to make measurements of radioligand binding, a form of binding reporter, as detected with scintillation counting signals by Filter-based radiodetection technology.", + "assayComponentTargetDesc": "Changes to scintillation counting signals produced from the receptor-ligand binding of the key ligand [[3H]-7-Methoxy-Prazosin] are indicative of a change in receptor function and kinetics for the Norway rat adrenoceptor alpha 1A [GeneSymbol:Adra1a | GeneID:29412 | Uniprot_SwissProt_Accession:P43140].", + "parameterReadoutType": "single", + "assayDesignType": "binding reporter", + "assayDesignTypeSub": "radioligand binding", + "biologicalProcessTarget": "receptor binding", + "detectionTechnologyType": "Radiometry", + "detectionTechnologyTypeSub": "Scintillation counting", + "detectionTechnology": "Filter-based radiodetection", + "keyAssayReagentType": "ligand", + "keyAssayReagent": "[3H]-7-Methoxy-Prazosin", + "technologicalTargetType": "protein", + "technologicalTargetTypeSub": "receptor", + "aid": 214, + "assayName": "NVS_GPCR_rAdra1_NonSelective", + "assayDesc": "NVS_GPCR_rAdra1_NonSelective is a biochemical, single-readout assay that uses extracted gene-proteins from Rat forebrain membranes in a tissue-based cell-free assay. Measurements were taken 1 hour after chemical dosing in a 48-well plate.", + "timepointHr": 1.0, + "organismId": 10116, + "organism": "rat", + "tissue": "brain", + "cellFormat": "tissue-based cell-free", + "cellFreeComponentSource": "Rat forebrain membranes", + "cellShortName": "NA", + "cellGrowthMode": "NA", + "assayFootprint": "microplate: 48-well plate", + "assayFormatType": "biochemical", + "assayFormatTypeSub": "protein single format", + "contentReadoutType": "single", + "dilutionSolvent": "DMSO", + "dilutionSolventPercentMax": 0.0, + "asid": 5, + "assaySourceName": "NVS", + "assaySourceLongName": "Novascreen", + "assaySourceDesc": "NovaScreen, part of PerkinElmer, a human and environmental health company, provides a large diverse suite of cell-free binding and biochemical assays.", + "gene": { + "geneId": 419, + "geneName": "adrenoceptor alpha 1A", + "description": null, + "geneSymbol": "Adra1a", + "organismId": 3, + "trackStatus": "live", + "entrezGeneId": 29412, + "officialSymbol": "Adra1a", + "officialFullName": "adrenoceptor alpha 1A", + "uniprotAccessionNumber": "P43140" + }, + "assayList": null, + "citations": { + "doi": "", + "url": "http://www.ncbi.nlm.nih.gov/pubmed/2879884", + "pmid": 2879884, + "title": "Alpha-1 and alpha-2 adrenoceptor binding in cerebral cortex: competition studies with [3H]prazosin and [3H]idazoxan", + "author": "Reader TA, Brière R, Grondin L", + "citation": "Reader TA, Brière R, Grondin L. Alpha-1 and alpha-2 adrenoceptor binding in cerebral cortex: competition studies with [3H]prazosin and [3H]idazoxan. J Neural Transm. 1987;68(1-2):79-95. PubMed PMID: 2879884.", + "otherId": "0", + "citationId": 73, + "otherSource": "" + } +} +] diff --git a/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-aeid/704.json b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-aeid/704.json new file mode 100644 index 00000000..a329279d --- /dev/null +++ b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-aeid/704.json @@ -0,0 +1,9207 @@ +[ + { + "aeid": 704, + "m4id": 1842410, + "spid": "LEGTV002G10", + "chid": 32577, + "casn": "79538-32-2", + "chnm": "Tefluthrin", + "dtxsid": "DTXSID5032577", + "bmad": 3.7634679299683276, + "respMax": 22.88978034849851, + "respMin": -26.552798250251374, + "maxMean": 22.88978034849851, + "maxMeanConc": 0.7781512503836436, + "maxMed": 22.88978034849851, + "maxMedConc": 0.7781512503836436, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 4, + "tmpi": 9, + "m5id": 5037056, + "modl": "exp4", + "hitc": 0.2411318116914611, + "fitc": 15, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.6989700043360187, + -0.22184874961635637, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187, + 0.3010299956639812 + ], + "resp": [ + -26.552798250251374, + 7.643488716816449, + 22.88978034849851, + 7.9412465922401445, + 19.249048936986245, + 22.72625970498906, + 20.26645313099273, + 10.220169791958208 + ] + }, + "mc4Param": { + "pow_a": 8.051875026642751, + "pow_p": 0.3000002363252646, + "exp2_a": 2586.5273948186914, + "exp2_b": 5061.903524643174, + "exp3_a": 16.991620306804258, + "exp3_b": 61.307930252068054, + "exp3_p": 0.3000001542012486, + "exp5_p": 0.41109358960702536, + "gnls_p": 0.5634256102787089, + "gnls_q": 7.950665366879992, + "hill_p": 0.5634498524518311, + "pow_er": 2.1767434212836925, + "cnst_er": 2.8698019137772666, + "exp2_er": 2.623207281861648, + "exp3_er": 2.3192847401467107, + "exp4_er": 2.1056134978195313, + "exp4_ga": 1.0188231249900932, + "exp4_tp": 20.260251446603277, + "exp5_er": 1.9820127172223416, + "exp5_ga": 0.4248866702697808, + "exp5_tp": 20.7377426492478, + "gnls_er": 1.99625942425146, + "gnls_ga": 0.3960985797099487, + "gnls_la": 4930.779736400695, + "gnls_tp": 21.81742856245767, + "hill_er": 1.996272080662291, + "hill_ga": 0.39605546778034006, + "hill_tp": 21.817114896556166, + "poly1_a": 0.5150479432537712, + "poly2_a": 2323.882444395881, + "poly2_b": 4567.207855100587, + "pow_aic": 68.5758988456374, + "pow_cov": 1, + "pow_rme": 12.721053786887008, + "pow_top": 26.03684923789126, + "all_bmed": 0, + "cnst_aic": 72.9602916781216, + "cnst_rme": 18.54949195654765, + "exp2_aic": 73.57241312566146, + "exp2_cov": 1, + "exp2_rme": 15.498838859238056, + "exp2_top": 25.67555887819936, + "exp3_aic": 71.90187282888056, + "exp3_cov": 1, + "exp3_rme": 13.226439348308494, + "exp3_top": 26.53564273777775, + "exp4_aic": 67.91716461253762, + "exp4_cov": 1, + "exp4_rme": 12.291600328368528, + "exp4_top": 20.260251446603277, + "exp5_aic": 68.74654825043743, + "exp5_cov": 1, + "exp5_rme": 12.205391269508892, + "exp5_top": 20.7377426492478, + "gnls_aic": 72.70908001073246, + "gnls_cov": 0, + "gnls_rme": 12.08907864204856, + "gnls_top": 21.62406269958069, + "hill_aic": 68.70908001125854, + "hill_cov": 1, + "hill_rme": 12.089052602788728, + "hill_top": 21.817114896556166, + "poly1_er": 2.6233806365269072, + "poly2_er": 2.623494262991935, + "pow_a_sd": 18.263178960432903, + "pow_ac50": 4.960637316196675, + "pow_p_sd": 0.697941144406865, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 32716.581509859232, + "exp2_ac50": 25.06173541792207, + "exp2_b_sd": 63813.265454996756, + "exp3_a_sd": null, + "exp3_ac50": 9.809731117071673, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 1.0188231249900932, + "exp5_ac50": 0.4248866702697808, + "exp5_p_sd": 0.34799669960865676, + "gnls_ac50": 0.3838306742682284, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.39605546778034006, + "hill_p_sd": 0.635744845964724, + "poly1_aic": 71.56605507092407, + "poly1_cov": 1, + "poly1_rme": 15.493294256204988, + "poly1_top": 25.75239716268856, + "poly2_aic": 73.57994628381844, + "poly2_cov": 1, + "poly2_rme": 15.50431136692914, + "poly2_top": 25.719470980222596, + "pow_er_sd": 1.15655148324573, + "exp2_er_sd": 0.3073701019975029, + "exp3_er_sd": null, + "exp4_er_sd": 0.387701061369176, + "exp4_ga_sd": 1.301060030418642, + "exp4_tp_sd": 4.791141733238257, + "exp5_er_sd": 0.3929731812861924, + "exp5_ga_sd": 0.8430161520344103, + "exp5_tp_sd": 5.937095261163485, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.3920891185604444, + "hill_ga_sd": 1.2602581620806317, + "hill_tp_sd": 10.912262369817968, + "poly1_a_sd": 0.2454616975843716, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 20164.124461380256, + "poly2_ac50": 25.135359225205608, + "poly2_b_sd": 39136.75145557223, + "poly1_er_sd": 0.3073969378754904, + "poly2_er_sd": 0.3073430361679298, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4935.719934078368 + }, + "mc5Param": { + "er": 2.1056134978195313, + "ga": 1.0188231249900932, + "tp": 20.260251446603277, + "ac5": 0.07539350363763271, + "bmd": 0.9015999983866408, + "bmr": 9.289141683881516, + "mll": -30.95858230626881, + "top": 20.260251446603277, + "ac10": 0.15486426667184697, + "ac20": 0.3279877876552497, + "ac50": 1.0188231249900932, + "bmdl": 0.015249773022781948, + "bmdu": 3.811435874108677, + "rmse": 12.291600328368528, + "ac1sd": 0.6104667435797823, + "caikwt": 0.07436025429585817, + "hitcall": 0.2411318116914611, + "top_over_cutoff": 0.8972332532835738 + }, + "mc6Param": { + "flag": [ + "Multiple points above baseline, inactive", + "Borderline", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 8, + 11, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842408, + "spid": "LEGTV002F02", + "chid": 34634, + "casn": "68157-60-8", + "chnm": "Forchlorfenuron", + "dtxsid": "DTXSID1034634", + "bmad": 3.7634679299683276, + "respMax": 30.305480403437308, + "respMin": -15.782463123633022, + "maxMean": 30.305480403437308, + "maxMeanConc": 1.6989700043360187, + "maxMed": 30.305480403437308, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 2, + "tmpi": 7, + "m5id": 5037054, + "modl": "poly1", + "hitc": 0.6460864720880574, + "fitc": 15, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187, + 0.3010299956639812, + -1.6989700043360187, + -0.22184874961635637, + -1.154901959985743 + ], + "resp": [ + 17.312197447937717, + 5.892444361517972, + -5.621637590571268, + 30.305480403437308, + -12.047921136921975, + -0.9033802904499949, + 3.9506691129976836, + -15.782463123633022 + ] + }, + "mc4Param": { + "pow_a": 0.1234505358742655, + "pow_p": 1.4039572198662018, + "exp2_a": 11.704126631709482, + "exp2_b": 39.21885087510036, + "exp3_a": 6.797876599868359, + "exp3_b": 27.227754995685633, + "exp3_p": 0.8670700138038412, + "exp5_p": 2.243572303903159, + "gnls_p": 3.417276045729987, + "gnls_q": 7.9999995152294145, + "hill_p": 3.410031445934874, + "pow_er": 2.053160430913364, + "cnst_er": 2.4831651329165245, + "exp2_er": 2.0477140196724335, + "exp3_er": 2.045418371135353, + "exp4_er": 2.1440692417744724, + "exp4_ga": 27.444981809921984, + "exp4_tp": 36.36657640836127, + "exp5_er": 2.056168804647671, + "exp5_ga": 33.29374622826353, + "exp5_tp": 36.366576245073674, + "gnls_er": 2.0583941068083926, + "gnls_ga": 31.61205104146836, + "gnls_la": 1534.1122637713574, + "gnls_tp": 36.36657643578302, + "hill_er": 2.058279940276527, + "hill_ga": 31.61029453570885, + "hill_tp": 36.36657616615269, + "poly1_a": 0.5785182000394039, + "poly2_a": 12.459385888548155, + "poly2_b": 44.18199252652262, + "pow_aic": 65.0995287126822, + "pow_cov": 1, + "pow_rme": 9.38736161655436, + "pow_top": 29.976034738668837, + "all_bmed": 0, + "cnst_aic": 67.9344363146865, + "cnst_rme": 14.5564438526066, + "exp2_aic": 65.01101796690389, + "exp2_cov": 1, + "exp2_rme": 9.336855219455533, + "exp2_top": 30.177138850514144, + "exp3_aic": 67.00414392078824, + "exp3_cov": 1, + "exp3_rme": 9.328883445138253, + "exp3_top": 30.184512709969923, + "exp4_aic": 65.8649681972613, + "exp4_cov": 1, + "exp4_rme": 9.540601853567534, + "exp4_top": 36.36657640836127, + "exp5_aic": 67.2557220191338, + "exp5_cov": 1, + "exp5_rme": 9.530978553849964, + "exp5_top": 36.366576245073674, + "gnls_aic": 71.33940383936331, + "gnls_cov": 1, + "gnls_rme": 9.604561582504878, + "gnls_top": 36.36043012871301, + "hill_aic": 67.33939320817458, + "hill_cov": 1, + "hill_rme": 9.604376235570829, + "hill_top": 36.36657616615269, + "poly1_er": 2.085652025408799, + "poly2_er": 2.049820013105159, + "pow_a_sd": 0.5753788358968032, + "pow_ac50": 30.517899763456313, + "pow_p_sd": 1.208640790059217, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 41.73861131597536, + "exp2_ac50": 32.48057507982734, + "exp2_b_sd": 80.2181969794621, + "exp3_a_sd": 55.46148196934477, + "exp3_ac50": 32.61409306497238, + "exp3_b_sd": 155.31132615599387, + "exp3_p_sd": 1.7685350503057042, + "exp4_ac50": 27.444981809921984, + "exp5_ac50": 33.29374622826353, + "exp5_p_sd": 3.435165237165201, + "gnls_ac50": 31.60892429289404, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 31.61029453570885, + "hill_p_sd": 23.432436210259, + "poly1_aic": 63.26368385628203, + "poly1_cov": 1, + "poly1_rme": 9.335379666909818, + "poly1_top": 28.92591000197019, + "poly2_aic": 65.04407548989566, + "poly2_cov": 1, + "poly2_rme": 9.347372572279864, + "poly2_top": 30.056881540429895, + "pow_er_sd": 0.33301411643671863, + "exp2_er_sd": 0.3322758677027563, + "exp3_er_sd": 0.3319875527085669, + "exp4_er_sd": 0.3157481584060974, + "exp4_ga_sd": 34.059639655609715, + "exp4_tp_sd": 26.977496390379052, + "exp5_er_sd": 0.334389570780719, + "exp5_ga_sd": 37.91927313278114, + "exp5_tp_sd": 50.504063030446645, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.33640069974138875, + "hill_ga_sd": 126.4453565783159, + "hill_tp_sd": 150.73989659276037, + "poly1_a_sd": 0.13788942465596515, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 81.28656120170228, + "poly2_ac50": 31.22468556738295, + "poly2_b_sd": 189.87096202288063, + "poly1_er_sd": 0.31798965447224936, + "poly2_er_sd": 0.3317697682239624, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1534.1764211860095 + }, + "mc5Param": { + "a": 0.5785182000394039, + "er": 2.085652025408799, + "ac5": 2.4999999999999996, + "acc": 39.03214726567279, + "bmd": 16.05678383713566, + "bmr": 9.289141683881516, + "mll": -29.631841928141014, + "top": 28.92591000197019, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 11.311189751842544, + "bmdu": 29.51384383733146, + "rmse": 9.335379666909818, + "ac1sd": 11.902730791056827, + "caikwt": 0.08823518845609243, + "hitcall": 0.6460864720880574, + "top_over_cutoff": 1.2809953718322074 + }, + "mc6Param": { + "flag": [ + "Multiple points above baseline, inactive", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 8, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842409, + "spid": "LEGTV002F07", + "chid": 32392, + "casn": "66441-23-4", + "chnm": "Fenoxaprop-ethyl", + "dtxsid": "DTXSID2032392", + "bmad": 3.7634679299683276, + "respMax": 11.82202000041872, + "respMin": -15.519375841783155, + "maxMean": 11.82202000041872, + "maxMeanConc": -1.6989700043360187, + "maxMed": 11.82202000041872, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 8, + "m5id": 5037055, + "modl": "poly1", + "hitc": 1.4322271531083211E-5, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637, + 1.6989700043360187 + ], + "resp": [ + 11.82202000041872, + 1.5536961694941236, + -15.519375841783155, + -3.18010844609448, + -2.140589126080783, + 8.784412793010326, + -2.3157498063462607, + -0.3023091900039757 + ] + }, + "mc4Param": { + "pow_a": 0.0000011632431730420026, + "pow_p": 0.371275158646456, + "exp2_a": 0.000001797829505777648, + "exp2_b": 72.74913416945634, + "exp3_a": 0.0000055005758644098394, + "exp3_b": 57.760844012588784, + "exp3_p": 6.22085425509824, + "exp5_p": 0.8997002598611641, + "gnls_p": 6.745015045169553, + "gnls_q": 7.999999994872401, + "hill_p": 7.540290076592129, + "pow_er": 1.8022541315256504, + "cnst_er": 1.8015796789499128, + "exp2_er": 1.8007494516437397, + "exp3_er": 1.8021894413500723, + "exp4_er": 1.80158870051793, + "exp4_ga": 7.782862626322558, + "exp4_tp": 3.226750921155688E-9, + "exp5_er": 1.8015912094733963, + "exp5_ga": 8.441755009402286, + "exp5_tp": 7.302557281932975E-10, + "gnls_er": 1.563319486875444, + "gnls_ga": 0.0021571134721910935, + "gnls_la": 0.3339308415916757, + "gnls_tp": 7.623928704938419, + "hill_er": 1.8015890186604628, + "hill_ga": 157.94452896356304, + "hill_tp": 1.8955153678433672, + "poly1_a": 5.662423411973493E-10, + "poly2_a": 0.000022326254566998696, + "poly2_b": 56.36270470222716, + "pow_aic": 61.5780037237116, + "pow_cov": 1, + "pow_rme": 7.748713087460874, + "pow_top": 0.0000049711385820584395, + "all_bmed": 0, + "cnst_aic": 57.57799866553477, + "cnst_rme": 7.748712496775653, + "exp2_aic": 61.578004749066096, + "exp2_cov": 1, + "exp2_rme": 7.748712562373631, + "exp2_top": 0.0000017768428039737286, + "exp3_aic": 63.57800185669078, + "exp3_cov": 1, + "exp3_rme": 7.748712510532352, + "exp3_top": 0.000002767495920583712, + "exp4_aic": 61.577998666698214, + "exp4_cov": 1, + "exp4_rme": 7.748712497203208, + "exp4_top": 3.226750921155688E-9, + "exp5_aic": 63.57799866627887, + "exp5_cov": 1, + "exp5_rme": 7.74871249686776, + "exp5_top": 7.302557281932975E-10, + "gnls_aic": 64.94555137524486, + "gnls_cov": 1, + "gnls_rme": 6.978798723259373, + "gnls_top": 7.6239285577032945, + "hill_aic": 63.57800538783228, + "hill_cov": 1, + "hill_rme": 7.748714090611704, + "hill_top": 1.8955153678433672, + "poly1_er": 1.801569355455974, + "poly2_er": 1.8017915647795937, + "pow_a_sd": null, + "pow_ac50": 7.72982644524005, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.213607891471405, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.42645739987168, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 7.782862626322558, + "exp5_ac50": 8.441755009402286, + "exp5_p_sd": null, + "gnls_ac50": 0.0021571134162010203, + "gnls_p_sd": 1886.6181378919537, + "gnls_q_sd": 13.897596369316378, + "hill_ac50": 157.94452896356304, + "hill_p_sd": null, + "poly1_aic": 59.577998670402955, + "poly1_cov": 1, + "poly1_rme": 7.748712498123487, + "poly1_top": 2.831211705986746E-8, + "poly2_aic": 61.57800229689971, + "poly2_cov": 1, + "poly2_rme": 7.748713685123689, + "poly2_top": 0.00003737589473088489, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": 0.39059567343598767, + "gnls_ga_sd": 1.343381900673757, + "gnls_la_sd": 0.3212711194493188, + "gnls_tp_sd": 3.818735746599816, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.1026000354392676, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.58306067150831, + "poly2_b_sd": null, + "poly1_er_sd": 0.34707929934562703, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.3339308431136041 + }, + "mc5Param": { + "a": 5.662423411973493E-10, + "er": 1.801569355455974, + "ac5": 2.5, + "bmd": 16404887109.358751, + "bmr": 9.289141683881516, + "mll": -27.78899933520148, + "top": 2.831211705986746E-8, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 62.41443596324167, + "rmse": 7.748712498123487, + "ac1sd": 12160776211.533545, + "caikwt": 0.7310585791085764, + "hitcall": 0.000014322271531083213, + "top_over_cutoff": 1.253813308483351E-9 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842411, + "spid": "LEGTV002H08", + "chid": 34742, + "casn": "NOCAS_34742", + "chnm": "Milbemectin (mixture of 70% Milbemcin A4, 30% Milbemycin A3)", + "dtxsid": "DTXSID8034742", + "bmad": 3.7634679299683276, + "respMax": 73.67532078350177, + "respMin": -5.395088130329359, + "maxMean": 73.67532078350177, + "maxMeanConc": 0.7781512503836436, + "maxMed": 73.67532078350177, + "maxMedConc": 0.7781512503836436, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 6, + "tmpi": 10, + "m5id": 5037057, + "modl": "exp4", + "hitc": 0.9999994968056571, + "fitc": 42, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.22184874961635637, + -0.6989700043360187, + 1.6989700043360187 + ], + "resp": [ + 52.505652872749074, + -5.395088130329359, + 73.67532078350177, + 5.395088130329359, + 72.53691394012041, + 19.22317269185714, + 30.263301277685446, + 69.87972321355599 + ] + }, + "mc4Param": { + "pow_a": 28.147886385576328, + "pow_p": 0.30000009689641516, + "exp2_a": 6119.261472113918, + "exp2_b": 3551.239003137988, + "exp3_a": 975.1669226858538, + "exp3_b": 153230.6117998245, + "exp3_p": 0.3000003501105035, + "exp5_p": 1.094805881965073, + "gnls_p": 1.3647130188568126, + "gnls_q": 0.5619058173970354, + "hill_p": 1.59050714992454, + "pow_er": 2.63553254897771, + "cnst_er": 3.795906798840122, + "exp2_er": 3.3954987701188113, + "exp3_er": 2.727845635618811, + "exp4_er": 1.4689672679270718, + "exp4_ga": 1.099878418012791, + "exp4_tp": 72.48760653689077, + "exp5_er": 1.385097799783372, + "exp5_ga": 1.132980663465564, + "exp5_tp": 72.29651505256778, + "gnls_er": 1.3581230433996936, + "gnls_ga": 1.3915857757652723, + "gnls_la": 524.1224234965719, + "gnls_tp": 88.41038117121148, + "hill_er": 1.5970021189190942, + "hill_ga": 1.077282613722834, + "hill_tp": 73.26305717696057, + "poly1_a": 1.7397504631410787, + "poly2_a": 8413.5045447357, + "poly2_b": 4888.583862175059, + "pow_aic": 73.54169876654271, + "pow_cov": 1, + "pow_rme": 15.2861480042891, + "pow_top": 91.02002602025269, + "all_bmed": 0, + "cnst_aic": 88.28390953083002, + "cnst_rme": 49.58992816204983, + "exp2_aic": 86.10951984809975, + "exp2_cov": 1, + "exp2_rme": 34.328944054173824, + "exp2_top": 86.76609362549449, + "exp3_aic": 75.92329672154494, + "exp3_cov": 1, + "exp3_rme": 15.630160935729108, + "exp3_top": 91.8010727392276, + "exp4_aic": 59.2793317878772, + "exp4_cov": 1, + "exp4_rme": 8.238704361671774, + "exp4_top": 72.48760653689077, + "exp5_aic": 61.10190561453248, + "exp5_cov": 1, + "exp5_rme": 8.62848952975195, + "exp5_top": 72.29651505256778, + "gnls_aic": 65.36002423995862, + "gnls_cov": 1, + "gnls_rme": 9.055176915896654, + "gnls_top": 75.01351487350438, + "hill_aic": 63.48641699639106, + "hill_cov": 1, + "hill_rme": 9.621896825468774, + "hill_top": 73.26305717696057, + "poly1_er": 3.393356939188565, + "poly2_er": 3.3954441024657243, + "pow_a_sd": 8.463344228881985, + "pow_ac50": 4.960631989323517, + "pow_p_sd": 0.09202961052734752, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 44830.330426869536, + "exp2_ac50": 25.087996729753247, + "exp2_b_sd": 25840.49536754701, + "exp3_a_sd": 1604.028096378901, + "exp3_ac50": 5.3422803072846445, + "exp3_b_sd": 660507.3822297514, + "exp3_p_sd": 0.10541901370789264, + "exp4_ac50": 1.099878418012791, + "exp5_ac50": 1.132980663465564, + "exp5_p_sd": 0.2147453097848282, + "gnls_ac50": 1.158904104169734, + "gnls_p_sd": 0.3461607578247413, + "gnls_q_sd": 0.7944942746221946, + "hill_ac50": 1.077282613722834, + "hill_p_sd": 0.4118849346917922, + "poly1_aic": 84.09047084550053, + "poly1_cov": 1, + "poly1_rme": 34.282455965850914, + "poly1_top": 86.98752315705393, + "poly2_aic": 86.11783010298875, + "poly2_cov": 1, + "poly2_rme": 34.3417360780736, + "poly2_top": 86.93271261079072, + "pow_er_sd": 0.32772739565048525, + "exp2_er_sd": 0.3154107490786174, + "exp3_er_sd": 0.34995551663162316, + "exp4_er_sd": 0.3801021109960385, + "exp4_ga_sd": 0.15804671767015727, + "exp4_tp_sd": 2.557860936885942, + "exp5_er_sd": 0.4212709024359285, + "exp5_ga_sd": 0.1485229561872174, + "exp5_tp_sd": 2.346998337980212, + "gnls_er_sd": 0.4418044445090503, + "gnls_ga_sd": 0.4322859035235454, + "gnls_la_sd": 1067.6005455781465, + "gnls_tp_sd": 26.852332203983984, + "hill_er_sd": 0.39657332639532145, + "hill_ga_sd": 0.16949083304776472, + "hill_tp_sd": 3.4053560285886713, + "poly1_a_sd": 0.5875701839815818, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 52103.4262311332, + "poly2_ac50": 25.12655125481741, + "poly2_b_sd": 29886.906099027077, + "poly1_er_sd": 0.31507639708506446, + "poly2_er_sd": 0.31533923357704763, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 902.1729967630253 + }, + "mc5Param": { + "er": 1.4689672679270718, + "ga": 1.099878418012791, + "tp": 72.48760653689077, + "ac5": 0.08139164245040806, + "acc": 0.59228230830365, + "bmd": 0.21760526858009044, + "bmr": 9.289141683881516, + "mll": -26.6396658939386, + "top": 72.48760653689077, + "ac10": 0.167184921951392, + "ac20": 0.3540817637185837, + "ac50": 1.099878418012791, + "bmdl": 0.17276594676938292, + "bmdu": 0.2697433120933787, + "rmse": 8.238704361671774, + "ac1sd": 0.15838472357506664, + "caikwt": 5.031943424985008E-7, + "hitcall": 0.9999994968056573, + "top_over_cutoff": 3.210142342371477 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842412, + "spid": "LEGTV003B07", + "chid": 23892, + "casn": "71751-41-2", + "chnm": "Abamectin", + "dtxsid": "DTXSID8023892", + "bmad": 3.7634679299683276, + "respMax": 77.95705815614956, + "respMin": -28.22028225978724, + "maxMean": 77.95705815614956, + "maxMeanConc": 1.6989700043360187, + "maxMed": 77.95705815614956, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 5, + "tmpi": 11, + "m5id": 5037058, + "modl": "hill", + "hitc": 0.9999986614193673, + "fitc": 41, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 0.3010299956639812, + 1.6989700043360187 + ], + "resp": [ + 64.23854892075744, + -28.22028225978724, + 71.52551303778179, + -8.36715608785845, + 77.90911291815605, + 1.215720341597959, + 77.60553886175157, + 77.95705815614956 + ] + }, + "mc4Param": { + "pow_a": 30.822288131348024, + "pow_p": 0.3000004325120875, + "exp2_a": 9745.30422459993, + "exp2_b": 4985.4095456974865, + "exp3_a": 743.0734773552446, + "exp3_b": 48000.25079936882, + "exp3_p": 0.30036500057781645, + "exp5_p": 4.387719474863923, + "gnls_p": 5.312129658102232, + "gnls_q": 6.044467438794108, + "hill_p": 5.312112708921902, + "pow_er": 3.2500407355444447, + "cnst_er": 4.016143460737711, + "exp2_er": 3.6767003773089906, + "exp3_er": 3.320916603363695, + "exp4_er": 2.55983470322537, + "exp4_ga": 0.4227743529273414, + "exp4_tp": 77.51175315148927, + "exp5_er": 1.566158921380688, + "exp5_ga": 0.4808129543908409, + "exp5_tp": 76.49260417613746, + "gnls_er": 1.5661710124267216, + "gnls_ga": 0.43921987635195425, + "gnls_la": 3693.146065235527, + "gnls_tp": 76.49829109592685, + "hill_er": 1.56618318750266, + "hill_ga": 0.4392211414112244, + "hill_tp": 76.4982866415209, + "poly1_a": 1.964864684075168, + "poly2_a": 13315.496644004026, + "poly2_b": 6833.361453964935, + "pow_aic": 83.17121500215309, + "pow_cov": 1, + "pow_rme": 27.538007561894084, + "pow_top": 99.66819933343275, + "all_bmed": 0, + "cnst_aic": 91.47566405075946, + "cnst_rme": 59.45598607857977, + "exp2_aic": 90.43010743722112, + "exp2_cov": 1, + "exp2_rme": 44.39325952551422, + "exp2_top": 98.2300154558304, + "exp3_aic": 85.41740122713443, + "exp3_cov": 1, + "exp3_rme": 27.91524176610176, + "exp3_top": 100.72988078777028, + "exp4_aic": 73.1330171088266, + "exp4_cov": 1, + "exp4_rme": 15.554088816265924, + "exp4_top": 77.51175315148927, + "exp5_aic": 64.42879073216514, + "exp5_cov": 1, + "exp5_rme": 10.586877659593066, + "exp5_top": 76.49260417613746, + "gnls_aic": 68.42786525704236, + "gnls_cov": 1, + "gnls_rme": 10.586540812021129, + "gnls_top": 76.49829109470431, + "hill_aic": 64.42786525848331, + "hill_cov": 1, + "hill_rme": 10.58654076385496, + "hill_top": 76.4982866415209, + "poly1_er": 3.675479917703469, + "poly2_er": 3.6753004741857582, + "pow_a_sd": 14.109693155432794, + "pow_ac50": 4.960644811507054, + "pow_p_sd": 0.13040289753508288, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 95296.73353627026, + "exp2_ac50": 25.06268265173192, + "exp2_b_sd": 48443.778447988494, + "exp3_a_sd": 1550.6811753333395, + "exp3_ac50": 5.520304040411192, + "exp3_b_sd": 261983.9706240629, + "exp3_p_sd": 0.14665644781542486, + "exp4_ac50": 0.4227743529273414, + "exp5_ac50": 0.4808129543908409, + "exp5_p_sd": 3.3678395549353852, + "gnls_ac50": 0.4392198767408624, + "gnls_p_sd": 3.3958255218054663, + "gnls_q_sd": 151123.9464489836, + "hill_ac50": 0.4392211414112244, + "hill_p_sd": 3.3956061053853364, + "poly1_aic": 88.41948218774404, + "poly1_cov": 1, + "poly1_rme": 44.36648863230358, + "poly1_top": 98.2432342037584, + "poly2_aic": 90.43488820771466, + "poly2_cov": 1, + "poly2_rme": 44.40668518959494, + "poly2_top": 98.14296226438184, + "pow_er_sd": 0.30358860504155505, + "exp2_er_sd": 0.3103300882267534, + "exp3_er_sd": 0.31482864784179443, + "exp4_er_sd": 0.3265560847968896, + "exp4_ga_sd": 0.18734711782917823, + "exp4_tp_sd": 6.138860820650144, + "exp5_er_sd": 0.42334596392662655, + "exp5_ga_sd": 0.08381003754668022, + "exp5_tp_sd": 2.37147868048167, + "gnls_er_sd": 0.4232676288363896, + "gnls_ga_sd": 0.09134632329842142, + "gnls_la_sd": 397472143.96622753, + "gnls_tp_sd": 2.3747859083019507, + "hill_er_sd": 0.4232684668587263, + "hill_ga_sd": 0.09134005178183088, + "hill_tp_sd": 2.3748058180813865, + "poly1_a_sd": 0.744525928526376, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 108969.20708301498, + "poly2_ac50": 25.090797462838403, + "poly2_b_sd": 55447.95612242906, + "poly1_er_sd": 0.31021542326112006, + "poly2_er_sd": 0.3101964438666455, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 3693.146065255056 + }, + "mc5Param": { + "p": 5.312112708921902, + "er": 1.56618318750266, + "ga": 0.4392211414112244, + "tp": 76.4982866415209, + "ac5": 0.25232432887622686, + "acc": 0.37284383772523594, + "bmd": 0.3026161445689406, + "bmr": 9.289141683881516, + "mll": -28.213932629241658, + "top": 76.4982866415209, + "ac10": 0.2904343777444861, + "ac20": 0.3383343045279963, + "ac50": 0.4392211414112244, + "bmdl": 0.24652928226101983, + "bmdu": 0.34140137679409, + "rmse": 10.58654076385496, + "ac1sd": 0.28414838641852014, + "caikwt": 0.0000013385806326866767, + "hitcall": 0.9999986614193672, + "top_over_cutoff": 3.3877568980269706 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842413, + "spid": "Strychnine nitrate", + "chid": null, + "casn": null, + "chnm": null, + "dtxsid": null, + "bmad": 3.7634679299683276, + "respMax": 101.90302651672913, + "respMin": -13.656252398863883, + "maxMean": 90.10574793432083, + "maxMeanConc": 0.0, + "maxMed": 92.78949471220062, + "maxMedConc": 1.0, + "logcMax": 1.0, + "logcMin": -2.0, + "nconc": 5, + "npts": 120, + "nrep": 28.0, + "nmedGtbl": 4, + "tmpi": 12, + "m5id": 5037059, + "modl": "hill", + "hitc": 0.9999999999995097, + "fitc": 41, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": null, + "stkc": null, + "stkcUnit": null, + "testedConcUnit": null, + "mc3Param": { + "logc": [ + 0, + -1, + -1.3010299956639813, + -1.3010299956639813, + 0, + -2, + -1, + 1, + 1, + -2, + -2, + 0, + 0, + 0, + -2, + -2, + -2, + 0, + 0, + -2, + -1.3010299956639813, + 0, + 0, + -1, + -1.3010299956639813, + 1, + -2, + -1.3010299956639813, + -2, + 1, + -1.3010299956639813, + 0, + -1, + -1.3010299956639813, + 0, + -1, + -1.3010299956639813, + 1, + -2, + -1.3010299956639813, + 0, + -2, + -1.3010299956639813, + -1, + 0, + -2, + -1.3010299956639813, + 0, + -2, + -1.3010299956639813, + -1.3010299956639813, + 1, + -2, + 0, + 0, + -2, + -1.3010299956639813, + 0, + -1.3010299956639813, + -1, + -1.3010299956639813, + -2, + -1.3010299956639813, + 1, + -2, + 0, + 0, + -2, + -1.3010299956639813, + 0, + 0, + -1, + -2, + 0, + 0, + 0, + 0, + -2, + -2, + 0, + 0, + -1, + -1.3010299956639813, + 0, + -2, + -1.3010299956639813, + 1, + 0, + -1.3010299956639813, + 0, + -1, + 0, + 0, + -1, + -1.3010299956639813, + 1, + -2, + -1.3010299956639813, + -1.3010299956639813, + 1, + -2, + 0, + 1, + 0, + 0, + 1, + -2, + 0, + 0, + -2, + -2, + 0, + -1.3010299956639813, + 0, + 0, + -2, + -1, + -1.3010299956639813, + -1.3010299956639813, + -1.3010299956639813 + ], + "resp": [ + 87.54658046017934, + 78.13232047400955, + 70.93317595233076, + 57.12698428271491, + 99.1261742792355, + 37.51266678271632, + 67.39566754400876, + 87.16917249987551, + 97.84412575893514, + 36.182153851871945, + 18.676759780138298, + 86.14639524902825, + 92.14700970993877, + 88.8633754305396, + 52.588582215844326, + 15.582133819049302, + 6.7437112326760795, + 90.99910854039037, + 93.537388378317, + 4.532945470243127, + 98.29029571012077, + 87.5125820151942, + 95.77948529616398, + 76.69719021917145, + 79.44282282360146, + 93.41848845767122, + 43.82855649076092, + 60.078635480642816, + 48.55573840229915, + 93.38936767278678, + 68.38088898210545, + 94.44174081967034, + 70.23063280229242, + 67.58951070420052, + 88.25476716259126, + 78.28663544945115, + 73.35709503155529, + 87.41418530525512, + 34.29624566401982, + 51.689530650495065, + 94.77671619175891, + 9.717713327456835, + 68.42696208430887, + 89.1457018171264, + 98.63621639131843, + 21.819867325289668, + 73.31442418286787, + 84.44684859725044, + 101.90302651672913, + 52.3796866174266, + 76.70392442439466, + 95.96954413243368, + 37.932664452132045, + 85.53995501238715, + 93.19761923373274, + 9.374938681003872, + 97.00772826137256, + 94.52068000480857, + 70.03934960306947, + 70.2207854474335, + 80.60056702989422, + 49.65332555177622, + 50.62118183723142, + -13.656252398863883, + 25.103929419420417, + 84.06775274470809, + 93.89545097387872, + 13.05234184109041, + 68.04669508697455, + 88.31017585712213, + 95.74909219574056, + 71.26573270110495, + 29.657483179306475, + 89.44967487095494, + 87.91122190917191, + 89.16083809801721, + 94.23105830572473, + 11.031715473484446, + 35.95756511831335, + 83.96484285494779, + 91.13344836386635, + 74.37468254708669, + 75.90341444167755, + 84.57925357612386, + 98.09697348327087, + 80.87025230976089, + 95.69038769184029, + 88.16849658860856, + 80.80349695840118, + 81.03526087553716, + 70.7375590556676, + 89.62211351249503, + 92.83767649850626, + 69.7285258942436, + 77.48304372596083, + 85.86002702419643, + 32.2784448599929, + 46.17015103402697, + 80.62410063741106, + 95.95106666573619, + 10.20724914281911, + 79.02545835944098, + 87.98083471817364, + 91.89339887484604, + 95.37517669787248, + 92.18962175161448, + 25.413153770849384, + 85.26467195488401, + 94.339523858436, + 21.432040978539256, + 30.458993571633304, + 93.86466610169768, + 70.85250358307763, + 84.70694885833929, + 90.17107266940845, + 42.17348917186203, + 67.85218078295692, + 80.66923781410267, + 52.40470406123019, + 66.29938729985028 + ] + }, + "mc4Param": { + "pow_a": 87.09928260115939, + "pow_p": 0.30000001846938457, + "exp2_a": 31883.447199556984, + "exp2_b": 2940.8756880830274, + "exp3_a": 91.76407834702847, + "exp3_b": 10.74787786809403, + "exp3_p": 5.705870147581669, + "exp5_p": 0.7347141145071212, + "gnls_p": 1.14249184755643, + "gnls_q": 7.1666617485862645, + "hill_p": 1.1425173709866314, + "pow_er": 3.2609559647059276, + "cnst_er": 4.280418232198627, + "exp2_er": 4.136618684570908, + "exp3_er": 4.195352905645352, + "exp4_er": 2.22008241758199, + "exp4_ga": 0.022051638521133003, + "exp4_tp": 89.00270902788958, + "exp5_er": 2.1777043891985155, + "exp5_ga": 0.020174723818180185, + "exp5_tp": 90.09083963206248, + "gnls_er": 2.1414728444590416, + "gnls_ga": 0.019239355601206622, + "gnls_la": 152.60173969793468, + "gnls_tp": 90.96174103754969, + "hill_er": 2.141463902181826, + "hill_ga": 0.019239408518013583, + "hill_tp": 90.96158402591846, + "poly1_a": 10.857285554865078, + "poly2_a": 43956.72490990105, + "poly2_b": 4063.958522468021, + "pow_aic": 1201.4051365890562, + "pow_cov": 1, + "pow_rme": 38.55227695861075, + "pow_top": 173.78592362556904, + "all_bmed": 0, + "cnst_aic": 1403.090413337808, + "cnst_rme": 74.8904479807055, + "exp2_aic": 1374.4311656282052, + "exp2_cov": 1, + "exp2_rme": 65.81746775643614, + "exp2_top": 108.5993407555391, + "exp3_aic": 1391.1625030286802, + "exp3_cov": 1, + "exp3_rme": 70.11489384972245, + "exp3_top": 86.24941190716868, + "exp4_aic": 958.5585213667588, + "exp4_cov": 1, + "exp4_rme": 17.136859425351332, + "exp4_top": 89.00270902788958, + "exp5_aic": 951.462915769895, + "exp5_cov": 1, + "exp5_rme": 16.563670044171328, + "exp5_top": 90.09083963206248, + "gnls_aic": 949.1076392567716, + "gnls_cov": 1, + "gnls_rme": 16.523174598011288, + "gnls_top": 90.94223261829664, + "hill_aic": 945.1076391339816, + "hill_cov": 1, + "hill_rme": 16.52318715556179, + "hill_top": 90.96158402591846, + "poly1_er": 4.136728636883216, + "poly2_er": 4.136765485844394, + "pow_a_sd": null, + "pow_ac50": 0.9921257986045094, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 199788.2012717345, + "exp2_ac50": 5.004250432627864, + "exp2_b_sd": 18377.639690188746, + "exp3_a_sd": null, + "exp3_ac50": 9.093200201104786, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.022051638521133003, + "exp5_ac50": 0.020174723818180185, + "exp5_p_sd": 0.0740314724723753, + "gnls_ac50": 0.01923213377527789, + "gnls_p_sd": 0.11328716035704128, + "gnls_q_sd": 5416.430149594935, + "hill_ac50": 0.019239408518013583, + "hill_p_sd": 0.11328905952344805, + "poly1_aic": 1372.405512117827, + "poly1_cov": 1, + "poly1_rme": 65.81045931392097, + "poly1_top": 108.57285554865078, + "poly2_aic": 1374.4425868107508, + "poly2_cov": 1, + "poly2_rme": 65.82134141098302, + "poly2_top": 108.42848666577588, + "pow_er_sd": null, + "exp2_er_sd": 0.07550543011989125, + "exp3_er_sd": null, + "exp4_er_sd": 0.08755079994277236, + "exp4_ga_sd": 0.0017581307838751255, + "exp4_tp_sd": 1.2648745704125903, + "exp5_er_sd": 0.08793429019100046, + "exp5_ga_sd": 0.001896252806984504, + "exp5_tp_sd": 1.229548672184863, + "gnls_er_sd": 0.08841293445887041, + "gnls_ga_sd": 0.0016388070613483495, + "gnls_la_sd": 314310.1153126622, + "gnls_tp_sd": 1.3592077185077482, + "hill_er_sd": 0.08841259880190765, + "hill_ga_sd": 0.001638789350228368, + "hill_tp_sd": 1.3591867915855804, + "poly1_a_sd": 1.724413789883238, + "poly1_ac50": 5, + "poly2_a_sd": 229686.482934115, + "poly2_ac50": 5.006136528441479, + "poly2_b_sd": 21186.121669100652, + "poly1_er_sd": 0.07551023114530929, + "poly2_er_sd": 0.07551301062757607, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 152.6093800236882 + }, + "mc5Param": { + "p": 1.1425173709866314, + "er": 2.141463902181826, + "ga": 0.019239408518013583, + "tp": 90.96158402591846, + "ac5": 0.001462007378119528, + "acc": 0.007294932270379909, + "bmd": 0.002869845955059214, + "bmr": 9.289141683881516, + "mll": -468.55381956699074, + "top": 90.96158402591846, + "ac10": 0.0028117791882338312, + "ac20": 0.005717847375539592, + "ac50": 0.019239408518013583, + "bmdl": 0.002556132850019782, + "bmdu": 0.003219636919114361, + "rmse": 16.52318715556179, + "ac1sd": 0.0021529836063463184, + "caikwt": 3.550619862824629E-100, + "hitcall": 0.9999999999995096, + "top_over_cutoff": 4.028269746527992 + }, + "mc6Param": null + }, + { + "aeid": 704, + "m4id": 1842414, + "spid": "TP0000202A12", + "chid": 40755, + "casn": "113776-20-8", + "chnm": "Fenoxaprop-(2S)-ethyl", + "dtxsid": "DTXSID0040755", + "bmad": 3.7634679299683276, + "respMax": 2.1463056962554306, + "respMin": -31.174537622350467, + "maxMean": 2.1463056962554306, + "maxMeanConc": 0.3010299956639812, + "maxMed": 2.1463056962554306, + "maxMedConc": 0.3010299956639812, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 13, + "m5id": 5037060, + "modl": "poly1", + "hitc": 3.112525321590652E-4, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + 1.6989700043360187, + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187 + ], + "resp": [ + -6.001541932753394, + -22.555888323094198, + 2.1463056962554306, + 1.48208851017487, + -31.174537622350467, + -1.4820885101748698, + -18.65401670786573, + -1.8956068394961023 + ] + }, + "mc4Param": { + "pow_a": 7.93772851385601E-8, + "pow_p": 0.3920636582682493, + "exp2_a": 0.000006112271332380458, + "exp2_b": 53.427073060892454, + "exp3_a": 0.00004898139853742899, + "exp3_b": 51.88258897771602, + "exp3_p": 2.324270887717195, + "exp5_p": 0.7819736441489689, + "gnls_p": 0.3273711734771393, + "gnls_q": 5.276277742389474, + "hill_p": 2.275897186558642, + "pow_er": 2.455992402942634, + "cnst_er": 2.4560891502518984, + "exp2_er": 2.4574807100236153, + "exp3_er": 2.4557796019426146, + "exp4_er": 2.456099699774736, + "exp4_ga": 2.3234618330958865, + "exp4_tp": 3.9607133152532646E-9, + "exp5_er": 2.4560842486541183, + "exp5_ga": 3.1011214463834262, + "exp5_tp": 5.124637982443043E-9, + "gnls_er": 2.45606236272885, + "gnls_ga": 2.0776018550817037, + "gnls_la": 105.43975814448936, + "gnls_tp": 2.3963648893966506E-8, + "hill_er": 2.456123173511501, + "hill_ga": 86.3108381026584, + "hill_tp": 4.991236675789709E-8, + "poly1_a": 5.0558047407700206E-11, + "poly2_a": 0.000050849272267483245, + "poly2_b": 54.52806494231579, + "pow_aic": 72.32793038983723, + "pow_cov": 1, + "pow_rme": 15.318305641270856, + "pow_top": 3.6796002210498555E-7, + "all_bmed": 0, + "cnst_aic": 68.32793015445507, + "cnst_rme": 15.318305491530715, + "exp2_aic": 72.32794851195803, + "exp2_cov": 1, + "exp2_rme": 15.318307841595969, + "exp2_top": 0.00000947030777995316, + "exp3_aic": 74.32794792480452, + "exp3_cov": 1, + "exp3_rme": 15.318319988232922, + "exp3_top": 0.00007364243647945785, + "exp4_aic": 72.32793015872747, + "exp4_cov": 1, + "exp4_rme": 15.318305493705283, + "exp4_top": 3.9607133152532646E-9, + "exp5_aic": 74.32793015704087, + "exp5_cov": 1, + "exp5_rme": 15.31830549412419, + "exp5_top": 5.124637982443043E-9, + "gnls_aic": 78.32793016843104, + "gnls_cov": 1, + "gnls_rme": 15.31830550116845, + "gnls_top": 1.7376669540347054E-8, + "hill_aic": 74.32793016978079, + "hill_cov": 1, + "hill_rme": 15.318305493880896, + "hill_top": 4.991236675789709E-8, + "poly1_er": 2.456091603321706, + "poly2_er": 2.458795669607504, + "pow_a_sd": null, + "pow_ac50": 8.534164879531097, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.647334567122023, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 40.44683070951887, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 2.3234618330958865, + "exp5_ac50": 3.1011214463834262, + "exp5_p_sd": null, + "gnls_ac50": 0.3706914715054184, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 86.3108381026584, + "hill_p_sd": null, + "poly1_aic": 70.32793015555615, + "poly1_cov": 1, + "poly1_rme": 15.31830549222699, + "poly1_top": 2.5279023703850103E-9, + "poly2_aic": 72.32801460829577, + "poly2_cov": 1, + "poly2_rme": 15.318327400684396, + "poly2_top": 0.00008938146834261408, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.67152733580562, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 108.5387707140687 + }, + "mc5Param": { + "a": 5.0558047407700206E-11, + "er": 2.456091603321706, + "ac5": 2.4999999999999996, + "bmd": 183732208029.59137, + "bmr": 9.289141683881516, + "mll": -33.16396507777807, + "top": 2.5279023703850103E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 55.118208071787095, + "rmse": 15.31830549222699, + "ac1sd": 136198819888.5036, + "caikwt": 0.7310585787382466, + "hitcall": 0.0003112525321590652, + "top_over_cutoff": 1.1194915688689839E-10 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842415, + "spid": "TP0000202E12", + "chid": 32488, + "casn": "117718-60-2", + "chnm": "Thiazopyr", + "dtxsid": "DTXSID1032488", + "bmad": 3.7634679299683276, + "respMax": 6.446936756495938, + "respMin": -27.99639047559999, + "maxMean": 6.446936756495938, + "maxMeanConc": -0.6989700043360187, + "maxMed": 6.446936756495938, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 14, + "m5id": 5037061, + "modl": "poly1", + "hitc": 3.46254861405938E-4, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + -1.6989700043360187, + 1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187 + ], + "resp": [ + 2.3401929572491063, + -9.617064235516741, + -24.581899003404654, + -5.427697641004625, + 5.427697641004625, + -9.142353819653172, + -27.99639047559999, + 6.446936756495938 + ] + }, + "mc4Param": { + "pow_a": 8.291778304541115E-8, + "pow_p": 0.759489844462891, + "exp2_a": 0.000005100967135478326, + "exp2_b": 66.78668129818874, + "exp3_a": 0.00000795052649415302, + "exp3_b": 59.8550913973304, + "exp3_p": 6.3695090638042515, + "exp5_p": 2.1989554286217405, + "gnls_p": 7.325020891066998, + "gnls_q": 7.999920644098824, + "hill_p": 5.230822870987461, + "pow_er": 2.4449412532586106, + "cnst_er": 2.444612267004776, + "exp2_er": 2.4454237030104045, + "exp3_er": 2.4444001292182183, + "exp4_er": 2.4446018093199684, + "exp4_ga": 5.268966164997101, + "exp4_tp": 2.503020809468994E-9, + "exp5_er": 2.4445975509803857, + "exp5_ga": 4.6875957305191935, + "exp5_tp": 1.1081629207669447E-9, + "gnls_er": 2.4231904512610143, + "gnls_ga": 0.004416803248006645, + "gnls_la": 0.82966745174129, + "gnls_tp": 2.40116151835256, + "hill_er": 2.444611179532325, + "hill_ga": 142.56639582523107, + "hill_tp": 0.00006917638723040847, + "poly1_a": 4.602316355764391E-10, + "poly2_a": 0.000012228970875458648, + "poly2_b": 51.825063680254665, + "pow_aic": 71.6355163848002, + "pow_cov": 1, + "pow_rme": 14.448605421396229, + "pow_top": 0.0000016180731311326594, + "all_bmed": 0, + "cnst_aic": 67.63551484073298, + "cnst_rme": 14.44860501974752, + "exp2_aic": 71.63552232788017, + "exp2_cov": 1, + "exp2_rme": 14.448606013868249, + "exp2_top": 0.000005683236291608053, + "exp3_aic": 73.63551565609121, + "exp3_cov": 1, + "exp3_rme": 14.448605256905164, + "exp3_top": 0.0000029758177359879932, + "exp4_aic": 71.63551484106912, + "exp4_cov": 1, + "exp4_rme": 14.448605020839846, + "exp4_top": 2.503020809468994E-9, + "exp5_aic": 73.63551484062032, + "exp5_cov": 1, + "exp5_rme": 14.448605020276853, + "exp5_top": 1.1081629207669447E-9, + "gnls_aic": 77.44750709660826, + "gnls_cov": 1, + "gnls_rme": 14.365799933750845, + "gnls_top": 2.401161508659121, + "hill_aic": 73.6355148837213, + "hill_cov": 1, + "hill_rme": 14.448605043026824, + "hill_top": 0.00006917638723040847, + "poly1_er": 2.444589406786654, + "poly2_er": 2.4442589836933477, + "pow_a_sd": null, + "pow_ac50": 20.072979750096557, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.57372140444595, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.38400488151858, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 5.268966164997101, + "exp5_ac50": 4.6875957305191935, + "exp5_p_sd": null, + "gnls_ac50": 0.004416803145331396, + "gnls_p_sd": 1521.0342465884344, + "gnls_q_sd": 78.00215408532839, + "hill_ac50": 142.56639582523107, + "hill_p_sd": null, + "poly1_aic": 69.63551484744472, + "poly1_cov": 1, + "poly1_rme": 14.448605024451211, + "poly1_top": 2.3011581778821953E-8, + "poly2_aic": 71.63552116107905, + "poly2_cov": 1, + "poly2_rme": 14.448608809150656, + "poly2_top": 0.0000231811467637089, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": 0.33687191979010667, + "gnls_ga_sd": 1.384790805886578, + "gnls_la_sd": 4.751505700203281, + "gnls_tp_sd": 5.895901623091699, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.4194146457345064, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.8068290375481, + "poly2_b_sd": null, + "poly1_er_sd": 0.5297759747014638, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.8296674525635499 + }, + "mc5Param": { + "a": 4.602316355764391E-10, + "er": 2.444589406786654, + "ac5": 2.5, + "bmd": 20183622693.053, + "bmr": 9.289141683881516, + "mll": -32.81775742372236, + "top": 2.3011581778821953E-8, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 51.81424943318225, + "rmse": 14.448605024451211, + "ac1sd": 14961914524.131208, + "caikwt": 0.7310585792898094, + "hitcall": 0.000346254861405938, + "top_over_cutoff": 1.0190770058816301E-9 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842416, + "spid": "TP0000267A05", + "chid": 20605, + "casn": "104-76-7", + "chnm": "2-Ethyl-1-hexanol", + "dtxsid": "DTXSID5020605", + "bmad": 3.7634679299683276, + "respMax": 8.917578703786559, + "respMin": -27.524983015647525, + "maxMean": 8.917578703786559, + "maxMeanConc": 1.3010299956639813, + "maxMed": 8.917578703786559, + "maxMedConc": 1.3010299956639813, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 15, + "m5id": 5037062, + "modl": "poly1", + "hitc": 2.7345343716299954E-4, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1.3010299956639813, + -0.22184874961635637, + 1.6989700043360187, + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + -0.6989700043360187 + ], + "resp": [ + 8.917578703786559, + 2.303464923343869, + -2.654003487492171, + 5.234355203561155, + -1.2708393819946822, + 3.560451307578698, + 1.2708393819946822, + -27.524983015647525 + ] + }, + "mc4Param": { + "pow_a": 1.3409798272664342, + "pow_p": 0.30000125329590954, + "exp2_a": 0.000009166742411061137, + "exp2_b": 71.96205294539993, + "exp3_a": 0.00006076828394343419, + "exp3_b": 62.86725328613552, + "exp3_p": 7.737091326965924, + "exp5_p": 7.999225969557049, + "gnls_p": 7.999875866687627, + "gnls_q": 7.928505491369158, + "hill_p": 7.999295227329135, + "pow_er": 1.6343827564280675, + "cnst_er": 1.7486670966982418, + "exp2_er": 1.747752679520703, + "exp3_er": 1.7491987890837994, + "exp4_er": 1.4661518060319405, + "exp4_ga": 0.5858515967961853, + "exp4_tp": 4.070715215170674, + "exp5_er": 1.4537496560481071, + "exp5_ga": 0.5879387517028682, + "exp5_tp": 4.129989453625999, + "gnls_er": 1.453809084181787, + "gnls_ga": 0.5829865127961461, + "gnls_la": 2656.355330614829, + "gnls_tp": 4.13074242306633, + "hill_er": 1.453742415592828, + "hill_ga": 0.582943689295207, + "hill_tp": 4.130157183529929, + "poly1_a": 0.006514257261741929, + "poly2_a": 0.000027619479202203845, + "poly2_b": 55.994704795242086, + "pow_aic": 62.72267287754171, + "pow_cov": 1, + "pow_rme": 10.626636623495806, + "pow_top": 4.336260608140496, + "all_bmed": 0, + "cnst_aic": 59.54309904759475, + "cnst_rme": 10.564107501908008, + "exp2_aic": 63.54310497598492, + "exp2_cov": 1, + "exp2_rme": 10.564107437382722, + "exp2_top": 0.000009197264782794135, + "exp3_aic": 65.54310319994451, + "exp3_cov": 1, + "exp3_rme": 10.564107854679628, + "exp3_top": 0.000011262424950383531, + "exp4_aic": 61.53985639831838, + "exp4_cov": 1, + "exp4_rme": 10.486648481057117, + "exp4_top": 4.070715215170674, + "exp5_aic": 63.21877166657443, + "exp5_cov": 1, + "exp5_rme": 10.19418095478504, + "exp5_top": 4.129989453625999, + "gnls_aic": 67.21889618297809, + "gnls_cov": 1, + "gnls_rme": 10.194291475779997, + "gnls_top": 4.130742423066309, + "hill_aic": 63.218896291500144, + "hill_cov": 1, + "hill_rme": 10.194281256916245, + "hill_top": 4.130157183529929, + "poly1_er": 1.7507922358775536, + "poly2_er": 1.749512892071607, + "pow_a_sd": 3.295794305479151, + "pow_ac50": 4.960676169539393, + "pow_p_sd": 0.5672534752096554, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.2579276272496, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.9617423857624, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.5858515967961853, + "exp5_ac50": 0.5879387517028682, + "exp5_p_sd": 98.74044274222942, + "gnls_ac50": 0.5829865133961057, + "gnls_p_sd": 74.31411976207677, + "gnls_q_sd": 6357704.376873938, + "hill_ac50": 0.582943689295207, + "hill_p_sd": 74.30108138165775, + "poly1_aic": 61.53965299852143, + "poly1_cov": 1, + "poly1_rme": 10.559185088231294, + "poly1_top": 0.3257128630870964, + "poly2_aic": 63.543106176613115, + "poly2_cov": 1, + "poly2_rme": 10.564107377657889, + "poly2_top": 0.00004668482556197718, + "pow_er_sd": 0.4819729825595672, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": 0.42833896312172504, + "exp4_ga_sd": 1.0334925947270197, + "exp4_tp_sd": 2.6528735376099615, + "exp5_er_sd": 0.42414936250544655, + "exp5_ga_sd": 0.2459821670424215, + "exp5_tp_sd": 2.444384508491113, + "gnls_er_sd": 0.42415640100500435, + "gnls_ga_sd": 0.32464475146069505, + "gnls_la_sd": 8816666864.83012, + "gnls_tp_sd": 2.4443852082427937, + "hill_er_sd": 0.4241479766226494, + "hill_ga_sd": 0.32494411453400046, + "hill_tp_sd": 2.4443739248424277, + "poly1_a_sd": 0.11187540886288934, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.600594333963585, + "poly2_b_sd": null, + "poly1_er_sd": 0.3807131709053242, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2656.355330614833 + }, + "mc5Param": { + "a": 0.006514257261741929, + "er": 1.7507922358775536, + "ac5": 2.4999999999999996, + "bmd": 1425.9709604096254, + "bmr": 9.289141683881516, + "mll": -28.769826499260716, + "top": 0.3257128630870964, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 35.11258847587849, + "rmse": 10.559185088231294, + "ac1sd": 1057.0577912599151, + "caikwt": 0.7307196766051358, + "hitcall": 0.00027345343716299954, + "top_over_cutoff": 0.014424323042295618 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842417, + "spid": "TP0000267B05", + "chid": 34287, + "casn": "104-67-6", + "chnm": "5-Heptyldihydro-2(3H)-furanone", + "dtxsid": "DTXSID4034287", + "bmad": 3.7634679299683276, + "respMax": 2.5626891439251516, + "respMin": -8.146024449386633, + "maxMean": 2.5626891439251516, + "maxMeanConc": -1.6989700043360187, + "maxMed": 2.5626891439251516, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 16, + "m5id": 5037063, + "modl": "poly1", + "hitc": 1.807739510130505E-7, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1.3010299956639813, + -0.22184874961635637, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + -1.6989700043360187, + 1.6989700043360187, + -0.6989700043360187 + ], + "resp": [ + -6.177917513479251, + -7.198652565084555, + -8.146024449386633, + -6.691171080481884, + -2.56268914392515, + 2.5626891439251516, + -2.808406691690573, + -1.4980285452563038 + ] + }, + "mc4Param": { + "pow_a": 5.2359519867188026E-8, + "pow_p": 0.38277275314144577, + "exp2_a": 0.000011087622110252254, + "exp2_b": 59.03037755815387, + "exp3_a": 0.000011323074766607115, + "exp3_b": 58.09532026397317, + "exp3_p": 3.173411562559084, + "exp5_p": 1.8704058411614604, + "gnls_p": 4.0745292599201, + "gnls_q": 7.9950187264172525, + "hill_p": 3.453820607013757, + "pow_er": 1.5839659163624915, + "cnst_er": 1.5838738330644857, + "exp2_er": 1.5830676537547204, + "exp3_er": 1.5842203728625608, + "exp4_er": 1.583875903464905, + "exp4_ga": 2.6417915753408012, + "exp4_tp": 1.5063871691541615E-9, + "exp5_er": 1.5838758461193252, + "exp5_ga": 1.4518069133691405, + "exp5_tp": 5.003350528655981E-10, + "gnls_er": 1.569937001781506, + "gnls_ga": 0.002000000005206344, + "gnls_la": 0.06324555337954348, + "gnls_tp": 1.6871203757458295, + "hill_er": 1.5838672292493845, + "hill_ga": 0.0032734995034449416, + "hill_tp": 1.5616538074162555E-9, + "poly1_a": 4.100095671825759E-11, + "poly2_a": 0.000003605359587272573, + "poly2_b": 56.69107597259129, + "pow_aic": 56.66259887682483, + "pow_cov": 1, + "pow_rme": 5.2960214297578565, + "pow_top": 2.3405346854235685E-7, + "all_bmed": 0, + "cnst_aic": 52.66259853073265, + "cnst_rme": 5.296021351915426, + "exp2_aic": 56.66261266299513, + "exp2_cov": 1, + "exp2_rme": 5.2960232653217565, + "exp2_top": 0.000014776347844907314, + "exp3_aic": 58.662602705894976, + "exp3_cov": 1, + "exp3_rme": 5.296022056507032, + "exp3_top": 0.00000974958415866995, + "exp4_aic": 56.662598532902635, + "exp4_cov": 1, + "exp4_rme": 5.296021352581836, + "exp4_top": 1.5063871691541615E-9, + "exp5_aic": 58.662598531608296, + "exp5_cov": 1, + "exp5_rme": 5.296021352180456, + "exp5_top": 5.003350528655981E-10, + "gnls_aic": 62.508666224566085, + "gnls_cov": 1, + "gnls_rme": 5.262039104915749, + "gnls_top": 1.686834446740104, + "hill_aic": 58.66259853487741, + "hill_cov": 1, + "hill_rme": 5.296021353114272, + "hill_top": 1.5616538074162555E-9, + "poly1_er": 1.5838907558030877, + "poly2_er": 1.584058977857187, + "pow_a_sd": null, + "pow_ac50": 8.175687415188362, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.142811088618416, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 42.03157273784789, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 2.6417915753408012, + "exp5_ac50": 1.4518069133691405, + "exp5_p_sd": null, + "gnls_ac50": 0.0019998336398390293, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.0032734995034449416, + "hill_p_sd": null, + "poly1_aic": 54.6625985350956, + "poly1_cov": 1, + "poly1_rme": 5.296021352230097, + "poly1_top": 2.050047835912879E-9, + "poly2_aic": 56.6626016317032, + "poly2_cov": 1, + "poly2_rme": 5.296022098645178, + "poly2_top": 0.000005984354139645306, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.12305820350276302, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.56750321043185, + "poly2_b_sd": null, + "poly1_er_sd": 0.387494804373577, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.06324822341628866 + }, + "mc5Param": { + "a": 4.100095671825759E-11, + "er": 1.5838907558030877, + "ac5": 2.4999999999999996, + "bmd": 226559144649.05865, + "bmr": 9.289141683881516, + "mll": -25.3312992675478, + "top": 2.050047835912879E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 116.03234310631164, + "rmse": 5.296021352230097, + "ac1sd": 167945993068.24213, + "caikwt": 0.7310585790589084, + "hitcall": 1.807739510130505E-7, + "top_over_cutoff": 9.078717971742852E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842418, + "spid": "TP0000267C07", + "chid": 26525, + "casn": "88-18-6", + "chnm": "2-tert-Butylphenol", + "dtxsid": "DTXSID2026525", + "bmad": 3.7634679299683276, + "respMax": 4.284991950831092, + "respMin": -17.752010560601963, + "maxMean": 4.284991950831092, + "maxMeanConc": -0.6989700043360187, + "maxMed": 4.284991950831092, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 17, + "m5id": 5037064, + "modl": "poly1", + "hitc": 1.080834578284038E-4, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + -1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436 + ], + "resp": [ + -3.429511618336063, + -10.303773152544004, + 4.284991950831092, + -17.752010560601963, + -11.184188881006792, + 3.429511618336063, + -11.946623245214802, + -14.030114108296962 + ] + }, + "mc4Param": { + "pow_a": 1.1688027459778409E-7, + "pow_p": 0.3542167430597227, + "exp2_a": 0.00001402914266781098, + "exp2_b": 62.43720598776625, + "exp3_a": 8.518851392561705E-7, + "exp3_b": 55.14935347186949, + "exp3_p": 5.08068979673058, + "exp5_p": 0.934648289336587, + "gnls_p": 5.502938821699771, + "gnls_q": 7.707236696501689, + "hill_p": 1.330809264220454, + "pow_er": 2.294643719896335, + "cnst_er": 2.294672403578953, + "exp2_er": 2.2949759846580298, + "exp3_er": 2.2939792210930836, + "exp4_er": 2.2946893862543956, + "exp4_ga": 1.6265408298714532, + "exp4_tp": 1.7029436841556618E-10, + "exp5_er": 2.294667883086028, + "exp5_ga": 9.989504833632218, + "exp5_tp": 1.1382103679305392E-9, + "gnls_er": 2.2946723713323243, + "gnls_ga": 0.04465268081832286, + "gnls_la": 1.4750833148086038, + "gnls_tp": 9.842124013532871E-9, + "hill_er": 2.294684574430046, + "hill_ga": 113.24013298211491, + "hill_tp": 3.8147986424229266E-8, + "poly1_a": 1.930068017745631E-10, + "poly2_a": 0.000008995913833305391, + "poly2_b": 60.79500343541555, + "pow_aic": 68.01728590637344, + "pow_cov": 1, + "pow_rme": 10.769388915092584, + "pow_top": 4.672451958820215E-7, + "all_bmed": 0, + "cnst_aic": 64.01728561110329, + "cnst_rme": 10.769388711778616, + "exp2_aic": 68.01729252056795, + "exp2_cov": 1, + "exp2_rme": 10.769393202636683, + "exp2_top": 0.000017218419324428374, + "exp3_aic": 70.01729110083275, + "exp3_cov": 1, + "exp3_rme": 10.769388859159086, + "exp3_top": 7.124009276524897E-7, + "exp4_aic": 68.01728561547779, + "exp4_cov": 1, + "exp4_rme": 10.769388711877632, + "exp4_top": 1.7029436841556618E-10, + "exp5_aic": 70.01728561164555, + "exp5_cov": 1, + "exp5_rme": 10.769388712196594, + "exp5_top": 1.1382103679305392E-9, + "gnls_aic": 74.01728561314724, + "gnls_cov": 1, + "gnls_rme": 10.769388713041575, + "gnls_top": 9.841866233302444E-9, + "hill_aic": 70.0172856168267, + "hill_cov": 1, + "hill_rme": 10.769388714323313, + "hill_top": 3.8147986424229266E-8, + "poly1_er": 2.2946661884606754, + "poly2_er": 2.2951725166659296, + "pow_a_sd": null, + "pow_ac50": 7.065178187371053, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.87674555498022, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 44.83746128233124, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 1.6265408298714532, + "exp5_ac50": 9.989504833632218, + "exp5_p_sd": null, + "gnls_ac50": 0.04465225444658185, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 113.24013298211491, + "hill_p_sd": null, + "poly1_aic": 66.01728561475585, + "poly1_cov": 1, + "poly1_rme": 10.769388714484304, + "poly1_top": 9.650340088728157E-9, + "poly2_aic": 68.01729292719538, + "poly2_cov": 1, + "poly2_rme": 10.769392172059073, + "poly2_top": 0.000013483408486187177, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": 0.29967162033605704, + "exp4_ga_sd": 2.700161867338397, + "exp4_tp_sd": 0.000018830151796886426, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.379822973030592, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1.475093338726149 + }, + "mc5Param": { + "a": 1.930068017745631E-10, + "er": 2.2946661884606754, + "ac5": 2.4999999999999996, + "bmd": 48128571627.913246, + "bmr": 9.289141683881516, + "mll": -31.008642807377925, + "top": 9.650340088728157E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 64.94939269971773, + "rmse": 10.769388714484304, + "ac1sd": 35677221369.839325, + "caikwt": 0.7310585789890732, + "hitcall": 0.0001080834578284038, + "top_over_cutoff": 4.2736912994009806E-10 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842419, + "spid": "TP0000267C12", + "chid": 21217, + "casn": "58-14-0", + "chnm": "Pyrimethamine", + "dtxsid": "DTXSID9021217", + "bmad": 3.7634679299683276, + "respMax": 27.43198135493239, + "respMin": -9.573031880730055, + "maxMean": 27.43198135493239, + "maxMeanConc": 1.6989700043360187, + "maxMed": 27.43198135493239, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 4, + "tmpi": 18, + "m5id": 5037065, + "modl": "exp5", + "hitc": 0.9993015893938282, + "fitc": 42, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.6989700043360187, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + 1.6989700043360187, + 0.7781512503836436 + ], + "resp": [ + -1.3626102221550411, + 1.362610222155042, + 26.100011514016813, + 5.083220148547186, + -9.573031880730055, + 12.263055448994821, + 27.43198135493239, + 19.028440712908623 + ] + }, + "mc4Param": { + "pow_a": 8.615918330641122, + "pow_p": 0.3256460648100804, + "exp2_a": 5515.924011580759, + "exp2_b": 8569.91582576029, + "exp3_a": 190.5815796850594, + "exp3_b": 18144.73145449149, + "exp3_p": 0.32098963519530016, + "exp5_p": 0.6697053366805052, + "gnls_p": 0.8182614183023493, + "gnls_q": 6.583211395264323, + "hill_p": 0.8182571770652887, + "pow_er": 1.363988503208183, + "cnst_er": 2.6252428146846465, + "exp2_er": 2.109704617961689, + "exp3_er": 1.5388722444020404, + "exp4_er": 0.9165567589387242, + "exp4_ga": 2.8867935103137805, + "exp4_tp": 26.682134872783596, + "exp5_er": 0.4118882359089413, + "exp5_ga": 2.6834018978246137, + "exp5_tp": 27.76803833586464, + "gnls_er": 0.5050076143816886, + "gnls_ga": 3.278943112805881, + "gnls_la": 4931.293978658584, + "gnls_tp": 30.974706420358636, + "hill_er": 0.5049887009187453, + "hill_ga": 3.2789253729229126, + "hill_tp": 30.974702991700216, + "poly1_a": 0.6448409372956132, + "poly2_a": 7685.079924681028, + "poly2_b": 11973.64247334707, + "pow_aic": 56.39160653523915, + "pow_cov": 1, + "pow_rme": 6.526761203406884, + "pow_top": 30.80097539574928, + "all_bmed": 0, + "cnst_aic": 69.92173854270355, + "cnst_rme": 16.07553951933683, + "exp2_aic": 65.29200171582212, + "exp2_cov": 1, + "exp2_rme": 9.191283585871052, + "exp2_top": 32.27596638509631, + "exp3_aic": 58.79084317495332, + "exp3_cov": 1, + "exp3_rme": 6.506169486296934, + "exp3_top": 31.014883737948537, + "exp4_aic": 50.88878665018997, + "exp4_cov": 1, + "exp4_rme": 4.969757377064164, + "exp4_top": 26.682134872783596, + "exp5_aic": 50.77303496851002, + "exp5_cov": 1, + "exp5_rme": 5.679144326208646, + "exp5_top": 27.76803833586464, + "gnls_aic": 55.27492786162859, + "gnls_cov": 1, + "gnls_rme": 5.673955293548314, + "gnls_top": 30.762420047102612, + "hill_aic": 51.27492786216142, + "hill_cov": 1, + "hill_rme": 5.6739736678642325, + "hill_top": 30.974702991700216, + "poly1_er": 2.108328509307753, + "poly2_er": 2.108918234235728, + "pow_a_sd": 1.9065377706614512, + "pow_ac50": 5.950610001585547, + "pow_p_sd": 0.06581177305373388, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 54261.41693977886, + "exp2_ac50": 25.03646471717236, + "exp2_b_sd": 83920.69797802145, + "exp3_a_sd": 319.30330931872754, + "exp3_ac50": 6.473920870323869, + "exp3_b_sd": 71486.21897878859, + "exp3_p_sd": 0.089062666508518, + "exp4_ac50": 2.8867935103137805, + "exp5_ac50": 2.6834018978246137, + "exp5_p_sd": 0.11428693722103664, + "gnls_ac50": 3.224472657149256, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 3.2789253729229126, + "hill_p_sd": 0.21665202304453965, + "poly1_aic": 63.28151185739537, + "poly1_cov": 1, + "poly1_rme": 9.185966970005357, + "poly1_top": 32.242046864780654, + "poly2_aic": 65.29643872279352, + "poly2_cov": 1, + "poly2_rme": 9.195851294815698, + "poly2_top": 32.22566397929895, + "pow_er_sd": 0.3611517914109552, + "exp2_er_sd": 0.3104544270600404, + "exp3_er_sd": 0.3808951094369049, + "exp4_er_sd": 0.3893880417326298, + "exp4_ga_sd": 0.8092255223155269, + "exp4_tp_sd": 1.7181047521648634, + "exp5_er_sd": 0.4652947689906473, + "exp5_ga_sd": 0.5440220897387579, + "exp5_tp_sd": 1.4682435434842378, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.44727516724237865, + "hill_ga_sd": 1.168035860526126, + "hill_tp_sd": 3.400651941209022, + "poly1_a_sd": 0.16629458913826986, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 63485.654673403085, + "poly2_ac50": 25.051980695483746, + "poly2_b_sd": 98453.01686169056, + "poly1_er_sd": 0.3103337077565139, + "poly2_er_sd": 0.31046879681961925, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4937.830903270403 + }, + "mc5Param": { + "p": 0.6697053366805052, + "er": 0.4118882359089413, + "ga": 2.6834018978246137, + "tp": 27.76803833586464, + "ac5": 0.05498375432560493, + "acc": 10.043861366765938, + "bmd": 1.2128892362955723, + "bmr": 9.289141683881516, + "mll": -21.38651748425501, + "top": 27.76803833586464, + "ac10": 0.16107667754826716, + "ac20": 0.4939400347473494, + "ac50": 2.6834018978246137, + "bmdl": 0.949215313715193, + "bmdu": 1.5372925871551637, + "rmse": 5.679144326208646, + "ac1sd": 0.7117500271731652, + "caikwt": 0.00006948349796016499, + "hitcall": 0.9993015893938282, + "top_over_cutoff": 1.2297185668723691 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2", + "Less than 50% efficacy" + ], + "mc6MthdId": [ + 13, + 17 + ] + } + }, + { + "aeid": 704, + "m4id": 1842420, + "spid": "TP0000267E12", + "chid": 21311, + "casn": "732-26-3", + "chnm": "2,4,6-Tris(tert-butyl)phenol", + "dtxsid": "DTXSID2021311", + "bmad": 3.7634679299683276, + "respMax": 2.3455034490210025, + "respMin": -8.881536046239422, + "maxMean": 2.3455034490210025, + "maxMeanConc": -1.6989700043360187, + "maxMed": 2.3455034490210025, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 19, + "m5id": 5037066, + "modl": "poly1", + "hitc": 2.529472360487395E-7, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + -1.6989700043360187 + ], + "resp": [ + -3.6871319675490226, + -8.202809310965216, + -2.3455034490210025, + -8.881536046239422, + 0.7714118421935772, + -3.442445468033866, + -8.217215474183769, + 2.3455034490210025 + ] + }, + "mc4Param": { + "pow_a": 4.4603222633107216E-8, + "pow_p": 0.3980715850861712, + "exp2_a": 0.00001500803162618182, + "exp2_b": 72.63641229778418, + "exp3_a": 0.000025895984061395693, + "exp3_b": 53.44323652739063, + "exp3_p": 6.684140439183912, + "exp5_p": 2.7549650881782495, + "gnls_p": 0.3000033566349074, + "gnls_q": 7.985201719769872, + "hill_p": 1.3414224872456235, + "pow_er": 1.6007569268879631, + "cnst_er": 1.600789396957988, + "exp2_er": 1.6013100926069517, + "exp3_er": 1.6012445517694611, + "exp4_er": 1.6007994489950037, + "exp4_ga": 1.8057489415221024, + "exp4_tp": 5.397987738417918E-10, + "exp5_er": 1.60079357288877, + "exp5_ga": 1.7684454448433695, + "exp5_tp": 8.377821726470055E-10, + "gnls_er": 1.5999160615939398, + "gnls_ga": 0.009427709959484824, + "gnls_la": 0.2982914089167051, + "gnls_tp": 0.2960388226873033, + "hill_er": 1.6007857351745025, + "hill_ga": 0.21326314555729145, + "hill_tp": 8.179987554374146E-10, + "poly1_a": 1.665857611967683E-11, + "poly2_a": 0.000003342211026439361, + "poly2_b": 54.331449188426035, + "pow_aic": 57.26619984359718, + "pow_cov": 1, + "pow_rme": 5.598366077511932, + "pow_top": 2.1167907095144258E-7, + "all_bmed": 0, + "cnst_aic": 53.26619960913695, + "cnst_rme": 5.598366003993902, + "exp2_aic": 57.266210263276776, + "exp2_cov": 1, + "exp2_rme": 5.5983683837974345, + "exp2_top": 0.000014864682387656134, + "exp3_aic": 59.26620901814293, + "exp3_cov": 1, + "exp3_rme": 5.598367798358593, + "exp3_top": 0.00002325120872148169, + "exp4_aic": 57.266199610517305, + "exp4_cov": 1, + "exp4_rme": 5.598366004275409, + "exp4_top": 5.397987738417918E-10, + "exp5_aic": 59.26619961039384, + "exp5_cov": 1, + "exp5_rme": 5.598366004426082, + "exp5_top": 8.377821726470055E-10, + "gnls_aic": 63.261593119240175, + "gnls_cov": 1, + "gnls_rme": 5.597589879481962, + "gnls_top": 0.20617373336031528, + "hill_aic": 59.26619961110041, + "hill_cov": 1, + "hill_rme": 5.598366004550358, + "hill_top": 8.179987554374146E-10, + "poly1_er": 1.600789285333053, + "poly2_er": 1.600935631744412, + "pow_a_sd": null, + "pow_ac50": 8.764946038692628, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.219899561165725, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 46.07206390886932, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 1.8057489415221024, + "exp5_ac50": 1.7684454448433695, + "exp5_p_sd": null, + "gnls_ac50": 0.0011666221360965088, + "gnls_p_sd": 3.279849567472979, + "gnls_q_sd": 92.59655516899352, + "hill_ac50": 0.21326314555729145, + "hill_p_sd": null, + "poly1_aic": 55.26619960963536, + "poly1_cov": 1, + "poly1_rme": 5.598366004146862, + "poly1_top": 8.329288059838414E-10, + "poly2_aic": 57.266202776564455, + "poly2_cov": 1, + "poly2_rme": 5.598366884119417, + "poly2_top": 0.000005906314023332767, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": 0.31071019075343265, + "gnls_ga_sd": 0.7914627160677781, + "gnls_la_sd": 1.8738093020015376, + "gnls_tp_sd": 4.103388080871007, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.15082807920588523, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.681166613865575, + "poly2_b_sd": null, + "poly1_er_sd": 0.4455631080651304, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.30262790841870524 + }, + "mc5Param": { + "a": 1.665857611967683E-11, + "er": 1.600789285333053, + "ac5": 2.5, + "bmd": 557619187687.316, + "bmr": 9.289141683881516, + "mll": -25.63309980481768, + "top": 8.329288059838414E-10, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 119.31078194095286, + "rmse": 5.598366004146862, + "ac1sd": 413357440835.6679, + "caikwt": 0.7310585786790016, + "hitcall": 2.529472360487395E-7, + "top_over_cutoff": 3.688658180359248E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842421, + "spid": "TP0000267H05", + "chid": 26252, + "casn": "101-02-0", + "chnm": "Triphenyl phosphite", + "dtxsid": "DTXSID0026252", + "bmad": 3.7634679299683276, + "respMax": 2.153448557173647, + "respMin": -10.47000653188537, + "maxMean": 2.153448557173647, + "maxMeanConc": -1.6989700043360187, + "maxMed": 2.153448557173647, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 20, + "m5id": 5037067, + "modl": "poly1", + "hitc": 1.9363278182448674E-6, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.3010299956639812, + -1.6989700043360187, + 1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637 + ], + "resp": [ + -8.233558829804824, + 2.153448557173647, + -5.178906539470438, + -7.2693827013629715, + -2.153448557173647, + -8.802875120938111, + -4.04098335160478, + -10.47000653188537 + ] + }, + "mc4Param": { + "pow_a": 3.4292130710908686E-8, + "pow_p": 0.33928487781574906, + "exp2_a": 0.0000127162267603712, + "exp2_b": 59.471246282597455, + "exp3_a": 0.000005456305245978216, + "exp3_b": 57.114981601771404, + "exp3_p": 4.737468297497621, + "exp5_p": 2.059721964231659, + "gnls_p": 3.7705534652747152, + "gnls_q": 7.98088765765917, + "hill_p": 1.8558453157097723, + "pow_er": 1.8316691732485768, + "cnst_er": 1.8316611738832205, + "exp2_er": 1.83171063967293, + "exp3_er": 1.8308588373067065, + "exp4_er": 1.831667717841896, + "exp4_ga": 2.39650583299111, + "exp4_tp": 9.736616090061843E-11, + "exp5_er": 1.8316409278190295, + "exp5_ga": 0.91710788966815, + "exp5_tp": 4.769155469756227E-10, + "gnls_er": 1.826653351166183, + "gnls_ga": 0.0020000000000068045, + "gnls_la": 0.06324555325220907, + "gnls_tp": 1.3708737937327125, + "hill_er": 1.8316765475841592, + "hill_ga": 0.1570478773337086, + "hill_tp": 4.665489172046982E-10, + "poly1_a": 1.6553661788288878E-11, + "poly2_a": 0.0000040937639725312225, + "poly2_b": 57.77189852066546, + "pow_aic": 60.52616872375968, + "pow_cov": 1, + "pow_rme": 6.709809695768132, + "pow_top": 1.2930916305837965E-7, + "all_bmed": 0, + "cnst_aic": 56.52616859619864, + "cnst_rme": 6.709809645256235, + "exp2_aic": 60.526175980843824, + "exp2_cov": 1, + "exp2_rme": 6.709812374327744, + "exp2_top": 0.000016761097647759444, + "exp3_aic": 62.52617699352762, + "exp3_cov": 1, + "exp3_rme": 6.709810021618865, + "exp3_top": 0.000003836214039161115, + "exp4_aic": 60.52616859672308, + "exp4_cov": 1, + "exp4_rme": 6.709809645302461, + "exp4_top": 9.736616090061843E-11, + "exp5_aic": 62.52616860177177, + "exp5_cov": 1, + "exp5_rme": 6.709809645540375, + "exp5_top": 4.769155469756227E-10, + "gnls_aic": 66.46070980336975, + "gnls_cov": 1, + "gnls_rme": 6.690902645418204, + "gnls_top": 1.3705036887888815, + "hill_aic": 62.52616859958253, + "hill_cov": 1, + "hill_rme": 6.709809645620258, + "hill_top": 4.665489172046982E-10, + "poly1_er": 1.8315037737657676, + "poly2_er": 1.8310229156461169, + "pow_a_sd": null, + "pow_ac50": 6.482186378904536, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.106803250288905, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 44.336210554612904, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 2.39650583299111, + "exp5_ac50": 0.91710788966815, + "exp5_p_sd": null, + "gnls_ac50": 0.001999713670738839, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.1570478773337086, + "hill_p_sd": null, + "poly1_aic": 58.5261688787493, + "poly1_cov": 1, + "poly1_rme": 6.7098096454111325, + "poly1_top": 8.276830894144437E-10, + "poly2_aic": 60.52617604664733, + "poly2_cov": 1, + "poly2_rme": 6.709810691449007, + "poly2_top": 0.000006609445990107358, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": 0.2972944391380977, + "exp4_ga_sd": 2.7511788983437424, + "exp4_tp_sd": 0.000018170256552519125, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.232877570932672, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.51687497965734, + "poly2_b_sd": null, + "poly1_er_sd": 0.4976104385069312, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.06324979854754481 + }, + "mc5Param": { + "a": 1.6553661788288878E-11, + "er": 1.8315037737657676, + "ac5": 2.5, + "bmd": 561153284553.225, + "bmr": 9.289141683881516, + "mll": -27.26308443937465, + "top": 8.276830894144437E-10, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 97.36337686032884, + "rmse": 6.7098096454111325, + "ac1sd": 415977230951.2416, + "caikwt": 0.7310586064064195, + "hitcall": 0.0000019363278182448674, + "top_over_cutoff": 3.665427316933053E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842422, + "spid": "TP0000267H07", + "chid": 22187, + "casn": "2416-94-6", + "chnm": "2,3,6-Trimethylphenol", + "dtxsid": "DTXSID6022187", + "bmad": 3.7634679299683276, + "respMax": 2.4546434804120567, + "respMin": -6.590039447466564, + "maxMean": 2.4546434804120567, + "maxMeanConc": -1.6989700043360187, + "maxMed": 2.4546434804120567, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 21, + "m5id": 5037068, + "modl": "poly1", + "hitc": 1.1548465742145037E-8, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187, + -1.6989700043360187, + -0.22184874961635637 + ], + "resp": [ + -0.6193413590687559, + -2.946862891147046, + -2.4546434804120567, + -2.0619838822007726, + -6.1122061271300225, + -6.590039447466564, + 2.4546434804120567, + -5.079836079239133 + ] + }, + "mc4Param": { + "pow_a": 3.767364113336769E-8, + "pow_p": 0.3793361095119566, + "exp2_a": 0.000013714158244907544, + "exp2_b": 62.473953885282626, + "exp3_a": 0.000003218586676112593, + "exp3_b": 54.793432376427845, + "exp3_p": 4.934528552083529, + "exp5_p": 2.5321434240687077, + "gnls_p": 1.7215545335763185, + "gnls_q": 5.9509617790505365, + "hill_p": 1.7113570602226835, + "pow_er": 1.3001645899703465, + "cnst_er": 1.3001163668151825, + "exp2_er": 1.2988900114548922, + "exp3_er": 1.299714305686752, + "exp4_er": 1.300111607345526, + "exp4_ga": 2.4635749935922417, + "exp4_tp": 2.141208914552821E-10, + "exp5_er": 1.3001191325357075, + "exp5_ga": 0.8329186071996519, + "exp5_tp": 9.468502830411367E-10, + "gnls_er": 1.300129441131634, + "gnls_ga": 0.02488389878063567, + "gnls_la": 0.8513441076183489, + "gnls_tp": 5.029312168256246E-10, + "hill_er": 1.3001098844504215, + "hill_ga": 1.3104070841784885, + "hill_tp": 2.3984539370057496E-10, + "poly1_a": 6.429960167444698E-12, + "poly2_a": 0.00010731334828336232, + "poly2_b": 52.50758262350933, + "pow_aic": 52.26528261409156, + "pow_cov": 1, + "pow_rme": 4.061439597937862, + "pow_top": 1.661568568423234E-7, + "all_bmed": 0, + "cnst_aic": 48.26528238427001, + "cnst_rme": 4.0614395482423795, + "exp2_aic": 52.265309193522334, + "exp2_cov": 1, + "exp2_rme": 4.061441753257708, + "exp2_top": 0.000016817443713639312, + "exp3_aic": 54.26528524536559, + "exp3_cov": 1, + "exp3_rme": 4.061439734220189, + "exp3_top": 0.0000028641829217196966, + "exp4_aic": 52.26528238577886, + "exp4_cov": 1, + "exp4_rme": 4.06143954832149, + "exp4_top": 2.141208914552821E-10, + "exp5_aic": 54.26528238551149, + "exp5_cov": 1, + "exp5_rme": 4.0614395486267245, + "exp5_top": 9.468502830411367E-10, + "gnls_aic": 58.26528238429869, + "gnls_cov": 1, + "gnls_rme": 4.061439548428354, + "gnls_top": 4.953675513002026E-10, + "hill_aic": 54.26528238638662, + "hill_cov": 1, + "hill_rme": 4.061439548335382, + "hill_top": 2.3984539370057496E-10, + "poly1_er": 1.3004069598601156, + "poly2_er": 1.3007699140477382, + "pow_a_sd": null, + "pow_ac50": 8.042653781004834, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.874021672293665, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 44.74689545963496, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 2.4635749935922417, + "exp5_ac50": 0.8329186071996519, + "exp5_p_sd": null, + "gnls_ac50": 0.02445288131245627, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 1.3104070841784885, + "hill_p_sd": 3186952.8147538053, + "poly1_aic": 50.26528324291422, + "poly1_cov": 1, + "poly1_rme": 4.061439548291606, + "poly1_top": 3.2149800837223486E-10, + "poly2_aic": 52.26540339182091, + "poly2_cov": 1, + "poly2_rme": 4.061464432547128, + "poly2_top": 0.00019949668932343944, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.30383111979982436, + "hill_ga_sd": 748711.7747256848, + "hill_tp_sd": 0.0000505315540909725, + "poly1_a_sd": 0.09096805428665258, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.772089863628302, + "poly2_b_sd": null, + "poly1_er_sd": 0.3809692717546628, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.8550161183126147 + }, + "mc5Param": { + "a": 6.429960167444698E-12, + "er": 1.3004069598601156, + "ac5": 2.4999999999999996, + "bmd": 1444665509891.1868, + "bmr": 9.289141683881516, + "mll": -23.13264162145711, + "top": 3.2149800837223486E-10, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 149.5912710282903, + "rmse": 4.061439548291606, + "ac1sd": 1070915870934.9048, + "caikwt": 0.7310586630398459, + "hitcall": 1.1548465742145036E-8, + "top_over_cutoff": 1.4237666533224164E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842423, + "spid": "TP0000268B05", + "chid": 47331, + "casn": "331623-06-4", + "chnm": "MK-547", + "dtxsid": "DTXSID4047331", + "bmad": 3.7634679299683276, + "respMax": 16.160587759184914, + "respMin": -11.834811380876454, + "maxMean": 16.160587759184914, + "maxMeanConc": -0.1549019599857432, + "maxMed": 16.160587759184914, + "maxMedConc": -0.1549019599857432, + "logcMax": 1.7781512503836436, + "logcMin": -1.5228787452803376, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 22, + "m5id": 5037069, + "modl": "poly1", + "hitc": 5.913901142194764E-5, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 22.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.5228787452803376, + 1.7781512503836436, + 0.3010299956639812, + 0.7781512503836436, + -1.0969100130080565, + 1.3010299956639813, + -0.6989700043360187, + -0.1549019599857432 + ], + "resp": [ + 1.0328742333020546, + -0.4101716381589, + -11.834811380876454, + -10.26235792055114, + -1.0328742333020546, + 1.4772968670590867, + -2.9469637282292744, + 16.160587759184914 + ] + }, + "mc4Param": { + "pow_a": 3.435232205446152E-7, + "pow_p": 0.40195886003095355, + "exp2_a": 0.00019185757540890645, + "exp2_b": 78.54636736109194, + "exp3_a": 0.000069246181189659, + "exp3_b": 73.10867338686336, + "exp3_p": 7.6208172674503984, + "exp5_p": 7.998247691004145, + "gnls_p": 7.901592218199406, + "gnls_q": 7.849018931807445, + "hill_p": 7.87734028198097, + "pow_er": 1.8213430667936583, + "cnst_er": 1.8213936756952465, + "exp2_er": 1.823591487999136, + "exp3_er": 1.822387183035188, + "exp4_er": 1.821353215471985, + "exp4_ga": 12.168837805792837, + "exp4_tp": 5.0263714950386055E-8, + "exp5_er": 1.8191975210324889, + "exp5_ga": 14.786689747990971, + "exp5_tp": 0.5317549737304359, + "gnls_er": 1.8213944981829744, + "gnls_ga": 0.1534550745988045, + "gnls_la": 19.550756854420513, + "gnls_tp": 4.787909883851375E-9, + "hill_er": 1.8214163821547027, + "hill_ga": 189.7269026616281, + "hill_tp": 5.920760401696781, + "poly1_a": 2.7530546982407402E-9, + "poly2_a": 0.0002694160974739683, + "poly2_b": 74.60371505672451, + "pow_aic": 62.11585875969622, + "pow_cov": 1, + "pow_rme": 8.060026848987192, + "pow_top": 0.0000017811469363016915, + "all_bmed": 0, + "cnst_aic": 58.115858404353595, + "cnst_rme": 8.06002673396659, + "exp2_aic": 62.11590472013238, + "exp2_cov": 1, + "exp2_rme": 8.060029785010771, + "exp2_top": 0.0002199817611461118, + "exp3_aic": 64.11586654613095, + "exp3_cov": 1, + "exp3_rme": 8.060026843281152, + "exp3_top": 0.000017196997763967384, + "exp4_aic": 62.115858433032486, + "exp4_cov": 1, + "exp4_rme": 8.06002673633787, + "exp4_top": 5.0263714950386055E-8, + "exp5_aic": 64.09764769253101, + "exp5_cov": 1, + "exp5_rme": 8.055656964717214, + "exp5_top": 0.5317549737304359, + "gnls_aic": 68.11585840669358, + "gnls_cov": 1, + "gnls_rme": 8.060026734552624, + "gnls_top": 4.7879098346713356E-9, + "hill_aic": 64.11587669600377, + "hill_cov": 1, + "hill_rme": 8.060031073676338, + "hill_top": 5.920760401696781, + "poly1_er": 1.821434550339795, + "poly2_er": 1.821797531197728, + "pow_a_sd": null, + "pow_ac50": 10.696551181133351, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 35.59499774025152, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 55.17214374903797, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 12.168837805792837, + "exp5_ac50": 14.786689747990971, + "exp5_p_sd": 121.15686871088236, + "gnls_ac50": 0.1534550738830234, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 189.7269026616281, + "hill_p_sd": null, + "poly1_aic": 60.11585841484666, + "poly1_cov": 1, + "poly1_rme": 8.06002673693981, + "poly1_top": 1.651832818944444E-7, + "poly2_aic": 62.115872817500886, + "poly2_cov": 1, + "poly2_rme": 8.06003160725891, + "poly2_top": 0.0003909407381656776, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": 0.3534660798818326, + "exp5_ga_sd": 95.93402528978984, + "exp5_tp_sd": 3.9415248388741375, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.08777291902049782, + "poly1_ac50": 30, + "poly2_a_sd": null, + "poly2_ac50": 36.38355504948771, + "poly2_b_sd": null, + "poly1_er_sd": 0.3531459297080129, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 19.55075690425482 + }, + "mc5Param": { + "a": 2.7530546982407402E-9, + "er": 1.821434550339795, + "ac5": 3, + "bmd": 3374121730.9694114, + "bmr": 9.289141683881516, + "mll": -28.05792920742333, + "top": 1.651832818944444E-7, + "ac10": 6, + "ac20": 12, + "ac50": 30, + "bmdl": 62.30001927366413, + "rmse": 8.06002673693981, + "ac1sd": 2501202172.6978583, + "caikwt": 0.7310585796615361, + "hitcall": 0.00005913901142194764, + "top_over_cutoff": 7.3152070097855445E-9 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842424, + "spid": "TP0000268B09", + "chid": 47376, + "casn": "648917-13-9", + "chnm": "AVE2865", + "dtxsid": "DTXSID5047376", + "bmad": 3.7634679299683276, + "respMax": 5.797527205844785, + "respMin": -6.504798500619806, + "maxMean": 5.797527205844785, + "maxMeanConc": -0.5228787452803376, + "maxMed": 5.797527205844785, + "maxMedConc": -0.5228787452803376, + "logcMax": 1.3010299956639813, + "logcMin": -2.0, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 23, + "m5id": 5037070, + "modl": "poly1", + "hitc": 3.401746069045992E-7, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 10.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1, + -0.5228787452803376, + -0.045757490560675115, + 0.47712125471966244, + -1.5228787452803376, + 1.3010299956639813, + 0.9030899869919435, + -2 + ], + "resp": [ + -0.45517858919509946, + 5.797527205844785, + -2.9328129243560577, + -6.504798500619806, + 2.0703869723867707, + 4.550643071685755, + 4.546273464789026, + -2.0703869723867707 + ] + }, + "mc4Param": { + "pow_a": 0.14645761569514076, + "pow_p": 1.1773046495484434, + "exp2_a": 270.97367161658156, + "exp2_b": 1116.4642123562155, + "exp3_a": 77.63471895063142, + "exp3_b": 252.08672173141304, + "exp3_p": 1.0981475406737444, + "exp5_p": 7.999999743873548, + "gnls_p": 7.9999999387204035, + "gnls_q": 7.925643774573192, + "hill_p": 7.999999862236661, + "pow_er": 1.1356265219229824, + "cnst_er": 1.3302829497154869, + "exp2_er": 1.132103795624519, + "exp3_er": 1.1430097651086235, + "exp4_er": 1.1201406029443286, + "exp4_ga": 12.576918087774663, + "exp4_tp": 6.957032563345469, + "exp5_er": 1.004007264778901, + "exp5_ga": 6.457229934853941, + "exp5_tp": 4.594738721200484, + "gnls_er": 1.2052015972921115, + "gnls_ga": 0.15589819888208656, + "gnls_la": 1408.8515612814258, + "gnls_tp": 2.45585111669779, + "hill_er": 1.0057274858019496, + "hill_ga": 5.840707041021681, + "hill_tp": 4.711097825805859, + "poly1_a": 0.24532316641680385, + "poly2_a": 217.59829371138036, + "poly2_b": 906.2718506374296, + "pow_aic": 50.20843275953963, + "pow_cov": 1, + "pow_rme": 3.69500181123112, + "pow_top": 4.982193866207102, + "all_bmed": 0, + "cnst_aic": 48.583528700455965, + "cnst_rme": 4.103082128822365, + "exp2_aic": 50.23261652082196, + "exp2_cov": 1, + "exp2_rme": 3.719604002845105, + "exp2_top": 4.897878431815489, + "exp3_aic": 52.21936455943542, + "exp3_cov": 1, + "exp3_rme": 3.703490261604697, + "exp3_top": 4.954803407260803, + "exp4_aic": 50.24261958999962, + "exp4_cov": 1, + "exp4_rme": 3.763007325226026, + "exp4_top": 6.957032563345469, + "exp5_aic": 50.606708255855864, + "exp5_cov": 1, + "exp5_rme": 3.416863170565935, + "exp5_top": 4.594738721200484, + "gnls_aic": 57.65043497612462, + "gnls_cov": 1, + "gnls_rme": 4.156168266214812, + "gnls_top": 2.455851116697789, + "hill_aic": 50.630370136769535, + "hill_cov": 1, + "hill_rme": 3.421658551377129, + "hill_top": 4.711097825805859, + "poly1_er": 1.1314827238691518, + "poly2_er": 1.1323596578117343, + "pow_a_sd": 0.5502364753741223, + "pow_ac50": 11.10032704166267, + "pow_p_sd": 1.2632680919710386, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 9140.874480213712, + "exp2_ac50": 10.04478364010083, + "exp2_b_sd": 37407.68771741646, + "exp3_a_sd": 1098.7341775704554, + "exp3_ac50": 10.788816917549276, + "exp3_b_sd": 3010.335602136789, + "exp3_p_sd": 1.1986941560896456, + "exp4_ac50": 12.576918087774663, + "exp5_ac50": 6.457229934853941, + "exp5_p_sd": 19.477000675370935, + "gnls_ac50": 0.15589819885359768, + "gnls_p_sd": 20.48523584343925, + "gnls_q_sd": 1762638.0146021335, + "hill_ac50": 5.840707041021681, + "hill_p_sd": 12.47501198328628, + "poly1_aic": 48.23172628107896, + "poly1_cov": 1, + "poly1_rme": 3.7202526561507, + "poly1_top": 4.906463328336078, + "poly2_aic": 50.23384580295357, + "poly2_cov": 1, + "poly2_rme": 3.7190286910920456, + "poly2_top": 4.908027255021525, + "pow_er_sd": 0.32075020244933933, + "exp2_er_sd": 0.32108258944317647, + "exp3_er_sd": 0.3216124902903471, + "exp4_er_sd": 0.32786527141411564, + "exp4_ga_sd": 33.74243671026672, + "exp4_tp_sd": 11.6108227506599, + "exp5_er_sd": 0.334854491636641, + "exp5_ga_sd": 5.3898863226067535, + "exp5_tp_sd": 2.1620411463879097, + "gnls_er_sd": 0.3500317149484511, + "gnls_ga_sd": 0.22054662364571845, + "gnls_la_sd": 2265909239.9199414, + "gnls_tp_sd": 2.2937771724887908, + "hill_er_sd": 0.3351225283208879, + "hill_ga_sd": 4.352134509212842, + "hill_tp_sd": 2.1279907242956564, + "poly1_a_sd": 0.13312558050871134, + "poly1_ac50": 10.000000000000002, + "poly2_a_sd": 4836.680590090178, + "poly2_ac50": 10.107947086330844, + "poly2_b_sd": 19734.212048261263, + "poly1_er_sd": 0.32103720561443533, + "poly2_er_sd": 0.32112575048366343, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1408.8515612792864 + }, + "mc5Param": { + "a": 0.24532316641680385, + "er": 1.1314827238691518, + "ac5": 1.0000000000000002, + "bmd": 37.86491842396683, + "bmr": 9.289141683881516, + "mll": -22.11586314053948, + "top": 4.906463328336078, + "ac10": 2.0000000000000004, + "ac20": 4.000000000000001, + "ac50": 10.000000000000002, + "bmdl": 18.73361680529658, + "bmdu": 1570.6186096996776, + "rmse": 3.7202526561507, + "ac1sd": 28.068879484037673, + "caikwt": 0.45613773535386626, + "hitcall": 3.401746069045992E-7, + "top_over_cutoff": 0.21728467022247083 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842425, + "spid": "TP0000268D09", + "chid": 47371, + "casn": "725228-45-5", + "chnm": "AVE5638", + "dtxsid": "DTXSID0047371", + "bmad": 3.7634679299683276, + "respMax": 9.829527801511304, + "respMin": -2.5563201140688663, + "maxMean": 9.829527801511304, + "maxMeanConc": 1.6989700043360187, + "maxMed": 9.829527801511304, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 24, + "m5id": 5037071, + "modl": "pow", + "hitc": 8.283608352293161E-12, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + -0.22184874961635637, + -1.6989700043360187, + 1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813 + ], + "resp": [ + 0.5431239666670336, + 4.285106967299528, + 2.5563201140688663, + 9.829527801511304, + 5.709719432762615, + 2.4081165876987582, + -2.5563201140688663, + 6.207106279335564 + ] + }, + "mc4Param": { + "pow_a": 2.6134169605347974, + "pow_p": 0.3224547315138239, + "exp2_a": 1847.8710307754577, + "exp2_b": 8594.958431701696, + "exp3_a": 5.951942308809372, + "exp3_b": 55.65624351376668, + "exp3_p": 0.3000009915091093, + "exp5_p": 0.408031291772936, + "gnls_p": 0.5036307275286347, + "gnls_q": 6.983373974900997, + "hill_p": 0.5036130799544578, + "pow_er": 0.6271801481986525, + "cnst_er": 1.483673944403286, + "exp2_er": 0.901885423620896, + "exp3_er": 0.617447007576443, + "exp4_er": 0.7472251905007579, + "exp4_ga": 12.860918984697772, + "exp4_tp": 10.29314061205533, + "exp5_er": 0.6664687774625762, + "exp5_ga": 10.227134832516548, + "exp5_tp": 11.795433349193852, + "gnls_er": 0.6844246765693558, + "gnls_ga": 8.727972134778678, + "gnls_la": 476.21374917073217, + "gnls_tp": 11.795433358441182, + "hill_er": 0.6844058554512551, + "hill_ga": 8.729066041588078, + "hill_tp": 11.795433359489715, + "poly1_a": 0.2155653486726829, + "poly2_a": 1619.371664147901, + "poly2_b": 7562.841340094379, + "pow_aic": 41.42019910503057, + "pow_cov": 1, + "pow_rme": 2.0570817824284617, + "pow_top": 9.226768448403208, + "all_bmed": 0, + "cnst_aic": 51.47828396257371, + "cnst_rme": 5.065500679597487, + "exp2_aic": 46.2016811403628, + "exp2_cov": 1, + "exp2_rme": 2.8349639096704293, + "exp2_top": 10.781066320544063, + "exp3_aic": 43.432265040834096, + "exp3_cov": 1, + "exp3_rme": 2.0734102760632704, + "exp3_top": 9.723220686034583, + "exp4_aic": 44.1490672469169, + "exp4_cov": 1, + "exp4_rme": 2.5333364833268393, + "exp4_top": 10.29314061205533, + "exp5_aic": 43.87885037563678, + "exp5_cov": 1, + "exp5_rme": 2.096972769799834, + "exp5_top": 11.795433349193852, + "gnls_aic": 48.13034965100882, + "gnls_cov": 1, + "gnls_rme": 2.1256207071279647, + "gnls_top": 9.848077588604877, + "hill_aic": 44.13034863233809, + "hill_cov": 1, + "hill_rme": 2.1256162744455236, + "hill_top": 11.795433359489715, + "poly1_er": 0.901280786231684, + "poly2_er": 0.9025570210051496, + "pow_a_sd": 1.2648723107958824, + "pow_ac50": 5.826565328027652, + "pow_p_sd": 0.14109048042799285, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 20517.97016403068, + "exp2_ac50": 25.036358472451216, + "exp2_b_sd": 95129.8509706833, + "exp3_a_sd": 13.444564053482148, + "exp3_ac50": 9.976184034850611, + "exp3_b_sd": 266.0736582783042, + "exp3_p_sd": 0.216903370957182, + "exp4_ac50": 12.860918984697772, + "exp5_ac50": 10.227134832516548, + "exp5_p_sd": 0.1950562304619866, + "gnls_ac50": 4.503531056699209, + "gnls_p_sd": 0.30642623552529974, + "gnls_q_sd": 1778.4355834488583, + "hill_ac50": 8.729066041588078, + "hill_p_sd": 0.30636334171671514, + "poly1_aic": 44.19352001430043, + "poly1_cov": 1, + "poly1_rme": 2.8338486403301544, + "poly1_top": 10.778267433634143, + "poly2_aic": 46.2119706927944, + "poly2_cov": 1, + "poly2_rme": 2.8364410811775858, + "poly2_top": 10.776887264522824, + "pow_er_sd": 0.30099084110430235, + "exp2_er_sd": 0.31175385714527687, + "exp3_er_sd": 0.31176613420103494, + "exp4_er_sd": 0.33118431722536384, + "exp4_ga_sd": 11.325306882966284, + "exp4_tp_sd": 3.4851291549920576, + "exp5_er_sd": 0.3015655658242953, + "exp5_ga_sd": 28.51915767292512, + "exp5_tp_sd": 8.264821291402265, + "gnls_er_sd": 0.3022586634075119, + "gnls_ga_sd": 31.4717089520362, + "gnls_la_sd": 273214.77054124634, + "gnls_tp_sd": 9.227295756030236, + "hill_er_sd": 0.3022524501530625, + "hill_ga_sd": 31.46313562630508, + "hill_tp_sd": 9.22366258473231, + "poly1_a_sd": 0.04384146784814762, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 12062.013966135755, + "poly2_ac50": 25.08209723966715, + "poly2_b_sd": 55965.732274987706, + "poly1_er_sd": 0.31174491997287024, + "poly2_er_sd": 0.31177073301646385, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 483.7219493904507 + }, + "mc5Param": { + "a": 2.6134169605347974, + "p": 0.3224547315138239, + "er": 0.6271801481986525, + "ac5": 0.004615323183986625, + "bmd": 51.05567688873282, + "bmr": 9.289141683881516, + "mll": -17.710099552515285, + "top": 9.226768448403208, + "ac10": 0.039605864897673385, + "ac20": 0.339873172854996, + "ac50": 5.826565328027652, + "bmdl": 25.969322888853053, + "bmdu": 126.0034288976538, + "rmse": 2.0570817824284617, + "ac1sd": 20.17667574437803, + "caikwt": 0.006502515494980162, + "hitcall": 8.283608352293161E-12, + "top_over_cutoff": 0.4086110922203279 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842426, + "spid": "TP0000268F11", + "chid": 47351, + "casn": "464930-42-5", + "chnm": "SSR 240612", + "dtxsid": "DTXSID2047351", + "bmad": 3.7634679299683276, + "respMax": 56.74340329908642, + "respMin": 0.9655862698342526, + "maxMean": 56.74340329908642, + "maxMeanConc": 1.6989700043360187, + "maxMed": 56.74340329908642, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 7, + "tmpi": 25, + "m5id": 5037072, + "modl": "hill", + "hitc": 0.9999997974131798, + "fitc": 42, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 19.100000381469727, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.6989700043360189, + -1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + 1.6989700043360187, + -1.154901959985743 + ], + "resp": [ + 44.59335472538687, + 0.9655862698342526, + 51.07450911124849, + 34.60777964222281, + 38.45466945352135, + 43.944478789484535, + 56.74340329908642, + 15.196453629289444 + ] + }, + "mc4Param": { + "pow_a": 22.29063955606957, + "pow_p": 0.3000000044703735, + "exp2_a": 7377.110355751841, + "exp2_b": 5355.437066929028, + "exp3_a": 591.2413263226587, + "exp3_b": 65665.77024490427, + "exp3_p": 0.300000305401534, + "exp5_p": 7.9983423573434145, + "gnls_p": 1.1287983917282394, + "gnls_q": 7.653239171873807, + "hill_p": 1.1288482557103248, + "pow_er": 2.5032045033922516, + "cnst_er": 3.6332397109938266, + "exp2_er": 3.29296967334806, + "exp3_er": 2.5419130229474893, + "exp4_er": 1.4570282322469614, + "exp4_ga": 0.1211168885912654, + "exp4_tp": 46.88558983477806, + "exp5_er": 1.650383818314157, + "exp5_ga": 0.07454030776539969, + "exp5_tp": 44.37027720585292, + "gnls_er": 1.305161491507147, + "gnls_ga": 0.1388302597633832, + "gnls_la": 4500.7988607575635, + "gnls_tp": 49.11672853031013, + "hill_er": 1.305166813111626, + "hill_ga": 0.13882412839547248, + "hill_tp": 49.116358486825376, + "poly1_a": 1.3848525837844712, + "poly2_a": 6214.513214531438, + "poly2_b": 4538.601931470192, + "pow_aic": 71.6277031240271, + "pow_cov": 1, + "pow_rme": 13.523494389939856, + "pow_top": 72.07979423450467, + "all_bmed": 0, + "cnst_aic": 85.17328329049076, + "cnst_rme": 39.77503672995993, + "exp2_aic": 83.88353944963814, + "exp2_cov": 1, + "exp2_rme": 28.82615638820165, + "exp2_top": 69.19748254971222, + "exp3_aic": 74.18541947887306, + "exp3_cov": 1, + "exp3_rme": 13.997699402413598, + "exp3_top": 72.72562462018436, + "exp4_aic": 55.16605989184805, + "exp4_cov": 1, + "exp4_rme": 5.0053816249751115, + "exp4_top": 46.88558983477806, + "exp5_aic": 60.83333339353628, + "exp5_cov": 1, + "exp5_rme": 6.417783643263895, + "exp5_top": 44.37027720585292, + "gnls_aic": 58.349089094862535, + "gnls_cov": 1, + "gnls_rme": 4.10385604566807, + "gnls_top": 49.11409533247871, + "hill_aic": 54.34908909384654, + "hill_cov": 1, + "hill_rme": 4.103866665590556, + "hill_top": 49.116358486825376, + "poly1_er": 3.291931983247854, + "poly2_er": 3.293092482358462, + "pow_a_sd": null, + "pow_ac50": 4.960628458191019, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 76621.24816189415, + "exp2_ac50": 25.058351701479907, + "exp2_b_sd": 55332.40931606274, + "exp3_a_sd": null, + "exp3_ac50": 5.456350237754098, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.1211168885912654, + "exp5_ac50": 0.07454030776539969, + "exp5_p_sd": null, + "gnls_ac50": 0.1388170716544355, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.13882412839547248, + "hill_p_sd": 1.0072426298983834, + "poly1_aic": 81.87415000051952, + "poly1_cov": 1, + "poly1_rme": 28.80990540590964, + "poly1_top": 69.24262918922355, + "poly2_aic": 83.8960828082405, + "poly2_cov": 1, + "poly2_rme": 28.846900317891546, + "poly2_top": 69.21708675555531, + "pow_er_sd": null, + "exp2_er_sd": 0.2979467220440815, + "exp3_er_sd": null, + "exp4_er_sd": 0.31706674559933146, + "exp4_ga_sd": 0.02771959613022985, + "exp4_tp_sd": 2.7450192626672303, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.30688202903113515, + "hill_ga_sd": 0.11148548451151348, + "hill_tp_sd": 7.894298278477134, + "poly1_a_sd": 0.49529366199526986, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 42973.45685321085, + "poly2_ac50": 25.136203021763425, + "poly2_b_sd": 30971.57960174396, + "poly1_er_sd": 0.2978316290780377, + "poly2_er_sd": 0.29791923025954864, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4500.85239695864 + }, + "mc5Param": { + "p": 1.1288482557103248, + "er": 1.305166813111626, + "ga": 0.13882412839547248, + "tp": 49.116358486825376, + "ac5": 0.0102251575317605, + "acc": 0.12033066816769825, + "bmd": 0.03823149140805884, + "bmr": 9.289141683881516, + "mll": -23.17454454692327, + "top": 49.116358486825376, + "ac10": 0.01982170312832394, + "ac20": 0.04065602361491505, + "ac50": 0.13882412839547248, + "bmdl": 0.027228374830847675, + "bmdu": 0.05629923061844972, + "rmse": 4.103866665590556, + "ac1sd": 0.027842487636980728, + "caikwt": 2.0258682012827294E-7, + "hitcall": 0.9999997974131798, + "top_over_cutoff": 2.1751373733303265 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2", + "Less than 50% efficacy" + ], + "mc6MthdId": [ + 13, + 17 + ] + } + }, + { + "aeid": 704, + "m4id": 1842427, + "spid": "TP0000268G07", + "chid": 47342, + "casn": "NOCAS_47342", + "chnm": "SR125047", + "dtxsid": "DTXSID3047342", + "bmad": 3.7634679299683276, + "respMax": 16.068431608615082, + "respMin": -2.4478548285083273, + "maxMean": 16.068431608615082, + "maxMeanConc": 1.6989700043360187, + "maxMed": 16.068431608615082, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 26, + "m5id": 5037073, + "modl": "hill", + "hitc": 7.513456343366634E-7, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 18.100000381469727, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.6989700043360189, + 1.3010299956639813, + -0.6989700043360187, + -1.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + -1.2218487496163564 + ], + "resp": [ + 2.578651202272505, + 10.929576624760047, + -2.4478548285083273, + -0.9930052374030435, + 16.068431608615082, + -1.1296964636433144, + -2.031470190077792, + 0.9930052374030434 + ] + }, + "mc4Param": { + "pow_a": 0.7495851450301008, + "pow_p": 0.7934306069332071, + "exp2_a": 3745.887701077395, + "exp2_b": 11161.230229848748, + "exp3_a": 211.17258400046512, + "exp3_b": 1321.9558679160486, + "exp3_p": 0.7862869437104818, + "exp5_p": 1.5971709257356228, + "gnls_p": 1.8437972877629345, + "gnls_q": 6.0802381175989755, + "hill_p": 1.8437982520570464, + "pow_er": 0.5569604229333858, + "cnst_er": 1.496227101300069, + "exp2_er": 0.6013530822669483, + "exp3_er": 0.56192578085808, + "exp4_er": 0.3643457082349424, + "exp4_ga": 18.77713492364612, + "exp4_tp": 19.282117896825127, + "exp5_er": 0.1813537664571939, + "exp5_ga": 14.606417150732632, + "exp5_tp": 16.15853839281399, + "gnls_er": 0.16259772400318157, + "gnls_ga": 15.327772022476056, + "gnls_la": 716.9030513711922, + "gnls_tp": 17.82615761827315, + "hill_er": 0.1626080470170854, + "hill_ga": 15.32785499084368, + "hill_tp": 17.826228582259645, + "poly1_a": 0.33630167057563587, + "poly2_a": 5534.470181137269, + "poly2_b": 16509.417806231653, + "pow_aic": 40.586937969960985, + "pow_cov": 1, + "pow_rme": 1.976876645272376, + "pow_top": 16.70458816459739, + "all_bmed": 0, + "cnst_aic": 54.648400025462585, + "cnst_rme": 7.050414694167261, + "exp2_aic": 41.509916177688794, + "exp2_cov": 1, + "exp2_rme": 2.1346868197498607, + "exp2_top": 16.81844459556715, + "exp3_aic": 42.707146864839885, + "exp3_cov": 1, + "exp3_rme": 1.9923148983459509, + "exp3_top": 16.710344322133963, + "exp4_aic": 37.940991423770946, + "exp4_cov": 1, + "exp4_rme": 1.7263552245064822, + "exp4_top": 19.282117896825127, + "exp5_aic": 36.94109523557594, + "exp5_cov": 1, + "exp5_rme": 1.4202088508960418, + "exp5_top": 16.15853839281399, + "gnls_aic": 40.679025093815895, + "gnls_cov": 1, + "gnls_rme": 1.3995253107697865, + "gnls_top": 17.693918959116115, + "hill_aic": 36.67902495033333, + "hill_cov": 1, + "hill_rme": 1.3995249681145707, + "hill_top": 17.826228582259645, + "poly1_er": 0.6001608259061096, + "poly2_er": 0.6007737931510304, + "pow_a_sd": 0.45733970898996046, + "pow_ac50": 20.872138600405815, + "pow_p_sd": 0.15802993812972735, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 34356.31271501256, + "exp2_ac50": 25.02799868224741, + "exp2_b_sd": 102105.6974126556, + "exp3_a_sd": 651.7340339714862, + "exp3_ac50": 21.20970217173776, + "exp3_b_sd": 4590.856553343913, + "exp3_p_sd": 0.189049486322834, + "exp4_ac50": 18.77713492364612, + "exp5_ac50": 14.606417150732632, + "exp5_p_sd": 0.4330441605396518, + "gnls_ac50": 15.204926781653212, + "gnls_p_sd": 0.5081164715543239, + "gnls_q_sd": 4108.363521527936, + "hill_ac50": 15.32785499084368, + "hill_p_sd": 0.5081331258789696, + "poly1_aic": 39.49794234452144, + "poly1_cov": 1, + "poly1_rme": 2.1327398858741935, + "poly1_top": 16.81508352878179, + "poly2_aic": 41.514073524464166, + "poly2_cov": 1, + "poly2_rme": 2.135746785098317, + "poly2_top": 16.812318280864897, + "pow_er_sd": 0.3123867399094015, + "exp2_er_sd": 0.3173507805054053, + "exp3_er_sd": 0.3132824822426714, + "exp4_er_sd": 0.3204206492367301, + "exp4_ga_sd": 7.538812655873604, + "exp4_tp_sd": 3.614102630459925, + "exp5_er_sd": 0.3228010130363589, + "exp5_ga_sd": 2.1623706344386395, + "exp5_tp_sd": 1.213152398522362, + "gnls_er_sd": 0.3235596345274449, + "gnls_ga_sd": 3.611431409511374, + "gnls_la_sd": 1286628.173870158, + "gnls_tp_sd": 2.3538578449416696, + "hill_er_sd": 0.3235605842861329, + "hill_ga_sd": 3.611520231183444, + "hill_tp_sd": 2.353918902922515, + "poly1_a_sd": 0.035107290392205344, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 43848.155451291146, + "poly2_ac50": 25.037742786782083, + "poly2_b_sd": 130401.28963646913, + "poly1_er_sd": 0.31719198749658833, + "poly2_er_sd": 0.3173229343451282, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 718.4597781609216 + }, + "mc5Param": { + "p": 1.8437982520570464, + "er": 0.1626080470170854, + "ga": 15.32785499084368, + "tp": 17.826228582259645, + "ac5": 3.1041182593433, + "bmd": 16.046024255628595, + "bmr": 9.289141683881516, + "mll": -14.339512475166664, + "top": 17.826228582259645, + "ac10": 4.655214191434633, + "ac20": 7.226847933148336, + "ac50": 15.32785499084368, + "bmdl": 12.817356025918471, + "bmdu": 19.68919163424624, + "rmse": 1.3995249681145707, + "ac1sd": 11.924278068437353, + "caikwt": 0.0001252983526033338, + "hitcall": 7.513456343366634E-7, + "top_over_cutoff": 0.7894415874744223 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842428, + "spid": "TP0000268H11", + "chid": 47362, + "casn": "NOCAS_47362", + "chnm": "SSR150106", + "dtxsid": "DTXSID1047362", + "bmad": 3.7634679299683276, + "respMax": 32.275376253360285, + "respMin": -7.867717756019061, + "maxMean": 32.275376253360285, + "maxMeanConc": 1.6989700043360187, + "maxMed": 32.275376253360285, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 27, + "m5id": 5037074, + "modl": "poly1", + "hitc": 0.9723023592263895, + "fitc": 42, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + -1.154901959985743, + -1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + 1.6989700043360187 + ], + "resp": [ + 7.836812981967315, + -1.688479877558232, + 1.688479877558232, + 11.146812393304948, + 2.103486843396195, + -5.189794556835356, + -7.867717756019061, + 32.275376253360285 + ] + }, + "mc4Param": { + "pow_a": 0.4589901690368699, + "pow_p": 1.0864882638245654, + "exp2_a": 101.4651209324748, + "exp2_b": 181.35011628024697, + "exp3_a": 136.47408823959836, + "exp3_b": 227.43583566565215, + "exp3_p": 1.0244060811915972, + "exp5_p": 1.6543740009751935, + "gnls_p": 2.544254271420234, + "gnls_q": 7.832466215756295, + "hill_p": 2.5440165316447105, + "pow_er": 1.1937920093205483, + "cnst_er": 2.1116016336711736, + "exp2_er": 1.189397204329031, + "exp3_er": 1.1900107506641908, + "exp4_er": 1.3892245596869288, + "exp4_ga": 26.05395024269712, + "exp4_tp": 38.7304515040133, + "exp5_er": 1.236530306766801, + "exp5_ga": 28.81134072021623, + "exp5_tp": 38.73045146929248, + "gnls_er": 1.2683740002383097, + "gnls_ga": 27.607015111885687, + "gnls_la": 4998.569320195761, + "gnls_tp": 38.73045147605155, + "hill_er": 1.2684075667282575, + "hill_ga": 27.60654261703223, + "hill_tp": 38.73045149963589, + "poly1_a": 0.6372560400447195, + "poly2_a": 182.2661163816764, + "poly2_b": 326.31707791831155, + "pow_aic": 51.68671768837355, + "pow_cov": 1, + "pow_rme": 4.1789842044248235, + "pow_top": 32.18950912321905, + "all_bmed": 0, + "cnst_aic": 63.90474507028467, + "cnst_rme": 12.87598788572432, + "exp2_aic": 51.68912006250683, + "exp2_cov": 1, + "exp2_rme": 4.201398457618982, + "exp2_top": 32.211670164602985, + "exp3_aic": 53.68628653722567, + "exp3_cov": 1, + "exp3_rme": 4.193697698573126, + "exp3_top": 32.2049157281836, + "exp4_aic": 54.24612188601166, + "exp4_cov": 1, + "exp4_rme": 4.781182771456221, + "exp4_top": 38.7304515040133, + "exp5_aic": 54.07263547430031, + "exp5_cov": 1, + "exp5_rme": 4.191856927998687, + "exp5_top": 38.73045146929248, + "gnls_aic": 58.62822032794858, + "gnls_cov": 1, + "gnls_rme": 4.334693218513672, + "gnls_top": 38.727333168934166, + "hill_aic": 54.62822039910054, + "hill_cov": 1, + "hill_rme": 4.334666275617764, + "hill_top": 38.73045149963589, + "poly1_er": 1.1994211380897748, + "poly2_er": 1.1893608922995844, + "pow_a_sd": 0.2662014726962556, + "pow_ac50": 26.41818935078147, + "pow_p_sd": 0.1521243947331567, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 348.26640117274536, + "exp2_ac50": 26.717755706472612, + "exp2_b_sd": 548.865968812935, + "exp3_a_sd": 807.847513184223, + "exp3_ac50": 26.72713309062012, + "exp3_b_sd": 1098.3202531522547, + "exp3_p_sd": 0.3785039176466354, + "exp4_ac50": 26.05395024269712, + "exp5_ac50": 28.81134072021623, + "exp5_p_sd": 0.8722989388452311, + "gnls_ac50": 27.605267916591213, + "gnls_p_sd": 2.908874800565709, + "gnls_q_sd": 1691693.862361631, + "hill_ac50": 27.60654261703223, + "hill_p_sd": 2.9035455790005753, + "poly1_aic": 49.794702774441554, + "poly1_cov": 1, + "poly1_rme": 4.2304963707100685, + "poly1_top": 31.86280200223597, + "poly2_aic": 51.69217105908964, + "poly2_cov": 1, + "poly2_rme": 4.2015552080075915, + "poly2_top": 32.206999419449126, + "pow_er_sd": 0.3335534848800435, + "exp2_er_sd": 0.3352306055195441, + "exp3_er_sd": 0.33540266751937425, + "exp4_er_sd": 0.34685487937247106, + "exp4_ga_sd": 14.862078891119456, + "exp4_tp_sd": 14.104706577122425, + "exp5_er_sd": 0.33280432150032224, + "exp5_ga_sd": 14.999794914044722, + "exp5_tp_sd": 18.593299749044046, + "gnls_er_sd": 0.3380749134545, + "gnls_ga_sd": 16.756024987415838, + "gnls_la_sd": 9183669699.444252, + "gnls_tp_sd": 22.121841064908335, + "hill_er_sd": 0.33805915168123435, + "hill_ga_sd": 16.727253222611452, + "hill_tp_sd": 22.083475060963128, + "poly1_a_sd": 0.0558929749060581, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 715.013055008413, + "poly2_ac50": 26.65356756528099, + "poly2_b_sd": 1138.546206698338, + "poly1_er_sd": 0.33129334042250025, + "poly2_er_sd": 0.3350705967166628, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4998.669787345316 + }, + "mc5Param": { + "a": 0.6372560400447195, + "er": 1.1994211380897748, + "ac5": 2.5, + "acc": 35.43443476538152, + "bmd": 14.57678091717993, + "bmr": 9.289141683881516, + "mll": -22.897351387220777, + "top": 31.86280200223597, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 12.611111933962569, + "bmdu": 17.452581906257134, + "rmse": 4.2304963707100685, + "ac1sd": 10.80561965691618, + "caikwt": 0.0008623202468912801, + "hitcall": 0.9723023592263896, + "top_over_cutoff": 1.411056796335542 + }, + "mc6Param": { + "flag": [ + "Only highest conc above baseline, active", + "Average number of replicates per conc is less than 2", + "Less than 50% efficacy" + ], + "mc6MthdId": [ + 6, + 13, + 17 + ] + } + }, + { + "aeid": 704, + "m4id": 1842429, + "spid": "TP0000269H02", + "chid": 22422, + "casn": "101-77-9", + "chnm": "4,4'-Diaminobiphenyl methane", + "dtxsid": "DTXSID6022422", + "bmad": 3.7634679299683276, + "respMax": 6.633232578988787, + "respMin": -9.288579922195433, + "maxMean": 6.633232578988787, + "maxMeanConc": 1.6989700043360187, + "maxMed": 6.633232578988787, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 28, + "m5id": 5037075, + "modl": "poly1", + "hitc": 3.192301725566275E-7, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + -1.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812 + ], + "resp": [ + -9.288579922195433, + -1.8279384384638953, + -0.14076023490952427, + -4.745260374024319, + 1.8279384384638953, + 6.633232578988787, + -4.73269516708234, + -1.5362461344536993 + ] + }, + "mc4Param": { + "pow_a": 6.640694251968835E-8, + "pow_p": 4.708272706063721, + "exp2_a": 0.0014256880285145326, + "exp2_b": 5.922987531364045, + "exp3_a": 4.8847255820373086, + "exp3_b": 51.06429898378816, + "exp3_p": 7.307167695500869, + "exp5_p": 7.999659316310423, + "gnls_p": 7.997921197479794, + "gnls_q": 7.999530335677372, + "hill_p": 7.987088871124498, + "pow_er": 1.1589254476238335, + "cnst_er": 1.4044782982786244, + "exp2_er": 1.1606772582682774, + "exp3_er": 1.158287286339332, + "exp4_er": 1.3005392690341286, + "exp4_ga": 47.86270321881696, + "exp4_tp": 7.959879066255224, + "exp5_er": 1.1586163655292807, + "exp5_ga": 44.27571832190897, + "exp5_tp": 7.895000592298389, + "gnls_er": 1.1573094818936194, + "gnls_ga": 40.56058652494757, + "gnls_la": 1282.63837357557, + "gnls_tp": 7.842544176863125, + "hill_er": 1.158759147911965, + "hill_ga": 40.89369026010592, + "hill_tp": 7.959875816540536, + "poly1_a": 0.10491644651330384, + "poly2_a": 0.0006507393642465428, + "poly2_b": 0.5070793867700588, + "pow_aic": 51.41328997449672, + "pow_cov": 1, + "pow_rme": 4.1877013763156805, + "pow_top": 6.628688104808383, + "all_bmed": 0, + "cnst_aic": 50.45420871184967, + "cnst_rme": 4.799166261950659, + "exp2_aic": 51.41291348555145, + "exp2_cov": 1, + "exp2_rme": 4.1880775010710165, + "exp2_top": 6.608583802396452, + "exp3_aic": 53.40921189505927, + "exp3_cov": 1, + "exp3_rme": 4.187148881312595, + "exp3_top": 6.628127374590708, + "exp4_aic": 53.10846032712193, + "exp4_cov": 1, + "exp4_rme": 4.550125713330075, + "exp4_top": 7.959879066255224, + "exp5_aic": 53.40936435022408, + "exp5_cov": 1, + "exp5_rme": 4.187167470953343, + "exp5_top": 7.895000592298389, + "gnls_aic": 57.410191575677814, + "gnls_cov": 1, + "gnls_rme": 4.18726579424983, + "gnls_top": 7.842528457243228, + "hill_aic": 53.41002025565312, + "hill_cov": 1, + "hill_rme": 4.187247227286038, + "hill_top": 7.959875816540536, + "poly1_er": 1.2638071352336775, + "poly2_er": 1.1976543273745366, + "pow_a_sd": 0.0000013788954939727336, + "pow_ac50": 43.15524701052844, + "pow_p_sd": 0.1097737662077741, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 0.012170331308111916, + "exp2_ac50": 45.89577526124489, + "exp2_b_sd": 6.001913269342651, + "exp3_a_sd": null, + "exp3_ac50": 46.66683218601111, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 47.86270321881696, + "exp5_ac50": 44.27571832190897, + "exp5_p_sd": 93.77195086112552, + "gnls_ac50": 40.56056619473948, + "gnls_p_sd": 43.59115160559422, + "gnls_q_sd": 2768980.6256247056, + "hill_ac50": 40.89369026010592, + "hill_p_sd": 56.475026137838405, + "poly1_aic": 50.713583537593315, + "poly1_cov": 1, + "poly1_rme": 4.48292241263243, + "poly1_top": 5.245822325665192, + "poly2_aic": 51.658540260325886, + "poly2_cov": 1, + "poly2_rme": 4.236574457386872, + "poly2_top": 6.391126680630588, + "pow_er_sd": 0.3390660571566805, + "exp2_er_sd": 0.33931424884331485, + "exp3_er_sd": null, + "exp4_er_sd": 0.32712745799309023, + "exp4_ga_sd": 85.09550371327019, + "exp4_tp_sd": 12.38636011110518, + "exp5_er_sd": 0.3391901097874664, + "exp5_ga_sd": 365.25436041198617, + "exp5_tp_sd": 196.19908115352908, + "gnls_er_sd": 0.33907426314020656, + "gnls_ga_sd": 78.57769638557588, + "gnls_la_sd": 1447381779.2912436, + "gnls_tp_sd": 22.236006501316705, + "hill_er_sd": 0.33920566149277925, + "hill_ga_sd": 189.84478002949493, + "hill_tp_sd": 57.07566436306677, + "poly1_a_sd": 0.06310343610315335, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 0.017222480464774936, + "poly2_ac50": 35.28153125132216, + "poly2_b_sd": 6.752089022420825, + "poly1_er_sd": 0.32616650584201273, + "poly2_er_sd": 0.3369788768607837, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1282.6390163455906 + }, + "mc5Param": { + "a": 0.10491644651330384, + "er": 1.2638071352336775, + "ac5": 2.5, + "bmd": 88.53847030268618, + "bmr": 9.289141683881516, + "mll": -23.356791768796658, + "top": 5.245822325665192, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 44.58314427339827, + "rmse": 4.48292241263243, + "ac1sd": 65.63266886781777, + "caikwt": 0.5323764880588537, + "hitcall": 3.192301725566275E-7, + "top_over_cutoff": 0.23231331772011585 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842443, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 3.7634679299683276, + "respMax": 5.412234762165331, + "respMin": -10.497225111686998, + "maxMean": 5.412234762165331, + "maxMeanConc": -0.6989700043360187, + "maxMed": 5.412234762165331, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 42, + "m5id": 5037089, + "modl": "poly1", + "hitc": 1.3111515548405657E-6, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + 1.3010299956639813, + -0.6989700043360187, + -1.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + -1.154901959985743 + ], + "resp": [ + -10.497225111686998, + -8.271301702212094, + 5.412234762165331, + -0.5697089223331855, + -5.4107315723966085, + -1.152645914630851, + -9.935332776150975, + 0.5697089223331855 + ] + }, + "mc4Param": { + "pow_a": 5.868021963410569E-8, + "pow_p": 0.31010469927487905, + "exp2_a": 0.00000820221770260021, + "exp2_b": 63.67412912081, + "exp3_a": 0.000015100154689265508, + "exp3_b": 66.7682650559194, + "exp3_p": 4.045012130124175, + "exp5_p": 2.5184566900851344, + "gnls_p": 1.004146220375644, + "gnls_q": 7.988324375445398, + "hill_p": 2.638717782813107, + "pow_er": 1.748991997794754, + "cnst_er": 1.749320687470586, + "exp2_er": 1.7502584913338175, + "exp3_er": 1.7494323994898786, + "exp4_er": 1.7493097643658628, + "exp4_ga": 3.3432891621411227, + "exp4_tp": 3.7125542218244536E-10, + "exp5_er": 1.7493111824172694, + "exp5_ga": 3.185722315810508, + "exp5_tp": 5.594093755272163E-10, + "gnls_er": 1.7165456563641568, + "gnls_ga": 0.015706640010627146, + "gnls_la": 0.4966875709539269, + "gnls_tp": 2.580846160887361, + "hill_er": 1.749345944481645, + "hill_ga": 33.73657111465509, + "hill_tp": 4.159714315410043E-9, + "poly1_a": 2.671599719093895E-11, + "poly2_a": 0.000005233244887677393, + "poly2_b": 60.3011801386689, + "pow_aic": 59.65799055310836, + "pow_cov": 1, + "pow_rme": 6.498682968118529, + "pow_top": 1.9740143842658864E-7, + "all_bmed": 0, + "cnst_aic": 55.65798921703397, + "cnst_rme": 6.498682892070479, + "exp2_aic": 59.65800315845096, + "exp2_cov": 1, + "exp2_rme": 6.4986846045958355, + "exp2_top": 0.000009784846486708034, + "exp3_aic": 61.657991223897305, + "exp3_cov": 1, + "exp3_rme": 6.4986834826679445, + "exp3_top": 0.00000549637162559571, + "exp4_aic": 59.65798921968127, + "exp4_cov": 1, + "exp4_rme": 6.498682892244033, + "exp4_top": 3.7125542218244536E-10, + "exp5_aic": 61.65798921951322, + "exp5_cov": 1, + "exp5_rme": 6.498682892347669, + "exp5_top": 5.594093755272163E-10, + "gnls_aic": 65.24298472190893, + "gnls_cov": 1, + "gnls_rme": 6.371147760432374, + "gnls_top": 2.422030692633518, + "hill_aic": 61.65798922272976, + "hill_cov": 1, + "hill_rme": 6.498682892532436, + "hill_top": 4.159714315410043E-9, + "poly1_er": 1.7493384697041403, + "poly2_er": 1.749869269967504, + "pow_a_sd": null, + "pow_ac50": 5.348516727471637, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.786661402010136, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 42.90853049989956, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 3.3432891621411227, + "exp5_ac50": 3.185722315810508, + "exp5_p_sd": null, + "gnls_ac50": 0.013892709273921892, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 33.73657111465509, + "hill_p_sd": null, + "poly1_aic": 57.65798921945516, + "poly1_cov": 1, + "poly1_rme": 6.49868289233687, + "poly1_top": 1.335799859546947E-9, + "poly2_aic": 59.65799619491047, + "poly2_cov": 1, + "poly2_rme": 6.498684235032681, + "poly2_top": 0.000007937241563467504, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.32379470628075435, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.40176401368837, + "poly2_b_sd": null, + "poly1_er_sd": 0.7320994661619505, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.5007494385640836 + }, + "mc5Param": { + "a": 2.671599719093895E-11, + "er": 1.7493384697041403, + "ac5": 2.4999999999999996, + "bmd": 347699605501.9814, + "bmr": 9.289141683881516, + "mll": -26.82899460972758, + "top": 1.335799859546947E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 108.3553281419698, + "rmse": 6.49868289233687, + "ac1sd": 257746186435.86465, + "caikwt": 0.7310585788680222, + "hitcall": 0.0000013111515548405657, + "top_over_cutoff": 5.915642542126427E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842432, + "spid": "TP0000394E04", + "chid": 20501, + "casn": "1095-90-5", + "chnm": "Methadone hydrochloride", + "dtxsid": "DTXSID2020501", + "bmad": 3.7634679299683276, + "respMax": 53.57668637905514, + "respMin": -4.581867196614961, + "maxMean": 53.57668637905514, + "maxMeanConc": 1.6020599913279625, + "maxMed": 53.57668637905514, + "maxMedConc": 1.6020599913279625, + "logcMax": 1.6020599913279625, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 2, + "tmpi": 31, + "m5id": 5037078, + "modl": "hill", + "hitc": 0.9999279506725846, + "fitc": 42, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 14.5, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1, + -0.3979400086720376, + 1.6020599913279625, + 0, + -1.6989700043360187, + 0.6020599913279624, + -1.3010299956639813, + -1 + ], + "resp": [ + 21.936647794421265, + -1.740228546008569, + 53.57668637905514, + 0.9551787559185203, + 4.581867196614961, + 5.153028957639964, + -4.581867196614961, + -4.44713457988105 + ] + }, + "mc4Param": { + "pow_a": 2.4561136581257776, + "pow_p": 0.8384142205134059, + "exp2_a": 11320.853419470812, + "exp2_b": 8346.744546958991, + "exp3_a": 1237.9308992517135, + "exp3_b": 1768.9351199634818, + "exp3_p": 0.8316744236700095, + "exp5_p": 1.8016780602346592, + "gnls_p": 1.9766627273478856, + "gnls_q": 4.997108159683513, + "hill_p": 1.9766497079181975, + "pow_er": 1.2490116616663218, + "cnst_er": 2.3406712762674364, + "exp2_er": 1.2565016352167926, + "exp3_er": 1.2497067897586192, + "exp4_er": 1.191255314619447, + "exp4_ga": 16.812978981896514, + "exp4_tp": 64.29202364758979, + "exp5_er": 0.8491056586507115, + "exp5_ga": 11.658831182973834, + "exp5_tp": 53.66634267307796, + "gnls_er": 0.8492765164139605, + "gnls_ga": 13.128901045410975, + "gnls_la": 2844.841004379705, + "gnls_tp": 59.500838623136616, + "hill_er": 0.8492543606297048, + "hill_ga": 13.128917895765634, + "hill_tp": 59.50093497422053, + "poly1_a": 1.35953439410823, + "poly2_a": 16188.436536049236, + "poly2_b": 11947.622892743011, + "pow_aic": 51.10023509243637, + "pow_cov": 1, + "pow_rme": 3.696125539873346, + "pow_top": 54.13003887794411, + "all_bmed": 0, + "cnst_aic": 70.10511686201906, + "cnst_rme": 20.748302126586477, + "exp2_aic": 52.14437661600831, + "exp2_cov": 1, + "exp2_rme": 4.1749638213440265, + "exp2_top": 54.38299031459843, + "exp3_aic": 53.16631363814249, + "exp3_cov": 1, + "exp3_rme": 3.712832014242786, + "exp3_top": 54.12213234353056, + "exp4_aic": 50.26961153208619, + "exp4_cov": 1, + "exp4_rme": 3.527127666309079, + "exp4_top": 64.29202364758979, + "exp5_aic": 48.01142321272821, + "exp5_cov": 1, + "exp5_rme": 2.8599881028288165, + "exp5_top": 53.66634267307796, + "gnls_aic": 52.00868220033195, + "gnls_cov": 1, + "gnls_rme": 2.859115773918567, + "gnls_top": 59.447789496359654, + "hill_aic": 48.00868220032641, + "hill_cov": 1, + "hill_rme": 2.8591158241549053, + "hill_top": 59.50093497422053, + "poly1_er": 1.2550642041651328, + "poly2_er": 1.2548228259159553, + "pow_a_sd": 0.5793958854691459, + "pow_ac50": 17.498995862103317, + "pow_p_sd": 0.06471940367191595, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 91463.2886733445, + "exp2_ac50": 20.023961414836553, + "exp2_b_sd": 67271.17368852775, + "exp3_a_sd": null, + "exp3_ac50": 17.605958078074853, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 16.812978981896514, + "exp5_ac50": 11.658831182973834, + "exp5_p_sd": 0.4678540387944143, + "gnls_ac50": 13.11706285853708, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 13.128917895765634, + "hill_p_sd": 0.5437164914820396, + "poly1_aic": 50.12897105076053, + "poly1_cov": 1, + "poly1_rme": 4.169192622228223, + "poly1_top": 54.38137576432922, + "poly2_aic": 52.15043963754287, + "poly2_cov": 1, + "poly2_rme": 4.1773867080169955, + "poly2_top": 54.3794684457665, + "pow_er_sd": 0.2953728072048604, + "exp2_er_sd": 0.32180507236787287, + "exp3_er_sd": null, + "exp4_er_sd": 0.32050596955935456, + "exp4_ga_sd": 4.7195276601323375, + "exp4_tp_sd": 9.472791030891605, + "exp5_er_sd": 0.3379311586462701, + "exp5_ga_sd": 1.1444511740381855, + "exp5_tp_sd": 2.171328717403055, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.33765766287101917, + "hill_ga_sd": 2.6322294581745154, + "hill_tp_sd": 6.46954953419342, + "poly1_a_sd": 0.08016047186257787, + "poly1_ac50": 20.000000000000007, + "poly2_a_sd": 111138.19550808848, + "poly2_ac50": 20.033367656805616, + "poly2_b_sd": 81749.64462524683, + "poly1_er_sd": 0.3215405880389804, + "poly2_er_sd": 0.3217023608890684, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2845.828862866811 + }, + "mc5Param": { + "p": 1.9766497079181975, + "er": 0.8492543606297048, + "ga": 13.128917895765634, + "tp": 59.50093497422053, + "ac5": 2.9600505790971923, + "acc": 10.2377822240795, + "bmd": 5.590946990603684, + "bmr": 9.289141683881516, + "mll": -20.00434110016321, + "top": 59.50093497422053, + "ac10": 4.31987731652492, + "ac20": 6.510927354274445, + "ac50": 13.128917895765634, + "bmdl": 4.96194145242722, + "bmdu": 6.331117452796167, + "rmse": 2.8591158241549053, + "ac1sd": 4.69288250612793, + "caikwt": 0.000015915242721747014, + "hitcall": 0.9999279506725846, + "top_over_cutoff": 2.6350224527585864 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842430, + "spid": "TP0000270A03", + "chid": 40713, + "casn": "1034-01-1", + "chnm": "Octyl gallate", + "dtxsid": "DTXSID4040713", + "bmad": 3.7634679299683276, + "respMax": 4.0110100385645735, + "respMin": -1753.9651348778787, + "maxMean": 4.0110100385645735, + "maxMeanConc": -0.6989700043360187, + "maxMed": 4.0110100385645735, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 29, + "m5id": 5037076, + "modl": "poly1", + "hitc": 0.09452569552120044, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187 + ], + "resp": [ + -2.8074617052802946, + 1.0764716849676692, + -3.8481164198730133, + -66.04011500681993, + -22.1044677990717, + -650.3289764196767, + 4.0110100385645735, + -1753.9651348778787 + ] + }, + "mc4Param": { + "pow_a": 0.000005430954273073871, + "pow_p": 0.44356001645759247, + "exp2_a": 0.0002868758851047003, + "exp2_b": 52.29564518101915, + "exp3_a": 0.00007065373025385777, + "exp3_b": 53.07437818010606, + "exp3_p": 7.856638077526047, + "exp5_p": 6.364784886246265, + "gnls_p": 1.0994616555400518, + "gnls_q": 6.028016384412763, + "hill_p": 1.4277336875116893, + "pow_er": 5.478367634135051, + "cnst_er": 5.135878672216937, + "exp2_er": 5.477689913583649, + "exp3_er": 5.48013831055958, + "exp4_er": 5.478384004342792, + "exp4_ga": 0.016244348117744, + "exp4_tp": 5.294724775052426E-7, + "exp5_er": 5.478340674314374, + "exp5_ga": 6.3316531519675445, + "exp5_tp": 2.3312427416913565E-7, + "gnls_er": 5.478333661045958, + "gnls_ga": 0.06561651513532632, + "gnls_la": 4.027166880955711, + "gnls_tp": 0.005795299244329243, + "hill_er": 5.478301864378817, + "hill_ga": 65.48576851856772, + "hill_tp": 5.147568284752382E-7, + "poly1_a": 9.803449957825028E-9, + "poly2_a": 0.0003985692201837858, + "poly2_b": 57.57648587989856, + "pow_aic": 128.0195917417057, + "pow_cov": 1, + "pow_rme": 661.8356526940903, + "pow_top": 0.00003079436898408721, + "all_bmed": 0, + "cnst_aic": 124.3587136415083, + "cnst_rme": 661.8356398173057, + "exp2_aic": 128.01959637464324, + "exp2_cov": 1, + "exp2_rme": 661.8358088666978, + "exp2_top": 0.0004594424423992509, + "exp3_aic": 130.0196021965711, + "exp3_cov": 1, + "exp3_rme": 661.8356601754986, + "exp3_top": 0.00006144291346564819, + "exp4_aic": 128.01959135584116, + "exp4_cov": 1, + "exp4_rme": 661.8356400664329, + "exp4_top": 5.294724775052426E-7, + "exp5_aic": 130.01959133366273, + "exp5_cov": 1, + "exp5_rme": 661.8356399242966, + "exp5_top": 2.3312427416913565E-7, + "gnls_aic": 134.0195953824525, + "gnls_cov": 1, + "gnls_rme": 661.8356575450581, + "gnls_top": 0.005607028353241692, + "hill_aic": 130.01959132750963, + "hill_cov": 1, + "hill_rme": 661.8356398963703, + "hill_top": 5.147568284752382E-7, + "poly1_er": 5.47830425526447, + "poly2_er": 5.47782475358971, + "pow_a_sd": null, + "pow_ac50": 10.478569298304585, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.761010400258353, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 46.61973121962576, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.016244348117744, + "exp5_ac50": 6.3316531519675445, + "exp5_p_sd": 570927.6166739571, + "gnls_ac50": 0.06184991600912808, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 65.48576851856772, + "hill_p_sd": null, + "poly1_aic": 126.0195913302737, + "poly1_cov": 1, + "poly1_rme": 661.8356400045014, + "poly1_top": 4.901724978912513E-7, + "poly2_aic": 128.0195974654655, + "poly2_cov": 1, + "poly2_rme": 661.8358775325804, + "poly2_top": 0.0006466969391063058, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": 0.5650956309919339, + "exp5_ga_sd": 30541.074886739865, + "exp5_tp_sd": 0.010891154955251125, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly1_ac50": 24.999999999999993, + "poly2_a_sd": null, + "poly2_ac50": 30.525963440706303, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4.056814023436538 + }, + "mc5Param": { + "a": 9.803449957825028E-9, + "er": 5.47830425526447, + "ac5": 2.4999999999999996, + "bmd": 947538032.4114374, + "bmr": 9.289141683881516, + "mll": -61.00979566513685, + "top": 4.901724978912513E-7, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999993, + "bmdl": 1.5904077965907737, + "rmse": 661.8356400045014, + "ac1sd": 702400320.542207, + "caikwt": 0.6964477131643466, + "hitcall": 0.09452569552120044, + "top_over_cutoff": 2.1707483054305203E-8 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Noisy data", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 10, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842431, + "spid": "TP0000270G03", + "chid": 24538, + "casn": "1143-38-0", + "chnm": "Anthralin", + "dtxsid": "DTXSID7024538", + "bmad": 3.7634679299683276, + "respMax": 1.07185605243019, + "respMin": -9693.875949218062, + "maxMean": 1.07185605243019, + "maxMeanConc": -1.6989700043360187, + "maxMed": 1.07185605243019, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 30, + "m5id": 5037077, + "modl": "poly1", + "hitc": 0.1121664647692, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + -1.6989700043360187, + 1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187 + ], + "resp": [ + -290.8004336479407, + -1119.7932814002315, + -3511.304770127347, + -14.130840021191842, + 1.07185605243019, + -9693.875949218062, + -5531.363440142849, + -9.227773090281191 + ] + }, + "mc4Param": { + "pow_a": 0.000016295912787337223, + "pow_p": 0.32150472408902353, + "exp2_a": 0.0005108027295935569, + "exp2_b": 117.05732896371232, + "exp3_a": 0.0007637855137420518, + "exp3_b": 66.37880128554707, + "exp3_p": 1.1690184802745147, + "exp5_p": 1.213976459225782, + "gnls_p": 1.465333545857999, + "gnls_q": 5.282627284696863, + "hill_p": 1.2584446172819073, + "pow_er": 7.913005745260049, + "cnst_er": 7.913106054805518, + "exp2_er": 7.91304122261628, + "exp3_er": 7.912357342166467, + "exp4_er": 7.9130904419643535, + "exp4_ga": 1.5991852149246326, + "exp4_tp": 2.547300452544774E-7, + "exp5_er": 7.913138104543472, + "exp5_ga": 1.0314696395590963, + "exp5_tp": 8.788694104592858E-7, + "gnls_er": 7.913096858909503, + "gnls_ga": 0.007141805168919414, + "gnls_la": 0.22621165840625276, + "gnls_tp": 0.7142118359098187, + "hill_er": 7.913164719748869, + "hill_ga": 0.07017612467977288, + "hill_tp": 0.0000014705482139499703, + "poly1_a": 7.358333303060364E-9, + "poly2_a": 0.02215910584118531, + "poly2_b": 158.14203618196245, + "pow_aic": 160.88623145756264, + "pow_cov": 1, + "pow_rme": 4156.850720832816, + "pow_top": 0.00005731991981836795, + "all_bmed": 0, + "cnst_aic": 156.88623127229403, + "cnst_rme": 4156.850693149301, + "exp2_aic": 160.8862316267931, + "exp2_cov": 1, + "exp2_rme": 4156.850791480489, + "exp2_top": 0.00027219093118124426, + "exp3_aic": 162.88623595855358, + "exp3_cov": 1, + "exp3_rme": 4156.850967911036, + "exp3_top": 0.0008022692602122777, + "exp4_aic": 160.88623127463256, + "exp4_cov": 1, + "exp4_rme": 4156.85069329631, + "exp4_top": 2.547300452544774E-7, + "exp5_aic": 162.88623128180765, + "exp5_cov": 1, + "exp5_rme": 4156.850693669871, + "exp5_top": 8.788694104592858E-7, + "gnls_aic": 166.88623633191477, + "gnls_cov": 1, + "gnls_rme": 4156.851147731188, + "gnls_top": 0.691919808292708, + "hill_aic": 162.8862313001522, + "hill_cov": 1, + "hill_rme": 4156.850694038434, + "hill_top": 0.0000014705482139499703, + "poly1_er": 7.913114168722814, + "poly2_er": 7.913479042407319, + "pow_a_sd": null, + "pow_ac50": 5.7896734789017446, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 27.64958084229515, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 31.74103567254259, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 1.5991852149246326, + "exp5_ac50": 1.0314696395590963, + "exp5_p_sd": null, + "gnls_ac50": 0.006843854769952966, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.07017612467977288, + "hill_p_sd": null, + "poly1_aic": 158.88623127321256, + "poly1_cov": 1, + "poly1_rme": 4156.850693286225, + "poly1_top": 3.679166651530182E-7, + "poly2_aic": 160.88624315935962, + "poly2_cov": 1, + "poly2_rme": 4156.854008688916, + "poly2_top": 0.009221198742038497, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 124.06407111097684, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 27.96064454439664, + "poly2_b_sd": null, + "poly1_er_sd": 0.5644466155491178, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.22837814263899145 + }, + "mc5Param": { + "a": 7.358333303060364E-9, + "er": 7.913114168722814, + "ac5": 2.5, + "bmd": 1262397516.0269134, + "bmr": 9.289141683881516, + "mll": -77.44311563660628, + "top": 3.679166651530182E-7, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 0.2092540156485721, + "rmse": 4156.850693286225, + "ac1sd": 935802458.1370742, + "caikwt": 0.7310585787203021, + "hitcall": 0.1121664647692, + "top_over_cutoff": 1.629333511889013E-8 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Noisy data", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 10, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842433, + "spid": "TP0000397C04", + "chid": 47303, + "casn": "179465-71-5", + "chnm": "CJ-013790", + "dtxsid": "DTXSID2047303", + "bmad": 3.7634679299683276, + "respMax": 4.713376683939935, + "respMin": -8.665862529755879, + "maxMean": 4.713376683939935, + "maxMeanConc": 1.6989700043360187, + "maxMed": 4.713376683939935, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 32, + "m5id": 5037079, + "modl": "poly1", + "hitc": 1.4657563430328811E-6, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1.6989700043360187, + 1.3010299956639813, + -0.22184874961635637, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + -1.6989700043360187, + -0.6989700043360187 + ], + "resp": [ + 4.713376683939935, + -2.842277469047785, + -8.665862529755879, + -6.370529795363219, + -4.8381205032263255, + 0.16783502687974627, + -0.16783502687974627, + -8.177282570884165 + ] + }, + "mc4Param": { + "pow_a": 4.7151852041982344E-8, + "pow_p": 4.707056641849134, + "exp2_a": 0.00013619254967583104, + "exp2_b": 4.786378022525692, + "exp3_a": 5.900683408927318, + "exp3_b": 53.44092756539992, + "exp3_p": 7.988441200666841, + "exp5_p": 7.999984075925836, + "gnls_p": 7.999997843476933, + "gnls_q": 2.098633684006826, + "hill_p": 7.999998966110843, + "pow_er": 1.4971788764551808, + "cnst_er": 1.5930907333079742, + "exp2_er": 1.4281119149809516, + "exp3_er": 1.495216359023091, + "exp4_er": 1.574893735475315, + "exp4_ga": 89.43517285381708, + "exp4_tp": 5.656051760011978, + "exp5_er": 1.4954679802518542, + "exp5_ga": 44.42715506006904, + "exp5_tp": 5.651471625387929, + "gnls_er": 1.4957921628108226, + "gnls_ga": 41.23384355892483, + "gnls_la": 3602.128748083291, + "gnls_tp": 5.656047237666198, + "hill_er": 1.4957815691417695, + "hill_ga": 41.23453451042785, + "hill_tp": 5.656051677235107, + "poly1_a": 0.050926851808962656, + "poly2_a": 0.000012052724389524282, + "poly2_b": 0.08546364297195863, + "pow_aic": 55.84673202895972, + "pow_cov": 1, + "pow_rme": 5.177530614120443, + "pow_top": 4.684322627141668, + "all_bmed": 0, + "cnst_aic": 52.95155071753253, + "cnst_rme": 5.434921591825441, + "exp2_aic": 55.8743139942496, + "exp2_cov": 1, + "exp2_rme": 5.173806472402641, + "exp2_top": 4.687233137067029, + "exp3_aic": 57.826834706209766, + "exp3_cov": 1, + "exp3_rme": 5.173298710256261, + "exp3_top": 4.718858031320078, + "exp4_aic": 56.73903934336423, + "exp4_cov": 1, + "exp4_rme": 5.385431090855095, + "exp4_top": 5.656051760011978, + "exp5_aic": 57.82823857314273, + "exp5_cov": 1, + "exp5_rme": 5.173596106096281, + "exp5_top": 5.651471625387929, + "gnls_aic": 61.83188800877744, + "gnls_cov": 1, + "gnls_rme": 5.17436656145897, + "gnls_top": 5.650466885579585, + "hill_aic": 57.83188406117348, + "hill_cov": 1, + "hill_rme": 5.174365789583489, + "hill_top": 5.656051677235107, + "poly1_er": 1.5665690518106064, + "poly2_er": 1.5387462152993685, + "pow_a_sd": 0.0000014616637059530786, + "pow_ac50": 43.15360567910734, + "pow_p_sd": 0.21842337803021228, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 0.0017043622702050344, + "exp2_ac50": 46.68247463584101, + "exp2_b_sd": 5.752295568125435, + "exp3_a_sd": null, + "exp3_ac50": 46.62733184577904, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 89.43517285381708, + "exp5_ac50": 44.42715506006904, + "exp5_p_sd": 37.67996399295617, + "gnls_ac50": 41.22454200269515, + "gnls_p_sd": 26.8489978675531, + "gnls_q_sd": 365.5344008388901, + "hill_ac50": 41.23453451042785, + "hill_p_sd": 26.882057159993813, + "poly1_aic": 54.65643655278332, + "poly1_cov": 1, + "poly1_rme": 5.369694576790002, + "poly1_top": 2.5463425904481323, + "poly2_aic": 56.11124549509633, + "poly2_cov": 1, + "poly2_rme": 5.235979290613626, + "poly2_top": 4.132416873278887, + "pow_er_sd": 0.3189018135141268, + "exp2_er_sd": 0.3138862113183906, + "exp3_er_sd": null, + "exp4_er_sd": 0.30874656566105163, + "exp4_ga_sd": 367.1517518690402, + "exp4_tp_sd": 24.085287988419147, + "exp5_er_sd": 0.31920776352680286, + "exp5_ga_sd": 128.5331012831714, + "exp5_tp_sd": 50.817238104594026, + "gnls_er_sd": 0.31925198781323405, + "gnls_ga_sd": 84.12979470825537, + "gnls_la_sd": 2666741.0444864347, + "gnls_tp_sd": 19.50597783562384, + "hill_er_sd": 0.31925103598267796, + "hill_ga_sd": 84.43629556899846, + "hill_tp_sd": 19.57120334180694, + "poly1_a_sd": 0.08732727070509533, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 0.00005470985934134532, + "poly2_ac50": 35.34283609938913, + "poly2_b_sd": 0.1930930384385403, + "poly1_er_sd": 0.3092301889812486, + "poly2_er_sd": 0.3174997459048597, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 3605.517232480094 + }, + "mc5Param": { + "a": 0.050926851808962656, + "er": 1.5665690518106064, + "ac5": 2.4999999999999996, + "bmd": 182.4016477344219, + "bmr": 9.289141683881516, + "mll": -25.32821827639166, + "top": 2.5463425904481323, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 48.45564360274376, + "rmse": 5.369694576790002, + "ac1sd": 135.21248905442692, + "caikwt": 0.7010793489765594, + "hitcall": 0.0000014657563430328811, + "top_over_cutoff": 0.11276578933008924 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842434, + "spid": "TP0000397C07", + "chid": 47290, + "casn": "402910-27-4", + "chnm": "UK-416244", + "dtxsid": "DTXSID0047290", + "bmad": 3.7634679299683276, + "respMax": 20.562993899193387, + "respMin": -1.7128786948219439, + "maxMean": 20.562993899193387, + "maxMeanConc": 1.6989700043360187, + "maxMed": 20.562993899193387, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 33, + "m5id": 5037080, + "modl": "poly1", + "hitc": 0.013162763209107189, + "fitc": 15, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + -1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436 + ], + "resp": [ + 1.7128786948219457, + 6.79192117713184, + 0.983536383364406, + 20.562993899193387, + 4.434828570684111, + -1.7128786948219439, + 3.81112438722068, + 3.4559450294617946 + ] + }, + "mc4Param": { + "pow_a": 0.6465352316272346, + "pow_p": 0.8777358322696996, + "exp2_a": 89.17261706113294, + "exp2_b": 242.1062343156615, + "exp3_a": 1.1322547120812192, + "exp3_b": 2.3290546411674624, + "exp3_p": 0.3515182576728658, + "exp5_p": 1.5578879657662703, + "gnls_p": 2.6086058918752, + "gnls_q": 6.488574895843359, + "hill_p": 2.608552656586586, + "pow_er": 0.592938019227486, + "cnst_er": 1.6023141970056376, + "exp2_er": 0.5815399491932731, + "exp3_er": 0.4027853746799608, + "exp4_er": 0.7852662330946163, + "exp4_ga": 25.08568386766411, + "exp4_tp": 24.675592673186735, + "exp5_er": 0.725548250986497, + "exp5_ga": 28.642999510263735, + "exp5_tp": 24.67559255717096, + "gnls_er": 0.7768842111175422, + "gnls_ga": 28.03423084450281, + "gnls_la": 1207.440421430461, + "gnls_tp": 24.675592520708317, + "hill_er": 0.7767855542995623, + "hill_ga": 28.03395361240333, + "hill_tp": 24.675592678367664, + "poly1_a": 0.40607178858594234, + "poly2_a": 177.31422405471238, + "poly2_b": 478.93026660415705, + "pow_aic": 41.233991570138386, + "pow_cov": 1, + "pow_rme": 2.079136922898597, + "pow_top": 20.03729289908219, + "all_bmed": 0, + "cnst_aic": 56.08828664046871, + "cnst_rme": 8.077268192520862, + "exp2_aic": 41.31836603558712, + "exp2_cov": 1, + "exp2_rme": 2.124397197473024, + "exp2_top": 20.455613509941355, + "exp3_aic": 40.32224322278512, + "exp3_cov": 1, + "exp3_rme": 1.7472047427116597, + "exp3_top": 20.256515991910604, + "exp4_aic": 43.99983839294445, + "exp4_cov": 1, + "exp4_rme": 2.4212957674199513, + "exp4_top": 24.675592673186735, + "exp5_aic": 45.31966847370493, + "exp5_cov": 1, + "exp5_rme": 2.3636821866975195, + "exp5_top": 24.67559255717096, + "gnls_aic": 50.24980681608249, + "gnls_cov": 1, + "gnls_rme": 2.506821099601261, + "gnls_top": 24.634723410831995, + "hill_aic": 46.24980691570314, + "hill_cov": 1, + "hill_rme": 2.506818523624102, + "hill_top": 24.675592678367664, + "poly1_er": 0.5923846502517791, + "poly2_er": 0.5823674792019434, + "pow_a_sd": 0.6278658064575703, + "pow_ac50": 22.699069305947805, + "pow_p_sd": 0.2549454765062092, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 359.0395021231347, + "exp2_ac50": 26.288468365058172, + "exp2_b_sd": 886.5958914663547, + "exp3_a_sd": null, + "exp3_ac50": 24.811922046316333, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 25.08568386766411, + "exp5_ac50": 28.642999510263735, + "exp5_p_sd": 1.0227938367314742, + "gnls_ac50": 27.998654408803787, + "gnls_p_sd": 5.461532170943338, + "gnls_q_sd": 22759.167333341324, + "hill_ac50": 28.03395361240333, + "hill_p_sd": 5.452818557413982, + "poly1_aic": 39.39114515732258, + "poly1_cov": 1, + "poly1_rme": 2.122723532583719, + "poly1_top": 20.303589429297116, + "poly2_aic": 41.325165646100416, + "poly2_cov": 1, + "poly2_rme": 2.1244698512830005, + "poly2_top": 20.44407341622616, + "pow_er_sd": 0.3108099654396902, + "exp2_er_sd": 0.3178770115917476, + "exp3_er_sd": null, + "exp4_er_sd": 0.33443563742176596, + "exp4_ga_sd": 13.749752885288313, + "exp4_tp_sd": 8.11750344400524, + "exp5_er_sd": 0.32227571811133654, + "exp5_ga_sd": 12.37560260555014, + "exp5_tp_sd": 10.526695614436056, + "gnls_er_sd": 0.3501482582991739, + "gnls_ga_sd": 29.843090634836496, + "gnls_la_sd": 13481202.453940429, + "gnls_tp_sd": 25.420327925189305, + "hill_er_sd": 0.3500296892891899, + "hill_ga_sd": 29.79588241284215, + "hill_tp_sd": 25.3801674852378, + "poly1_a_sd": 0.030791471721265937, + "poly1_ac50": 25, + "poly2_a_sd": 792.2766056136632, + "poly2_ac50": 26.179002210991253, + "poly2_b_sd": 1966.159052634094, + "poly1_er_sd": 0.31366046598015807, + "poly2_er_sd": 0.31747777530209154, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1208.036729727654 + }, + "mc5Param": { + "a": 0.40607178858594234, + "er": 0.5923846502517791, + "ac5": 2.5, + "bmd": 22.87561447257627, + "bmr": 9.289141683881516, + "mll": -17.69557257866129, + "top": 20.303589429297116, + "ac10": 5, + "ac20": 10, + "ac50": 25, + "bmdl": 20.16263893407659, + "bmdu": 26.70412321005569, + "rmse": 2.122723532583719, + "ac1sd": 16.95746069130932, + "caikwt": 0.00023667860169117045, + "hitcall": 0.013162763209107187, + "top_over_cutoff": 0.8991524929981263 + }, + "mc6Param": { + "flag": [ + "Borderline", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 11, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842435, + "spid": "TP0000880C04", + "chid": 33923, + "casn": "32809-16-8", + "chnm": "Procymidone", + "dtxsid": "DTXSID9033923", + "bmad": 3.7634679299683276, + "respMax": 3.8699568062787453, + "respMin": -24.489107339892946, + "maxMean": 3.8699568062787453, + "maxMeanConc": -1.6989700043360187, + "maxMed": 3.8699568062787453, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 34, + "m5id": 5037081, + "modl": "poly1", + "hitc": 2.0097205336309178E-4, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1.6989700043360187, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436 + ], + "resp": [ + -16.749193727335452, + -3.8699568062787457, + -24.489107339892946, + -2.381126076423389, + -0.43391299854400067, + -11.816416045813897, + 3.8699568062787453, + -18.88319457236392 + ] + }, + "mc4Param": { + "pow_a": 1.952362597456107E-7, + "pow_p": 0.39552329951433673, + "exp2_a": 0.0000013815285997456324, + "exp2_b": 57.36258080607493, + "exp3_a": 0.0001480645519160266, + "exp3_b": 58.52389350028799, + "exp3_p": 3.781832639454812, + "exp5_p": 2.151688320633654, + "gnls_p": 4.527989650709323, + "gnls_q": 5.108399001356277, + "hill_p": 1.303035732677177, + "pow_er": 2.418785008334611, + "cnst_er": 2.4188909137985077, + "exp2_er": 2.4174176897085324, + "exp3_er": 2.419726742963499, + "exp4_er": 2.4189096181956495, + "exp4_ga": 12.65722171867288, + "exp4_tp": 1.0355875462847547E-9, + "exp5_er": 2.4189155605747237, + "exp5_ga": 2.333940770138562, + "exp5_tp": 7.523689804982252E-10, + "gnls_er": 2.418842358875211, + "gnls_ga": 0.006221346383250256, + "gnls_la": 0.1981088801387234, + "gnls_tp": 1.090792464590304E-7, + "hill_er": 2.4188877929803674, + "hill_ga": 11.485567544481444, + "hill_tp": 2.7451333346567636E-9, + "poly1_a": 2.0842008078263976E-11, + "poly2_a": 0.000005049104462465559, + "poly2_b": 54.21786559908971, + "pow_aic": 70.76387560116336, + "pow_cov": 1, + "pow_rme": 13.286580877800748, + "pow_top": 9.173661286959486E-7, + "all_bmed": 0, + "cnst_aic": 66.76387501055429, + "cnst_rme": 13.28658048320367, + "exp2_aic": 70.7638964289917, + "exp2_cov": 1, + "exp2_rme": 13.28658095149074, + "exp2_top": 0.0000019214971296937626, + "exp3_aic": 72.76390545298773, + "exp3_cov": 1, + "exp3_rme": 13.28659824551256, + "exp3_top": 0.00010892669639514888, + "exp4_aic": 70.7638750136908, + "exp4_cov": 1, + "exp4_rme": 13.286580483579051, + "exp4_top": 1.0355875462847547E-9, + "exp5_aic": 72.76387501605065, + "exp5_cov": 1, + "exp5_rme": 13.2865804836615, + "exp5_top": 7.523689804982252E-10, + "gnls_aic": 76.76387503731891, + "gnls_cov": 1, + "gnls_rme": 13.286580484397929, + "gnls_top": 1.090255384568449E-7, + "hill_aic": 72.76387501190618, + "hill_cov": 1, + "hill_rme": 13.286580484182, + "hill_top": 2.7451333346567636E-9, + "poly1_er": 2.4189004532043645, + "poly2_er": 2.418496776366225, + "pow_a_sd": null, + "pow_ac50": 8.667164755308963, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.28360145565822, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 43.05544733482424, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 12.65722171867288, + "exp5_ac50": 2.333940770138562, + "exp5_p_sd": null, + "gnls_ac50": 0.006219991242649403, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 11.485567544481444, + "hill_p_sd": 182115.5261684, + "poly1_aic": 68.7638750114407, + "poly1_cov": 1, + "poly1_rme": 13.286580483490953, + "poly1_top": 1.0421004039131984E-9, + "poly2_aic": 70.76387916054314, + "poly2_cov": 1, + "poly2_rme": 13.286582613515252, + "poly2_top": 0.00000895038468449257, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.32318093486450644, + "hill_ga_sd": 39787.827708636134, + "hill_tp_sd": 0.00014220966225169602, + "poly1_a_sd": null, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.68674937055745, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.19814706168674365 + }, + "mc5Param": { + "a": 2.0842008078263976E-11, + "er": 2.4189004532043645, + "ac5": 2.4999999999999996, + "bmd": 445693219626.4291, + "bmr": 9.289141683881516, + "mll": -32.38193750572035, + "top": 1.0421004039131984E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 58.80191266271995, + "rmse": 13.286580483490953, + "ac1sd": 330387857395.42554, + "caikwt": 0.731058578717145, + "hitcall": 0.00020097205336309175, + "top_over_cutoff": 4.614982879730862E-11 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842436, + "spid": "TP0000881A11", + "chid": 48175, + "casn": "151506-44-4", + "chnm": "Difpas-pyrazole", + "dtxsid": "DTXSID6048175", + "bmad": 3.7634679299683276, + "respMax": 9.134362565846857, + "respMin": -9.785612022505717, + "maxMean": 9.134362565846857, + "maxMeanConc": 0.3010299956639812, + "maxMed": 9.134362565846857, + "maxMedConc": 0.3010299956639812, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 35, + "m5id": 5037082, + "modl": "poly1", + "hitc": 1.1947725092996029E-4, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + -1.6989700043360187 + ], + "resp": [ + 9.134362565846857, + -9.785612022505717, + 3.535593024563581, + 6.742445658286296, + -0.3105023663836639, + 5.823097242106741, + -4.029995470890604, + -3.535593024563581 + ] + }, + "mc4Param": { + "pow_a": 0.5017775225188548, + "pow_p": 0.6591192202685694, + "exp2_a": 453.975198070989, + "exp2_b": 3365.723487674608, + "exp3_a": 47.11060086418455, + "exp3_b": 932.6075153090944, + "exp3_p": 0.6902242901855664, + "exp5_p": 7.999996307955874, + "gnls_p": 7.999999981968314, + "gnls_q": 3.2727881400777346, + "hill_p": 7.999999785978309, + "pow_er": 1.531638797544549, + "cnst_er": 1.7262662747276574, + "exp2_er": 1.5506701363683515, + "exp3_er": 1.536100270032405, + "exp4_er": 1.5089274250976916, + "exp4_ga": 13.628170726573147, + "exp4_tp": 6.977505107544097, + "exp5_er": 1.289488315288251, + "exp5_ga": 1.4438188583318046, + "exp5_tp": 6.178082350961625, + "gnls_er": 1.2953710144587984, + "gnls_ga": 1.10862617843866, + "gnls_la": 4151.891415636962, + "gnls_tp": 6.166337115180187, + "hill_er": 1.4438381777640448, + "hill_ga": 12.482180184563882, + "hill_tp": 6.342080307914102, + "poly1_a": 0.13564844128161777, + "poly2_a": 383.3454143719398, + "poly2_b": 2877.2229593527345, + "pow_aic": 56.75504382566062, + "pow_cov": 1, + "pow_rme": 5.641059195157223, + "pow_top": 6.612032619018348, + "all_bmed": 0, + "cnst_aic": 54.94826792526694, + "cnst_rme": 6.12272333576879, + "exp2_aic": 56.83709901722125, + "exp2_cov": 1, + "exp2_rme": 5.590761673925524, + "exp2_top": 6.794438217682005, + "exp3_aic": 58.76709884295892, + "exp3_cov": 1, + "exp3_rme": 5.627994848984627, + "exp3_top": 6.686017631086944, + "exp4_aic": 56.60430600619944, + "exp4_cov": 1, + "exp4_rme": 5.64803429898856, + "exp4_top": 6.977505107544097, + "exp5_aic": 57.43232581617384, + "exp5_cov": 1, + "exp5_rme": 6.1785465480449275, + "exp5_top": 6.178082350961625, + "gnls_aic": 61.48247646171176, + "gnls_cov": 1, + "gnls_rme": 6.1821614427506155, + "gnls_top": 6.166337058698889, + "hill_aic": 57.56759946363208, + "hill_cov": 1, + "hill_rme": 5.261298696231139, + "hill_top": 6.342080307914102, + "poly1_er": 1.5502075397868125, + "poly2_er": 1.550523396666215, + "pow_a_sd": 1.8425110941903395, + "pow_ac50": 17.468453440300433, + "pow_p_sd": 0.9672892572791348, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 8922.735205678156, + "exp2_ac50": 25.09284693992692, + "exp2_b_sd": 65504.294285102085, + "exp3_a_sd": 613.2900449736795, + "exp3_ac50": 19.20254148908469, + "exp3_b_sd": 11915.632924850908, + "exp3_p_sd": 1.5295163260514226, + "exp4_ac50": 13.628170726573147, + "exp5_ac50": 1.4438188583318046, + "exp5_p_sd": 26.276043660735045, + "gnls_ac50": 1.1086261757300446, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 12.482180184563882, + "hill_p_sd": 15.808942438750206, + "poly1_aic": 54.834448290805426, + "poly1_cov": 1, + "poly1_rme": 5.59051462132586, + "poly1_top": 6.782422064080888, + "poly2_aic": 56.84053243854048, + "poly2_cov": 1, + "poly2_rme": 5.5908588367326715, + "poly2_top": 6.777492495111021, + "pow_er_sd": 0.32653699413281, + "exp2_er_sd": 0.31815485619140227, + "exp3_er_sd": 0.32790889345958, + "exp4_er_sd": 0.33416716724015716, + "exp4_ga_sd": 31.79171894098858, + "exp4_tp_sd": 6.352844098132389, + "exp5_er_sd": 0.3758220092286442, + "exp5_ga_sd": 1.9804842288363265, + "exp5_tp_sd": 2.143982334536147, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.332730110230082, + "hill_ga_sd": 15.134790376842096, + "hill_tp_sd": 2.8528600881389283, + "poly1_a_sd": 0.08178965120744121, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 5071.424671946927, + "poly2_ac50": 25.213497375344687, + "poly2_b_sd": 37395.91769567147, + "poly1_er_sd": 0.31814280871376166, + "poly2_er_sd": 0.3181039857589696, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4151.891438876929 + }, + "mc5Param": { + "a": 0.13564844128161777, + "er": 1.5502075397868125, + "ac5": 2.5, + "bmd": 68.47953132462807, + "bmr": 9.289141683881516, + "mll": -25.417224145402713, + "top": 6.782422064080888, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 31.540364959678023, + "rmse": 5.59051462132586, + "ac1sd": 50.763181115365505, + "caikwt": 0.48577638435279785, + "hitcall": 0.00011947725092996028, + "top_over_cutoff": 0.3003622452433992 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842437, + "spid": "TP0000900G07", + "chid": 20337, + "casn": "50-41-9", + "chnm": "Clomiphene citrate (1:1)", + "dtxsid": "DTXSID8020337", + "bmad": 3.7634679299683276, + "respMax": 10.898789471139123, + "respMin": -5.515280710520811, + "maxMean": 10.898789471139123, + "maxMeanConc": -0.6989700043360187, + "maxMed": 10.898789471139123, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6020599913279625, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 36, + "m5id": 5037083, + "modl": "exp5", + "hitc": 9.661810864110531E-17, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 16.799999237060547, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.3010299956639812, + 1.6020599913279625, + 0.6989700043360189, + -1.2218487496163564, + 1, + -0.6989700043360187, + -0.3010299956639812, + -1.6989700043360187 + ], + "resp": [ + 9.542989087509472, + 7.659697931946032, + 2.722279533841609, + 8.963514885797641, + 3.4847031705862404, + 10.898789471139123, + 4.5850191008881405, + -5.515280710520811 + ] + }, + "mc4Param": { + "pow_a": 2.894877828291989, + "pow_p": 0.30000009184154497, + "exp2_a": 507.19665769285456, + "exp2_b": 2390.670092115083, + "exp3_a": 6.049534282925707, + "exp3_b": 57.69378050863092, + "exp3_p": 0.3000001376282075, + "exp5_p": 7.99999942640795, + "gnls_p": 7.999793902840986, + "gnls_q": 0.3000000006452066, + "hill_p": 7.999999962514539, + "pow_er": 1.5751148789361489, + "cnst_er": 1.9204039795995531, + "exp2_er": 1.7462217494828138, + "exp3_er": 1.60658050250781, + "exp4_er": 1.3106985883527575, + "exp4_ga": 0.027758750868336332, + "exp4_tp": 6.630252961291825, + "exp5_er": 1.1618953320857577, + "exp5_ga": 0.04402078526015048, + "exp5_tp": 6.928768027059429, + "gnls_er": 1.078426077644248, + "gnls_ga": 0.044919076585011514, + "gnls_la": 2.255723019139164, + "gnls_tp": 13.078546805362636, + "hill_er": 1.1679042852770425, + "hill_ga": 0.03577555974551571, + "hill_tp": 6.9330269168075835, + "poly1_a": 0.21403725104232135, + "poly2_a": 618.1481332192153, + "poly2_b": 2934.2080821756736, + "pow_aic": 56.78989112699861, + "pow_cov": 1, + "pow_rme": 5.417311928123108, + "pow_top": 8.75484344876054, + "all_bmed": 0, + "cnst_aic": 57.84110962062907, + "cnst_rme": 7.244502292220726, + "exp2_aic": 59.61899839531536, + "exp2_cov": 1, + "exp2_rme": 6.4909481098367, + "exp2_top": 8.557660172303574, + "exp3_aic": 59.43480588967103, + "exp3_cov": 1, + "exp3_rme": 5.672416841872105, + "exp3_top": 8.769641636805533, + "exp4_aic": 52.464863303353795, + "exp4_cov": 1, + "exp4_rme": 4.153583197446473, + "exp4_top": 6.630252961291825, + "exp5_aic": 51.72994045013513, + "exp5_cov": 1, + "exp5_rme": 3.4066258677428043, + "exp5_top": 6.928768027059429, + "gnls_aic": 54.51261883419981, + "gnls_cov": 1, + "gnls_rme": 3.182126811772757, + "gnls_top": 9.472157188065228, + "hill_aic": 51.823001877133166, + "hill_cov": 1, + "hill_rme": 3.426451464532569, + "hill_top": 6.9330269168075835, + "poly1_er": 1.7457558826110058, + "poly2_er": 1.7452968782570826, + "pow_a_sd": null, + "pow_ac50": 3.968505436961949, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 7886.209158743144, + "exp2_ac50": 20.0836575769218, + "exp2_b_sd": 36834.91963316086, + "exp3_a_sd": null, + "exp3_ac50": 7.634424142811094, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.027758750868336332, + "exp5_ac50": 0.04402078526015048, + "exp5_p_sd": 16.740985051144577, + "gnls_ac50": 0.04432778118356064, + "gnls_p_sd": 12.005109141069354, + "gnls_q_sd": 0.4874284554370162, + "hill_ac50": 0.03577555974551571, + "hill_p_sd": 8.198400789158134, + "poly1_aic": 57.614782432250024, + "poly1_cov": 1, + "poly1_rme": 6.489573055026577, + "poly1_top": 8.561490041692856, + "poly2_aic": 59.62160290345598, + "poly2_cov": 1, + "poly2_rme": 6.491849855433758, + "poly2_top": 8.541656153189367, + "pow_er_sd": null, + "exp2_er_sd": 0.31177602076055916, + "exp3_er_sd": null, + "exp4_er_sd": 0.30388057834208093, + "exp4_ga_sd": 0.02693013869703401, + "exp4_tp_sd": 1.661867218808188, + "exp5_er_sd": 0.29468062372775733, + "exp5_ga_sd": 0.03680809630884936, + "exp5_tp_sd": 1.4295227932907637, + "gnls_er_sd": 0.3065288310832348, + "gnls_ga_sd": 0.031029309418172207, + "gnls_la_sd": 24.854379539431022, + "gnls_tp_sd": 20.121310783219784, + "hill_er_sd": 0.2958893567650495, + "hill_ga_sd": 0.020109201282715105, + "hill_tp_sd": 1.444345524585305, + "poly1_a_sd": 0.1246611948311575, + "poly1_ac50": 20.000000000000004, + "poly2_a_sd": 7675.09337419141, + "poly2_ac50": 20.1344835005275, + "poly2_b_sd": 35962.194179144324, + "poly1_er_sd": 0.3117610061713438, + "poly2_er_sd": 0.3116647419349434, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 14.889197885456817 + }, + "mc5Param": { + "p": 7.99999942640795, + "er": 1.1618953320857577, + "ga": 0.04402078526015048, + "tp": 6.928768027059429, + "ac5": 0.031791583986919426, + "bmr": 9.289141683881516, + "mll": -21.86497022506757, + "top": 6.928768027059429, + "ac10": 0.03478478563989077, + "ac20": 0.03820565423269564, + "ac50": 0.04402078526015048, + "rmse": 3.4066258677428043, + "ac1sd": 0.056474950476798486, + "caikwt": 0.04497698241958925, + "hitcall": 9.661810864110532E-17, + "top_over_cutoff": 0.30684323413014714 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842438, + "spid": "TP0000901C02", + "chid": 44742, + "casn": "929-59-9", + "chnm": "2,2'-[Ethane-1,2-diylbis(oxy)]diethanamine", + "dtxsid": "DTXSID9044742", + "bmad": 3.7634679299683276, + "respMax": 2.102135732023357, + "respMin": -13.866850456669049, + "maxMean": 2.102135732023357, + "maxMeanConc": -1.6989700043360187, + "maxMed": 2.102135732023357, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 37, + "m5id": 5037084, + "modl": "poly1", + "hitc": 1.6909241923219796E-5, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637 + ], + "resp": [ + 2.102135732023357, + -9.412448215112468, + -13.866850456669049, + -2.1021357320233576, + -12.917586117741852, + -10.97561525557232, + -6.22147697413914, + -2.080189161400509 + ] + }, + "mc4Param": { + "pow_a": 3.4446382511039494E-8, + "pow_p": 0.405668436564102, + "exp2_a": 0.0000035767163069793493, + "exp2_b": 54.19534891303776, + "exp3_a": 0.00010379978775640668, + "exp3_b": 59.37620949215037, + "exp3_p": 5.888770426636071, + "exp5_p": 1.9821606540096437, + "gnls_p": 0.30001012009352335, + "gnls_q": 7.999995713520498, + "hill_p": 1.7490788379969926, + "pow_er": 2.071207160271089, + "cnst_er": 2.071211568093979, + "exp2_er": 2.087900394504249, + "exp3_er": 2.0726661672288493, + "exp4_er": 2.071198368794665, + "exp4_ga": 1.5550293796779942, + "exp4_tp": 6.854934679554375E-10, + "exp5_er": 2.071188089956425, + "exp5_ga": 1.075853940567168, + "exp5_tp": 7.285098719222379E-11, + "gnls_er": 2.0848424617077885, + "gnls_ga": 0.0036576464311942544, + "gnls_la": 0.11566493705462633, + "gnls_tp": 2.508032612116657, + "hill_er": 2.0712056577390427, + "hill_ga": 0.0943243612038477, + "hill_tp": 1.0236527737537164E-10, + "poly1_a": 2.7800312881203852E-11, + "poly2_a": 0.00000627535807537266, + "poly2_b": 60.95260835116624, + "pow_aic": 64.64743364497741, + "pow_cov": 1, + "pow_rme": 8.804003396114856, + "pow_top": 1.6840777009062426E-7, + "all_bmed": 0, + "cnst_aic": 60.647433518627345, + "cnst_rme": 8.804003324454703, + "exp2_aic": 64.65038867128672, + "exp2_cov": 1, + "exp2_rme": 8.804004670425206, + "exp2_top": 0.0000054215645424565595, + "exp3_aic": 66.64747052230402, + "exp3_cov": 1, + "exp3_rme": 8.804011695015834, + "exp3_top": 0.00004549404939612168, + "exp4_aic": 64.64743351699708, + "exp4_cov": 1, + "exp4_rme": 8.804003324877298, + "exp4_top": 6.854934679554375E-10, + "exp5_aic": 66.6474335170417, + "exp5_cov": 1, + "exp5_rme": 8.804003324503169, + "exp5_top": 7.285098719222379E-11, + "gnls_aic": 70.7685853545882, + "gnls_cov": 1, + "gnls_rme": 8.85030950797314, + "gnls_top": 1.7467856376852715, + "hill_aic": 66.64743351725284, + "hill_cov": 1, + "hill_rme": 8.804003324534168, + "hill_top": 1.0236527737537164E-10, + "poly1_er": 2.071181356064919, + "poly2_er": 2.0591467602950058, + "pow_a_sd": null, + "pow_ac50": 9.055465992561412, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.57258064410303, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.10566579953819, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 1.5550293796779942, + "exp5_ac50": 1.075853940567168, + "exp5_p_sd": null, + "gnls_ac50": 0.00045274899531010966, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.0943243612038477, + "hill_p_sd": null, + "poly1_aic": 62.647433519300336, + "poly1_cov": 1, + "poly1_rme": 8.804003324837579, + "poly1_top": 1.3900156440601922E-9, + "poly2_aic": 64.648984881928, + "poly2_cov": 1, + "poly2_rme": 8.80400563504064, + "poly2_top": 0.000009370471461854893, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.372856253972696, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.11734082051568114 + }, + "mc5Param": { + "a": 2.7800312881203852E-11, + "er": 2.071181356064919, + "ac5": 2.4999999999999996, + "bmd": 334138026560.1983, + "bmr": 9.289141683881516, + "mll": -29.323716759650168, + "top": 1.3900156440601922E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 83.31772378411256, + "rmse": 8.804003324837579, + "ac1sd": 247693125693.253, + "caikwt": 0.7310585786961639, + "hitcall": 0.000016909241923219796, + "top_over_cutoff": 6.155739289426647E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842439, + "spid": "TP0000901G06", + "chid": 37717, + "casn": "1478-61-1", + "chnm": "Bisphenol AF", + "dtxsid": "DTXSID7037717", + "bmad": 3.7634679299683276, + "respMax": 25.02709988877963, + "respMin": -5.116640339141512, + "maxMean": 25.02709988877963, + "maxMeanConc": 1.6989700043360187, + "maxMed": 25.02709988877963, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 2, + "tmpi": 38, + "m5id": 5037085, + "modl": "poly1", + "hitc": 0.4839809180427277, + "fitc": 15, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.6989700043360187, + 1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637 + ], + "resp": [ + 5.116640339141512, + 25.02709988877963, + -1.5045979142152461, + 18.349042537758507, + -5.116640339141512, + 5.529082512613025, + 0.5975072132046018, + -1.187660181498737 + ] + }, + "mc4Param": { + "pow_a": 0.07159436973182562, + "pow_p": 1.4960735696348564, + "exp2_a": 8.456409712931872, + "exp2_b": 36.37151003282228, + "exp3_a": 4.7469347723334465, + "exp3_b": 24.593641736552343, + "exp3_p": 0.854675613605653, + "exp5_p": 2.264198460682199, + "gnls_p": 3.318653605103369, + "gnls_q": 5.8042879403945875, + "hill_p": 3.319207509571538, + "pow_er": 1.298769240423112, + "cnst_er": 2.069727518985843, + "exp2_er": 1.3076817798550966, + "exp3_er": 1.3140568468982357, + "exp4_er": 1.6046703279553285, + "exp4_ga": 26.25609903911517, + "exp4_tp": 30.03251983398266, + "exp5_er": 1.2910910235308246, + "exp5_ga": 33.09797478746359, + "exp5_tp": 30.032519004305016, + "gnls_er": 1.2904522494318973, + "gnls_ga": 30.9993505952315, + "gnls_la": 1379.821215621746, + "gnls_tp": 30.032519583217184, + "hill_er": 1.2906396868889318, + "hill_ga": 31.00480635661345, + "hill_tp": 30.032519453725904, + "poly1_a": 0.4801784188472726, + "poly2_a": 7.581640517436643, + "poly2_b": 36.27786078315009, + "pow_aic": 56.35279588835657, + "pow_cov": 1, + "pow_rme": 6.682149859256472, + "pow_top": 24.92659682737705, + "all_bmed": 0, + "cnst_aic": 62.96436169588917, + "cnst_rme": 11.456467755742704, + "exp2_aic": 56.21699568284793, + "exp2_cov": 1, + "exp2_rme": 6.540814233283506, + "exp2_top": 24.979385566604833, + "exp3_aic": 58.20667037507905, + "exp3_cov": 1, + "exp3_rme": 6.502564689513747, + "exp3_top": 24.95932460632071, + "exp4_aic": 58.1094254225183, + "exp4_cov": 1, + "exp4_rme": 6.2731787855341095, + "exp4_top": 30.03251983398266, + "exp5_aic": 58.55393829008341, + "exp5_cov": 1, + "exp5_rme": 6.871326153335053, + "exp5_top": 30.032519004305016, + "gnls_aic": 62.67232565633159, + "gnls_cov": 1, + "gnls_rme": 6.968000583173041, + "gnls_top": 30.013400810194607, + "hill_aic": 58.67232739427216, + "hill_cov": 1, + "hill_rme": 6.968054555449975, + "hill_top": 30.032519453725904, + "poly1_er": 1.4547327831413472, + "poly2_er": 1.3132567568023277, + "pow_a_sd": 0.08813493434702901, + "pow_ac50": 31.459849478540292, + "pow_p_sd": 0.3186339393901382, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 16.387643242603666, + "exp2_ac50": 32.98997403636759, + "exp2_b_sd": 38.85953499547879, + "exp3_a_sd": 22.27340883508407, + "exp3_ac50": 33.09824724111999, + "exp3_b_sd": 83.07150496858122, + "exp3_p_sd": 1.0925857934998315, + "exp4_ac50": 26.25609903911517, + "exp5_ac50": 33.09797478746359, + "exp5_p_sd": 2.3249446576593304, + "gnls_ac50": 30.98745994826971, + "gnls_p_sd": 11.859185725142751, + "gnls_q_sd": 30210.660566019513, + "hill_ac50": 31.00480635661345, + "hill_p_sd": 11.897866553982782, + "poly1_aic": 54.92956695032407, + "poly1_cov": 1, + "poly1_rme": 6.304845114135714, + "poly1_top": 24.008920942363627, + "poly2_aic": 56.27311149656675, + "poly2_cov": 1, + "poly2_rme": 6.561527988769902, + "poly2_top": 24.851306266956673, + "pow_er_sd": 0.38981300436821936, + "exp2_er_sd": 0.3898189614605816, + "exp3_er_sd": 0.39290796815857126, + "exp4_er_sd": 0.34668313066113043, + "exp4_ga_sd": 26.90625013028702, + "exp4_tp_sd": 17.283997953709413, + "exp5_er_sd": 0.39740593076852454, + "exp5_ga_sd": 32.129634015331355, + "exp5_tp_sd": 33.76175010764305, + "gnls_er_sd": 0.39760125645615085, + "gnls_ga_sd": 69.85697532885499, + "gnls_la_sd": 23813357.443562742, + "gnls_tp_sd": 66.51521302449146, + "hill_er_sd": 0.3976143434895321, + "hill_ga_sd": 70.09052961350474, + "hill_tp_sd": 66.73515623997775, + "poly1_a_sd": 0.07512526413723014, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 25.10493170570885, + "poly2_ac50": 31.720545290878295, + "poly2_b_sd": 76.80867364470046, + "poly1_er_sd": 0.3462602829941217, + "poly2_er_sd": 0.39170875683118345, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1380.1223141739165 + }, + "mc5Param": { + "a": 0.4801784188472726, + "er": 1.4547327831413472, + "ac5": 2.5, + "acc": 47.02586933002523, + "bmd": 19.34518778703392, + "bmr": 9.289141683881516, + "mll": -25.464783475162037, + "top": 24.008920942363627, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 15.225799349328566, + "bmdu": 27.980142000769774, + "rmse": 6.304845114135714, + "ac1sd": 14.340391243168211, + "caikwt": 0.017681488290464575, + "hitcall": 0.4839809180427277, + "top_over_cutoff": 1.0632445654348772 + }, + "mc6Param": { + "flag": [ + "Multiple points above baseline, inactive", + "Borderline", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 8, + 11, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842440, + "spid": "TP0000901G12", + "chid": 48511, + "casn": "1062243-51-9", + "chnm": "Ro 3280", + "dtxsid": "DTXSID4048511", + "bmad": 3.7634679299683276, + "respMax": 10.325057625042314, + "respMin": -8.983764245071658, + "maxMean": 10.325057625042314, + "maxMeanConc": -0.22184874961635637, + "maxMed": 10.325057625042314, + "maxMedConc": -0.22184874961635637, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 39, + "m5id": 5037086, + "modl": "poly1", + "hitc": 7.3098271082847474E-6, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 18.600000381469727, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + -1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + 0.6989700043360189, + -1.2218487496163564, + 1.6989700043360187, + 1.3010299956639813 + ], + "resp": [ + 6.480097196924522, + -0.2515554731701046, + 10.325057625042314, + 1.142930253550185, + -7.730923290188433, + 0.2515554731701055, + 3.1098381663147343, + -8.983764245071658 + ] + }, + "mc4Param": { + "pow_a": 9.6342481700584E-7, + "pow_p": 0.4432645042337321, + "exp2_a": 0.000007399967893446319, + "exp2_b": 3.861528561537906, + "exp3_a": 6.923699292827273, + "exp3_b": 56.58306462368016, + "exp3_p": 7.999746381582563, + "exp5_p": 7.998319899204924, + "gnls_p": 7.999999733938488, + "gnls_q": 7.999994914873606, + "hill_p": 7.999985522691064, + "pow_er": 1.6764333208273414, + "cnst_er": 1.6757159315047794, + "exp2_er": 1.6351776912730394, + "exp3_er": 1.6339748313050555, + "exp4_er": 1.6757250594077964, + "exp4_ga": 6.289265154206966, + "exp4_tp": 1.6850922680145134E-10, + "exp5_er": 1.634304344180973, + "exp5_ga": 0.07106828066816326, + "exp5_tp": 1.535161759146987, + "gnls_er": 1.3295228996669055, + "gnls_ga": 0.063224292527447, + "gnls_la": 1.999327678425197, + "gnls_tp": 7.298128558374947, + "hill_er": 1.6340694275967216, + "hill_ga": 57.330818894657035, + "hill_tp": 12.377335603468827, + "poly1_a": 0.009461767869048447, + "poly2_a": 0.000028686825557986437, + "poly2_b": 0.1807498952770959, + "pow_aic": 58.61519395624266, + "pow_cov": 1, + "pow_rme": 6.125537217447439, + "pow_top": 0.000005456459372025317, + "all_bmed": 0, + "cnst_aic": 54.6151883619927, + "cnst_rme": 6.125536842485228, + "exp2_aic": 58.19296056082926, + "exp2_cov": 1, + "exp2_rme": 6.026299220676452, + "exp2_top": 3.1086952065074684, + "exp3_aic": 60.19312750281706, + "exp3_cov": 1, + "exp3_rme": 6.026368174940302, + "exp3_top": 3.1178027036730622, + "exp4_aic": 58.61518836239423, + "exp4_cov": 1, + "exp4_rme": 6.125536842509785, + "exp4_top": 1.6850922680145134E-10, + "exp5_aic": 60.35216613544548, + "exp5_cov": 1, + "exp5_rme": 6.133102241580869, + "exp5_top": 1.535161759146987, + "gnls_aic": 59.638816472495165, + "gnls_cov": 1, + "gnls_rme": 4.6551870260688855, + "gnls_top": 7.298113962072281, + "hill_aic": 60.193622806346006, + "hill_cov": 1, + "hill_rme": 6.026559284171812, + "hill_top": 12.377335603468827, + "poly1_er": 1.671396299010503, + "poly2_er": 1.647533881452146, + "pow_a_sd": null, + "pow_ac50": 10.467658378845464, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 0.000019653592135234332, + "exp2_ac50": 47.323401556905104, + "exp2_b_sd": 0.7800950706885615, + "exp3_a_sd": null, + "exp3_ac50": 46.359485549724944, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 6.289265154206966, + "exp5_ac50": 0.07106828066816326, + "exp5_p_sd": 1263.5073660910928, + "gnls_ac50": 0.06322426071869278, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 57.330818894657035, + "hill_p_sd": null, + "poly1_aic": 56.6071465334128, + "poly1_cov": 1, + "poly1_rme": 6.1384421956539885, + "poly1_top": 0.4730883934524223, + "poly2_aic": 58.411074893876496, + "poly2_cov": 1, + "poly2_rme": 6.104875979378861, + "poly2_top": 2.2030965746019064, + "pow_er_sd": null, + "exp2_er_sd": 0.3255205050681696, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": 0.3352032946991091, + "exp5_ga_sd": 1.911154416144701, + "exp5_tp_sd": 2.910113134475448, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.10408741267075336, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 0.0008879455965969786, + "poly2_ac50": 35.32892649963858, + "poly2_b_sd": 2.826738198600287, + "poly1_er_sd": 0.32131033280129584, + "poly2_er_sd": 0.3251646386415122, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1.9993286780943216 + }, + "mc5Param": { + "a": 0.009461767869048447, + "er": 1.671396299010503, + "ac5": 2.5, + "bmd": 981.755398403756, + "bmr": 9.289141683881516, + "mll": -26.3035732667064, + "top": 0.4730883934524223, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 53.80832634227983, + "rmse": 6.1384421956539885, + "ac1sd": 727.7653064520059, + "caikwt": 0.7302672847993994, + "hitcall": 0.0000073098271082847474, + "top_over_cutoff": 0.020950906728217367 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842441, + "spid": "TP0000902A09", + "chid": 48167, + "casn": "138472-01-2", + "chnm": "FR 409", + "dtxsid": "DTXSID2048167", + "bmad": 3.7634679299683276, + "respMax": 8.45824139096988, + "respMin": -4.715592708196917, + "maxMean": 8.45824139096988, + "maxMeanConc": 0.7781512503836436, + "maxMed": 8.45824139096988, + "maxMedConc": 0.7781512503836436, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 40, + "m5id": 5037087, + "modl": "poly1", + "hitc": 4.349091266397037E-7, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + -0.22184874961635637, + -1.6989700043360187, + 1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813 + ], + "resp": [ + -1.2342590439036523, + 5.370932466583148, + 0.8322209040287843, + 5.089877121352194, + -4.715592708196917, + 8.45824139096988, + -0.8322209040287843, + 1.8604769341122718 + ] + }, + "mc4Param": { + "pow_a": 1.0221806706745422, + "pow_p": 0.39639742374359954, + "exp2_a": 281.84163059484536, + "exp2_b": 2710.1819410276626, + "exp3_a": 3.070336657854594, + "exp3_b": 58.38202827572274, + "exp3_p": 0.3178065838682131, + "exp5_p": 7.999999556088412, + "gnls_p": 7.997950401679715, + "gnls_q": 0.5167742299566985, + "hill_p": 7.999999636255, + "pow_er": 1.0920563687798213, + "cnst_er": 1.3248432907908116, + "exp2_er": 1.070134684601057, + "exp3_er": 1.0900745687259326, + "exp4_er": 1.0812481377946803, + "exp4_ga": 1.7811347250586496, + "exp4_tp": 4.400696875885273, + "exp5_er": 0.9781436965607416, + "exp5_ga": 4.374536235061529, + "exp5_tp": 5.114592012835368, + "gnls_er": 0.9363241065953332, + "gnls_ga": 3.483652859252365, + "gnls_la": 110.16277693301092, + "gnls_tp": 7.783031273259884, + "hill_er": 0.8800553465055232, + "hill_ga": 0.3510818534236002, + "hill_tp": 4.414701379307003, + "poly1_a": 0.10489123022206318, + "poly2_a": 173.98996532557754, + "poly2_b": 1734.46106467781, + "pow_aic": 49.80239750036858, + "pow_cov": 1, + "pow_rme": 3.6268956792336415, + "pow_top": 4.819422456676002, + "all_bmed": 0, + "cnst_aic": 49.12848756125315, + "cnst_rme": 4.40031788290068, + "exp2_aic": 50.12082719543147, + "exp2_cov": 1, + "exp2_rme": 3.8215443365906254, + "exp2_top": 5.247941640101082, + "exp3_aic": 51.822662540403314, + "exp3_cov": 1, + "exp3_rme": 3.640408829394019, + "exp3_top": 4.884063849755363, + "exp4_aic": 49.4849553439781, + "exp4_cov": 1, + "exp4_rme": 3.556633163595015, + "exp4_top": 4.400696875885273, + "exp5_aic": 49.523866255353845, + "exp5_cov": 1, + "exp5_rme": 3.0787945193813617, + "exp5_top": 5.114592012835368, + "gnls_aic": 53.04563717615321, + "gnls_cov": 1, + "gnls_rme": 3.0191908372849388, + "gnls_top": 6.2867229683220325, + "hill_aic": 50.23685799735487, + "hill_cov": 1, + "hill_rme": 3.720806929349788, + "hill_top": 4.414701379307003, + "poly1_er": 1.0697380575582094, + "poly2_er": 1.068876338903681, + "pow_a_sd": 1.94288100342848, + "pow_ac50": 8.700724003011597, + "pow_p_sd": 0.5142804521178921, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 5978.121364138775, + "exp2_ac50": 25.115304276643503, + "exp2_b_sd": 56967.1422829092, + "exp3_a_sd": 34.884204794475934, + "exp3_ac50": 10.816909274054677, + "exp3_b_sd": 1339.2381888478171, + "exp3_p_sd": 0.7494980203805416, + "exp4_ac50": 1.7811347250586496, + "exp5_ac50": 4.374536235061529, + "exp5_p_sd": 17.23262161929217, + "gnls_ac50": 3.4336886835483624, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.3510818534236002, + "hill_p_sd": 11.55230396465234, + "poly1_aic": 48.11858673318644, + "poly1_cov": 1, + "poly1_rme": 3.820595413798474, + "poly1_top": 5.244561511103158, + "poly2_aic": 50.12696585786312, + "poly2_cov": 1, + "poly2_rme": 3.825332733168213, + "poly2_top": 5.160266984567867, + "pow_er_sd": 0.3358088728357998, + "exp2_er_sd": 0.35301842299911645, + "exp3_er_sd": 0.3388919198692416, + "exp4_er_sd": 0.32586774663917945, + "exp4_ga_sd": 2.5289267272649596, + "exp4_tp_sd": 2.0456398887627545, + "exp5_er_sd": 0.3174460886892625, + "exp5_ga_sd": 3.746745018855691, + "exp5_tp_sd": 1.8569699379647628, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.3730906919696318, + "hill_ga_sd": 0.2783296229902509, + "hill_tp_sd": 1.4930457823064731, + "poly1_a_sd": 0.04854843979303387, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 2374.099369826869, + "poly2_ac50": 25.35017708616761, + "poly2_b_sd": 23458.53218916691, + "poly1_er_sd": 0.3529581302897474, + "poly2_er_sd": 0.3530822082323522, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 234.01464386723652 + }, + "mc5Param": { + "a": 0.10489123022206318, + "er": 1.0697380575582094, + "ac5": 2.5, + "bmd": 88.55975532192402, + "bmr": 9.289141683881516, + "mll": -22.05929336659322, + "top": 5.244561511103158, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 47.61937513459634, + "bmdu": 515.5480279689932, + "rmse": 3.820595413798474, + "ac1sd": 65.64844723641512, + "caikwt": 0.37637801032969415, + "hitcall": 4.349091266397037E-7, + "top_over_cutoff": 0.23225748204827024 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842442, + "spid": "TP0000904A04", + "chid": 20932, + "casn": "59-67-6", + "chnm": "Nicotinic acid", + "dtxsid": "DTXSID1020932", + "bmad": 3.7634679299683276, + "respMax": 7.808154220734798, + "respMin": -15.587583552949539, + "maxMean": 7.808154220734798, + "maxMeanConc": -0.6989700043360187, + "maxMed": 7.808154220734798, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 41, + "m5id": 5037088, + "modl": "poly1", + "hitc": 1.2842082484215337E-5, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + -1.6989700043360187, + 1.3010299956639813, + -0.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + 1.6989700043360187, + -1.154901959985743 + ], + "resp": [ + -6.4591483450512746, + 3.0224966031679426, + -15.587583552949539, + 7.808154220734798, + -0.12052294495462057, + -3.3880170099974922, + -12.541681485061535, + -3.0224966031679426 + ] + }, + "mc4Param": { + "pow_a": 5.543622267971873E-7, + "pow_p": 0.364373857362965, + "exp2_a": 5.894362630259528E-7, + "exp2_b": 68.55078029862463, + "exp3_a": 0.0000037615601832033385, + "exp3_b": 69.7561028814606, + "exp3_p": 4.517972377107961, + "exp5_p": 3.4371838689355867, + "gnls_p": 0.30000354623098807, + "gnls_q": 7.948653448964739, + "hill_p": 4.575319604381713, + "pow_er": 1.92339375580289, + "cnst_er": 1.9230667378989736, + "exp2_er": 1.9230442720434788, + "exp3_er": 1.9235351607245372, + "exp4_er": 1.923073891482418, + "exp4_ga": 5.720368939603105, + "exp4_tp": 1.5289441124987554E-10, + "exp5_er": 1.9230858205598875, + "exp5_ga": 3.7080047981398536, + "exp5_tp": 1.358730549491495E-9, + "gnls_er": 1.9069579723705967, + "gnls_ga": 0.03296521485727647, + "gnls_la": 1.0424516568136877, + "gnls_tp": 3.0470136554132834, + "hill_er": 1.923067740437899, + "hill_ga": 144.92218389271736, + "hill_tp": 0.000003918510318302473, + "poly1_a": 2.3821419834720777E-10, + "poly2_a": 0.0000380194771302548, + "poly2_b": 112.44605954378144, + "pow_aic": 62.85990744190046, + "pow_cov": 1, + "pow_rme": 8.160259534186697, + "pow_top": 0.000002305971230116009, + "all_bmed": 0, + "cnst_aic": 58.859904654421854, + "cnst_rme": 8.16025858692367, + "exp2_aic": 62.859904981765446, + "exp2_cov": 1, + "exp2_rme": 8.160258762264611, + "exp2_top": 6.329410925446836E-7, + "exp3_aic": 64.8599070905033, + "exp3_cov": 1, + "exp3_rme": 8.16025876987888, + "exp3_top": 9.357200976922738E-7, + "exp4_aic": 62.85990465443332, + "exp4_cov": 1, + "exp4_rme": 8.160258586995395, + "exp4_top": 1.5289441124987554E-10, + "exp5_aic": 64.85990465768748, + "exp5_cov": 1, + "exp5_rme": 8.160258587645599, + "exp5_top": 1.358730549491495E-9, + "gnls_aic": 68.58354633450392, + "gnls_cov": 1, + "gnls_rme": 8.047045534239281, + "gnls_top": 2.1214791438989553, + "hill_aic": 64.85990466538351, + "hill_cov": 1, + "hill_rme": 8.160258592771067, + "hill_top": 0.000003918510318302473, + "poly1_er": 1.923120606473471, + "poly2_er": 1.923450892386962, + "pow_a_sd": null, + "pow_ac50": 7.461275077538203, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.46105839655378, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 43.40360563362071, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 5.720368939603105, + "exp5_ac50": 3.7080047981398536, + "exp5_p_sd": null, + "gnls_ac50": 0.0040734772355949045, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 144.92218389271736, + "hill_p_sd": null, + "poly1_aic": 60.85990468448603, + "poly1_cov": 1, + "poly1_rme": 8.16025859051074, + "poly1_top": 1.1910709917360389E-8, + "poly2_aic": 62.859918528385, + "poly2_cov": 1, + "poly2_rme": 8.160265420971498, + "poly2_top": 0.00002442287818225344, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 28.760383699947685, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1.0577383522061834 + }, + "mc5Param": { + "a": 2.3821419834720777E-10, + "er": 1.923120606473471, + "ac5": 2.5, + "bmd": 38994911925.2001, + "bmr": 9.289141683881516, + "mll": -28.429952342243016, + "top": 1.1910709917360389E-8, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 93.8246790996463, + "rmse": 8.16025859051074, + "ac1sd": 28906532190.659824, + "caikwt": 0.731058581585493, + "hitcall": 0.000012842082484215337, + "top_over_cutoff": 5.27470502339785E-10 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842403, + "spid": "LEGTV001B10", + "chid": 23900, + "casn": "17804-35-2", + "chnm": "Benomyl", + "dtxsid": "DTXSID5023900", + "bmad": 3.7634679299683276, + "respMax": 25.59444974532059, + "respMin": -1.2102612303412605, + "maxMean": 25.59444974532059, + "maxMeanConc": 0.7781512503836436, + "maxMed": 25.59444974532059, + "maxMedConc": 0.7781512503836436, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 4, + "tmpi": 2, + "m5id": 5037049, + "modl": "exp4", + "hitc": 8.838707536646198E-5, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + 0.3010299956639812, + -0.6989700043360187, + 1.6989700043360187 + ], + "resp": [ + 2.9023483672510224, + -1.2102612303412605, + 25.59444974532059, + 1.2102612303412605, + 13.08335350830972, + 13.91717341460287, + 3.6279354590637736, + 13.918360177919546 + ] + }, + "mc4Param": { + "pow_a": 5.205810100365427, + "pow_p": 0.300000106525784, + "exp2_a": 2468.049539504221, + "exp2_b": 7225.095324245473, + "exp3_a": 81.926086402836, + "exp3_b": 11971.021959945418, + "exp3_p": 0.30000050892105745, + "exp5_p": 1.932308954909185, + "gnls_p": 2.2122108268358556, + "gnls_q": 0.8596878616497325, + "hill_p": 3.867980719774923, + "pow_er": 1.3575665310341234, + "cnst_er": 2.320091490701855, + "exp2_er": 1.904101077761098, + "exp3_er": 1.5530301363053958, + "exp4_er": 0.829982332161024, + "exp4_ga": 0.7837526624913668, + "exp4_tp": 14.691482524381094, + "exp5_er": 0.6597965319495738, + "exp5_ga": 0.9532308456224, + "exp5_tp": 14.297652679638324, + "gnls_er": 0.7867729444839626, + "gnls_ga": 1.7121229667458349, + "gnls_la": 54.1420821270971, + "gnls_tp": 26.63271573330083, + "hill_er": 0.6818282209423071, + "hill_ga": 0.8455244118283385, + "hill_tp": 14.238251015246254, + "poly1_a": 0.3429912490465289, + "poly2_a": 2011.137320298468, + "poly2_b": 6041.169272414498, + "pow_aic": 56.93013758751977, + "pow_cov": 1, + "pow_rme": 6.662842960817711, + "pow_top": 16.833696930224765, + "all_bmed": 0, + "cnst_aic": 65.41421720746133, + "cnst_rme": 12.44072681214264, + "exp2_aic": 64.45225922740426, + "exp2_cov": 1, + "exp2_rme": 10.010167810133272, + "exp2_top": 17.13893736437594, + "exp3_aic": 59.42851423204404, + "exp3_cov": 1, + "exp3_rme": 6.738763578058861, + "exp3_top": 17.471290115830215, + "exp4_aic": 48.68746759593549, + "exp4_cov": 1, + "exp4_rme": 4.18881846478536, + "exp4_top": 14.691482524381094, + "exp5_aic": 49.657707875948965, + "exp5_cov": 1, + "exp5_rme": 4.220695557928282, + "exp5_top": 14.297652679638324, + "gnls_aic": 51.15685979133812, + "gnls_cov": 1, + "gnls_rme": 2.7507444039260966, + "gnls_top": 21.79102332025044, + "hill_aic": 50.061396997873935, + "hill_cov": 1, + "hill_rme": 4.276429269729576, + "hill_top": 14.238251015246254, + "poly1_er": 1.9034889654893083, + "poly2_er": 1.9018795046605577, + "pow_a_sd": 2.0943271829959196, + "pow_ac50": 4.96063235721311, + "pow_p_sd": 0.11002382159571332, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 29513.6753956216, + "exp2_ac50": 25.04325193819569, + "exp2_b_sd": 86084.5411190017, + "exp3_a_sd": 150.0984224223333, + "exp3_ac50": 5.804399305999619, + "exp3_b_sd": 59137.001224216314, + "exp3_p_sd": 0.14658200866607235, + "exp4_ac50": 0.7837526624913668, + "exp5_ac50": 0.9532308456224, + "exp5_p_sd": 1.0630755148028903, + "gnls_ac50": 1.5013800743653127, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.8455244118283385, + "hill_p_sd": 3.878619687420101, + "poly1_aic": 62.445202743928206, + "poly1_cov": 1, + "poly1_rme": 10.006455332888448, + "poly1_top": 17.149562452326442, + "poly2_aic": 64.4652608512803, + "poly2_cov": 1, + "poly2_rme": 10.02747933976459, + "poly2_top": 16.783030687308678, + "pow_er_sd": 0.4080138155151314, + "exp2_er_sd": 0.3680437573619178, + "exp3_er_sd": 0.4222055989380574, + "exp4_er_sd": 0.39592940969417895, + "exp4_ga_sd": 0.31194015228918653, + "exp4_tp_sd": 1.6633876035629098, + "exp5_er_sd": 0.44034681277537735, + "exp5_ga_sd": 0.24033727643017272, + "exp5_tp_sd": 1.384891857432722, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.4472823050404181, + "hill_ga_sd": 0.2970999212415293, + "hill_tp_sd": 1.42857712990458, + "poly1_a_sd": 0.12552318478451832, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 17285.66623585318, + "poly2_ac50": 25.102605828879497, + "poly2_b_sd": 52518.880955116154, + "poly1_er_sd": 0.3680092384332859, + "poly2_er_sd": 0.36881665372257216, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 83.00745848531592 + }, + "mc5Param": { + "er": 0.829982332161024, + "ga": 0.7837526624913668, + "tp": 14.691482524381094, + "ac5": 0.057998152732469395, + "bmd": 1.1312085709028028, + "bmr": 9.289141683881516, + "mll": -21.343733797967744, + "top": 14.691482524381094, + "ac10": 0.11913282919448194, + "ac20": 0.25231200149874355, + "ac50": 0.7837526624913668, + "bmdl": 0.5939237424805409, + "bmdu": 2.1007406685525587, + "rmse": 4.18881846478536, + "ac1sd": 0.7151040430592887, + "caikwt": 0.00023320141532168285, + "hitcall": 0.00008838707536646198, + "top_over_cutoff": 0.6506181177291949 + }, + "mc6Param": { + "flag": [ + "Multiple points above baseline, inactive", + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 8, + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842402, + "spid": "DMSO", + "chid": null, + "casn": null, + "chnm": null, + "dtxsid": null, + "bmad": 3.7634679299683276, + "respMax": 29.154644659004813, + "respMin": -64.01776227967419, + "maxMean": -2.786975848040293, + "maxMeanConc": -2.0, + "maxMed": -1.8549943011561494, + "maxMedConc": -2.0, + "logcMax": -2.0, + "logcMin": -2.0, + "nconc": 1, + "npts": 60, + "nrep": 60.0, + "nmedGtbl": 0, + "tmpi": 1, + "m5id": 5037048, + "modl": "none", + "hitc": 0.0, + "fitc": 2, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": null, + "stkc": null, + "stkcUnit": null, + "testedConcUnit": null, + "mc3Param": { + "logc": [ + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2, + -2 + ], + "resp": [ + -11.154261912892895, + -0.3085213350118397, + -10.769705425508318, + 4.175375587545503, + -10.98141849274888, + -12.376517295353013, + 0, + -64.01776227967419, + 0, + 0, + 7.302396825405491, + -23.726740442131682, + 20.578950616404875, + -2.1637598929705573, + 8.221941787379146, + -3.3615951256467733, + -13.00838695625285, + 0, + -8.147282382442452, + -16.675358684435366, + -7.366722199083715, + -4.547070003657009, + 6.727984535614843, + -14.413034459122256, + -3.3130697596828527, + -4.033069414485719, + -15.264672272410884, + -11.574027922167316, + -1.8116084217961972, + -2.683274758192687, + 13.045441512530893, + 11.771596698177454, + 1.822950768406886, + -6.366163269382269, + 10.919639964829472, + 7.646339314405353, + -5.425526716521953, + -23.59240555574474, + 29.154644659004813, + -1.8983801805161016, + 0, + -13.802724260910109, + 4.979838314070986, + 8.416800860440848, + -0.2717465644121584, + 3.9578867653660548, + -1.1225186138635874, + -21.297944237672343, + 8.682142820122102, + 15.423542211616034, + -8.54044397300711, + 0, + -3.629592160884692, + 5.3958263838470995, + -9.059839600469063, + 17.31012973696578, + -18.631736544948375, + -6.017477029882166, + 9.453622918139667, + -0.8512450188087707 + ] + }, + "mc4Param": { + "pow_a": null, + "pow_p": null, + "exp2_a": null, + "exp2_b": null, + "exp3_a": null, + "exp3_b": null, + "exp3_p": null, + "exp5_p": null, + "gnls_p": null, + "gnls_q": null, + "hill_p": null, + "pow_er": null, + "cnst_er": null, + "exp2_er": null, + "exp3_er": null, + "exp4_er": null, + "exp4_ga": null, + "exp4_tp": null, + "exp5_er": null, + "exp5_ga": null, + "exp5_tp": null, + "gnls_er": null, + "gnls_ga": null, + "gnls_la": null, + "gnls_tp": null, + "hill_er": null, + "hill_ga": null, + "hill_tp": null, + "poly1_a": null, + "poly2_a": null, + "poly2_b": null, + "pow_aic": null, + "pow_cov": null, + "pow_rme": null, + "all_bmed": 0, + "cnst_aic": null, + "cnst_rme": null, + "exp2_aic": null, + "exp2_cov": null, + "exp2_rme": null, + "exp3_aic": null, + "exp3_cov": null, + "exp3_rme": null, + "exp4_aic": null, + "exp4_cov": null, + "exp4_rme": null, + "exp5_aic": null, + "exp5_cov": null, + "exp5_rme": null, + "gnls_aic": null, + "gnls_cov": null, + "gnls_rme": null, + "hill_aic": null, + "hill_cov": null, + "hill_rme": null, + "poly1_er": null, + "poly2_er": null, + "pow_a_sd": null, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp5_p_sd": null, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_p_sd": null, + "poly1_aic": null, + "poly1_cov": null, + "poly1_rme": null, + "poly2_aic": null, + "poly2_cov": null, + "poly2_rme": null, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": null, + "poly2_a_sd": null, + "poly2_b_sd": null, + "poly1_er_sd": null, + "poly2_er_sd": null, + "pow_success": null, + "cnst_success": null, + "exp2_success": null, + "exp3_success": null, + "exp4_success": null, + "exp5_success": null, + "gnls_success": null, + "hill_success": null, + "poly1_success": null, + "poly2_success": null + }, + "mc5Param": { + "bmr": 9.289141683881516, + "hitcall": 0 + }, + "mc6Param": null + }, + { + "aeid": 704, + "m4id": 1842404, + "spid": "LEGTV001C03", + "chid": 22162, + "casn": "1689-84-5", + "chnm": "Bromoxynil", + "dtxsid": "DTXSID3022162", + "bmad": 3.7634679299683276, + "respMax": 17.24432669518075, + "respMin": -16.748848993380015, + "maxMean": 17.24432669518075, + "maxMeanConc": -0.6989700043360187, + "maxMed": 17.24432669518075, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 3, + "m5id": 5037050, + "modl": "poly1", + "hitc": 0.0029920822873240717, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1.6989700043360187, + -1.6989700043360187, + 0.3010299956639812, + 0.7781512503836436, + -1.154901959985743, + 1.3010299956639813, + -0.22184874961635637, + -0.6989700043360187 + ], + "resp": [ + 8.524600212493528, + 9.072860762252425, + -3.8916282997793408, + -10.455090309750185, + -10.227272727272725, + -16.748848993380015, + -3.3236167488489907, + 17.24432669518075 + ] + }, + "mc4Param": { + "pow_a": 1.725949077512417E-7, + "pow_p": 4.5253782558540285, + "exp2_a": 0.00001640418685242636, + "exp2_b": 3.8001515537909256, + "exp3_a": 12.90516865711751, + "exp3_b": 54.422945490831, + "exp3_p": 7.998344245445021, + "exp5_p": 7.999993694423218, + "gnls_p": 0.4241648347027184, + "gnls_q": 7.9998847670280355, + "hill_p": 7.999087698843317, + "pow_er": 2.2542985187481523, + "cnst_er": 2.323734743510376, + "exp2_er": 2.251755277558436, + "exp3_er": 2.253232239765138, + "exp4_er": 2.323771099104438, + "exp4_ga": 11.86923471702094, + "exp4_tp": 7.755465672199024E-8, + "exp5_er": 2.25311336300597, + "exp5_ga": 51.61988856711754, + "exp5_tp": 20.5725635581771, + "gnls_er": 2.232648918042158, + "gnls_ga": 0.011612337436387274, + "gnls_la": 0.3672143632370176, + "gnls_tp": 12.14436282748164, + "hill_er": 2.2521666902515927, + "hill_ga": 52.29053788518011, + "hill_tp": 20.688317160612986, + "poly1_a": 0.059264731838513336, + "poly2_a": 0.00008746164302267517, + "poly2_b": 0.17995434389891726, + "pow_aic": 67.60619394277374, + "pow_cov": 1, + "pow_rme": 10.63489778795089, + "pow_top": 8.423835804546373, + "all_bmed": 0, + "cnst_aic": 64.42755044014181, + "cnst_rme": 11.028222754070327, + "exp2_aic": 67.57203572586648, + "exp2_cov": 1, + "exp2_rme": 10.609032886271716, + "exp2_top": 8.494289345379501, + "exp3_aic": 69.57232094962438, + "exp3_cov": 1, + "exp3_rme": 10.60924696767611, + "exp3_top": 8.535257141972448, + "exp4_aic": 68.42755045762016, + "exp4_cov": 1, + "exp4_rme": 11.028222760170856, + "exp4_top": 7.755465672199024E-8, + "exp5_aic": 69.57309089671247, + "exp5_cov": 1, + "exp5_rme": 10.609830072861923, + "exp5_top": 20.5725635581771, + "gnls_aic": 73.41799184836066, + "gnls_cov": 1, + "gnls_rme": 10.614494151590849, + "gnls_top": 9.287173487099578, + "hill_aic": 69.57365995839154, + "hill_cov": 1, + "hill_rme": 10.610269740695813, + "hill_top": 20.688317160612986, + "poly1_er": 2.308829204544371, + "poly2_er": 2.2585407128453037, + "pow_a_sd": 0.0000018803876981312193, + "pow_ac50": 42.89924007169241, + "pow_p_sd": 0.2615425978878468, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 0.00006528915415492634, + "exp2_ac50": 47.36594300362757, + "exp2_b_sd": 1.1482590548973135, + "exp3_a_sd": null, + "exp3_ac50": 46.53251133220428, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 11.86923471702094, + "exp5_ac50": 51.61988856711754, + "exp5_p_sd": null, + "gnls_ac50": 0.003749285947936685, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 52.29053788518011, + "hill_p_sd": 34.94604828343594, + "poly1_aic": 66.3487573617917, + "poly1_cov": 1, + "poly1_rme": 11.07211531968513, + "poly1_top": 2.9632365919256665, + "poly2_aic": 67.91979710905, + "poly2_cov": 1, + "poly2_rme": 10.858529674694983, + "poly2_top": 6.776309423253431, + "pow_er_sd": 0.3074409916401629, + "exp2_er_sd": 0.3064920897367097, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.3066098414034118, + "hill_ga_sd": 433.0782348506896, + "hill_tp_sd": 798.217144794448, + "poly1_a_sd": 0.2008290041071431, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 0.001526277534281327, + "poly2_ac50": 35.32904249953417, + "poly2_b_sd": 1.5875043868026275, + "poly1_er_sd": 0.3041166431752558, + "poly2_er_sd": 0.3058854737291205, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.3727404712005974 + }, + "mc5Param": { + "a": 0.059264731838513336, + "er": 2.308829204544371, + "ac5": 2.4999999999999996, + "bmd": 156.73979103107902, + "bmr": 9.289141683881516, + "mll": -31.17437868089585, + "top": 2.9632365919256665, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 25.23802000566871, + "rmse": 11.07211531968513, + "ac1sd": 116.18961529360936, + "caikwt": 0.7232426117655388, + "hitcall": 0.0029920822873240717, + "top_over_cutoff": 0.13122810517083394 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842405, + "spid": "LEGTV001C05", + "chid": 20440, + "casn": "120-36-5", + "chnm": "Dichlorprop", + "dtxsid": "DTXSID0020440", + "bmad": 3.7634679299683276, + "respMax": 12.401136092711798, + "respMin": -8.612173606576068, + "maxMean": 12.401136092711798, + "maxMeanConc": -0.22184874961635637, + "maxMed": 12.401136092711798, + "maxMedConc": -0.22184874961635637, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 4, + "m5id": 5037051, + "modl": "exp5", + "hitc": 7.715427065113419E-15, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + 0.3010299956639812, + 1.3010299956639813 + ], + "resp": [ + 10.364772833286688, + 8.905785158234078, + 12.401136092711798, + -0.6942500855179268, + 10.618476018699921, + 0.6942500855179268, + -8.612173606576068, + 6.03652911237573 + ] + }, + "mc4Param": { + "pow_a": 3.121611710249508, + "pow_p": 0.300000440805151, + "exp2_a": 844.7352530391539, + "exp2_b": 4140.505458874806, + "exp3_a": 6.529613004062455, + "exp3_b": 62.365867529043086, + "exp3_p": 0.30000012065047343, + "exp5_p": 7.384612447046498, + "gnls_p": 7.998079908874962, + "gnls_q": 0.3000000007152951, + "hill_p": 7.999999550286872, + "pow_er": 1.7128917398097694, + "cnst_er": 2.064484274768512, + "exp2_er": 1.854098740521344, + "exp3_er": 1.7364617533808766, + "exp4_er": 1.3051553103733522, + "exp4_ga": 0.09070126641098608, + "exp4_tp": 8.97564962535527, + "exp5_er": 0.9338117444364008, + "exp5_ga": 0.09437221560468234, + "exp5_tp": 9.445184350204824, + "gnls_er": 0.5389629722138889, + "gnls_ga": 0.1650117092406103, + "gnls_la": 59.04702616089972, + "gnls_tp": 14.881363229750573, + "hill_er": 0.9350004825335526, + "hill_ga": 0.09546411869143644, + "hill_tp": 9.449887679873935, + "poly1_a": 0.20536815823136903, + "poly2_a": 687.7206271707939, + "poly2_b": 3402.532885448278, + "pow_aic": 59.62983960478393, + "pow_cov": 1, + "pow_rme": 6.671243317314767, + "pow_top": 10.094170392107534, + "all_bmed": 0, + "cnst_aic": 60.19666751493744, + "cnst_rme": 8.402789111634103, + "exp2_aic": 61.531032617462245, + "exp2_cov": 1, + "exp2_rme": 7.3615053364472125, + "exp2_top": 10.262711761047347, + "exp3_aic": 62.09365177604067, + "exp3_cov": 1, + "exp3_rme": 6.794901875497607, + "exp3_top": 10.116872077829878, + "exp4_aic": 56.12885991920658, + "exp4_cov": 1, + "exp4_rme": 6.681915704324382, + "exp4_top": 8.97564962535527, + "exp5_aic": 55.557492165112755, + "exp5_cov": 1, + "exp5_rme": 6.608895943346805, + "exp5_top": 9.445184350204824, + "gnls_aic": 57.520569181463856, + "gnls_cov": 1, + "gnls_rme": 6.998426262818015, + "gnls_top": 12.249786804248052, + "hill_aic": 55.56652951607745, + "hill_cov": 1, + "hill_rme": 6.610861943383319, + "hill_top": 9.449887679873935, + "poly1_er": 1.853314780351189, + "poly2_er": 1.8543795698394705, + "pow_a_sd": null, + "pow_ac50": 4.960645128343272, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": 14008.70342854903, + "exp2_ac50": 25.075473418488187, + "exp2_b_sd": 68253.83508399563, + "exp3_a_sd": null, + "exp3_ac50": 9.780888763356495, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.09070126641098608, + "exp5_ac50": 0.09437221560468234, + "exp5_p_sd": 269.96048261662713, + "gnls_ac50": 0.1635254438108516, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 0.09546411869143644, + "hill_p_sd": 14.519583400029104, + "poly1_aic": 59.527349525667354, + "poly1_cov": 1, + "poly1_rme": 7.360105587021132, + "poly1_top": 10.26840791156845, + "poly2_aic": 61.53621082274063, + "poly2_cov": 1, + "poly2_rme": 7.363476010280246, + "poly2_top": 10.254517159159812, + "pow_er_sd": null, + "exp2_er_sd": 0.31997257287398145, + "exp3_er_sd": null, + "exp4_er_sd": 0.370650678068716, + "exp4_ga_sd": 0.06239224387281597, + "exp4_tp_sd": 1.9164242059007173, + "exp5_er_sd": 0.431497487479637, + "exp5_ga_sd": 1.032106503926616, + "exp5_tp_sd": 1.3000343253660858, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.43172822082146006, + "hill_ga_sd": 0.05953029354685805, + "hill_tp_sd": 1.3057088570476094, + "poly1_a_sd": 0.10793537826384712, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 7498.910083446686, + "poly2_ac50": 25.181017025347085, + "poly2_b_sd": 36576.65297284068, + "poly1_er_sd": 0.31993419285597785, + "poly2_er_sd": 0.3199628347203704, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 194.37172917375648 + }, + "mc5Param": { + "p": 7.384612447046498, + "er": 0.9338117444364008, + "ga": 0.09437221560468234, + "tp": 9.445184350204824, + "ac5": 0.06633147903190056, + "bmd": 0.12006740302572848, + "bmr": 9.289141683881516, + "mll": -23.778746082556378, + "top": 9.445184350204824, + "ac10": 0.07312288030740835, + "ac20": 0.0809443375202312, + "ac50": 0.09437221560468234, + "bmdl": 0.08803437994217998, + "bmdu": 0.24201185048064888, + "rmse": 6.608895943346805, + "ac1sd": 0.10282304939527366, + "caikwt": 0.08951365853820019, + "hitcall": 7.715427065113419E-15, + "top_over_cutoff": 0.41828372686944937 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842406, + "spid": "LEGTV002C04", + "chid": 20442, + "casn": "94-75-7", + "chnm": "2,4-Dichlorophenoxyacetic acid", + "dtxsid": "DTXSID0020442", + "bmad": 3.7634679299683276, + "respMax": 6.370859881086669, + "respMin": -24.72241823635355, + "maxMean": 6.370859881086669, + "maxMeanConc": -1.6989700043360187, + "maxMed": 6.370859881086669, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 5, + "m5id": 5037052, + "modl": "poly1", + "hitc": 0.002042012002651702, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + 1.6989700043360187, + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436, + -1.154901959985743, + -0.22184874961635637, + 1.3010299956639813 + ], + "resp": [ + -21.311944042400853, + -24.72241823635355, + 4.233132626308943, + 6.370859881086669, + -2.027415652400837, + -6.370859881086669, + -24.42384722229375, + 4.914918420921617 + ] + }, + "mc4Param": { + "pow_a": 3.3072505400423485E-7, + "pow_p": 0.48940737393325506, + "exp2_a": 0.0001178398873513196, + "exp2_b": 63.34951489094878, + "exp3_a": 0.0001841064325533645, + "exp3_b": 55.65163739945494, + "exp3_p": 6.824418075268488, + "exp5_p": 7.707370645935452, + "gnls_p": 7.997415906240865, + "gnls_q": 7.989198554360788, + "hill_p": 2.571992160004071, + "pow_er": 2.5239488469935676, + "cnst_er": 2.5242223192710633, + "exp2_er": 2.525053668986501, + "exp3_er": 2.523884767735848, + "exp4_er": 2.5241938891100872, + "exp4_ga": 1.6515772735986691, + "exp4_tp": 6.617210716178248E-9, + "exp5_er": 2.524199907336932, + "exp5_ga": 10.178571517103231, + "exp5_tp": 5.172831559020237E-10, + "gnls_er": 2.5242279860451324, + "gnls_ga": 0.004183840961600125, + "gnls_la": 0.4674883095224845, + "gnls_tp": 1.1951706709070964E-9, + "hill_er": 2.524223618395549, + "hill_ga": 148.03344804359023, + "hill_tp": 2.733414071151221E-7, + "poly1_a": 3.75351162131322E-10, + "poly2_a": 0.00002346265382550711, + "poly2_b": 59.967965785150426, + "pow_aic": 72.58967090276546, + "pow_cov": 1, + "pow_rme": 14.955280470099757, + "pow_top": 0.0000022436522447587723, + "all_bmed": 0, + "cnst_aic": 68.58966978130083, + "cnst_rme": 14.955279986723223, + "exp2_aic": 72.58970163671296, + "exp2_cov": 1, + "exp2_rme": 14.95530781824828, + "exp2_top": 0.00014161915125562188, + "exp3_aic": 74.5896936496435, + "exp3_cov": 1, + "exp3_rme": 14.955303510350245, + "exp3_top": 0.00011387453660103208, + "exp4_aic": 72.58966979064168, + "exp4_cov": 1, + "exp4_rme": 14.955279988191776, + "exp4_top": 6.617210716178248E-9, + "exp5_aic": 74.58966978654288, + "exp5_cov": 1, + "exp5_rme": 14.955279986808964, + "exp5_top": 5.172831559020237E-10, + "gnls_aic": 78.58966978173339, + "gnls_cov": 0, + "gnls_rme": 14.955279986965122, + "gnls_top": 1.1951706553283066E-9, + "hill_aic": 74.58966978433192, + "hill_cov": 1, + "hill_rme": 14.955279989922763, + "hill_top": 2.733414071151221E-7, + "poly1_er": 2.524225595579482, + "poly2_er": 2.5192954625514083, + "pow_a_sd": null, + "pow_ac50": 12.13051274192964, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.809987412922897, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.922737651566834, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 1.6515772735986691, + "exp5_ac50": 10.178571517103231, + "exp5_p_sd": null, + "gnls_ac50": 0.004183841731103657, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 148.03344804359023, + "hill_p_sd": null, + "poly1_aic": 70.58966978459904, + "poly1_cov": 1, + "poly1_rme": 14.955279990364838, + "poly1_top": 1.8767558106566096E-8, + "poly2_aic": 72.58990187798537, + "poly2_cov": 1, + "poly2_rme": 14.95528704942522, + "poly2_top": 0.00003587357796415024, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.7543725426808853, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.416665901382313, + "poly2_b_sd": null, + "poly1_er_sd": 0.4477482735353781, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.46748831104898736 + }, + "mc5Param": { + "a": 3.75351162131322E-10, + "er": 2.524225595579482, + "ac5": 2.4999999999999996, + "bmd": 24747869784.486176, + "bmr": 9.289141683881516, + "mll": -33.29483489229952, + "top": 1.8767558106566096E-8, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 32.07314681587885, + "rmse": 14.955279990364838, + "ac1sd": 18345344540.019405, + "caikwt": 0.7310585789542388, + "hitcall": 0.002042012002651702, + "top_over_cutoff": 8.311287379883885E-10 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842407, + "spid": "LEGTV002C05", + "chid": 24159, + "casn": "82558-50-7", + "chnm": "Isoxaben", + "dtxsid": "DTXSID8024159", + "bmad": 3.7634679299683276, + "respMax": 5.49720635915255, + "respMin": -42.51947478602658, + "maxMean": 5.49720635915255, + "maxMeanConc": -1.6989700043360187, + "maxMed": 5.49720635915255, + "maxMedConc": -1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 6, + "m5id": 5037053, + "modl": "poly1", + "hitc": 0.005642489777948826, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + -1.6989700043360187, + 0.7781512503836436, + 0.3010299956639812, + -1.154901959985743, + 1.3010299956639813 + ], + "resp": [ + -25.365997806861397, + -17.548550487285034, + -34.678529552780105, + 5.49720635915255, + -33.60688227782604, + -42.51947478602658, + -5.497206359152553, + -17.438893556824596 + ] + }, + "mc4Param": { + "pow_a": 6.226170694933507E-8, + "pow_p": 0.4042163870931334, + "exp2_a": 0.0001012762858506541, + "exp2_b": 57.270518532764584, + "exp3_a": 0.0000182768161808948, + "exp3_b": 54.022410694191784, + "exp3_p": 6.142965107596046, + "exp5_p": 2.8793235821658465, + "gnls_p": 3.493285104003668, + "gnls_q": 7.031846474264492, + "hill_p": 1.0379684048996836, + "pow_er": 3.173306223014833, + "cnst_er": 3.173629962494881, + "exp2_er": 3.1736428876942693, + "exp3_er": 3.1731540297554797, + "exp4_er": 3.173621981878118, + "exp4_ga": 3.8258649261720423, + "exp4_tp": 3.8520423020123184E-9, + "exp5_er": 3.1736383043942484, + "exp5_ga": 2.271771952781368, + "exp5_tp": 5.262533058108749E-11, + "gnls_er": 3.1736202534985587, + "gnls_ga": 0.005952471727474193, + "gnls_la": 0.18861860617718257, + "gnls_tp": 1.6686711949450346E-7, + "hill_er": 3.17364751679775, + "hill_ga": 20.040557914497292, + "hill_tp": 1.1614522693913956E-8, + "poly1_a": 3.659932631449042E-9, + "poly2_a": 0.000013026598523821235, + "poly2_b": 57.387744641763376, + "pow_aic": 82.14157800030708, + "pow_cov": 1, + "pow_rme": 26.114813220190868, + "pow_top": 3.0267220450413394E-7, + "all_bmed": 0, + "cnst_aic": 78.14157681500255, + "cnst_rme": 26.114813127316296, + "exp2_aic": 82.14159084553305, + "exp2_cov": 1, + "exp2_rme": 26.114831275368346, + "exp2_top": 0.00014119949389863312, + "exp3_aic": 84.14158033084956, + "exp3_cov": 1, + "exp3_rme": 26.1148144541783, + "exp3_top": 0.000015755848523068117, + "exp4_aic": 82.14157681587226, + "exp4_cov": 1, + "exp4_rme": 26.11481312868518, + "exp4_top": 3.8520423020123184E-9, + "exp5_aic": 84.14157681658645, + "exp5_cov": 1, + "exp5_rme": 26.114813127337793, + "exp5_top": 5.262533058108749E-11, + "gnls_aic": 88.14157682092178, + "gnls_cov": 1, + "gnls_rme": 26.11481313545457, + "gnls_top": 1.6676819541873118E-7, + "hill_aic": 84.14157682143528, + "hill_cov": 1, + "hill_rme": 26.114813129178945, + "hill_top": 1.1614522693913956E-8, + "poly1_er": 3.1736110292974504, + "poly2_er": 3.177870228427013, + "pow_a_sd": null, + "pow_ac50": 9.000054430731787, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 30.29159091667016, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.711967424362975, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 3.8258649261720423, + "exp5_ac50": 2.271771952781368, + "exp5_p_sd": null, + "gnls_ac50": 0.0059504517433272355, + "gnls_p_sd": 224765.9170368504, + "gnls_q_sd": 180670.09083156497, + "hill_ac50": 20.040557914497292, + "hill_p_sd": null, + "poly1_aic": 80.14157683765278, + "poly1_cov": 1, + "poly1_rme": 26.114813154277936, + "poly1_top": 1.829966315724521E-7, + "poly2_aic": 82.14177676316693, + "poly2_cov": 1, + "poly2_rme": 26.11481578856423, + "poly2_top": 0.000021238186978110477, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": 0.3015548243048596, + "gnls_ga_sd": 485.41916773439993, + "gnls_la_sd": 289.43404331885483, + "gnls_tp_sd": 0.003781427130691287, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.6673078948731034, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.534768764417112, + "poly2_b_sd": null, + "poly1_er_sd": 0.4166433568135868, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.188650105801014 + }, + "mc5Param": { + "a": 3.659932631449042E-9, + "er": 3.1736110292974504, + "ac5": 2.5, + "bmd": 2538063570.9143515, + "bmr": 9.289141683881516, + "mll": -38.07078841882639, + "top": 1.829966315724521E-7, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 23.5430889035458, + "rmse": 26.114813154277936, + "ac1sd": 1881440749.3805425, + "caikwt": 0.7310585808566573, + "hitcall": 0.005642489777948826, + "top_over_cutoff": 8.104078249888357E-9 + }, + "mc6Param": { + "flag": [ + "Model directionality questionable", + "Bmd > ac50, indication of high baseline variability", + "Noisy data", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 5, + 9, + 10, + 13 + ] + } + } +] diff --git a/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/DTXSID30944145.json b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/DTXSID30944145.json new file mode 100644 index 00000000..4ddd3f32 --- /dev/null +++ b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-dtxsid/DTXSID30944145.json @@ -0,0 +1,1064 @@ +[ + { + "aeid": 3094, + "m4id": 822141, + "spid": "ES211_47_47", + "chid": 944145, + "casn": "21535-47-7", + "chnm": "Mianserin hydrochloride", + "dtxsid": "DTXSID30944145", + "bmad": 6.75211217879369, + "respMax": 101.97489068160048, + "respMin": -5.852474808193342, + "maxMean": 101.28943947387002, + "maxMeanConc": 2.3010299956639813, + "maxMed": 101.164780328344, + "maxMedConc": 2.3010299956639813, + "logcMax": 2.3010299956639813, + "logcMin": -6.0, + "nconc": 9, + "npts": 36, + "nrep": 4.0, + "nmedGtbl": 3, + "tmpi": 42, + "m5id": 7598924, + "modl": "exp5", + "hitc": 0.9999999999966847, + "fitc": 42, + "coff": 20.25633653638107, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 100.0, + "stkcUnit": null, + "testedConcUnit": null, + "mc3Param": { + "logc": [ + -0.3010299956639812, + -3, + 2.3010299956639813, + 1.9030899869919435, + 0.6989700043360189, + 0.6989700043360189, + -1.3010299956639813, + -6, + 2.3010299956639813, + 1.4771212547196624, + 1, + 1.4771212547196624, + 1, + -1.3010299956639813, + -0.3010299956639812, + -3, + -6, + 1.9030899869919435, + 1.9030899869919435, + 1, + 1.4771212547196624, + -0.3010299956639812, + 0.6989700043360189, + -1.3010299956639813, + -3, + 2.3010299956639813, + 1.4771212547196624, + 1.9030899869919435, + 0.6989700043360189, + -0.3010299956639812, + -1.3010299956639813, + -6, + 2.3010299956639813, + -6, + 1, + -3 + ], + "resp": [ + 7.427232859032931, + -3.750051787305786, + 101.07307228396438, + 98.9002717861462, + 17.02699226830727, + 17.699805850864504, + 2.9964941201219695, + -2.3418378029464026, + 100.8533065571916, + 58.64570278003023, + 5.964872358375655, + 49.11565073337273, + 14.83512968293488, + -3.9755251250928403, + 8.861038251024265, + -2.503018132836884, + 10.01979188930157, + 99.31356213766618, + 101.39305781992614, + 19.77117858122105, + 52.084973469960936, + 6.965386514618434, + 12.337528884815498, + -5.852474808193342, + 2.4837211637883, + 101.25648837272361, + 45.27350419250797, + 101.25648837272361, + 10.373412937556623, + 8.43972728547434, + -3.9875658920796426, + 1.7693315847934825, + 101.97489068160048, + 14.296296110011324, + 6.899162035880055, + -0.9777667971902465 + ] + }, + "mc4Param": { + "pow_a": 8.980263423505296, + "pow_p": 0.4658605032164628, + "exp2_a": 20906.920443662984, + "exp2_b": 38271.293496514474, + "exp3_a": 1485.9514343897358, + "exp3_b": 65459.19750014387, + "exp3_p": 0.46157030104511454, + "exp5_p": 1.4598137263404865, + "gnls_p": 2.0882292940940737, + "gnls_q": 7.993467618938603, + "hill_p": 2.08823290079987, + "pow_er": 2.153005726183071, + "cnst_er": 3.5592259949766554, + "exp2_er": 2.6995029704246463, + "exp3_er": 2.1600743867360332, + "exp4_er": 1.7944788900032378, + "exp4_ga": 28.42183560284198, + "exp4_tp": 105.35849603526988, + "exp5_er": 1.6323860710514544, + "exp5_ga": 29.136304634949504, + "exp5_tp": 102.86194850536708, + "gnls_er": 1.7852653451471712, + "gnls_ga": 29.224488415897408, + "gnls_la": 3787.921673603752, + "gnls_tp": 106.40480941826632, + "hill_er": 1.785256872105232, + "hill_ga": 29.22430650665218, + "hill_tp": 106.40450294071316, + "poly1_a": 0.5474828009413533, + "poly2_a": 27146.761600523227, + "poly2_b": 49818.73895889866, + "pow_aic": 286.2961627225351, + "pow_cov": 1, + "pow_rme": 12.749288084437351, + "pow_top": 105.98589412140464, + "all_bmed": 0, + "cnst_aic": 384.3251737754444, + "cnst_rme": 51.114626158662446, + "exp2_aic": 328.2752622937805, + "exp2_cov": 1, + "exp2_rme": 23.28731820786984, + "exp2_top": 109.54238551681884, + "exp3_aic": 288.7695452039763, + "exp3_cov": 1, + "exp3_rme": 12.853976257861472, + "exp3_top": 106.23398734408596, + "exp4_aic": 252.15096836877743, + "exp4_cov": 1, + "exp4_rme": 7.153206032224669, + "exp4_top": 105.35849603526988, + "exp5_aic": 242.37818996364612, + "exp5_cov": 1, + "exp5_rme": 6.04671272377595, + "exp5_top": 102.86194850536708, + "gnls_aic": 256.43287140229086, + "gnls_cov": 1, + "gnls_rme": 6.883032818734613, + "gnls_top": 106.3485222050823, + "hill_aic": 252.43287141156785, + "hill_cov": 1, + "hill_rme": 6.883035058943881, + "hill_top": 106.40450294071316, + "poly1_er": 2.698231249887153, + "poly2_er": 2.69823328798644, + "pow_a_sd": 1.6459870762064353, + "pow_ac50": 45.16993304352483, + "pow_p_sd": 0.0359070833296379, + "all_onesd": 13.177463361669563, + "exp2_a_sd": 80054.91579295504, + "exp2_ac50": 100.13064607578782, + "exp2_b_sd": 146042.59634222218, + "exp3_a_sd": 1557.2108093448396, + "exp3_ac50": 46.23219211065147, + "exp3_b_sd": 126993.03927633302, + "exp3_p_sd": 0.04175006048618471, + "exp4_ac50": 28.42183560284198, + "exp5_ac50": 29.136304634949504, + "exp5_p_sd": 0.16077431744640758, + "gnls_ac50": 29.209685841672393, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 29.22430650665218, + "hill_p_sd": 0.3854703745468205, + "poly1_aic": 326.2063457159531, + "poly1_cov": 1, + "poly1_rme": 23.266335897780746, + "poly1_top": 109.49656018827066, + "poly2_aic": 328.3117909623189, + "poly2_cov": 1, + "poly2_rme": 23.312627580644826, + "poly2_top": 109.41964530134416, + "pow_er_sd": 0.17588811957512163, + "exp2_er_sd": 0.18414085537434977, + "exp3_er_sd": 0.17616560477044965, + "exp4_er_sd": 0.14951537674258722, + "exp4_ga_sd": 2.504500211345132, + "exp4_tp_sd": 3.090966159056836, + "exp5_er_sd": 0.1494114951654834, + "exp5_ga_sd": 1.6840648875294664, + "exp5_tp_sd": 2.1361083422870157, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.14832567590990886, + "hill_ga_sd": 1.96787729051603, + "hill_tp_sd": 3.504225659847863, + "poly1_a_sd": 0.039187291314295165, + "poly1_ac50": 100, + "poly2_a_sd": 84355.29653483114, + "poly2_ac50": 100.1999242731534, + "poly2_b_sd": 154185.56825938867, + "poly1_er_sd": 0.1840572310279764, + "poly2_er_sd": 0.18411448898547148, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 3788.3863573521858 + }, + "mc5Param": { + "p": 1.4598137263404865, + "er": 1.6323860710514544, + "ga": 29.136304634949504, + "tp": 102.86194850536708, + "ac5": 4.895974620693649, + "acc": 13.246002431318528, + "bmd": 11.994507756086188, + "bmr": 17.776398074892242, + "mll": -117.18909498182306, + "top": 102.86194850536708, + "ac10": 8.01655754617927, + "ac20": 13.404172123946616, + "ac50": 29.136304634949504, + "bmdl": 11.03986268985668, + "bmdu": 12.963072648031766, + "rmse": 6.04671272377595, + "ac1sd": 9.600739034050022, + "caikwt": 1.5017723494623147E-31, + "hitcall": 0.9999999999966848, + "top_over_cutoff": 5.078013406847952 + }, + "mc6Param": null + }, + { + "aeid": 3098, + "m4id": 822345, + "spid": "ES211_47_47", + "chid": 944145, + "casn": "21535-47-7", + "chnm": "Mianserin hydrochloride", + "dtxsid": "DTXSID30944145", + "bmad": 6.292361272058492, + "respMax": 98.60944617597698, + "respMin": -15.487892591704627, + "maxMean": 97.61114262807376, + "maxMeanConc": 2.3010299956639813, + "maxMed": 97.67386193907646, + "maxMedConc": 2.3010299956639813, + "logcMax": 2.3010299956639813, + "logcMin": -6.0, + "nconc": 9, + "npts": 36, + "nrep": 4.0, + "nmedGtbl": 3, + "tmpi": 42, + "m5id": 7599128, + "modl": "exp5", + "hitc": 0.9999999999589282, + "fitc": 42, + "coff": 18.877083816175475, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 100.0, + "stkcUnit": null, + "testedConcUnit": null, + "mc3Param": { + "logc": [ + -6, + 1.4771212547196624, + -1.3010299956639813, + -3, + 1.9030899869919435, + 1.9030899869919435, + 1.4771212547196624, + -0.3010299956639812, + 0.6989700043360189, + -1.3010299956639813, + -3, + 2.3010299956639813, + 1.4771212547196624, + 0.6989700043360189, + -0.3010299956639812, + -1.3010299956639813, + -6, + 2.3010299956639813, + 1, + -3, + 0.6989700043360189, + 1.4771212547196624, + -0.3010299956639812, + -3, + 2.3010299956639813, + 1.9030899869919435, + 1, + 0.6989700043360189, + -1.3010299956639813, + 2.3010299956639813, + 1.9030899869919435, + 1, + 1, + -0.3010299956639812, + -6, + -6 + ], + "resp": [ + -15.487892591704627, + 40.445936226324626, + -3.308559098537521, + 2.4871891013623295, + 95.05061867266592, + 94.2402094469292, + 41.223955492527544, + 13.285839270091238, + 12.403185338714955, + 5.966930265995686, + 3.2590462497004555, + 97.74742391564821, + 37.58280214973128, + 13.203930026359934, + 1.8653867132104287, + 7.428820770153813, + -0.5751258087706687, + 96.48740045816517, + 10.046907385185994, + 6.577942620268354, + 0.2397506593143131, + 45.626647495806374, + 10.740829537281229, + 3.4763845600575403, + 98.60944617597698, + 96.61951570366818, + 36.849676336609924, + 25.084364454443193, + 14.135733033370828, + 97.60029996250469, + 94.17685118619698, + 5.586801649793776, + 16.462976276060388, + 6.709801102324467, + -0.6374203224596925, + 4.330751609032399 + ] + }, + "mc4Param": { + "pow_a": 8.718852311483452, + "pow_p": 0.4621192452087188, + "exp2_a": 30733.63862806683, + "exp2_b": 58053.22582237376, + "exp3_a": 95.1637174921906, + "exp3_b": 487.2146854984712, + "exp3_p": 0.36448949067095376, + "exp5_p": 1.5921607117432042, + "gnls_p": 2.5006151066661264, + "gnls_q": 7.884701749657575, + "hill_p": 2.5005615803454724, + "pow_er": 2.1386687105738353, + "cnst_er": 3.5130386164195015, + "exp2_er": 2.6970289699940606, + "exp3_er": 2.2185744921064368, + "exp4_er": 2.011051198182322, + "exp4_ga": 32.650308081937, + "exp4_tp": 102.35617680593612, + "exp5_er": 1.7482328153387492, + "exp5_ga": 33.60823929102817, + "exp5_tp": 99.05623958289912, + "gnls_er": 1.8712349808607216, + "gnls_ga": 33.56038699307263, + "gnls_la": 5782.338770572877, + "gnls_tp": 101.44815858342024, + "hill_er": 1.8712200758466104, + "hill_ga": 33.56045811387879, + "hill_tp": 101.4484696652948, + "poly1_a": 0.5305416047533859, + "poly2_a": 27673.0817955942, + "poly2_b": 52368.24882950644, + "pow_aic": 284.11914879686157, + "pow_cov": 1, + "pow_rme": 12.167746147199564, + "pow_top": 100.8810435335372, + "all_bmed": 0, + "cnst_aic": 380.5440532323087, + "cnst_rme": 48.52148017787647, + "exp2_aic": 324.77731273488877, + "exp2_cov": 1, + "exp2_rme": 21.596356868481895, + "exp2_top": 106.06349428140288, + "exp3_aic": 288.16578474486806, + "exp3_cov": 1, + "exp3_rme": 12.654705150741076, + "exp3_top": 100.90413703157488, + "exp4_aic": 266.6070682545724, + "exp4_cov": 1, + "exp4_rme": 8.542515933428906, + "exp4_top": 102.35617680593612, + "exp5_aic": 257.6591381302885, + "exp5_cov": 1, + "exp5_rme": 8.397684028922718, + "exp5_top": 99.05623958289912, + "gnls_aic": 269.9181398445775, + "gnls_cov": 1, + "gnls_rme": 9.43263682314636, + "gnls_top": 101.43815067391468, + "hill_aic": 265.9181398398791, + "hill_cov": 1, + "hill_rme": 9.432603290521724, + "hill_top": 101.4484696652948, + "poly1_er": 2.6974150875559637, + "poly2_er": 2.6974910028623347, + "pow_a_sd": 1.6532680814195877, + "pow_ac50": 44.62909211616844, + "pow_p_sd": 0.037632545643377605, + "all_onesd": 13.014601637003002, + "exp2_a_sd": 144770.52933512983, + "exp2_ac50": 100.08612781558456, + "exp2_b_sd": 273004.74414100195, + "exp3_a_sd": 144.74203282152968, + "exp3_ac50": 46.69029054309706, + "exp3_b_sd": 1335.7880545481178, + "exp3_p_sd": 0.09938750851619732, + "exp4_ac50": 32.650308081937, + "exp5_ac50": 33.60823929102817, + "exp5_p_sd": 0.1861700465060868, + "gnls_ac50": 33.55773915040644, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 33.56045811387879, + "hill_p_sd": 0.6962069108870773, + "poly1_aic": 322.7320181754561, + "poly1_cov": 1, + "poly1_rme": 21.576688972834244, + "poly1_top": 106.10832095067718, + "poly2_aic": 324.83200434183965, + "poly2_cov": 1, + "poly2_rme": 21.612975364548863, + "poly2_top": 106.09011722019908, + "pow_er_sd": 0.17201036124649297, + "exp2_er_sd": 0.1724789031231027, + "exp3_er_sd": 0.1778243849070398, + "exp4_er_sd": 0.14816738537311727, + "exp4_ga_sd": 3.8800102860948154, + "exp4_tp_sd": 3.881300977472912, + "exp5_er_sd": 0.16675857577462103, + "exp5_ga_sd": 1.909160862868152, + "exp5_tp_sd": 2.442228657418365, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.16807331852131832, + "hill_ga_sd": 1.9630919114427805, + "hill_tp_sd": 4.0603354568457, + "poly1_a_sd": 0.03909925746514938, + "poly1_ac50": 100, + "poly2_a_sd": 88278.60946926908, + "poly2_ac50": 100.190228208773, + "poly2_b_sd": 166328.9016942867, + "poly1_er_sd": 0.17246325393606268, + "poly2_er_sd": 0.1725193110812217, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 5782.479713707603 + }, + "mc5Param": { + "p": 1.5921607117432042, + "er": 1.7482328153387492, + "ga": 33.60823929102817, + "tp": 99.05623958289912, + "ac5": 6.549950475444407, + "acc": 15.942801656366925, + "bmd": 15.15768602592679, + "bmr": 17.556697608317048, + "mll": -124.82956906514426, + "top": 99.05623958289912, + "ac10": 10.294039781041006, + "ac20": 16.492264340792413, + "ac50": 33.60823929102817, + "bmdl": 13.9632920083894, + "bmdu": 16.36542533906654, + "rmse": 8.397684028922718, + "ac1sd": 12.353374802821008, + "caikwt": 2.0695681448366308E-27, + "hitcall": 0.9999999999589282, + "top_over_cutoff": 5.24743337199252 + }, + "mc6Param": null + }, + { + "aeid": 3095, + "m4id": 1150437, + "spid": "ES211_47_47", + "chid": 944145, + "casn": "21535-47-7", + "chnm": "Mianserin hydrochloride", + "dtxsid": "DTXSID30944145", + "bmad": 0.1635842394403502, + "respMax": 11.45832139758188, + "respMin": 0.04981319925745456, + "maxMean": 4.937025241580714, + "maxMeanConc": 1.9030899869919435, + "maxMed": 5.454860652403362, + "maxMedConc": 1.9030899869919435, + "logcMax": 2.3010299956639813, + "logcMin": -6.0, + "nconc": 9, + "npts": 36, + "nrep": 4.0, + "nmedGtbl": 2, + "tmpi": 42, + "m5id": 7598992, + "modl": "exp5", + "hitc": 0.9999998831449819, + "fitc": 42, + "coff": 0.4907527183210506, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 100.0, + "stkcUnit": null, + "testedConcUnit": null, + "mc3Param": { + "logc": [ + -0.3010299956639812, + -1.3010299956639813, + 2.3010299956639813, + 0.6989700043360189, + -0.3010299956639812, + -6, + 2.3010299956639813, + 1, + -3, + 0.6989700043360189, + 1.4771212547196624, + -0.3010299956639812, + -3, + 2.3010299956639813, + 1.9030899869919435, + 1, + 0.6989700043360189, + -1.3010299956639813, + -6, + 2.3010299956639813, + 1.4771212547196624, + 1.9030899869919435, + 1, + 1, + -1.3010299956639813, + -0.3010299956639812, + -3, + -6, + 1.9030899869919435, + -6, + 1.9030899869919435, + 1.4771212547196624, + 0.6989700043360189, + -3, + 1.4771212547196624, + -1.3010299956639813 + ], + "resp": [ + 0.2882675039415536, + 0.2293577923201378, + 2.12765731100286, + 0.2760905500803271, + 0.2223210266269225, + 0.2859185064112817, + 3.726705759810087, + 0.169779282809137, + 0.2335357255129443, + 0.3364575742259655, + 0.2644336595666082, + 1.101262393197357, + 0.4222553297999173, + 1.724134958388003, + 6.3829741964722, + 0.1518602827691616, + 0.500500483800451, + 0.4657932906610395, + 0.6850736830999858, + 11.45832139758188, + 0.362318825993606, + 4.526747108334523, + 0.2382843463520162, + 0.22948937953272, + 0.3481086018076444, + 0.3596198212273357, + 0.461420136851573, + 0.5216095250469567, + 6.565653249670075, + 0.2280501658369403, + 2.272726411846056, + 0.3340757114300033, + 0.04981319925745456, + 0.222937819595298, + 0.4805766727842742, + 0.1649776062932452 + ] + }, + "mc4Param": { + "pow_a": 0.07306340900696351, + "pow_p": 0.6909308897469263, + "exp2_a": 489.25456473992574, + "exp2_b": 30770.895494055152, + "exp3_a": 16.86144381389201, + "exp3_b": 2819.131595534077, + "exp3_p": 0.6927530157131045, + "exp5_p": 4.565817027769467, + "gnls_p": 7.955761313099027, + "gnls_q": 0.5644747159243586, + "hill_p": 7.999999975199726, + "pow_er": -0.4956759683416578, + "cnst_er": -0.06367288253941095, + "exp2_er": -0.4920846292443089, + "exp3_er": -0.4952315996998395, + "exp4_er": -0.48780818578433305, + "exp4_ga": 62.936593572598966, + "exp4_tp": 3.160545685691406, + "exp5_er": -0.5427393909605482, + "exp5_ga": 45.24973438082952, + "exp5_tp": 3.6092716297582976, + "gnls_er": -0.5743685279270239, + "gnls_ga": 40.39441528906965, + "gnls_la": 1277.3835717446193, + "gnls_tp": 4.9743882398250925, + "hill_er": -0.5418420584767905, + "hill_ga": 39.362832742773776, + "hill_tp": 3.598558047969296, + "poly1_a": 0.015951258753982463, + "poly2_a": 689.1656998074085, + "poly2_b": 43422.635840414565, + "pow_aic": 119.27110226117928, + "pow_cov": 1, + "pow_rme": 1.970612708065348, + "pow_top": 2.841532541460785, + "all_bmed": 0, + "cnst_aic": 147.02320231677632, + "cnst_rme": 2.7213080260384577, + "exp2_aic": 121.536640649848, + "exp2_cov": 1, + "exp2_rme": 1.9806070196866243, + "exp2_top": 3.190339433218957, + "exp3_aic": 121.41570410348348, + "exp3_cov": 1, + "exp3_rme": 1.964500358062248, + "exp3_top": 2.9245335937115775, + "exp4_aic": 117.40649569667184, + "exp4_cov": 1, + "exp4_rme": 1.9143914875326904, + "exp4_top": 3.160545685691406, + "exp5_aic": 108.69371063135708, + "exp5_cov": 1, + "exp5_rme": 1.5839688744886915, + "exp5_top": 3.6092716297582976, + "gnls_aic": 110.23531348142146, + "gnls_cov": 1, + "gnls_rme": 1.540743257946914, + "gnls_top": 4.114035106463596, + "hill_aic": 108.7802965738098, + "hill_cov": 1, + "hill_rme": 1.5870073319060576, + "hill_top": 3.598558047969296, + "poly1_er": -0.49322275683035666, + "poly2_er": -0.4931857994848398, + "pow_a_sd": 0.06098198965840179, + "pow_ac50": 73.34025784745266, + "pow_p_sd": 0.17664309055759367, + "all_onesd": 0.8923597763803547, + "exp2_a_sd": 3184.6202015618323, + "exp2_ac50": 100.16249092262407, + "exp2_b_sd": 199490.5906912948, + "exp3_a_sd": 58.61911836048125, + "exp3_ac50": 77.81121531926684, + "exp3_b_sd": 9986.108641207353, + "exp3_p_sd": 0.29683220702002194, + "exp4_ac50": 62.936593572598966, + "exp5_ac50": 45.24973438082952, + "exp5_p_sd": 4.213044861329193, + "gnls_ac50": 39.827322985728394, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 39.362832742773776, + "hill_p_sd": 5.573024297626113, + "poly1_aic": 119.51285294787452, + "poly1_cov": 1, + "poly1_rme": 1.9801146542527, + "poly1_top": 3.190251750796493, + "poly2_aic": 121.54640180031528, + "poly2_cov": 1, + "poly2_rme": 1.981069269414523, + "poly2_top": 3.1888433746628246, + "pow_er_sd": 0.19875859625257855, + "exp2_er_sd": 0.19669797020202764, + "exp3_er_sd": 0.19724985616593993, + "exp4_er_sd": 0.1965661043023219, + "exp4_ga_sd": 34.81821712492219, + "exp4_tp_sd": 1.0390395652442248, + "exp5_er_sd": 0.1840458110753714, + "exp5_ga_sd": 16.99176937771065, + "exp5_tp_sd": 0.663162309702829, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.18392569712837312, + "hill_ga_sd": 7.865147277595785, + "hill_tp_sd": 0.6707173101135189, + "poly1_a_sd": 0.003422826182028237, + "poly1_ac50": 100, + "poly2_a_sd": 3794.628359530953, + "poly2_ac50": 100.2292375794687, + "poly2_b_sd": 237831.70254565787, + "poly1_er_sd": 0.19659363721503492, + "poly2_er_sd": 0.196607292096659, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2372.2570284464873 + }, + "mc5Param": { + "p": 4.565817027769467, + "er": -0.5427393909605482, + "ga": 45.24973438082952, + "tp": 3.6092716297582976, + "ac5": 25.583338192735063, + "acc": 32.177479924985796, + "bmd": 40.242151032551405, + "bmr": 1.2037933383370985, + "mll": -50.346855315678546, + "top": 3.6092716297582976, + "ac10": 29.9520321053751, + "ac20": 35.30253965284071, + "ac50": 45.24973438082952, + "bmdl": 33.264446410375136, + "bmdu": 53.793763933888144, + "rmse": 1.5839688744886915, + "ac1sd": 37.21757330690621, + "caikwt": 4.751783349020907E-9, + "hitcall": 0.999999883144982, + "top_over_cutoff": 7.354562685065171 + }, + "mc6Param": { + "flag": [ + "Noisy data" + ], + "mc6MthdId": [ + 10 + ] + } + }, + { + "aeid": 3096, + "m4id": 1150505, + "spid": "ES211_47_47", + "chid": 944145, + "casn": "21535-47-7", + "chnm": "Mianserin hydrochloride", + "dtxsid": "DTXSID30944145", + "bmad": 0.257990171134824, + "respMax": 12.49998697918023, + "respMin": 0.0, + "maxMean": 5.541738410783121, + "maxMeanConc": 2.3010299956639813, + "maxMed": 4.833483331976126, + "maxMedConc": 2.3010299956639813, + "logcMax": 2.3010299956639813, + "logcMin": -6.0, + "nconc": 9, + "npts": 36, + "nrep": 4.0, + "nmedGtbl": 7, + "tmpi": 42, + "m5id": 7599060, + "modl": "exp5", + "hitc": 0.9999998559756664, + "fitc": 42, + "coff": 0.7739705134044719, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 100.0, + "stkcUnit": null, + "testedConcUnit": null, + "mc3Param": { + "logc": [ + 1.9030899869919435, + -1.3010299956639813, + 2.3010299956639813, + -6, + -0.3010299956639812, + -3, + 2.3010299956639813, + 1.9030899869919435, + 0.6989700043360189, + 0.6989700043360189, + -1.3010299956639813, + -6, + 2.3010299956639813, + 1.4771212547196624, + 1, + 1.4771212547196624, + 1, + -1.3010299956639813, + -0.3010299956639812, + -3, + -6, + 1.9030899869919435, + 1.9030899869919435, + 1, + 1.4771212547196624, + -0.3010299956639812, + 0.6989700043360189, + -1.3010299956639813, + -3, + 2.3010299956639813, + 1.4771212547196624, + 0.6989700043360189, + -0.3010299956639812, + -6, + 1, + -3 + ], + "resp": [ + 4.526747108334523, + 0.824888031466226, + 4.347823386445102, + 0.4561003316738806, + 0.7789416927493502, + 0.8941877572233543, + 0, + 5.673754841308623, + 1.057438090424463, + 1.601601548161443, + 0.7860261779905042, + 1.266348323306034, + 12.49998697918023, + 0.5233494153240975, + 0.6619009620889339, + 0.3966504893499123, + 0.6597819661565701, + 0.7658389239768177, + 0.8219881628053387, + 0.7946680134665979, + 1.341281635835031, + 5.050502499746212, + 3.030301882461408, + 0.9870918379995505, + 0.7423904698444517, + 0.9801095134012823, + 0.2988791955447274, + 0.6880733769604134, + 0.916522147225114, + 5.319143277507151, + 0.8810572334378359, + 0.7454444852168833, + 0.5113383612419217, + 1.119847483444187, + 0.5093378484274108, + 0.4670714510258886 + ] + }, + "mc4Param": { + "pow_a": 0.256129166457669, + "pow_p": 0.5644406772111492, + "exp2_a": 1129.3096760444655, + "exp2_b": 39317.04061124209, + "exp3_a": 0.8720019016302841, + "exp3_b": 22.670011403864912, + "exp3_p": 0.30000305864361876, + "exp5_p": 3.190253095690696, + "gnls_p": 4.264093872089519, + "gnls_q": 0.6791167117000405, + "hill_p": 7.176325755057048, + "pow_er": -0.034773780653756595, + "cnst_er": 0.3936756503357535, + "exp2_er": 0.049717571642521746, + "exp3_er": -0.06866643163594202, + "exp4_er": -0.0334255933863206, + "exp4_ga": 54.83941521805386, + "exp4_tp": 5.528448444550952, + "exp5_er": -0.12470418879335174, + "exp5_ga": 47.982496654915074, + "exp5_tp": 4.7906449817634, + "gnls_er": -0.123418231619115, + "gnls_ga": 48.10588765537344, + "gnls_la": 1521.241791470397, + "gnls_tp": 5.939435678991746, + "hill_er": -0.12226946714558153, + "hill_ga": 38.87908122770836, + "hill_tp": 4.727067329887222, + "poly1_a": 0.028809872811533375, + "poly2_a": 1571.4797602650003, + "poly2_b": 54739.707244964055, + "pow_aic": 131.0854979041203, + "pow_cov": 1, + "pow_rme": 1.7655265144654924, + "pow_top": 5.096288028509811, + "all_bmed": 0, + "cnst_aic": 163.6015491080996, + "cnst_rme": 2.940288361762558, + "exp2_aic": 137.69447001575364, + "exp2_cov": 1, + "exp2_rme": 1.8398294934860109, + "exp2_top": 5.759267997099814, + "exp3_aic": 132.21816633784778, + "exp3_cov": 1, + "exp3_rme": 1.7676923268681453, + "exp3_top": 5.085763779463437, + "exp4_aic": 129.8610022030918, + "exp4_cov": 1, + "exp4_rme": 1.7411782753483664, + "exp4_top": 5.528448444550952, + "exp5_aic": 126.4266045032358, + "exp5_cov": 1, + "exp5_rme": 1.7108365520435371, + "exp5_top": 4.7906449817634, + "gnls_aic": 130.5159804184214, + "gnls_cov": 1, + "gnls_rme": 1.71478488931515, + "gnls_top": 4.942677854612155, + "hill_aic": 126.56736784290752, + "hill_cov": 1, + "hill_rme": 1.7154496972433324, + "hill_top": 4.727067329887222, + "poly1_er": 0.048751930612820536, + "poly2_er": 0.04920885674061179, + "pow_a_sd": 0.1568794096944919, + "pow_ac50": 58.57409370876723, + "pow_p_sd": 0.12743956516601432, + "all_onesd": 0.40082905954467335, + "exp2_a_sd": 6523.3330851199225, + "exp2_ac50": 100.1271711840828, + "exp2_b_sd": 226568.13671898856, + "exp3_a_sd": null, + "exp3_ac50": 63.9739161348579, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 54.83941521805386, + "exp5_ac50": 47.982496654915074, + "exp5_p_sd": 1.6269771671859927, + "gnls_ac50": 46.104045082264136, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 38.87908122770836, + "hill_p_sd": 78.09046476767209, + "poly1_aic": 135.66432541001384, + "poly1_cov": 1, + "poly1_rme": 1.839223539922158, + "poly1_top": 5.761974562306676, + "poly2_aic": 137.70745803349075, + "poly2_cov": 1, + "poly2_rme": 1.8399012025826664, + "poly2_top": 5.762622726294994, + "pow_er_sd": 0.16005952572503318, + "exp2_er_sd": 0.16512363320736548, + "exp3_er_sd": null, + "exp4_er_sd": 0.1553647531392489, + "exp4_ga_sd": 22.623173556633372, + "exp4_tp_sd": 1.0746491215089478, + "exp5_er_sd": 0.1550298307298998, + "exp5_ga_sd": 11.027654963611443, + "exp5_tp_sd": 0.5822266175525593, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.15517480648449222, + "hill_ga_sd": 110.91755377399213, + "hill_tp_sd": 1.3037185004938374, + "poly1_a_sd": 0.004437974865094146, + "poly1_ac50": 100, + "poly2_a_sd": 7620.57224036576, + "poly2_ac50": 100.18201711241991, + "poly2_b_sd": 264301.4890716433, + "poly1_er_sd": 0.1650477137056485, + "poly2_er_sd": 0.16508964434676754, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 2505.4734619566725 + }, + "mc5Param": { + "p": 3.190253095690696, + "er": -0.12470418879335174, + "ga": 47.982496654915074, + "tp": 4.7906449817634, + "ac5": 21.21481348706796, + "acc": 31.23504395850078, + "bmd": 27.67407473473264, + "bmr": 0.5407184013257643, + "mll": -59.213302251617904, + "top": 4.7906449817634, + "ac10": 26.584628460854177, + "ac20": 33.634697200724105, + "ac50": 47.982496654915074, + "bmdl": 21.832233757697352, + "bmdu": 34.85027881622872, + "rmse": 1.7108365520435371, + "ac1sd": 25.06997712418609, + "caikwt": 8.463760056913385E-9, + "hitcall": 0.9999998559756664, + "top_over_cutoff": 6.18969960585545 + }, + "mc6Param": { + "flag": [ + "Noisy data" + ], + "mc6MthdId": [ + 10 + ] + } + } +] diff --git a/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-m4id/1842443.json b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-m4id/1842443.json new file mode 100644 index 00000000..dff7f002 --- /dev/null +++ b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-m4id/1842443.json @@ -0,0 +1,211 @@ +{ + "aeid": 704, + "m4id": 1842443, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 3.7634679299683276, + "respMax": 5.412234762165331, + "respMin": -10.497225111686998, + "maxMean": 5.412234762165331, + "maxMeanConc": -0.6989700043360187, + "maxMed": 5.412234762165331, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 42, + "m5id": 5037089, + "modl": "poly1", + "hitc": 1.3111515548405657E-6, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + 1.3010299956639813, + -0.6989700043360187, + -1.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + -1.154901959985743 + ], + "resp": [ + -10.497225111686998, + -8.271301702212094, + 5.412234762165331, + -0.5697089223331855, + -5.4107315723966085, + -1.152645914630851, + -9.935332776150975, + 0.5697089223331855 + ] + }, + "mc4Param": { + "pow_a": 5.868021963410569E-8, + "pow_p": 0.31010469927487905, + "exp2_a": 0.00000820221770260021, + "exp2_b": 63.67412912081, + "exp3_a": 0.000015100154689265508, + "exp3_b": 66.7682650559194, + "exp3_p": 4.045012130124175, + "exp5_p": 2.5184566900851344, + "gnls_p": 1.004146220375644, + "gnls_q": 7.988324375445398, + "hill_p": 2.638717782813107, + "pow_er": 1.748991997794754, + "cnst_er": 1.749320687470586, + "exp2_er": 1.7502584913338175, + "exp3_er": 1.7494323994898786, + "exp4_er": 1.7493097643658628, + "exp4_ga": 3.3432891621411227, + "exp4_tp": 3.7125542218244536E-10, + "exp5_er": 1.7493111824172694, + "exp5_ga": 3.185722315810508, + "exp5_tp": 5.594093755272163E-10, + "gnls_er": 1.7165456563641568, + "gnls_ga": 0.015706640010627146, + "gnls_la": 0.4966875709539269, + "gnls_tp": 2.580846160887361, + "hill_er": 1.749345944481645, + "hill_ga": 33.73657111465509, + "hill_tp": 4.159714315410043E-9, + "poly1_a": 2.671599719093895E-11, + "poly2_a": 0.000005233244887677393, + "poly2_b": 60.3011801386689, + "pow_aic": 59.65799055310836, + "pow_cov": 1, + "pow_rme": 6.498682968118529, + "pow_top": 1.9740143842658864E-7, + "all_bmed": 0, + "cnst_aic": 55.65798921703397, + "cnst_rme": 6.498682892070479, + "exp2_aic": 59.65800315845096, + "exp2_cov": 1, + "exp2_rme": 6.4986846045958355, + "exp2_top": 0.000009784846486708034, + "exp3_aic": 61.657991223897305, + "exp3_cov": 1, + "exp3_rme": 6.4986834826679445, + "exp3_top": 0.00000549637162559571, + "exp4_aic": 59.65798921968127, + "exp4_cov": 1, + "exp4_rme": 6.498682892244033, + "exp4_top": 3.7125542218244536E-10, + "exp5_aic": 61.65798921951322, + "exp5_cov": 1, + "exp5_rme": 6.498682892347669, + "exp5_top": 5.594093755272163E-10, + "gnls_aic": 65.24298472190893, + "gnls_cov": 1, + "gnls_rme": 6.371147760432374, + "gnls_top": 2.422030692633518, + "hill_aic": 61.65798922272976, + "hill_cov": 1, + "hill_rme": 6.498682892532436, + "hill_top": 4.159714315410043E-9, + "poly1_er": 1.7493384697041403, + "poly2_er": 1.749869269967504, + "pow_a_sd": null, + "pow_ac50": 5.348516727471637, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.786661402010136, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 42.90853049989956, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 3.3432891621411227, + "exp5_ac50": 3.185722315810508, + "exp5_p_sd": null, + "gnls_ac50": 0.013892709273921892, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 33.73657111465509, + "hill_p_sd": null, + "poly1_aic": 57.65798921945516, + "poly1_cov": 1, + "poly1_rme": 6.49868289233687, + "poly1_top": 1.335799859546947E-9, + "poly2_aic": 59.65799619491047, + "poly2_cov": 1, + "poly2_rme": 6.498684235032681, + "poly2_top": 0.000007937241563467504, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.32379470628075435, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.40176401368837, + "poly2_b_sd": null, + "poly1_er_sd": 0.7320994661619505, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.5007494385640836 + }, + "mc5Param": { + "a": 2.671599719093895E-11, + "er": 1.7493384697041403, + "ac5": 2.4999999999999996, + "bmd": 347699605501.9814, + "bmr": 9.289141683881516, + "mll": -26.82899460972758, + "top": 1.335799859546947E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 108.3553281419698, + "rmse": 6.49868289233687, + "ac1sd": 257746186435.86465, + "caikwt": 0.7310585788680222, + "hitcall": 0.0000013111515548405657, + "top_over_cutoff": 5.915642542126427E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } +} diff --git a/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-spid/TP0000904H05.json b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-spid/TP0000904H05.json new file mode 100644 index 00000000..64c6f26b --- /dev/null +++ b/vignettes/api/0/api-ccte.epa.gov/bioactivity/data/search/by-spid/TP0000904H05.json @@ -0,0 +1,1715 @@ +[ + { + "aeid": 623, + "m4id": 1833668, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 4.208854513532483, + "respMax": 29.901771956856702, + "respMin": -7.501926040061633, + "maxMean": 29.901771956856702, + "maxMeanConc": 1.3010299956639813, + "maxMed": 29.901771956856702, + "maxMedConc": 1.3010299956639813, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 2, + "tmpi": 173, + "m5id": 5028314, + "modl": "exp5", + "hitc": 0.3882324490933417, + "fitc": 15, + "coff": 25.253127081194897, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.6989700043360187, + -1.6989700043360187, + 1.3010299956639813, + 0.3010299956639812, + 0.7781512503836436, + -0.22184874961635637, + -1.154901959985743, + 1.6989700043360187 + ], + "resp": [ + 5.209938366718028, + -4.959553158705701, + 29.901771956856702, + -4.651386748844375, + -7.501926040061633, + -1.3578582434514619, + 4.9595531587057025, + 20.02118644067797 + ] + }, + "mc4Param": { + "pow_a": 0.44336623130581354, + "pow_p": 0.9925644596727824, + "exp2_a": 1721.5267035510278, + "exp2_b": 4025.7260629221983, + "exp3_a": 1149.7862297572626, + "exp3_b": 3865.930582986358, + "exp3_p": 0.917722768672351, + "exp5_p": 7.999998569591368, + "gnls_p": 7.999999998725721, + "gnls_q": 6.1299493285886815, + "hill_p": 7.999999995602079, + "pow_er": 1.9125454943910825, + "cnst_er": 2.2713874650689845, + "exp2_er": 1.9114072623315592, + "exp3_er": 1.9217973647521511, + "exp4_er": 1.941838889601473, + "exp4_ga": 13.263284766380592, + "exp4_tp": 24.09270151565037, + "exp5_er": 1.5919951761954754, + "exp5_ga": 14.42814252864356, + "exp5_tp": 24.957524183833613, + "gnls_er": 1.602022603368262, + "gnls_ga": 11.075019190563058, + "gnls_la": 4057.2571930089903, + "gnls_tp": 24.99533986136314, + "hill_er": 1.6020268977019103, + "hill_ga": 11.07620152627384, + "hill_tp": 24.995330944202244, + "poly1_a": 0.4304809360209948, + "poly2_a": 1481.0924717053826, + "poly2_b": 3489.637064916511, + "pow_aic": 63.54642686971948, + "pow_cov": 1, + "pow_rme": 9.110378433889926, + "pow_top": 21.532767773256374, + "all_bmed": 0, + "cnst_aic": 65.7380627468674, + "cnst_rme": 13.467830827162247, + "exp2_aic": 63.5509972646931, + "exp2_cov": 1, + "exp2_rme": 9.128808609267953, + "exp2_top": 21.514900150579237, + "exp3_aic": 65.56286926134463, + "exp3_cov": 1, + "exp3_rme": 9.029227555570293, + "exp3_top": 21.464382238767605, + "exp4_aic": 62.98697633687659, + "exp4_cov": 1, + "exp4_rme": 8.155246492992447, + "exp4_top": 24.09270151565037, + "exp5_aic": 58.33551786266656, + "exp5_cov": 1, + "exp5_rme": 5.064097391524118, + "exp5_top": 24.957524183833613, + "gnls_aic": 62.50680467218653, + "gnls_cov": 1, + "gnls_rme": 5.12230318637964, + "gnls_top": 24.995339798729216, + "hill_aic": 58.50680471790864, + "hill_cov": 1, + "hill_rme": 5.12229712088364, + "hill_top": 24.995330944202244, + "poly1_er": 1.9115526550839648, + "poly2_er": 1.9107008970876125, + "pow_a_sd": 1.30795225093553, + "pow_ac50": 24.870523119834353, + "pow_p_sd": 0.7451572698575011, + "all_onesd": 5.871582120667167, + "exp2_a_sd": 26000.97172895427, + "exp2_ac50": 25.077625249843255, + "exp2_b_sd": 60411.57063986761, + "exp3_a_sd": null, + "exp3_ac50": 23.61210508379751, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 13.263284766380592, + "exp5_ac50": 14.42814252864356, + "exp5_p_sd": 14.257258147825569, + "gnls_ac50": 11.075019183625043, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 11.07620152627384, + "hill_p_sd": 5.6132273415436185, + "poly1_aic": 61.5465618387384, + "poly1_cov": 1, + "poly1_rme": 9.121069696481047, + "poly1_top": 21.524046801049735, + "poly2_aic": 63.5566347758779, + "poly2_cov": 1, + "poly2_rme": 9.136999205494709, + "poly2_top": 21.52535837501469, + "pow_er_sd": 0.35032444517103617, + "exp2_er_sd": 0.33775432638513775, + "exp3_er_sd": null, + "exp4_er_sd": 0.31898399504554403, + "exp4_ga_sd": 16.437658831836973, + "exp4_tp_sd": 9.402421344167246, + "exp5_er_sd": 0.2866421065447428, + "exp5_ga_sd": 10.811848496418005, + "exp5_tp_sd": 4.504679302336407, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.2889737774748023, + "hill_ga_sd": 4.654460027967879, + "hill_tp_sd": 4.624285420174428, + "poly1_a_sd": 0.12591284476723125, + "poly1_ac50": 24.999999999999993, + "poly2_a_sd": 15244.347569196254, + "poly2_ac50": 25.176562967913593, + "poly2_b_sd": 35357.40607056334, + "poly1_er_sd": 0.3376542920341601, + "poly2_er_sd": 0.33789398129427817, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 4057.257196326073 + }, + "mc5Param": { + "p": 7.999998569591368, + "er": 1.5919951761954754, + "ga": 14.42814252864356, + "tp": 24.957524183833613, + "ac5": 10.419929728081096, + "bmd": 13.391740000924123, + "bmr": 7.920764280780008, + "mll": -25.16775893133328, + "top": 24.957524183833613, + "ac10": 11.400974094782285, + "ac20": 12.522189530406145, + "ac50": 14.42814252864356, + "bmdl": 6.346138919905622, + "bmdu": 16.86891434152304, + "rmse": 5.064097391524118, + "ac1sd": 12.813544894047944, + "caikwt": 0.024097080019334458, + "hitcall": 0.3882324490933417, + "top_over_cutoff": 0.9882944042371128 + }, + "mc6Param": { + "flag": [ + "Borderline", + "Average number of replicates per conc is less than 2", + "Multiple points above baseline, inactive" + ], + "mc6MthdId": [ + 11, + 13, + 8 + ] + } + }, + { + "aeid": 626, + "m4id": 1834094, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 4.884792210388105, + "respMax": 29.6569605105704, + "respMin": -0.8775428799361791, + "maxMean": 29.6569605105704, + "maxMeanConc": 1.3010299956639813, + "maxMed": 29.6569605105704, + "maxMedConc": 1.3010299956639813, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 2, + "tmpi": 127, + "m5id": 5028740, + "modl": "exp4", + "hitc": 0.01954693088289667, + "fitc": 13, + "coff": 29.30875326232863, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.154901959985743, + 1.6989700043360187, + 0.7781512503836436, + -0.22184874961635637, + -1.6989700043360187, + 1.3010299956639813, + 0.3010299956639812, + -0.6989700043360187 + ], + "resp": [ + -0.8775428799361791, + 14.818508177104107, + 7.818109293976865, + 0.6182688472277631, + 0.8775428799361791, + 29.6569605105704, + 14.000797766254488, + 11.22856003191065 + ] + }, + "mc4Param": { + "pow_a": 6.104769005070028, + "pow_p": 0.30000061702105263, + "exp2_a": 2626.4817742925065, + "exp2_b": 6939.1379984058385, + "exp3_a": 120.15711077915388, + "exp3_b": 23397.765294430603, + "exp3_p": 0.30000031698770585, + "exp5_p": 0.594894190079819, + "gnls_p": 0.8731492533237095, + "gnls_q": 7.968128567118133, + "hill_p": 0.699837429056946, + "pow_er": 1.7335248446140346, + "cnst_er": 2.380613185122028, + "exp2_er": 2.060944039839989, + "exp3_er": 1.8546380117175023, + "exp4_er": 1.742284415011934, + "exp4_ga": 2.8193975022647706, + "exp4_tp": 19.007523606809062, + "exp5_er": 1.6978383675225492, + "exp5_ga": 1.6927866800008955, + "exp5_tp": 18.11557823124747, + "gnls_er": 1.6327825441519803, + "gnls_ga": 1.735452996784926, + "gnls_la": 54.87984244327055, + "gnls_tp": 24.19390328229074, + "hill_er": 1.6938476048310585, + "hill_ga": 1.813379328743659, + "hill_tp": 19.44068645643118, + "poly1_a": 0.37984578052812146, + "poly2_a": 2264.1081940817717, + "poly2_b": 6022.235022571993, + "pow_aic": 60.00263716196596, + "pow_cov": 1, + "pow_rme": 6.885998407649498, + "pow_top": 19.740642572392304, + "all_bmed": 0, + "cnst_aic": 66.57834307933227, + "cnst_rme": 13.621084951805804, + "exp2_aic": 65.81071829753414, + "exp2_cov": 1, + "exp2_rme": 10.22892676304634, + "exp2_top": 18.99347662794126, + "exp3_aic": 62.2288005070792, + "exp3_cov": 1, + "exp3_rme": 6.886283476321515, + "exp3_top": 20.58121443270486, + "exp4_aic": 59.581830457686145, + "exp4_cov": 1, + "exp4_rme": 6.490262952004159, + "exp4_top": 19.007523606809062, + "exp5_aic": 60.930401394432195, + "exp5_cov": 1, + "exp5_rme": 6.304211108274938, + "exp5_top": 18.11557823124747, + "gnls_aic": 64.01083808276202, + "gnls_cov": 1, + "gnls_rme": 5.921058456285511, + "gnls_top": 22.158867072863508, + "hill_aic": 61.05594929038858, + "hill_cov": 1, + "hill_rme": 6.438553620903468, + "hill_top": 19.44068645643118, + "poly1_er": 2.059622051495357, + "poly2_er": 2.0605577889775617, + "pow_a_sd": 3.149959838854599, + "pow_ac50": 4.960651860666694, + "pow_p_sd": 0.1482676079125486, + "all_onesd": 7.091261826118074, + "exp2_a_sd": 30938.21312122273, + "exp2_ac50": 25.045034314642436, + "exp2_b_sd": 81312.38225224172, + "exp3_a_sd": 303.1118237953914, + "exp3_ac50": 5.644138602314242, + "exp3_b_sd": 141170.26637545082, + "exp3_p_sd": 0.17783524373196458, + "exp4_ac50": 2.8193975022647706, + "exp5_ac50": 1.6927866800008955, + "exp5_p_sd": 0.40135476309182777, + "gnls_ac50": 1.4306730373148124, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 1.813379328743659, + "hill_p_sd": 0.6752166489168941, + "poly1_aic": 63.80340730003342, + "poly1_cov": 1, + "poly1_rme": 10.22362919651012, + "poly1_top": 18.99228902640607, + "poly2_aic": 65.82009863445656, + "poly2_cov": 1, + "poly2_rme": 10.238688730082709, + "poly2_top": 18.953977151594913, + "pow_er_sd": 0.3335635504694223, + "exp2_er_sd": 0.34947041875452034, + "exp3_er_sd": 0.34371770733317997, + "exp4_er_sd": 0.3221439177850666, + "exp4_ga_sd": 4.969271064671941, + "exp4_tp_sd": 7.484672815601464, + "exp5_er_sd": 0.3208267776910146, + "exp5_ga_sd": 2.2579559312184383, + "exp5_tp_sd": 5.794590169915659, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": 0.32586972894861654, + "hill_ga_sd": 3.8056187634873897, + "hill_tp_sd": 9.540592027517304, + "poly1_a_sd": 0.160075249411384, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 17871.438263865843, + "poly2_ac50": 25.102925760278133, + "poly2_b_sd": 47059.40366080807, + "poly1_er_sd": 0.3493877366290281, + "poly2_er_sd": 0.3495083063258392, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 55.428544878921535 + }, + "mc5Param": { + "er": 1.742284415011934, + "ga": 2.8193975022647706, + "tp": 19.007523606809062, + "ac5": 0.2086370544887254, + "bmd": 2.8461708745717997, + "bmr": 9.56611220343328, + "mll": -26.790915228843073, + "top": 19.007523606809062, + "ac10": 0.4285571419954925, + "ac20": 0.9076432666342852, + "ac50": 2.8193975022647706, + "bmdl": 0.42381147732328206, + "bmdu": 10.478324051348984, + "rmse": 6.490262952004159, + "ac1sd": 1.899255719797609, + "caikwt": 0.029361884721225712, + "hitcall": 0.01954693088289667, + "top_over_cutoff": 0.6485271972056202 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2", + "Multiple points above baseline, inactive", + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 13, + 8, + 9 + ] + } + }, + { + "aeid": 645, + "m4id": 1836233, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 3.4265572687763393, + "respMax": 7.386363636363637, + "respMin": -9.09090909090909, + "maxMean": 7.386363636363637, + "maxMeanConc": 1.6989700043360187, + "maxMed": 7.386363636363637, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 134, + "m5id": 5030879, + "modl": "poly1", + "hitc": 4.481617968402787E-5, + "fitc": 13, + "coff": 20.559343612658036, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + -1.6989700043360187, + -1.154901959985743, + -0.6989700043360187, + -0.22184874961635637, + 1.3010299956639813, + 0.3010299956639812, + 1.6989700043360187 + ], + "resp": [ + -7.702020202020201, + 2.904040404040405, + -2.904040404040403, + -0.9469696969696955, + -8.143939393939391, + -3.5984848484848477, + -9.09090909090909, + 7.386363636363637 + ] + }, + "mc4Param": { + "pow_a": 7.38792442803479E-8, + "pow_p": 4.707344288793977, + "exp2_a": 9.720535659483423E-7, + "exp2_b": 3.155293427742727, + "exp3_a": 10.992475308914631, + "exp3_b": 54.33735479981147, + "exp3_p": 7.997291932162272, + "exp5_p": 7.999998484010299, + "gnls_p": 7.999999892071809, + "gnls_q": 2.9607003309368434, + "hill_p": 7.9999961146922605, + "pow_er": 1.5635126278095273, + "cnst_er": 1.719984746193826, + "exp2_er": 1.5591089362306945, + "exp3_er": 1.559419875600755, + "exp4_er": 1.6883920413738989, + "exp4_ga": 74.80480041333628, + "exp4_tp": 8.863636346356905, + "exp5_er": 1.5607744582298897, + "exp5_ga": 44.417660789138985, + "exp5_tp": 8.863603105060312, + "gnls_er": 1.561195254781372, + "gnls_ga": 41.16217714273171, + "gnls_la": 1968.4261784520863, + "gnls_tp": 8.863620744215016, + "hill_er": 1.5615418348405026, + "hill_ga": 41.134292358351026, + "hill_tp": 8.85885765273257, + "poly1_a": 0.0916727261027705, + "poly2_a": 0.00003275646438816725, + "poly2_b": 0.11084829353336607, + "pow_aic": 56.802529668867656, + "pow_cov": 1, + "pow_rme": 5.474106464958057, + "pow_top": 7.347831543130136, + "all_bmed": 0, + "cnst_aic": 54.82949934043421, + "cnst_rme": 6.057646057469498, + "exp2_aic": 56.76807692440605, + "exp2_cov": 1, + "exp2_rme": 5.465880012590823, + "exp2_top": 7.407786706660837, + "exp3_aic": 58.76914315577856, + "exp3_cov": 1, + "exp3_rme": 5.466134248427126, + "exp3_top": 7.388890198629367, + "exp4_aic": 58.3862013644993, + "exp4_cov": 1, + "exp4_rme": 5.91931768956607, + "exp4_top": 8.863636346356905, + "exp5_aic": 58.771451215856445, + "exp5_cov": 1, + "exp5_rme": 5.466684000894818, + "exp5_top": 8.863603105060312, + "gnls_aic": 62.777644709625726, + "gnls_cov": 1, + "gnls_rme": 5.468147134258676, + "gnls_top": 8.859894820651965, + "hill_aic": 58.77767023528245, + "hill_cov": 1, + "hill_rme": 5.468153598929289, + "hill_top": 8.85885765273257, + "poly1_er": 1.6708188343034331, + "poly2_er": 1.603520396966836, + "pow_a_sd": 0.0000014804515060319311, + "pow_ac50": 43.15399398938185, + "pow_p_sd": 0.148714056473758, + "all_onesd": 9.788806432103662, + "exp2_a_sd": 0.00000229547866974318, + "exp2_ac50": 47.81291767075994, + "exp2_b_sd": 0.1144483227925822, + "exp3_a_sd": null, + "exp3_ac50": 46.540170334040354, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 74.80480041333628, + "exp5_ac50": 44.417660789138985, + "exp5_p_sd": 30.83791719208217, + "gnls_ac50": 41.157961075007606, + "gnls_p_sd": 20.623651182531617, + "gnls_q_sd": 917.2489266479544, + "hill_ac50": 41.134292358351026, + "hill_p_sd": 20.755167151874623, + "poly1_aic": 56.20208741239672, + "poly1_cov": 1, + "poly1_rme": 5.879174343453156, + "poly1_top": 4.5836363051385245, + "poly2_aic": 57.24725841856889, + "poly2_cov": 1, + "poly2_rme": 5.591373578271515, + "poly2_top": 6.679450797669966, + "pow_er_sd": 0.31476622758872136, + "exp2_er_sd": 0.31494236846040924, + "exp3_er_sd": null, + "exp4_er_sd": 0.3050999358871871, + "exp4_ga_sd": 206.23903994982948, + "exp4_tp_sd": 24.866384140473222, + "exp5_er_sd": 0.3151258300122656, + "exp5_ga_sd": 133.05442859689597, + "exp5_tp_sd": 82.18120992121477, + "gnls_er_sd": 0.31519605639597137, + "gnls_ga_sd": 64.74140517770995, + "gnls_la_sd": 2232417.631488272, + "gnls_tp_sd": 23.216264261253723, + "hill_er_sd": 0.3152310297032542, + "hill_ga_sd": 66.03127922964485, + "hill_tp_sd": 23.585311596930016, + "poly1_a_sd": 0.10105939936781418, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 0.000828471087305424, + "poly2_ac50": 35.339127399684344, + "poly2_b_sd": 1.4052316063819617, + "poly1_er_sd": 0.30563589696444254, + "poly2_er_sd": 0.31148611469958, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 1968.9852136355971 + }, + "mc5Param": { + "a": 0.0916727261027705, + "er": 1.6708188343034331, + "ac5": 2.5, + "bmd": 144.0461131493368, + "bmr": 13.20509987690784, + "mll": -26.10104370619836, + "top": 4.5836363051385245, + "ac10": 5, + "ac20": 10, + "ac50": 24.999999999999996, + "bmdl": 52.7459473602489, + "rmse": 5.879174343453156, + "ac1sd": 106.77992079268851, + "caikwt": 0.6651420101678049, + "hitcall": 0.00004481617968402787, + "top_over_cutoff": 0.22294662667715023 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2", + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 13, + 9 + ] + } + }, + { + "aeid": 647, + "m4id": 1836494, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 2.8724632813460445, + "respMax": 24.5911214953271, + "respMin": -15.344176851186198, + "maxMean": 24.5911214953271, + "maxMeanConc": -0.6989700043360187, + "maxMed": 24.5911214953271, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 1, + "tmpi": 176, + "m5id": 5031140, + "modl": "poly1", + "hitc": 7.691234876598405E-4, + "fitc": 13, + "coff": 20.0, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + -1.154901959985743, + -1.6989700043360187, + 1.6989700043360187, + 0.3010299956639812, + -0.6989700043360187, + 1.3010299956639813, + 0.7781512503836436 + ], + "resp": [ + 0.31002875629043825, + -4.23705966930266, + 4.23705966930266, + -10.65330697340043, + -15.344176851186198, + 24.5911214953271, + -3.338425593098491, + 4.084291876347951 + ] + }, + "mc4Param": { + "pow_a": 0.0000015333586251507758, + "pow_p": 0.3766871063745604, + "exp2_a": 0.0000011936693923752977, + "exp2_b": 75.25835790295875, + "exp3_a": 0.0006569488939842799, + "exp3_b": 96.83528802743167, + "exp3_p": 7.800663857633126, + "exp5_p": 7.937542044894579, + "gnls_p": 0.729162061739079, + "gnls_q": 7.999999989113995, + "hill_p": 7.874824062203916, + "pow_er": 2.14936705216903, + "cnst_er": 2.149647244900154, + "exp2_er": 2.1499314425778753, + "exp3_er": 2.150315520704397, + "exp4_er": 2.149639800584959, + "exp4_ga": 19.434543462158643, + "exp4_tp": 1.1341713592504431E-9, + "exp5_er": 2.1496833837069445, + "exp5_ga": 116.5095827986136, + "exp5_tp": 0.0024033220782305803, + "gnls_er": 2.16232385103293, + "gnls_ga": 0.014951651893028646, + "gnls_la": 0.4728127504187675, + "gnls_tp": 11.2206197033088, + "hill_er": 2.1496462163421155, + "hill_ga": 158.06723237834862, + "hill_tp": 0.09087731268651236, + "poly1_a": 1.2510975773993083E-9, + "poly2_a": 0.000010622282859787738, + "poly2_b": 65.91494218290552, + "pow_aic": 67.2883088418402, + "pow_cov": 1, + "pow_rme": 11.277677799643604, + "pow_top": 0.000006693046390825522, + "all_bmed": 0, + "cnst_aic": 63.288305947678175, + "cnst_rme": 11.277676854033178, + "exp2_aic": 67.2883069898754, + "exp2_cov": 1, + "exp2_rme": 11.27767700055377, + "exp2_top": 0.0000011259662475929594, + "exp3_aic": 69.28831082872938, + "exp3_cov": 1, + "exp3_rme": 11.27767730254966, + "exp3_top": 0.000003797491381994292, + "exp4_aic": 67.28830594801778, + "exp4_cov": 1, + "exp4_rme": 11.277676854167195, + "exp4_top": 1.1341713592504431E-9, + "exp5_aic": 69.2883064884335, + "exp5_cov": 1, + "exp5_rme": 11.277677092560204, + "exp5_top": 0.0024033220782305803, + "gnls_aic": 72.17919094570237, + "gnls_cov": 1, + "gnls_rme": 9.771294007073369, + "gnls_top": 9.896104475278875, + "hill_aic": 69.28830869470625, + "hill_cov": 1, + "hill_rme": 11.277678096478796, + "hill_top": 0.09087731268651236, + "poly1_er": 2.1496851424365406, + "poly2_er": 2.1489661386583347, + "pow_a_sd": null, + "pow_ac50": 7.939966888042317, + "pow_p_sd": null, + "all_onesd": 10.104413980537656, + "exp2_a_sd": null, + "exp2_ac50": 29.078168746553875, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 45.7572447748528, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 19.434543462158643, + "exp5_ac50": 116.5095827986136, + "exp5_p_sd": null, + "gnls_ac50": 0.01079980647197256, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 158.06723237834862, + "hill_p_sd": null, + "poly1_aic": 65.28830598103433, + "poly1_cov": 1, + "poly1_rme": 11.2776768623634, + "poly1_top": 6.255487886996541E-8, + "poly2_aic": 67.28831401939081, + "poly2_cov": 1, + "poly2_rme": 11.277678682582888, + "poly2_top": 0.000014169663550936488, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.4105028884852779, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.16200653088329, + "poly2_b_sd": null, + "poly1_er_sd": 0.6280287466170111, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.47847525919124695 + }, + "mc5Param": { + "a": 1.2510975773993083E-9, + "er": 2.1496851424365406, + "ac5": 2.4999999999999996, + "bmd": 10895116980.467772, + "bmr": 13.6308544597453, + "mll": -30.644152990517163, + "top": 6.255487886996541E-8, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 86.00840841895133, + "rmse": 11.2776768623634, + "ac1sd": 8076439570.398645, + "caikwt": 0.7310585819091135, + "hitcall": 0.0007691234876598405, + "top_over_cutoff": 3.12774394349827E-9 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2", + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 13, + 9 + ] + } + }, + { + "aeid": 679, + "m4id": 1839401, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 5.621579363521706, + "respMax": 14.08123821744849, + "respMin": -6.612486732252886, + "maxMean": 14.08123821744849, + "maxMeanConc": 0.3010299956639812, + "maxMed": 14.08123821744849, + "maxMedConc": 0.3010299956639812, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 133, + "m5id": 5034047, + "modl": "exp4", + "hitc": 3.7196432829375366E-15, + "fitc": 13, + "coff": 33.72947618113024, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -1.6989700043360187, + 0.3010299956639812, + -1.154901959985743, + 0.7781512503836436, + -0.22184874961635637, + -0.6989700043360187, + 1.3010299956639813, + 1.6989700043360187 + ], + "resp": [ + 2.2780919791518146, + 14.08123821744849, + -2.2780919791518137, + -6.612486732252886, + 10.679150230502348, + 13.089523628471415, + 4.467468276222602, + 6.318616035359553 + ] + }, + "mc4Param": { + "pow_a": 2.240045406368432, + "pow_p": 0.30000049943105944, + "exp2_a": 112.98083072982448, + "exp2_b": 865.8254929535174, + "exp3_a": 4.545028620685052, + "exp3_b": 65.7285988399926, + "exp3_p": 0.3000003150791311, + "exp5_p": 7.999999018346869, + "gnls_p": 0.300091098903469, + "gnls_q": 7.550849029707361, + "hill_p": 0.30000000017227746, + "pow_er": 1.9084326032965633, + "cnst_er": 2.050383693644464, + "exp2_er": 1.951409270215791, + "exp3_er": 1.9203767699862313, + "exp4_er": 1.6754549302442965, + "exp4_ga": 0.07329301415768419, + "exp4_tp": 7.710786101521187, + "exp5_er": 1.513226499207291, + "exp5_ga": 0.1453438995327829, + "exp5_tp": 8.610190191604286, + "gnls_er": 1.8470198467698633, + "gnls_ga": 0.29231631165137606, + "gnls_la": 59.66977501585602, + "gnls_tp": 9.655899171708228, + "hill_er": 1.882783861146438, + "hill_ga": 54.87345686534822, + "hill_tp": 16.841921803354463, + "poly1_a": 0.13427234808054894, + "poly2_a": 163.94604679311635, + "poly2_b": 1270.0524640798787, + "pow_aic": 62.22501034060233, + "pow_cov": 1, + "pow_rme": 7.635077607201984, + "pow_top": 7.243503453530403, + "all_bmed": 0, + "cnst_aic": 60.31637953410401, + "cnst_rme": 8.643268453824428, + "exp2_aic": 63.20845198455855, + "exp2_cov": 1, + "exp2_rme": 8.236056037957985, + "exp2_top": 6.716525076559469, + "exp3_aic": 64.52332339400041, + "exp3_cov": 1, + "exp3_rme": 7.810212289193087, + "exp3_top": 6.873721691967609, + "exp4_aic": 59.07676009097395, + "exp4_cov": 1, + "exp4_rme": 6.585985949819935, + "exp4_top": 7.710786101521187, + "exp5_aic": 59.34963698633271, + "exp5_cov": 1, + "exp5_rme": 6.313571586200532, + "exp5_top": 8.610190191604286, + "gnls_aic": 66.68700367035977, + "gnls_cov": 1, + "gnls_rme": 7.005486126644505, + "gnls_top": 7.69073998343443, + "hill_aic": 63.70370651182299, + "hill_cov": 1, + "hill_rme": 7.371748953581798, + "hill_top": 16.841921803354463, + "poly1_er": 1.9514160891689865, + "poly2_er": 1.953269884448892, + "pow_a_sd": null, + "pow_ac50": 4.960647368144271, + "pow_p_sd": null, + "all_onesd": 9.193701942255004, + "exp2_a_sd": 2618.1000472689234, + "exp2_ac50": 25.360877092869007, + "exp2_b_sd": 19534.177463369564, + "exp3_a_sd": null, + "exp3_ac50": 9.693473276544648, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.07329301415768419, + "exp5_ac50": 0.1453438995327829, + "exp5_p_sd": 21.257608326450363, + "gnls_ac50": 0.07386566609090593, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 54.87345686534822, + "hill_p_sd": null, + "poly1_aic": 61.20659443782829, + "poly1_cov": 1, + "poly1_rme": 8.235017480262172, + "poly1_top": 6.713617404027446, + "poly2_aic": 63.209083993314835, + "poly2_cov": 1, + "poly2_rme": 8.236417282123691, + "poly2_top": 6.708398029005737, + "pow_er_sd": null, + "exp2_er_sd": 0.32176579624163837, + "exp3_er_sd": null, + "exp4_er_sd": 0.32290193845118853, + "exp4_ga_sd": 0.07925814316759382, + "exp4_tp_sd": 2.776801163350604, + "exp5_er_sd": 0.3377590868121545, + "exp5_ga_sd": 0.14972218569452714, + "exp5_tp_sd": 2.4071558977199987, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.11707993441117576, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 3437.347970091856, + "poly2_ac50": 25.473296332973103, + "poly2_b_sd": 25758.50715822951, + "poly1_er_sd": 0.32179810050301344, + "poly2_er_sd": 0.32190869935481625, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 60.347790496302295 + }, + "mc5Param": { + "er": 1.6754549302442965, + "ga": 0.07329301415768419, + "tp": 7.710786101521187, + "ac5": 0.005423725663435604, + "bmr": 12.402303920102002, + "mll": -26.538380045486974, + "top": 7.710786101521187, + "ac10": 0.01114076487987984, + "ac20": 0.023595080416335745, + "ac50": 0.07329301415768419, + "rmse": 6.585985949819935, + "caikwt": 0.34982472852238994, + "hitcall": 3.7196432829375366E-15, + "top_over_cutoff": 0.22860675511572107 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 13 + ] + } + }, + { + "aeid": 704, + "m4id": 1842443, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 3.7634679299683276, + "respMax": 5.412234762165331, + "respMin": -10.497225111686998, + "maxMean": 5.412234762165331, + "maxMeanConc": -0.6989700043360187, + "maxMed": 5.412234762165331, + "maxMedConc": -0.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 0, + "tmpi": 42, + "m5id": 5037089, + "modl": "poly1", + "hitc": 1.3111515548405657E-6, + "fitc": 13, + "coff": 22.580807579809964, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 0.7781512503836436, + 1.3010299956639813, + -0.6989700043360187, + -1.6989700043360187, + 1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + -1.154901959985743 + ], + "resp": [ + -10.497225111686998, + -8.271301702212094, + 5.412234762165331, + -0.5697089223331855, + -5.4107315723966085, + -1.152645914630851, + -9.935332776150975, + 0.5697089223331855 + ] + }, + "mc4Param": { + "pow_a": 5.868021963410569E-8, + "pow_p": 0.31010469927487905, + "exp2_a": 0.00000820221770260021, + "exp2_b": 63.67412912081, + "exp3_a": 0.000015100154689265508, + "exp3_b": 66.7682650559194, + "exp3_p": 4.045012130124175, + "exp5_p": 2.5184566900851344, + "gnls_p": 1.004146220375644, + "gnls_q": 7.988324375445398, + "hill_p": 2.638717782813107, + "pow_er": 1.748991997794754, + "cnst_er": 1.749320687470586, + "exp2_er": 1.7502584913338175, + "exp3_er": 1.7494323994898786, + "exp4_er": 1.7493097643658628, + "exp4_ga": 3.3432891621411227, + "exp4_tp": 3.7125542218244536E-10, + "exp5_er": 1.7493111824172694, + "exp5_ga": 3.185722315810508, + "exp5_tp": 5.594093755272163E-10, + "gnls_er": 1.7165456563641568, + "gnls_ga": 0.015706640010627146, + "gnls_la": 0.4966875709539269, + "gnls_tp": 2.580846160887361, + "hill_er": 1.749345944481645, + "hill_ga": 33.73657111465509, + "hill_tp": 4.159714315410043E-9, + "poly1_a": 2.671599719093895E-11, + "poly2_a": 0.000005233244887677393, + "poly2_b": 60.3011801386689, + "pow_aic": 59.65799055310836, + "pow_cov": 1, + "pow_rme": 6.498682968118529, + "pow_top": 1.9740143842658864E-7, + "all_bmed": 0, + "cnst_aic": 55.65798921703397, + "cnst_rme": 6.498682892070479, + "exp2_aic": 59.65800315845096, + "exp2_cov": 1, + "exp2_rme": 6.4986846045958355, + "exp2_top": 0.000009784846486708034, + "exp3_aic": 61.657991223897305, + "exp3_cov": 1, + "exp3_rme": 6.4986834826679445, + "exp3_top": 0.00000549637162559571, + "exp4_aic": 59.65798921968127, + "exp4_cov": 1, + "exp4_rme": 6.498682892244033, + "exp4_top": 3.7125542218244536E-10, + "exp5_aic": 61.65798921951322, + "exp5_cov": 1, + "exp5_rme": 6.498682892347669, + "exp5_top": 5.594093755272163E-10, + "gnls_aic": 65.24298472190893, + "gnls_cov": 1, + "gnls_rme": 6.371147760432374, + "gnls_top": 2.422030692633518, + "hill_aic": 61.65798922272976, + "hill_cov": 1, + "hill_rme": 6.498682892532436, + "hill_top": 4.159714315410043E-9, + "poly1_er": 1.7493384697041403, + "poly2_er": 1.749869269967504, + "pow_a_sd": null, + "pow_ac50": 5.348516727471637, + "pow_p_sd": null, + "all_onesd": 6.885946392795786, + "exp2_a_sd": null, + "exp2_ac50": 29.786661402010136, + "exp2_b_sd": null, + "exp3_a_sd": null, + "exp3_ac50": 42.90853049989956, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 3.3432891621411227, + "exp5_ac50": 3.185722315810508, + "exp5_p_sd": null, + "gnls_ac50": 0.013892709273921892, + "gnls_p_sd": null, + "gnls_q_sd": null, + "hill_ac50": 33.73657111465509, + "hill_p_sd": null, + "poly1_aic": 57.65798921945516, + "poly1_cov": 1, + "poly1_rme": 6.49868289233687, + "poly1_top": 1.335799859546947E-9, + "poly2_aic": 59.65799619491047, + "poly2_cov": 1, + "poly2_rme": 6.498684235032681, + "poly2_top": 0.000007937241563467504, + "pow_er_sd": null, + "exp2_er_sd": null, + "exp3_er_sd": null, + "exp4_er_sd": null, + "exp4_ga_sd": null, + "exp4_tp_sd": null, + "exp5_er_sd": null, + "exp5_ga_sd": null, + "exp5_tp_sd": null, + "gnls_er_sd": null, + "gnls_ga_sd": null, + "gnls_la_sd": null, + "gnls_tp_sd": null, + "hill_er_sd": null, + "hill_ga_sd": null, + "hill_tp_sd": null, + "poly1_a_sd": 0.32379470628075435, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": null, + "poly2_ac50": 30.40176401368837, + "poly2_b_sd": null, + "poly1_er_sd": 0.7320994661619505, + "poly2_er_sd": null, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 0.5007494385640836 + }, + "mc5Param": { + "a": 2.671599719093895E-11, + "er": 1.7493384697041403, + "ac5": 2.4999999999999996, + "bmd": 347699605501.9814, + "bmr": 9.289141683881516, + "mll": -26.82899460972758, + "top": 1.335799859546947E-9, + "ac10": 4.999999999999999, + "ac20": 9.999999999999998, + "ac50": 24.999999999999996, + "bmdl": 108.3553281419698, + "rmse": 6.49868289233687, + "ac1sd": 257746186435.86465, + "caikwt": 0.7310585788680222, + "hitcall": 0.0000013111515548405657, + "top_over_cutoff": 5.915642542126427E-11 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability", + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 9, + 13 + ] + } + }, + { + "aeid": 714, + "m4id": 1847540, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 4.065604241325404, + "respMax": 90.80446870746331, + "respMin": -5.707883228590463, + "maxMean": 90.62049611334439, + "maxMeanConc": 1.6989700043360187, + "maxMed": 90.62049611334439, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 16, + "nrep": 2.0, + "nmedGtbl": 6, + "tmpi": 1280, + "m5id": 5042186, + "modl": "hill", + "hitc": 0.9999999999990554, + "fitc": 42, + "coff": 24.393625447952424, + "actp": null, + "modelType": 2, + "chidRep": 1, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + -0.22184874961635637, + -0.6989700043360187, + 0.7781512503836436, + 0.3010299956639812, + -0.22184874961635637, + -0.6989700043360187, + -1.154901959985743, + 1.3010299956639813, + 0.7781512503836436, + 1.3010299956639813, + 0.3010299956639812, + -1.154901959985743, + -1.6989700043360187, + 1.6989700043360187, + -1.6989700043360187, + 1.6989700043360187 + ], + "resp": [ + 23.65294390222711, + 14.242737988357604, + 72.43005879116106, + 46.484959502640294, + 55.886726620789105, + 28.84492825461404, + 5.707883228590464, + 88.63403737583766, + 80.03489098177559, + 80.0297093264599, + 74.69438203693808, + 3.5586226430884302, + -5.707883228590463, + 90.80446870746331, + -3.5586226430884302, + 90.43652351922545 + ] + }, + "mc4Param": { + "pow_a": 32.911138431472224, + "pow_p": 0.3000000797458051, + "exp2_a": 10308.09931192428, + "exp2_b": 4751.077023800089, + "exp3_a": 1269.4299811454289, + "exp3_b": 214861.03156835592, + "exp3_p": 0.30000013149029114, + "exp5_p": 0.7104729913327161, + "gnls_p": 0.955542591689892, + "gnls_q": 7.509065539947891, + "hill_p": 0.9555341491157984, + "pow_er": 2.641957951988852, + "cnst_er": 3.95904849507247, + "exp2_er": 3.4960111520069024, + "exp3_er": 2.6880458922007326, + "exp4_er": 2.098857080265625, + "exp4_ga": 0.7897221222126788, + "exp4_tp": 83.97402405983311, + "exp5_er": 1.9948049077180752, + "exp5_ga": 1.2342906618623586, + "exp5_tp": 87.8897045568669, + "gnls_er": 1.9847399896737128, + "gnls_ga": 1.0031443070703985, + "gnls_la": 557.0432143919979, + "gnls_tp": 91.01391582017716, + "hill_er": 1.9847477692501443, + "hill_ga": 1.003191124397109, + "hill_tp": 91.01447500018872, + "poly1_a": 2.1865425331680353, + "poly2_a": 14664.260556155692, + "poly2_b": 6767.106371403012, + "pow_aic": 141.82653772826615, + "pow_cov": 1, + "pow_rme": 16.068716512669607, + "pow_top": 106.42264340458804, + "all_bmed": 0, + "cnst_aic": 179.848625362541, + "cnst_rme": 58.56882891622411, + "exp2_aic": 169.61132698024198, + "exp2_cov": 1, + "exp2_rme": 38.21336628800247, + "exp2_top": 109.05454587381912, + "exp3_aic": 144.43145465266923, + "exp3_cov": 0, + "exp3_rme": 16.37845865253221, + "exp3_top": 107.50377103361215, + "exp4_aic": 126.23812256465268, + "exp4_cov": 1, + "exp4_rme": 10.334639998161537, + "exp4_top": 83.97402405983311, + "exp5_aic": 125.99404191588884, + "exp5_cov": 1, + "exp5_rme": 10.04248749715944, + "exp5_top": 87.8897045568669, + "gnls_aic": 128.4085145582657, + "gnls_cov": 1, + "gnls_rme": 9.09129189490256, + "gnls_top": 90.40700949566956, + "hill_aic": 124.40851436294564, + "hill_cov": 1, + "hill_rme": 9.09135696458556, + "hill_top": 91.01447500018872, + "poly1_er": 3.4963072277205045, + "poly2_er": 3.4967033306110524, + "pow_a_sd": 5.539590328742932, + "pow_ac50": 4.960631334085256, + "pow_p_sd": 0.05065285664483593, + "all_onesd": 36.16048671325037, + "exp2_a_sd": 58049.23115375191, + "exp2_ac50": 25.065774256310934, + "exp2_b_sd": 26637.78941676024, + "exp3_a_sd": null, + "exp3_ac50": 5.304622230963994, + "exp3_b_sd": null, + "exp3_p_sd": null, + "exp4_ac50": 0.7897221222126788, + "exp5_ac50": 1.2342906618623586, + "exp5_p_sd": 0.11448338011960948, + "gnls_ac50": 0.9892404145079376, + "gnls_p_sd": 0.19605463854823008, + "gnls_q_sd": 4028.2837050226367, + "hill_ac50": 1.003191124397109, + "hill_p_sd": 0.1960536175489813, + "poly1_aic": 167.57928052693967, + "poly1_cov": 1, + "poly1_rme": 38.170211145924405, + "poly1_top": 109.32712665840177, + "poly2_aic": 169.62385203407865, + "poly2_cov": 1, + "poly2_rme": 38.225046010433935, + "poly2_top": 109.15012495603122, + "pow_er_sd": 0.22682743340833847, + "exp2_er_sd": 0.22434251903225583, + "exp3_er_sd": null, + "exp4_er_sd": 0.23345662340053935, + "exp4_ga_sd": 0.2852253940608193, + "exp4_tp_sd": 3.843251237417471, + "exp5_er_sd": 0.26681973494160827, + "exp5_ga_sd": 0.3934957270117465, + "exp5_tp_sd": 4.10415190766761, + "gnls_er_sd": 0.2447595646202884, + "gnls_ga_sd": 0.4933082047260317, + "gnls_la_sd": 720123.8796452188, + "gnls_tp_sd": 6.100726679795194, + "hill_er_sd": 0.24476191439739545, + "hill_ga_sd": 0.49331894680155614, + "hill_tp_sd": 6.10085139691297, + "poly1_a_sd": 0.45742366357273334, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 70563.77452581785, + "poly2_ac50": 25.091679894774504, + "poly2_b_sd": 32307.63616776071, + "poly1_er_sd": 0.22427708068428584, + "poly2_er_sd": 0.22436205738666837, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 557.6818189423375 + }, + "mc5Param": { + "p": 0.9555341491157984, + "er": 1.9847477692501443, + "ga": 1.003191124397109, + "tp": 91.01447500018872, + "ac5": 0.04603871449945376, + "acc": 0.3505460195302733, + "bmd": 1.1664879741712382, + "bmr": 48.78049657617475, + "mll": -58.20425718147282, + "top": 91.01447500018872, + "ac10": 0.1006318431871514, + "ac20": 0.23512931816587768, + "ac50": 1.003191124397109, + "bmdl": 0.7135391211625854, + "bmdu": 1.7796567328157402, + "rmse": 9.09135696458556, + "ac1sd": 0.6486166660027173, + "caikwt": 9.148141181839124E-13, + "hitcall": 0.9999999999990554, + "top_over_cutoff": 3.7310761860463177 + }, + "mc6Param": { + "flag": [ + "Bmd > ac50, indication of high baseline variability" + ], + "mc6MthdId": [ + 9 + ] + } + }, + { + "aeid": 719, + "m4id": 1850045, + "spid": "TP0000904H05", + "chid": 45232, + "casn": "51-24-1", + "chnm": "Tiratricol", + "dtxsid": "DTXSID2045232", + "bmad": 4.036116152450091, + "respMax": 107.21526582248697, + "respMin": -2.7450872741675525, + "maxMean": 107.21526582248697, + "maxMeanConc": 1.6989700043360187, + "maxMed": 107.21526582248697, + "maxMedConc": 1.6989700043360187, + "logcMax": 1.6989700043360187, + "logcMin": -1.6989700043360187, + "nconc": 8, + "npts": 8, + "nrep": 1.0, + "nmedGtbl": 5, + "tmpi": 907, + "m5id": 5044691, + "modl": "hill", + "hitc": 0.9999985006475061, + "fitc": 42, + "coff": 24.21669691470054, + "actp": null, + "modelType": 2, + "chidRep": 0, + "stkc": 20.0, + "stkcUnit": "mM", + "testedConcUnit": "uM", + "mc3Param": { + "logc": [ + 1.6989700043360187, + -0.22184874961635637, + 0.3010299956639812, + -1.6989700043360187, + 0.7781512503836436, + 1.3010299956639813, + -0.6989700043360187, + -1.154901959985743 + ], + "resp": [ + 107.21526582248697, + 30.195960015843077, + 23.92147481774581, + -2.7450872741675525, + 70.82325167352285, + 87.60749957843302, + 6.666640522978341, + 2.745087274167552 + ] + }, + "mc4Param": { + "pow_a": 26.38188579595087, + "pow_p": 0.373321688144596, + "exp2_a": 10555.066230255175, + "exp2_b": 4397.549085127513, + "exp3_a": 784.0385960885498, + "exp3_b": 12122.72093512508, + "exp3_p": 0.3638067662358064, + "exp5_p": 0.6706734088210354, + "gnls_p": 0.7940478448675982, + "gnls_q": 4.635795527795299, + "hill_p": 0.7940457988465808, + "pow_er": 2.233770712846338, + "cnst_er": 3.823652826194619, + "exp2_er": 3.112037332406609, + "exp3_er": 2.2207623331779267, + "exp4_er": 1.9257018004052453, + "exp4_ga": 3.8261863681864567, + "exp4_tp": 101.17371650605573, + "exp5_er": 1.851583883281417, + "exp5_ga": 4.388513514529561, + "exp5_tp": 108.53396863931586, + "gnls_er": 1.763196258086566, + "gnls_ga": 5.230735872271651, + "gnls_la": 3728.9702818099768, + "gnls_tp": 123.23260400266716, + "hill_er": 1.7632048386470296, + "hill_ga": 5.230720817485771, + "hill_tp": 123.23247985508776, + "poly1_a": 2.4157216564524493, + "poly2_a": 14475.570423248031, + "poly2_b": 6050.547391426295, + "pow_aic": 66.99572995533279, + "pow_cov": 1, + "pow_rme": 10.165270166462872, + "pow_top": 113.64967185920248, + "all_bmed": 0, + "cnst_aic": 89.66837566455231, + "cnst_rme": 56.71162606585343, + "exp2_aic": 82.18838027457493, + "exp2_cov": 1, + "exp2_rme": 27.76912571036805, + "exp2_top": 120.69563618612736, + "exp3_aic": 69.31400616583988, + "exp3_cov": 1, + "exp3_rme": 10.392779268529251, + "exp3_top": 113.91588681399294, + "exp4_aic": 63.470739630590785, + "exp4_cov": 1, + "exp4_rme": 8.85897961514353, + "exp4_top": 101.17371650605573, + "exp5_aic": 63.473426195943134, + "exp5_cov": 1, + "exp5_rme": 7.367611470284465, + "exp5_top": 108.53396863931586, + "gnls_aic": 66.84742309100423, + "gnls_cov": 1, + "gnls_rme": 7.41641546707749, + "gnls_top": 121.09148833061737, + "hill_aic": 62.84742306797685, + "hill_cov": 1, + "hill_rme": 7.41641875777227, + "hill_top": 123.23247985508776, + "poly1_er": 3.1106053488018537, + "poly2_er": 3.114821770788662, + "pow_a_sd": 5.3252399545122096, + "pow_ac50": 7.809343150454362, + "pow_p_sd": 0.056051948310051315, + "all_onesd": 11.631725174057522, + "exp2_a_sd": 62396.56299440558, + "exp2_ac50": 25.07106192806109, + "exp2_b_sd": 25839.769114659568, + "exp3_a_sd": 1271.834084672146, + "exp3_ac50": 8.152864786253309, + "exp3_b_sd": 47172.61248160081, + "exp3_p_sd": 0.060040388923249574, + "exp4_ac50": 3.8261863681864567, + "exp5_ac50": 4.388513514529561, + "exp5_p_sd": 0.1399475195939742, + "gnls_ac50": 5.006742473448925, + "gnls_p_sd": 0.1854347139300874, + "gnls_q_sd": 6795.493494626446, + "hill_ac50": 5.230720817485771, + "hill_p_sd": 0.1854307163440282, + "poly1_aic": 80.15930580117441, + "poly1_cov": 1, + "poly1_rme": 27.713999426199813, + "poly1_top": 120.78608282262245, + "poly2_aic": 82.20131097823085, + "poly2_cov": 1, + "poly2_rme": 27.795630326649007, + "poly2_top": 120.61051231658656, + "pow_er_sd": 0.2974052783401845, + "exp2_er_sd": 0.33465921260039705, + "exp3_er_sd": 0.29489066888069415, + "exp4_er_sd": 0.3357623948715002, + "exp4_ga_sd": 0.8745068218026666, + "exp4_tp_sd": 7.947871781710462, + "exp5_er_sd": 0.3159497283524588, + "exp5_ga_sd": 1.9622995568669583, + "exp5_tp_sd": 10.681406923273569, + "gnls_er_sd": 0.3405846164664119, + "gnls_ga_sd": 3.020438938884526, + "gnls_la_sd": 23405695.431429833, + "gnls_tp_sd": 17.604579650183712, + "hill_er_sd": 0.34058479447409523, + "hill_ga_sd": 3.020385246373638, + "hill_tp_sd": 17.60426841589827, + "poly1_a_sd": 0.46291777018798136, + "poly1_ac50": 24.999999999999996, + "poly2_a_sd": 72067.05274661083, + "poly2_ac50": 25.102448102487468, + "poly2_b_sd": 29880.417835129876, + "poly1_er_sd": 0.33437412905907915, + "poly2_er_sd": 0.33496016443302623, + "pow_success": 1, + "cnst_success": 1, + "exp2_success": 1, + "exp3_success": 1, + "exp4_success": 1, + "exp5_success": 1, + "gnls_success": 1, + "hill_success": 1, + "poly1_success": 1, + "poly2_success": 1, + "gnls_ac50_loss": 3748.429832774264 + }, + "mc5Param": { + "p": 0.7940457988465808, + "er": 1.7632048386470296, + "ga": 5.230720817485771, + "tp": 123.23247985508776, + "ac5": 0.1282724896705554, + "acc": 0.887855091317106, + "bmd": 0.46326275977400544, + "bmr": 15.691197259803596, + "mll": -27.423711533988424, + "top": 123.23247985508776, + "ac10": 0.3287108931871063, + "ac20": 0.9127320943550252, + "ac50": 5.230720817485771, + "bmdl": 0.33623832625756866, + "bmdu": 0.651275873448465, + "rmse": 7.41641875777227, + "ac1sd": 0.3032690510690583, + "caikwt": 0.0000014993516184967038, + "hitcall": 0.999998500647506, + "top_over_cutoff": 5.088740231136994 + }, + "mc6Param": { + "flag": [ + "Average number of replicates per conc is less than 2" + ], + "mc6MthdId": [ + 13 + ] + } + } +] diff --git a/vignettes/css/rmdformats.css b/vignettes/css/rmdformats.css new file mode 100644 index 00000000..920b3a05 --- /dev/null +++ b/vignettes/css/rmdformats.css @@ -0,0 +1,165 @@ +@media screen and (max-width: 1000px) { + .tablet-hide { + display: none; + } + + #content { + margin-left: 0; + padding: 1em; + } + + #content.shift { + position: relative; + min-width: 100%; + left: 300px; + top: 0; + height: 100%; + overflow: hidden; + } + + #sidebar { + font-size: 120%; + left: -300px; + width: 300px; + } + + #content.shift #sidebar { + font-size: 120%; + left: 0; + width: 300px; /* was 75% */ + } + #nav-top { + display: inline-block; + } + #postamble { + left: -300px; + } + #postamble.shift { + font-size: 90%; /* was 110%*/ + left: 0; + width: 100%; /* was 75%*/ + } + #main .nav-pills { + margin-left: 0px; + } + #main .nav-pills li { + margin-left: 10px !important; + } + #main .nav-pills > li > a { + padding: 2px 8px !important; + margin-right: 0px !important; + } +} + +#content { + max-width: 850px; +} + +@media (min-width: 1450px) { + #content { + width: 1150px; + margin: 0 auto; + } + + #sidebar { + position: fixed; + left: 50%; + width: 300px; + transform: translateX(-725px); + } +} + +@media screen and (max-width: 768px) { + img { + max-width: 100%; + width: auto; + } +} + +/* colors */ + +:root { + --light-tone: #a6b5c6; + --pale-tone: #5a7b9c; + --strong-tone: #003366; + --brighter-tone: #303f9f; + --light-gray: #f6f6f6; +} +div.sourceCode::before { + content: "Code [" counter(counter-rchunks) "]: "; + display: inline; + position: absolute; + left: -5em; + font-size: 0.7em; + color: var(--brighter-tone); +} +#nav-top span.glyphicon { + color: var(--pale-tone); +} +#postamble { + background: var(--pale-tone); + border-top: solid 10px var(--pale-tone); +} +#postamble .date { + color: white; +} +.title { + text-align: center; + color: var(--strong-tone); +} +.subtitle { + color: var(--strong-tone); +} +h1, +h2, +h3, +h4, +h5, +h6, +legend { + color: var(--pale-tone); +} +#main :not(.leaflet-control) > a { + color: var(--pale-tone); + background-image: var(--pale-tone); +} +#sidebar h2 { + background-color: var(--pale-tone); +} +#main .nav-pills > li.active > a, +#main .nav-pills > li.active > a:hover, +#main .nav-pills > li.active > a:focus { + background-color: var(--pale-tone); +} +#sidebar #toc, +#sidebar { + background-color: var(--light-gray); + color: black; +} +#sidebar #toc ul li a:hover { + background-color: var(--light-tone); + color: white; +} +# toc ul.nav li.active ul li.active a { + background-color: var(--light-tone); +} +code { + color: var(--strong-tone); +} +#sidebar a { + color: black; +} + +.scroll-100 { + max-height: 100px; + overflow-y: auto; +} + +.noticebox { + padding: 1em; + background: lightgray; + color: blue; + border: 2px solid black; + border-radius: 10px; +} + diff --git a/vignettes/img/API_plot_1847540.jpg b/vignettes/img/API_plot_1847540.jpg new file mode 100644 index 00000000..fa8600e6 Binary files /dev/null and b/vignettes/img/API_plot_1847540.jpg differ diff --git a/vignettes/img/API_plot_704.png b/vignettes/img/API_plot_704.png new file mode 100644 index 00000000..da9117ee Binary files /dev/null and b/vignettes/img/API_plot_704.png differ diff --git a/vignettes/img/API_plot_compare.png b/vignettes/img/API_plot_compare.png new file mode 100644 index 00000000..de1c718d Binary files /dev/null and b/vignettes/img/API_plot_compare.png differ diff --git a/vignettes/img/API_plot_standalone.png b/vignettes/img/API_plot_standalone.png new file mode 100644 index 00000000..69aea4d4 Binary files /dev/null and b/vignettes/img/API_plot_standalone.png differ diff --git a/vignettes/img/CCD_BPA_Bioactivity_ToxCast_BOTTOM.png b/vignettes/img/CCD_BPA_Bioactivity_ToxCast_BOTTOM.png new file mode 100644 index 00000000..f4c676e2 Binary files /dev/null and b/vignettes/img/CCD_BPA_Bioactivity_ToxCast_BOTTOM.png differ diff --git a/vignettes/img/CCD_BPA_Bioactivity_ToxCast_TOP.png b/vignettes/img/CCD_BPA_Bioactivity_ToxCast_TOP.png new file mode 100644 index 00000000..20ac102c Binary files /dev/null and b/vignettes/img/CCD_BPA_Bioactivity_ToxCast_TOP.png differ diff --git a/vignettes/img/Fig1_tcpl_overview.png b/vignettes/img/Fig1_tcpl_overview.png index bb6afe10..6afcbf83 100644 Binary files a/vignettes/img/Fig1_tcpl_overview.png and b/vignettes/img/Fig1_tcpl_overview.png differ diff --git a/vignettes/img/Fig5_fitc_tree_10jul2023.png b/vignettes/img/Fig5_fitc_tree_10jul2023.png index 9dd495fd..c3787b6d 100644 Binary files a/vignettes/img/Fig5_fitc_tree_10jul2023.png and b/vignettes/img/Fig5_fitc_tree_10jul2023.png differ diff --git a/vignettes/img/ccd_seqapass_filter.png b/vignettes/img/ccd_seqapass_filter.png new file mode 100644 index 00000000..6ec79db9 Binary files /dev/null and b/vignettes/img/ccd_seqapass_filter.png differ diff --git a/vignettes/img/output_console.png b/vignettes/img/output_console.png index e338c132..259d3873 100644 Binary files a/vignettes/img/output_console.png and b/vignettes/img/output_console.png differ diff --git a/vignettes/img/output_jpg.jpg b/vignettes/img/output_jpg.jpg index 3a41d81c..e3dff999 100644 Binary files a/vignettes/img/output_jpg.jpg and b/vignettes/img/output_jpg.jpg differ diff --git a/vignettes/img/output_pdf.png b/vignettes/img/output_pdf.png index 22f0f2a1..f50396cb 100644 Binary files a/vignettes/img/output_pdf.png and b/vignettes/img/output_pdf.png differ diff --git a/vignettes/img/plot_compare.png b/vignettes/img/plot_compare.png new file mode 100644 index 00000000..6021808c Binary files /dev/null and b/vignettes/img/plot_compare.png differ diff --git a/vignettes/img/plotplate.png b/vignettes/img/plotplate.png new file mode 100644 index 00000000..235ab28b Binary files /dev/null and b/vignettes/img/plotplate.png differ diff --git a/vignettes/img/sc_output.png b/vignettes/img/sc_output.png new file mode 100644 index 00000000..50e9df23 Binary files /dev/null and b/vignettes/img/sc_output.png differ diff --git a/vignettes/img/sc_plot_compare.png b/vignettes/img/sc_plot_compare.png new file mode 100644 index 00000000..bbc69607 Binary files /dev/null and b/vignettes/img/sc_plot_compare.png differ diff --git a/vignettes/img/schema.png b/vignettes/img/schema.png new file mode 100644 index 00000000..aaf6da21 Binary files /dev/null and b/vignettes/img/schema.png differ diff --git a/vignettes/img/tcpl_hex.png b/vignettes/img/tcpl_hex.png new file mode 100644 index 00000000..fed9b385 Binary files /dev/null and b/vignettes/img/tcpl_hex.png differ