toxboot: Main function to sample, fit, and write results to mongoDB

Description Usage Arguments Details See Also

View source: R/toxboot.R

Description

toxboot is the main function that performs the bootstrap sampling, fitting, and writing to the database

Usage

1
2
toxboot(dat, m4id, boot_method, replicates = 100, concvals = F,
  destination = "memory", table_name = "toxboot")

Arguments

dat

A data.table typically generated with toxbootQueryToxCast. Required columns are:

  • logc: numeric, contains concentrations

  • resp: numeric, normalized response values

  • m3id: numeric, value unique to each row corresponding to an individual concentration and response

  • m4id: numeric, value unique to an aeid/spid pair. Multiple m3ids per m4id

  • aeid: numeric, assay id

  • spid: character, sample ID

  • bmad: numeric, baseline mad. Unique to an aeid.

m4id

numeric length 1, m4id to bootstrap. Choice of m4id will determine which rows are selected, and therefore the values of logc, resp, m3id, aeid, spid, and bmad.

boot_method

parameter passed to toxbootReplicates to determine sampling method

replicates

number of bootstrap samples. Default 100

concvals

logical, default is FALSE. If TRUE, dose response samples written to the database as well.

destination

string length 1, options are "mongo", "mysql", "file", "memory"

table_name

string length 1, the name of the MySQL table to write results to. Default is "toxboot". The table can be erased and configured used toxbootMysqlCreateTable

Details

toxboot is the workhorse function of this package. This function will typically be wrapped in a mclapply to perform in parallel using toxbootmc. The dose response data is passed to toxbootReplicates. The returned matrix is passed to tcplFit.

There are multiple options for saving the results, based on the value of destination.

mongo

If destination is set to "mongo" a connection to the mongo database will be created and the results will be written using the mongolite package. The connection will be established using the parameters retrieved using toxbootConfList by the function toxbootConnectMongo. See the documentation on these functions as well as toxbootConf for how to properly setup the MongoDB environment. For large scale screening of uncertainty parameters it is recommended that MongoDB be used for performance and scaling.

mysql

Authentication and connection parameters are handled using a MySQL configuration file as recommended by the 'RMySQL' package. This file can be used to maintain all of your MySQL parameters, which can then be accessed by name.

If the table toxboot has not already been setup or has been setup incorrectly, execute function toxbootMysqlCreateTable which will drop the table if it exists and create a new table with the correct columns.

file

A directory toxboot/ will be created. A csv file for each m4id will be created with name set to the value of m4id. The format of the file will be tabular with one row for each bootstrap replicate. Subsequent runs will be appended onto the file. This way further bootstrap results can be created without loss of previous computational work. Note that the file size can get quite large if many curves are run. With 1000 replicates the file size will typically range from 300 to 600 KB per m4id.

memory

Results will be returned as a single data.table. This is a reasonable option for checking a few curves or even an entire assay with 1000 replicates if a suitable amount of memory is available. Care must be taken as the resulting data.table can become multiple GB in memory.

See Also

toxbootReplicates


toxboot documentation built on Nov. 26, 2018, 1:04 a.m.