Description Usage Arguments Details Value See Also Examples
View source: R/gtoxSubsetChid.R
gtoxSubsetChid
subsets level 5 data to a single tested sample per
chemical. In other words, if a chemical is tested more than once (a chid
has more than one spid) for a given assay endpoint, the function uses a
series of logic to select a single "representative" sample.
1 | gtoxSubsetChid(dat, flag = TRUE)
|
dat |
data.table, a data.table with level 5 data |
flag |
Integer, the mc6_mthd_id values to go into the flag count, see details for more information |
gtoxSubsetChid
is intended to work with level 5 data that has
chemical and assay information mapped with gtoxPrepOtpt
.
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, then the first sample for every chemical is selected.
The flag
param can be used to specify a subset of flags to be used in
the flag count. Leaving flag
TRUE utilize all the available flags.
Setting flag
to FALSE
will do the subsetting without
considering any flags.
A data.table with a single sample for every given chemical-assay pair.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Store the current config settings, so they can be reloaded at the end
## of the examples
conf_store <- gtoxConfList()
gtoxConfDefault()
## Load the example level 5 data
d1 <- gtoxLoadData(lvl = 5, fld = "aeid", val = 2)
d1 <- gtoxPrepOtpt(d1)
## Subset to an example of a duplicated chid
d2 <- d1[chid == 10]
d2[ , list(m4id, hitc, fitc, modl_ga)]
## Here the consensus hit-call is 1 (active), and the fit categories are
## all equal. Therefore, if the flags are ignored, the selected sample will
## be the sample with the lowest modl_ga.
gtoxSubsetChid(dat = d2, flag = FALSE)[ , list(m4id, modl_ga)]
## Reset configuration
options(conf_store)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.