aggregated {opm}R Documentation

Get aggregated data

Description

Get the aggregated kinetic data or the aggregation settings used. (See do_aggr for generating aggregated data.)

Usage

  ## S4 method for signature 'MOPMX'
aggr_settings(object, join = NULL) 
  ## S4 method for signature 'OPMA'
aggr_settings(object, join = NULL) 
  ## S4 method for signature 'OPMS'
aggr_settings(object, join = NULL) 

  ## S4 method for signature 'MOPMX'
aggregated(object, ...) 
  ## S4 method for signature 'OPMA'
aggregated(object, subset = NULL, ci = TRUE,
    trim = c("no", "full", "medium"), full = FALSE, in.parens = TRUE,
    max = opm_opt("max.chars"), ...) 
  ## S4 method for signature 'OPMS'
aggregated(object, ...) 

Arguments

object

OPMA, OPMS or MOPMX object.

subset

Character vector. If not NULL, restrict to this or these parameter(s). See param_names for the possible values.

ci

Logical scalar. Include the estimates of confidence intervals (CIs) in the output?

trim

Character scalar. Parameter estimates from intrinsically negative reactions (i.e., no respiration) are sometimes biologically unreasonable because they are too large or too small, and some corrections might be appropriate.

no

No modification.

full

Negative lambda estimates are set to zero.

medium

Lambda estimates larger than hours(object) (i.e., the maximum time value observed) are set to that value. Negative lambda estimates smaller than -hours(object) are set to this value (i.e., the negative maximum time).

full

Like ‘medium’, but all negative values are set to zero, which is a less moderate treatment.

Currently the other parameters are not checked, and all NA values, if any, also remain unchanged.

full

Logical scalar passed to wells. This and the following arguments affect the column names of the resulting matrix.

in.parens

Logical scalar also passed to that function.

max

Numeric scalar also passed to that function.

join

Empty or character scalar. If empty, a list is returned; a nested list in the case of OPMS objects with one contained list per plate. Otherwise this nested list is converted to a matrix or data frame, depending on the value of join. The following values yield a matrix in character mode and differ in how they would convert non-scalar values in a matrix in list mode, if encountered:

json

Converts to a JSON string.

yaml

Converts to a YAML string.

rcode

Converts by deparsing, yielding an R code string.

All other values of join are passed as what argument to the collect method form the pkgutils package, with dataframe and keep.unnamed set to TRUE but stringsAsFactors to FALSE.

...

Optional arguments passed between the methods or to wells.

Details

Note that the conversion of the settings list to a matrix or data frame might not work for all combinations of object and join, mainly because the options entry can hold arbitrary content. For similar conversions of the metadata, see the OPMX methods of to_metadata.

Value

aggregated yields a numeric matrix of aggregated values (a.k.a. the curve parameters). If bootstrapping was used, their CIs are included. The columns represent the wells, the rows the estimated parameters and their CIs.

aggr_settings returns a named list if join is empty. Other values yield a matrix or data frame (or an error). See the description of the argument above and the examples below for further details.

See Also

Other getter-functions: anyDuplicated, anyNA, contains, csv_data, dim, disc_settings, discretized, duplicated, has_aggr, has_disc, hours, max, measurements, minmax, seq, subset, thin_out, well

Examples

