plates {opm} | R Documentation |
Get all plates
contained in an OPMS
object or a list, or create a list containing a single
OPM
object as element, or apply a function
to a collection of OPM
objects.
## S4 method for signature 'MOPMX' oapply(object, fun, ..., simplify = TRUE) ## S4 method for signature 'OPM' oapply(object, fun, ..., simplify = TRUE) ## S4 method for signature 'OPMS' oapply(object, fun, ..., simplify = TRUE) ## S4 method for signature 'MOPMX' plates(object) ## S4 method for signature 'WMD' plates(object) ## S4 method for signature 'WMDS' plates(object) ## S4 method for signature 'list' plates(object)
object |
|
fun |
A function. Should accept an |
... |
Optional other arguments passed to
|
simplify |
Logical scalar. If |
The list method of plates
traverses the input
recursively and skips all objects of other classes than
OPM
. See also opms
, which is
somewhat similar but more flexible.
oapply
applies a function to all OPM
objects within an OPMS
object. Optionally
it simplifies the result to an OPMS
object
if possible, or other structures simpler than a list. The
OPM
method of oapply
simply applies
fun
once (to object
).
For plates
, a list of OPM
objects
(may be empty instead if object
is a list). The
result of oapply
depends on fun
and
simplify
: a list, vector, matrix or
OPMS
object are possible outcomes.
base::list base::as.list base::sapply
Other conversion-functions: as.data.frame
,
extract
, extract_columns
,
flatten
, merge
,
opmx
, rep
, rev
,
sort
, split
,
to_yaml
, unique
# plates(), 'OPM' method
summary(x <- plates(vaas_1)) # => list of OPM objects
## Length Class Mode
## [1,] 1 OPMD S4
stopifnot(is.list(x), length(x) == 1L, sapply(x, inherits, what = "OPM"))
# plates(), 'OPMS' method
summary(x <- plates(vaas_4)) # => list of OPM objects
## Length Class Mode
## [1,] 1 OPMD S4
## [2,] 1 OPMD S4
## [3,] 1 OPMD S4
## [4,] 1 OPMD S4
stopifnot(is.list(x), length(x) == 4L, sapply(x, inherits, what = "OPM"))
# plates(), list method
x <- list(vaas_1, letters, vaas_4, 1:10)
summary(x <- plates(x)) # => list of OPM objects
## Length Class Mode
## [1,] 1 OPMD S4
## [2,] 1 OPMD S4
## [3,] 1 OPMD S4
## [4,] 1 OPMD S4
## [5,] 1 OPMD S4
stopifnot(is.list(x), length(x) == 5, sapply(x, inherits, what = "OPM"))
## oapply()
summary(x <- oapply(vaas_4, identity)) # trivial
## 1
## Class OPMD
## From file ./E. coli DSM
## 18039_vim10_12B__1_28_PMX_0_8#30#2010_E_12B_5.csv
## Hours measured 95.75
## Number of wells 96
## Plate type Gen III
## Position 12-B
## Setup time 8/30/2010 1:19:11 PM
## Metadata 5
## Aggregated TRUE
## Discretized TRUE
##
## 2
## Class OPMD
## From file ./E. coli DSM
## 30083T_vim10_7B__1_28_PMX_0_8#30#2010_F_
## 7B_5.csv
## Hours measured 95.75
## Number of wells 96
## Plate type Gen III
## Position 7-B
## Setup time 8/30/2010 1:53:08 PM
## Metadata 5
## Aggregated TRUE
## Discretized TRUE
##
## 3
## Class OPMD
## From file ./P. aeruginosa DSM
## 1707_vim10_17B__1_28_PMX_0_8#30#2010_D_17B_5.csv
## Hours measured 95.75
## Number of wells 96
## Plate type Gen III
## Position 17-B
## Setup time 8/30/2010 12:31:46 PM
## Metadata 5
## Aggregated TRUE
## Discretized TRUE
##
## 4
## Class OPMD
## From file ./P. aeruginosa St.
## 429_vim10_22B__1_28_PMX_0_8#30#2010_C_22B_5.csv
## Hours measured 95.75
## Number of wells 96
## Plate type Gen III
## Position 22-B
## Setup time 8/30/2010 11:28:54 AM
## Metadata 5
## Aggregated TRUE
## Discretized TRUE
##
## => OPMS object with 4 plates (4 aggregated, 4 discretized) of type 'Gen III', 96 well(s) and about 384 time point(s).
stopifnot(identical(x, vaas_4))
summary(x <- oapply(vaas_4, identity, simplify = FALSE)) # => yields list
## Length Class Mode
## [1,] 1 OPMD S4
## [2,] 1 OPMD S4
## [3,] 1 OPMD S4
## [4,] 1 OPMD S4
stopifnot(is.list(x), length(x) == 4, sapply(x, class) == "OPMD")