# 'OPMA' methods
# Get full matrix
(x <- aggregated(vaas_1))[, 1:3]
##                          A01           A02           A03
## mu                  4.070829     7.5624410    16.4848300
## lambda             18.523010     0.5628715     1.7110130
## A                 123.455800   248.1809000   284.0994000
## AUC              8918.137000 18391.5900000 21960.0800000
## mu CI95 low         3.971357     6.4975400    15.1024400
## lambda CI95 low    -7.194295   -33.9691600    -0.7143524
## A CI95 low        122.886200   247.4527000   283.8384000
## AUC CI95 low     8846.238000 18255.3400000 21808.5600000
## mu CI95 high       10.581020    16.4906500    21.9867000
## lambda CI95 high   82.911920    73.6234100     2.6739110
## A CI95 high       125.714400   249.5763000   285.3661000
## AUC CI95 high    8944.920000 18453.3300000 22040.5700000
stopifnot(is.matrix(x), dim(x) == c(12, 96))
(y <- aggregated(vaas_1, full = TRUE))[, 1:3] # full names
##                  A01 (Negative Control) A02 (Dextrin) A03 (D-Maltose)
## mu                             4.070829     7.5624410      16.4848300
## lambda                        18.523010     0.5628715       1.7110130
## A                            123.455800   248.1809000     284.0994000
## AUC                         8918.137000 18391.5900000   21960.0800000
## mu CI95 low                    3.971357     6.4975400      15.1024400
## lambda CI95 low               -7.194295   -33.9691600      -0.7143524
## A CI95 low                   122.886200   247.4527000     283.8384000
## AUC CI95 low                8846.238000 18255.3400000   21808.5600000
## mu CI95 high                  10.581020    16.4906500      21.9867000
## lambda CI95 high              82.911920    73.6234100       2.6739110
## A CI95 high                  125.714400   249.5763000     285.3661000
## AUC CI95 high               8944.920000 18453.3300000   22040.5700000
stopifnot(x == y, nchar(colnames(x)) < nchar(colnames(y)))
# Subsetting
(x <- aggregated(vaas_1, "lambda"))[, 1:3]
##                        A01         A02        A03
## lambda           18.523010   0.5628715  1.7110130
## lambda CI95 low  -7.194295 -33.9691600 -0.7143524
## lambda CI95 high 82.911920  73.6234100  2.6739110
stopifnot(is.matrix(x), dim(x) == c(3, 96), any(x < 0))
# Now with lambda correction
(x <- aggregated(vaas_1, "lambda", trim = "full"))[, 1:3]
##                       A01        A02      A03
## lambda           18.52301  0.5628715 1.711013
## lambda CI95 low   0.00000  0.0000000 0.000000
## lambda CI95 high 82.91192 73.6234100 2.673911
stopifnot(is.matrix(x), dim(x) == c(3, 96), !any(x < 0))

# settings
(x <- aggr_settings(vaas_1)) # yields named list
## $method
## [1] "grofit"
## 
## $options
## $options$neg.nan.act
## [1] FALSE
## 
## $options$clean.bootstrap
## [1] TRUE
## 
## $options$suppress.messages
## [1] TRUE
## 
## $options$fit.opt
## [1] "s"
## 
## $options$log.x.gc
## [1] FALSE
## 
## $options$log.y.gc
## [1] FALSE
## 
## $options$interactive
## [1] FALSE
## 
## $options$nboot.gc
## [1] 100
## 
## $options$smooth.gc
## NULL
## 
## $options$smooth.dr
## NULL
## 
## $options$have.atleast
## [1] 6
## 
## $options$parameter
## [1] 9
## 
## $options$log.x.dr
## [1] FALSE
## 
## $options$log.y.dr
## [1] FALSE
## 
## $options$nboot.dr
## [1] 0
## 
## $options$model.type
## [1] "logistic"     "richards"     "gompertz"     "gompertz.exp"
## 
## 
## $software
## [1] "opm"
## 
## $version
## [1] "0.1-0"
stopifnot(is.list(x), !is.null(names(x)))
(x <- aggr_settings(vaas_1, join = "json")) # yields a matrix
##      method  
## [1,] "grofit"
##      options                                                                                                                                                                                                                                                                                                                                                                            
## [1,] "{\"neg.nan.act\":false,\"clean.bootstrap\":true,\"suppress.messages\":true,\"fit.opt\":\"s\",\"log.x.gc\":false,\"log.y.gc\":false,\"interactive\":false,\"nboot.gc\":100,\"smooth.gc\":null,\"smooth.dr\":null,\"have.atleast\":6,\"parameter\":9,\"log.x.dr\":false,\"log.y.dr\":false,\"nboot.dr\":0,\"model.type\":[\"logistic\",\"richards\",\"gompertz\",\"gompertz.exp\"]}"
##      software version
## [1,] "opm"    "0.1-0"
stopifnot(is.matrix(x), is.character(x), nrow(x) == 1)

# 'OPMS' methods
summary(x <- aggregated(vaas_4)) # => one matrix per OPM object
##      Length Class  Mode   
## [1,] 1152   -none- numeric
## [2,] 1152   -none- numeric
## [3,] 1152   -none- numeric
## [4,] 1152   -none- numeric
stopifnot(is.list(x), length(x) == length(vaas_4), sapply(x, is.matrix))

# settings
summary(x <- aggr_settings(vaas_4)) # list of named lists, one per plate
##      Length Class  Mode
## [1,] 4      -none- list
## [2,] 4      -none- list
## [3,] 4      -none- list
## [4,] 4      -none- list
stopifnot(is.list(x), length(x) == length(vaas_4), sapply(x, is.list))
(x <- aggr_settings(vaas_4, join = "yaml")) # matrix, one row per plate
##      method  
## [1,] "grofit"
## [2,] "grofit"
## [3,] "grofit"
## [4,] "grofit"
##      options                                                                                                                                                                                                                                                                                                                          
## [1,] "---\nneg.nan.act: no\nclean.bootstrap: yes\nsuppress.messages: yes\nfit.opt: s\nlog.x.gc: no\nlog.y.gc: no\ninteractive: no\nnboot.gc: 100.0\nsmooth.gc: ~\nsmooth.dr: ~\nhave.atleast: 6.0\nparameter: 9.0\nlog.x.dr: no\nlog.y.dr: no\nnboot.dr: 0.0e+00\nmodel.type:\n- logistic\n- richards\n- gompertz\n- gompertz.exp\n\n"
## [2,] "---\nneg.nan.act: no\nclean.bootstrap: yes\nsuppress.messages: yes\nfit.opt: s\nlog.x.gc: no\nlog.y.gc: no\ninteractive: no\nnboot.gc: 100.0\nsmooth.gc: ~\nsmooth.dr: ~\nhave.atleast: 6.0\nparameter: 9.0\nlog.x.dr: no\nlog.y.dr: no\nnboot.dr: 0.0e+00\nmodel.type:\n- logistic\n- richards\n- gompertz\n- gompertz.exp\n\n"
## [3,] "---\nneg.nan.act: no\nclean.bootstrap: yes\nsuppress.messages: yes\nfit.opt: s\nlog.x.gc: no\nlog.y.gc: no\ninteractive: no\nnboot.gc: 100.0\nsmooth.gc: ~\nsmooth.dr: ~\nhave.atleast: 6.0\nparameter: 9.0\nlog.x.dr: no\nlog.y.dr: no\nnboot.dr: 0.0e+00\nmodel.type:\n- logistic\n- richards\n- gompertz\n- gompertz.exp\n\n"
## [4,] "---\nneg.nan.act: no\nclean.bootstrap: yes\nsuppress.messages: yes\nfit.opt: s\nlog.x.gc: no\nlog.y.gc: no\ninteractive: no\nnboot.gc: 100.0\nsmooth.gc: ~\nsmooth.dr: ~\nhave.atleast: 6.0\nparameter: 9.0\nlog.x.dr: no\nlog.y.dr: no\nnboot.dr: 0.0e+00\nmodel.type:\n- logistic\n- richards\n- gompertz\n- gompertz.exp\n\n"
##      software version
## [1,] "opm"    "0.1-0"
## [2,] "opm"    "0.1-0"
## [3,] "opm"    "0.1-0"
## [4,] "opm"    "0.1-0"
stopifnot(is.matrix(x), is.character(x), nrow(x) == 4)

[Package opm version 1.3.63 Index]