168
Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions by Lea A.I. Vaas, Benjamin Hofner, Johannes Sikorski, Nora Buddruhs and Anne Fiebig Maintainer Markus Goeker <[email protected]> Depends R (>= 2.10.0), grofit Imports methods, lattice, boot, hwriter, plotrix, pkgutils (>= 0.3-0),Ckmeans.1d.dp, yaml (>= 2.1.5) Suggests multicore, optparse, gplots, opmdata (>= 0.4-0), testthat Description Tools for analysing OmniLog(R) and Microstation Phenotype Microarray (PM) data as produced by the devices distributed by BiOLOG Inc., including plotting, aggregating (estimating curve parameters), comparing and discretizing PM data, creating phylogenetic formats and re- ports for taxonomic journals,integrating metadata, using the YAML format for the storage of data and metadata, and batch conversion of large numbers of files. License GPL (>= 2) URL http://opm.dsmz.de/ Collate ’substrate-info.R’ ’well-map.R’ ’plate- map.R’ ’imports.R’’package.R’ ’constants.R’ ’classes.R’ ’auxiliary.R’ ’kmeans.R’’naming.R’ ’metadata.R’ ’getter.R’ ’conv LazyData yes LazyDataCompression bzip2 Repository CRAN Date/Publication 2013-01-24 08:16:10 NeedsCompilation no 1

Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

Package ‘opm’February 15, 2013

Version 0.8-0

Date 2013-01-23

Title Tools for analysing OmniLog(R) Phenotype Microarray data

Author Markus Goeker, with contributions by Lea A.I. Vaas, BenjaminHofner, Johannes Sikorski, Nora Buddruhs and Anne Fiebig

Maintainer Markus Goeker <[email protected]>

Depends R (>= 2.10.0), grofit

Imports methods, lattice, boot, hwriter, plotrix, pkgutils (>= 0.3-0),Ckmeans.1d.dp, yaml (>= 2.1.5)

Suggests multicore, optparse, gplots, opmdata (>= 0.4-0), testthat

Description Tools for analysing OmniLog(R) and Microstation PhenotypeMicroarray (PM) data as produced by the devices distributed byBiOLOG Inc., including plotting, aggregating (estimating curveparameters), comparing and discretizing PM data, creating phylogenetic formats and re-ports for taxonomic journals,integrating metadata, using the YAML format for the storage ofdata and metadata, and batch conversion of large numbers of files.

License GPL (>= 2)

URL http://opm.dsmz.de/

Collate ’substrate-info.R’ ’well-map.R’ ’plate-map.R’ ’imports.R’’package.R’ ’constants.R’ ’classes.R’ ’auxiliary.R’ ’kmeans.R’’naming.R’ ’metadata.R’ ’getter.R’ ’conversion.R’’combination.R’ ’aggregation.R’ ’discretization.R’ ’plotting.R’’io.R’ ’phylogeny.R’ ’data.R’ ’testing.R’

LazyData yes

LazyDataCompression bzip2

Repository CRAN

Date/Publication 2013-01-24 08:16:10

NeedsCompilation no

1

Page 2: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

2 R topics documented:

R topics documented:aggregated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4aggr_settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5anyDuplicated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6batch_collect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7batch_opm_to_yaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8batch_process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11best_cutoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16calinski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17ci_plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18clean_filenames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20collect_template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21contains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24csv_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25dim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26discrete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27discretized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30disc_settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31do_aggr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32do_disc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35duplicated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38explode_dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41extract_columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42fast_estimate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44filename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45file_pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46find_positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47find_substrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48flatten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49gen_iii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51glob_to_regex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52has_aggr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53has_disc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54heat_map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55hours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58html_args . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59include_metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61kubrick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62level_plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65map_metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66map_names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69map_values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Page 3: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

R topics documented: 3

max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80metadata.set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81metadata_chars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84minmax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86MOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87oapply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87OPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88opm.package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89OPMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90OPMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91OPMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91opms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92OPMX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93opm_files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94opm_opt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95param_names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97phylo_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97plates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103plate_type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107radial_plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108read_opm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110read_single_opm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112rep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113rev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115run_kmeans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116safe_labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118select_colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120separate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121seq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123setup_time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126split_files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128subset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129substrate_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133thin_out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134to_kmeans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135to_metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136to_yaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137unique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139vaas_1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

Page 4: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

4 aggregated

vaas_4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141well . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142wells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143well_to_substrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144WMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145xy_plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146YAML_VIA_LIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149%k% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152%K% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153%Q% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155%q% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

Index 159

aggregated Get aggregated kinetic data

Description

The aggregated values are the curve parameters. If bootstrapping was used, their CIs are included.The columns represent the wells, the rows the estimated parameters and their CIs.

Usage

## S4 method for signature ’OPMA’aggregated(object, subset = NULL, ci = TRUE,

trim = c("no", "full", "medium"))

## S4 method for signature ’OPMS’aggregated(object, ...)

Arguments

object OPMA 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 toolarge or too small. If trim is ‘medium’ or ‘full’, lambda estimates larger thanhours are set to that value. Negative lambda estimates smaller than hours areset to this value if trim is ‘medium’; this is a more moderate treatment thansetting all negative values to zero, which is done if trim is ‘full’. Currently theother parameters are not checked, and all NA values also remain unchanged. Iftrim is ‘no’, lambda is not modified either.

... Optional arguments passed between the methods.

Page 5: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

aggr_settings 5

Value

Numeric matrix.

Note

See do_aggr for generating aggregated data.

See Also

Other getter-functions: aggr_settings, anyDuplicated, csv_data, dim, disc_settings, discretized,duplicated, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPMA’ methoddata(vaas_1)# Get full matrixsummary(x <- aggregated(vaas_1))stopifnot(is.matrix(x), identical(dim(x), c(12L, 96L)))# Subsettingsummary(x <- aggregated(vaas_1, "lambda"))stopifnot(is.matrix(x), identical(dim(x), c(3L, 96L)), any(x < 0))# Now with lambda correctionsummary(x <- aggregated(vaas_1, "lambda", trim = "full"))stopifnot(is.matrix(x), identical(dim(x), c(3L, 96L)), !any(x < 0))

# ’OPMS’ methoddata(vaas_4)summary(x <- aggregated(vaas_4))stopifnot(is.list(x), length(x) == length(vaas_4), sapply(x, is.matrix))

aggr_settings Get aggregation settings

Description

The settings used for aggregating the kinetic data.

Usage

## S4 method for signature ’OPMA’aggr_settings(object)

## S4 method for signature ’OPMS’aggr_settings(object, ...)

Page 6: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

6 anyDuplicated

Arguments

object OPMA object.... Optional arguments passed between the methods.

Value

Named list. See the examples for details.

Note

See do_aggr for generating aggregated data.

See Also

Other getter-functions: aggregated, anyDuplicated, csv_data, dim, disc_settings, discretized,duplicated, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- aggr_settings(vaas_1))stopifnot(is.list(x), !is.null(names(x)))

# ’OPMS’ methoddata(vaas_4)summary(x <- aggr_settings(vaas_4))stopifnot(is.list(x), length(x) == length(vaas_4), sapply(x, is.list))

anyDuplicated Determine whether plates are duplicated

Description

Check whether duplicated OPM or OPMA objects are contained within an OPMS object. For reasons ofconsistency, the OPM method always returns 0.

Usage

## S4 method for signature ’OPM,ANY’anyDuplicated(x, incomparables, ...)

## S4 method for signature ’OPMS,missing’anyDuplicated(x, incomparables, ...)

## S4 method for signature ’OPMS,ANY’anyDuplicated(x, incomparables, ...)

Page 7: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

batch_collect 7

Arguments

x OPMS object.

incomparables Vector passed to duplicated. The default is FALSE.

... Optional arguments passed to duplicated. See the examples.

Value

Integer scalar. 0 if no values are duplicated, the index of the first or last (depending on fromLast)duplicated object otherwise.

See Also

base::anyDuplicated

Other getter-functions: aggr_settings, aggregated, csv_data, dim, disc_settings, discretized,duplicated, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- anyDuplicated(vaas_1))stopifnot(identical(x, 0L))(x <- anyDuplicated(vaas_1, what = list("Strain", "Species")))stopifnot(identical(x, 0L))

# ’OPMS’ methoddata(vaas_4)stopifnot(identical(anyDuplicated(vaas_4), 0L))stopifnot(identical(anyDuplicated(vaas_4, what = list("Strain")), 0L))stopifnot(identical(anyDuplicated(vaas_4, what = list("Species")), 2L))x <- vaas_4[c(1, 1)]stopifnot(identical(anyDuplicated(x), 2L))

batch_collect Collect information from files

Description

Batch-collect information from a series of input files. This is not normally directly called by anopm user because collect_template is available.

Usage

batch_collect(names, fun, fun.args = list(), ...,use.names = TRUE, simplify = FALSE, demo = FALSE)

Page 8: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

8 batch_opm_to_yaml

Arguments

names Character vector with file or directory names, or convertible to such. See explode_dirfor details.

fun Collecting function. Should use the filename as first argument.

fun.args Optional list of arguments to fun.

... Optional further arguments passed to explode_dir.

simplify Logical scalar. Should the resulting list be simplified to a vector or matrix ifpossible?

use.names Logical scalar. Should names be used for naming the elements of the result?

demo Logical scalar. Do not read files, but print a vector with the names of the filesthat would be (attempted to) read, and return them invisibly?

Value

List, potentially simplified to a vector, depending on the output of fun and the value of simplify.See also demo.

See Also

Other IO-functions: batch_opm_to_yaml, batch_process, clean_filenames, collect_template,explode_dir, file_pattern, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

# Read the first line from each of the OPM test dataset filesf <- opm_files("testdata")if (length(f) > 0L) {

x <- batch_collect(f, fun = readLines, fun.args = list(n = 1L))# yields a list with the input files as names and the result from each# file as values (exactly one line)stopifnot(is.list(x), identical(names(x), f))stopifnot(sapply(x, is.character), sapply(x, length) == 1L)

}

batch_opm_to_yaml Batch-convert to YAML

Description

Batch-convert from OmniLog® CSV (or previous opm YAML) to opm YAML. It is possible to addmetadata to each set of raw data and to aggregate the curves; these additional data will then beincluded in the YAML output file.

Page 9: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

batch_opm_to_yaml 9

Usage

batch_opm_to_yaml(names, md.args = NULL,aggr.args = NULL, force.aggr = FALSE, disc.args = NULL,force.disc = FALSE, gen.iii = opm_opt("gen.iii"), ...,verbose = TRUE, demo = FALSE)

Arguments

md.args If not NULL but a list, passed as arguments to include_metadata with the dataread from each individual file as additional argument ‘object’. If NULL, metadataare not included (but may already be present in the case of YAML input).

aggr.args If not NULL but a list, passed as arguments to do_aggr with the data read fromeach individual file as additional argument object. If NULL, aggregation takesnot place (but aggregated data may already be present in case of YAML input).

force.aggr Logical scalar. If FALSE, do not aggregate already aggregated data (which canbe present in YAML input).

disc.args If not NULL but a list, passed as arguments to do_disc with the data read fromeach individual file as additional argument object. If NULL, discretization takesnot place (but discretized data may already be present in case of YAML input).

force.disc Logical scalar. If FALSE, do not discretize already discretized data (which canbe present in YAML input).

... Optional arguments passed to batch_process in addition to verbose and demo.Note that out.ext, fun and fun.args are set automatically.

names Character vector with names of files in one of three formats accepted by read_opm,or names of directories containing such files, or both; or convertible to such avector. See the include argument of read_opm and explode_dir for how toselect subsets from the input files or directories.

gen.iii Logical or character scalar. If TRUE, invoke gen_iii on each plate. This isautomatically done with CSV input if the plate type is given as ‘OTH’ (which isusually the case for plates run in ID mode). If a character scalar, it is used as theto argument of gen_iii to set other plate types unless it is empty.

demo Logical scalar. Do not read files, but print a vector with the names of the filesthat would be (attempted to) read, and return them invisibly?

verbose Logical scalar. Print conversion and success/failure information?

Details

A YAML document can comprise scalars (single values of some type), sequences (ordered collec-tions of some values, without names) and mappings (collections assigning a name to each value), ina variety of combinations (e.g., mappings of sequences). The output of batch_opm_to_yaml is oneYAML document per plate which represents a mapping with the following components (key-valuepairs):

metadata Arbitrarily nested mapping of arbitrary metadata entries. Empty if no metadata havebeen added.

Page 10: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

10 batch_opm_to_yaml

csv_data Non-nested mapping containing the OmniLog® run information read from the input CSVfile (character scalars) together with the measurements. The most important entry is mostlikely the plate type.

measurements A mapping whose values are sequences of floating-point numbers of the samelength and in the appropriate order. The keys are ‘hours’, which refers to the time points,and the well coordinates, ranging between ‘A01’ and ‘H12’.

aggregated A mapping, only present if curve parameters have been estimated. Its keys corre-spond to those of ‘measurements’ with the exception of ‘hours’. The values are themselvesmappings, whose keys indicate the respective curve parameter and whether this is the pointestimate or the upper or lower confidence interval. The values of these secondary mappingsare floating-point numbers.

aggr_settings A mapping, only present if curve parameters have been estimated. Its keys are‘program’ and ‘options’. The value of the former is a character scalar. The value of the latteris an arbitrarily nested mapping with arbitrary content.

Details of the contents should be obvious from the documentation of the classes of the objectsfrom which the YAML output is generated. In the case of YAML input with several plates per file,batch_opm_to_yaml generates YAML output files containing a sequence of mappings as describedabove, one per plate, to keep a 1:1 relationship between input and output files.

Value

The function invisibly returns a matrix which describes each attempted file conversion. See batch_processfor details.

Note

• Regarding the CSV format, see the remark to read_single_opm.

• This function is for batch-converting many files; for writing a single object to a YAML file (orstring), see to_yaml.

• When inputting YAML files generated with the help of the yaml package (on which the opmimplementation is based) using other programming languages, a potential problem is that they,and YAML in general, lack a native representation of NA values. Such entries are likely to bemisunderstood as ‘NA’ character scalars.

• Attempting to generate YAML from input data with a wrong character encoding might causeR to crash or hang. This problem was observed with CSV files that were generated on adistinct operating system and contained special characters such as German umlauts. It isthen necessary to explicitely (and correctly) specify the encoding used in these files; see the‘file.encoding’ option of opm_opt for how to do this.

References

http://www.yaml.org/

http://www.biolog.com/

Page 11: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

batch_process 11

See Also

utils::read.csv yaml::yaml.load_file

Other IO-functions: batch_collect, batch_process, clean_filenames, collect_template,explode_dir, file_pattern, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

test.files <- grep("Multiple", opm_files("testdata"), invert = TRUE,value = TRUE, fixed = TRUE)

if (length(test.files) > 0) {num.files <- length(list.files(outdir <- tempdir()))x <- batch_opm_to_yaml(test.files[1], outdir = outdir)stopifnot(length(list.files(outdir)) == num.files + 1, is.matrix(x))stopifnot(file.exists(x[, "outfile"]))stopifnot(test.files[1] == x[, "infile"])unlink(x[, "outfile"])

}

batch_process Convert infiles to outfiles

Description

Batch-convert data from infiles to data in outfiles. This is not normally directly called by an opmuser because batch_opm_to_yaml is available.

Usage

batch_process(names, out.ext, io.fun, fun.args = list(),proc = 1L, outdir = NULL,overwrite = c("yes", "older", "no"), in.ext = "any",compressed = TRUE, literally = FALSE, ...,verbose = TRUE, demo = FALSE)

Arguments

out.ext Character scalar. The extension of the outfile names (without the dot).

proc Integer scalar. The number of processes to spawn.

outdir Character vector. Directories in which to place the outfiles. If NULL or onlycontaining empty strings, each infile’s directory is used.

in.ext Character scalar. Passed through file_pattern, then used for the replacementof old file extensions with new ones.

compressed Logical scalar. Passed as 2nd argument to file_pattern.

literally Logical scalar. Passed as 3rd argument to file_pattern.

Page 12: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

12 batch_process

demo Logical scalar. Do not convert files, but print the attempted infile-outfile con-versions and invisibly return a matrix with infiles in the first and outfiles in thesecond column?

io.fun Conversion function. Should accept infile and outfile as the first two argu-ments.

fun.args Optional list of further arguments of io.fun.

overwrite Character scalar. If ‘yes’, conversion is always tried if infile exists and is notempty. If ‘no’, conversion is not tried if outfile exists and is not empty. If‘older’, conversion is tried if outfile does not exist or is empty or is older thaninfile (with respect to the modification time).

verbose Logical scalar. Print conversion and success/failure information?

names Character vector with file or directory names, or convertible to such. See explode_dirfor details.

... Optional further arguments passed to explode_dir.

Value

In normal mode, an invisibly returned character matrix in which each row corresponds to a namedcharacter vector with the keys ‘infile’, ‘outfile’, ‘before’ and ‘after’. The latter two describe theresult of the action(s) before and after attempting to convert infile to outfile. ‘after’ is theempty string if no conversion was tried (see overwrite), ‘ok’ if conversion was successful and amessage describing the problems otherwise. For the results of the demo mode see above.

See Also

Other IO-functions: batch_collect, batch_opm_to_yaml, clean_filenames, collect_template,explode_dir, file_pattern, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

# Read the first line from each of the OPM test dataset files and store it# in temporary filespf <- function(infile, outfile) write(readLines(infile, n = 1), outfile)infiles <- opm_files("testdata")if (length(infiles) > 0) {

x <- batch_process(infiles, out.ext = "tmp", io.fun = pf,outdir = tempdir())

stopifnot(is.matrix(x), identical(x[, 1], infiles))stopifnot(file.exists(x[, 2]))unlink(x[, 2])

}

Page 13: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

best_cutoff 13

best_cutoff Determine best cutoff

Description

Determine the best cutoff for dividing a numeric matrix into two categories by minimizing within-group discrepancies. That is, for each combination of row group and column maximize the numberof contained elements that are in the category in which most of the elements within this combinationof row group and column are located.

Usage

## S4 method for signature ’matrix,character’best_cutoff(x, y, ...)

## S4 method for signature ’matrix,factor’best_cutoff(x, y,

combined = TRUE, lower = min(x, na.rm = TRUE),upper = max(x, na.rm = TRUE), all = FALSE)

Arguments

x Numeric matrix.

y Factor or character vector indicating group affiliations. Its length must corre-spond to the number of rows of x.

combined Logical scalar. If TRUE, determine a single threshold for the entire matrix. IfFALSE, determine one threshold for each group of rows of x that corresponds toa level of y.

lower Numeric scalar. Lower bound for the cutoff values to test.

upper Numeric scalar. Upper bound for the cutoff values to test.

all Logical scalar. If TRUE, calculate the score for all possible cutoffs for x. This isslow and is only useful for plotting complete optimization curves.

... Optional arguments passed between the methods.

Details

The scoring function to be maximized is calculated as follows. All values in x are divided intothose larger then the cutoff and those at most large as the cutoff. For each combination of groupand matrix column the frequencies of the two categories are determined, and the respective largerones are summed up over all combinations. This value is then divided by the frequency over theentire matrix of the more frequent of the two categories. This is done to avoid trivial solutions withminimal and maximal cutoffs, causing all values to be placed in the same category.

Page 14: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

14 borders

Value

If combined is TRUE, either a matrix or a vector: If all is TRUE, a two-column matrix with (i) thecutoffs examined and (ii) the resulting scores. If all is FALSE, a vector with the entries ‘maximum’(the best cutoff) and ‘objective’ (the score it achieved). If combined is FALSE, either a list of matricesor a matrix. If all is TRUE, a list of matrices structures like the single matrix returned if combinedis TRUE. If all is FALSE, a matrix with two colums called ‘maximum’ ‘objective’, and one row perlevel of y.

See Also

stats::optimize

Other discretization-functions: discrete, do_disc

Examples

x <- matrix(c(5:2, 1:2, 7:8), ncol = 2)grps <- c("a", "a", "b", "b")

# combined optimization(y <- best_cutoff(x, grps))stopifnot(is.numeric(y), length(y) == 2)stopifnot(y[["maximum"]] < 4, y[["maximum"]] > 3, y[["objective"]] == 2)plot(best_cutoff(x, grps, all = TRUE), type = "l")

# separate optimization(y <- best_cutoff(x, grps, combined = FALSE))stopifnot(is.matrix(y), dim(y) == c(2, 2))stopifnot(y["a", "objective"] == 2, y["b", "objective"] == 2)(y <- best_cutoff(x, grps, combined = FALSE, all = TRUE))plot(y$a, type = "l")plot(y$b, type = "l")

borders Cluster borders

Description

Determine the borders between clusters of one-dimensional data. They are calculated as the meanof the maximum of the cluster with the lower values and the minimum of the neighboring clusterwith the higher values. The hist method plots a histogram of one-dimensional data subjected tok-means partitioning in which these borders can be drawn.

Usage

borders(x, ...)

## S3 method for class ’kmeans’borders(x, y, ...)

Page 15: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

borders 15

## S3 method for class ’Ckmeans.1d.dp’borders(x, y, ...)

## S3 method for class ’kmeanss’borders(x, ...)

## S3 method for class ’kmeans’hist(x, y, col = "black", lwd = 1L,

lty = 1L, main = NULL, xlab = "Clustered values", ...)

## S3 method for class ’Ckmeans.1d.dp’hist(x, y, ...)

## S3 method for class ’kmeanss’hist(x, k = NULL, col = "black",

lwd = 1L, lty = 1L, main = NULL,xlab = "Clustered values", ...)

Arguments

x Object of class ‘kmeans’, ‘Ckmeans.1d.dp’ or ‘kmeanss’.

y Vector of original data subjected to clustering. Automatically determined for the‘kmeanss’ methods.

k Numeric vector or NULL. If non-empty, it indicates the number of groups (previ-ously used as input for kmeans) for which vertical lines should be drawn in theplot that represent the cluster borders. If empty, the smallest non-trivial numberof clusters is chosen.

col Graphical parameter passed to abline. If several values of k are given, col isrecycled as necessary.

lwd Like col.

lty Like col.

main Passed to hist.default.

xlab Passed to hist.default.

... Optional arguments passed to and from other methods. For the hist method,optional arguments passed to hist.default.

Value

Numeric vector or list of such vectors. For the hist method, like hist.default; see there fordetails.

Note

y must also be in the order it has been when subjected to clustering, but this is not checked. Using‘kmeanss’ objects thus might preferable in most cases because they contain a copy of the input data.

Page 16: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

16 c

See Also

graphics::hist graphics::abline

Other kmeans-functions: calinski, plot.kmeanss, run_kmeans, to_kmeans,

Examples

data(vaas_4)x <- as.vector(extract(vaas_4, as.labels = NULL, subset = "A"))x.km <- run_kmeans(x, k = 1:10)

# borders() method(x.b <- borders(x.km))stopifnot(is.list(x.b), length(x.b) == 10, sapply(x, is.numeric))stopifnot(sapply(x.b, length) == as.numeric(names(x.b)) - 1)

# hist() methodsy <- hist(x.km[[2]], x, col = "blue", lwd = 2)stopifnot(inherits(y, "histogram"))y <- hist(x.km, 3:4, col = c("blue", "red"), lwd = 2)stopifnot(inherits(y, "histogram"))

c Combination

Description

Combine a OPM or OPMS object with other objects. If possible, create an OPMS object, otherwisereturn a list.

Usage

## S4 method for signature ’OPMX’c(x, ..., recursive = FALSE)

Arguments

x OPMX object.

... Other R objects.

recursive Logical scalar. See c from the base package.

Value

OPMS object, list, or OPM object (if ... is not given and x is such an object).

Page 17: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

calinski 17

See Also

base::c

Other combination-functions: opms, plus

Examples

data(vaas_1, vaas_4)

# Adding nothingsummary(x <- c(vaas_1))stopifnot(identical(x, vaas_1))summary(x <- c(vaas_4))stopifnot(identical(x, vaas_4))

# Not particularly useful: adding identical plates!summary(x <- c(vaas_1, vaas_1)) # yields a two-plate OPMS objectstopifnot(identical(dim(x), c(2L, dim(vaas_1))))

# Also not particularly useful: adding partially identical plates!summary(x <- c(vaas_4, vaas_1))stopifnot(identical(dim(x), c(5L, dim(vaas_1))))

calinski Calinski-Harabasz statistics

Description

Calculate or plot the Calinski-Harabasz statistics from kmeans results. The result of plot is a simplescatterplot which can be modified with arguments passed to plot from the graphics package.

Usage

calinski(x, ...)

## S3 method for class ’kmeans’calinski(x, ...)

## S3 method for class ’Ckmeans.1d.dp’calinski(x, y, ...)

## S3 method for class ’kmeanss’calinski(x, ...)

## S3 method for class ’kmeanss’plot(x, xlab = "Number of clusters",

ylab = "Calinski-Harabasz statistics", ...)

Page 18: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

18 ci_plot

Arguments

x Object of class ‘kmeans’, ‘Ckmeans.1d.dp’ or ‘kmeanss’. For plot, only thelatter.

xlab Character scalar passed to plot from the graphics package.

ylab Character scalar passed to plot.

... Optional arguments passed to and from other methods, and/or between the meth-ods.

y Original numeric vector that was used to create a ‘Ckmeans.1d.dp’ object, orindex of an element of a ‘kmeanss’ object.

Value

calinksi returns a numeric vector with one element per ‘kmeans’ object. plot returns it invisibly.Its ‘names’ attribute indicates the original numbers of clusters requested.

See Also

Other kmeans-functions: borders, hist.Ckmeans.1d.dp, hist.kmeans, hist.kmeanss, run_kmeans,to_kmeans,

Examples

data(vaas_4)x <- as.vector(extract(vaas_4, as.labels = NULL, subset = "A"))x.km <- run_kmeans(x, k = 1:10)# the usual arguments of plot() are availableshow(y <- plot(x.km, col = "blue", pch = 19))stopifnot(is.numeric(y), names(y) == 1:10)

ci_plot Plot point estimates with CIs

Description

Draw point estimates with their confidence intervals. The data frame method is not normally directlycalled by an opm user but via the OPMS method. This one is used for comparing aggregated valuestogether with their confidence intervals between plates. This method can in most cases not beapplied to entire plates but to selected wells only.

Usage

## S4 method for signature ’data.frame’ci_plot(object, rowname.sep = " ",

prop.offset = 0.04, align = "center", col = "blue", na.action = "warn",draw.legend = TRUE, legend.field = c(1, 1), x = "topleft", xpd = TRUE,vline = 0, ...)

Page 19: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

ci_plot 19

## S4 method for signature ’OPMS’ci_plot(object, as.labels,

subset = opm_opt("curve.param"), ...)

Arguments

object Dataframe or OPMS object. If an OPMS object, it is in most cases necessary torestrict the plates to at most about one dozen wells. See [ for how to achievethis. The data frame should be as exported by extract with ci set to TRUE.There must be a column named ‘Parameter’ followed by columns with onlynumeric values. Columns before the ‘Parameter’ column, if any, are used forgrouping. The rows must entirely comprise triplets representing (i) the pointestimate, (ii) the lower and (iii) the upper confidence interval.

as.labels List. Metadata to be joined and used to draw a legend. Ignored if NULL.

subset Character scalar. The parameter to plot. Only a single one can be selected. Seeparam_names for the options.

rowname.sep Character scalar. Used when joining explanatory columns into row labels of theplots.

prop.offset Numeric scalar. A proportional offset that is added to the vertical range of thepanels (after determining the maximum range among all panels to ensure con-sistency within the plot).

align Character scalar. How to apply the offset; one of ‘center’, ‘left’ and ‘right’.

col Character scalar. Colour to be used.

na.action Character scalar. What to do if a confidence interval contains NA values; one of‘ignore’, ‘warn’ and ‘error’.

draw.legend Logical scalar. Ignored if there are no explanatory columns.

legend.field Two-element numeric vector. Indicates the panel in which the legend is drawn.Subsequent arguments work then relative to this panel. If legend.field hasless then two fields, the number of panels is set to 1 (the entire plot), and thelegend is drawn relative to that.

x Legend position, passed to legend from the graphics package. Ignored unlessdraw.legend is TRUE.

xpd Logical scalar. Also passed to that function.

vline Numeric scalar with the position on the y-axis of a vertical line to be drawn.Ignored if NULL.

... Optional other arguments passed to legend, or arguments passed from the OPMSmethod to the data frame method.

Value

Character vector describing the plot’s legend, returned invisibly.

Page 20: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

20 clean_filenames

Note

• The default placement of the legend is currently not necessarily very useful.

• When plotting entire PM plates, the ‘mar’ parameter of par most likely would need to be setto a lower value, but it is recommended to plot only subsets of plates, i.e. selected wells.

References

Vaas LAI, Sikorski J, Michael V, Goeker M, Klenk H-P. 2012 Visualization and curve parame-ter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoS ONE 7,e34846.

See Also

graphics::plot

Other plotting-functions: heat_map, level_plot, radial_plot, select_colors, show, xy_plot

Examples

data(vaas_4)

x <- ci_plot(vaas_4[, , 1:3], as.labels = list("Species", "Strain"),subset = "A", x = "bottomright", legend.field = NULL)

# note that the values on the y axes are drawn to scalexstopifnot(is.character(x), identical(length(x), 4L))# ... and that the return value contains the legend (even if it is not drawn)

clean_filenames Clean file names

Description

Clean file names by removing anything else then word characters, dashes, and dots. Also removetrailing and leading dashes and underscores (per part of a file name, with dots separating these parts)and reduce adjacent dashes and underscores to a single one. Note that directory parts within the filenames, if any, are not affected.

Usage

clean_filenames(x, overwrite = FALSE, demo = FALSE,empty.tmpl = "__EMPTY__%05i__")

Page 21: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

collect_template 21

Arguments

x Character vector or convertible to such. Names of the files to be modified.

overwrite Logical scalar. Overwrite pre-existing files, and do not care for duplicate namescreated by cleaning the filenames?

demo Logical scalar. Do not rename files but just return the usual result indicatingthe renaming actions that would be attempted? (Note that this does not indicatewhether the renaming would also by successful.)

empty.tmpl Character scalar. The template to use for filenames that become empty aftercleaning. Should include an integer placeholder to enable incrementing an indexfor creating unique filenames. (Empty filenames should occur rarely anyway.)

Value

Character vector, its names corresponding to the renamed old files, values corresponding to thenovel names, returned invisibly.

See Also

base::file.rename

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, collect_template,explode_dir, file_pattern, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

# Check the example files: they should be ok(x <- clean_filenames(opm_files("testdata"), demo = TRUE))stopifnot(length(x) == 0)

# Example with temporary files(x <- tempfile(pattern = "cb& ahi+ si--"))write("test", x)stopifnot(file.exists(x))(y <- clean_filenames(x))stopifnot(!file.exists(x), file.exists(y))unlink(y) # tidy up

collect_template Collect metadata template

Description

Collect a metadata template from OmniLog® CSV comments assisting in later on adding metadatausing include_metadata. The character method batch-collects such information from files andoptionally add these data as novel rows to previously collected data. It writes the collected templateto a file for use with an external editor, and/or creates a data frame for editing the data directly in Rwith the edit function. The OPM and OPMS methods collect a data frame.

Page 22: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

22 collect_template

Usage

## S4 method for signature ’character’collect_template(object, outfile = NULL,

sep = "\t", previous = outfile, md.args = list(),selection = opm_opt("csv.selection"), add.cols = NULL,include = list(), ..., demo = FALSE)

## S4 method for signature ’OPM’collect_template(object,

selection = opm_opt("csv.selection"), add.cols = NULL)

## S4 method for signature ’OPMS’collect_template(object, ...)

Arguments

object Character vector or OPM or OPMS object. If a character vector is provided, it actslike the names argument of read_opm. That is, if it is a directory name, this isautomatically scanned for all CSV and YAML files it contains (unless restrictionswith patterns are made). One can also provide file names, or a mixture of fileand directory names.

outfile Character scalar. Ignored if NULL or empty string. Otherwise, interpreted as thename of a CSV output file. If metadata have already been collected in an olderfile with the same name, old metadata will be kept, identifiers for novel files willbe included, their so far empty entries set to NA. Users who wish to keep the oldversion can use two distinct names for novel and old files; see previous.

sep Character scalar. CSV field separator for outfile.

previous Ignored if NULL. Otherwise passed to to_metadata. If it is a filename differentfrom outfile, it is an error if the file does not exist.

md.args List of other arguments passed to the ‘to_metadata’ methods.

add.cols Optional character vector with the names of columns to be added to the result,or NULL. If not empty, names of columns to be added, initially containing NA.

selection Elements to be extracted from the CSV comments contained in each file. Char-acter vector passed to csv_data.

include File inclusion pattern (or generator for a pattern). Passed to batch_collect.

... Other arguments passed to batch_collect, or arguments passed from the OPMSto the OPM method.

demo Logical scalar. Run in ‘demo’ mode? Also passed to batch_collect.

Value

In the case of the character method, a data frame, returned invisibly if outfile is given; if demois TRUE, a character vector of filenames instead, also returned invisibly. The OPM method returns adata frame with one row and the number of columns equal to the sum of the lengths of selectionand add.cols. The OPM method returns such a data frame with one row per contained plate.

Page 23: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

collect_template 23

Note

Regarding the CSV format, see the remark to read_single_opm.

References

http://www.biolog.com/

See Also

utils::edit utils::read.delim

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,explode_dir, file_pattern, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

# Character methodtest.files <- grep("Multiple|Ecoplate", opm_files("testdata"), invert = TRUE,

value = TRUE, perl = TRUE)if (length(test.files) > 0) {

# Without writing to a file(x <- collect_template(test.files))stopifnot(is.data.frame(x), identical(x[, "File"], test.files))# now proceed with e.g.# x <- edit(x)

# Write to fileoutfile <- tempfile()stopifnot(!file.exists(outfile))# This results in a CSV outfile which could be used as a starting point# for including the metadata of interest together with the plate# identifiers in a single file. include_metadata() can then be used to# integrate the metadata in OPM, OPMA or OPMS objects.x <- collect_template(test.files, outfile = outfile)stopifnot(file.exists(outfile))unlink(outfile)

}

# OPM methoddata(vaas_1)(x <- collect_template(vaas_1))stopifnot(identical(dim(x), c(1L, 3L)))(x <- collect_template(vaas_1, add.cols = c("A", "B")))stopifnot(identical(dim(x), c(1L, 5L)))# see include_metadata() for how to use this to add metadata information

# OPMS methoddata(vaas_4)(x <- collect_template(vaas_4))stopifnot(identical(dim(x), c(4L, 3L)))(x <- collect_template(vaas_4, add.cols = c("A", "B")))

Page 24: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

24 contains

stopifnot(identical(dim(x), c(4L, 5L)))# again see include_metadata() for how to use this to add metadata# information

contains Query a list with a list

Description

Test whether all names of a query list occur as names in a data list and optionally also whether theypoint to the same elements; apply this principle recursively to all sublists. Non-list elements areignored if values is FALSE. Otherwise the comparison is done using identical if exact is TRUE.If exact is FALSE, the value(s) in the data list can be any of the values at the corresponding positionin the query list, and the comparison is done by coercion to character vectors. An empty query listresults in TRUE. Missing names in a non-empty query list result in FALSE. There is also an OPMSmethod, which tests whether an OPM object is contained.

Usage

## S4 method for signature ’list,list’contains(object, other,

values = TRUE, exact = FALSE, ...)

## S4 method for signature ’OPMS,OPM’contains(object, other, ...)

Arguments

object List containing the data, or OPMS object.

other For the list method, a list used as query; for the OPMS method, an OPM object usedas query.

values Logical scalar. Compare also the values or only the keys? If FALSE, exact isignored.

exact Logical scalar. If FALSE, the data value(s) might by any of the query value(s),and some coercion is done before comparing (see match for details. If TRUE, thedata value(s) must exactly correspond to the query value(s), and no coercion isdone (see identical) for details). This might be too strict for most applications.

... Optional arguments passed to identical from the base package, allowing forfine-control of identity. Has no effect unless exact is TRUE.

Value

Logical scalar.

Page 25: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

csv_data 25

Note

This function is not normally directly called by an opm user but might be useful in other contexts.It forms the basis of a number of metadata query functions.

See Also

base::list base::as.list base::‘[‘ base::‘[[‘ base::match

base::identity

Other auxiliary-functions: glob_to_regex, kubrick, map_names, map_values, opm_opt, separate

Examples

# List/list methodx <- list(a = 1:8, c = 9, d = list(d1 = ’x’, d2 = ’y’))y <- list(a = 1:10, c = "9", d = list(d1 = "x"))stopifnot(contains(x, y))stopifnot(!contains(x, y, exact = TRUE))stopifnot(contains(x, y, exact = TRUE, values = FALSE))# see particularly infix-q and infix-k for more examples

# OPMS/OPM methoddata(vaas_4)stopifnot(contains(vaas_4, vaas_4[3]))

csv_data Information from input CSV file

Description

Information about the plate as originally read from the input CSV file. See read_opm and read_single_opmfor reading such files.

Usage

## S4 method for signature ’OPM’csv_data(object, keys = character(),

strict = TRUE)

## S4 method for signature ’OPMS’csv_data(object, ...)

Page 26: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

26 dim

Arguments

object OPM object.keys Character vector (or other objects usable as vector index). An optional sub-

selection. If empty (the default), all CSV data are returned. By default it is anerror to select non-existing items.

strict Logical scalar indicating whether or not it is an error if keys are not found.... Optional arguments passed between the methods.

Value

Named character vector.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, dim, disc_settings, discretized,duplicated, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)# compare this to setup_time()(x <- csv_data(vaas_1, "Setup Time"))stopifnot(identical(x, c(‘Setup Time‘ = "8/30/2010 1:53:08 PM")))

# ’OPMS’ methoddata(vaas_4)(x <- csv_data(vaas_4, "Setup Time"))stopifnot(is.character(x), length(x) == 4)

dim Dimensions

Description

Get the dimensions of the measurements of an OPM object, or get the dimensions of an OPMS object.Note that this function cannot be used to determine the correspondence of the time points betweenall plates as it reports only the time points of the first plate. Instead the OPMS method of hours mustbe used.

Usage

## S4 method for signature ’OPM’dim(x)

## S4 method for signature ’OPMS’dim(x)

Page 27: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

discrete 27

Arguments

x OPM or OPMS object.

Value

For the OPM method, a two-element numeric vector (number of time points and number of wells).For the OPMS method, a numeric vector with (i) the number of contained OPM objects, and (ii) and(iii) the dimensions of the first plate.

See Also

base::dim

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, seq, setup_time, subset, summary, well,wells

Examples

# OPM methoddata(vaas_1)(x <- dim(vaas_1))stopifnot(identical(x, c(384L, 96L)))

# OPMS methoddata(vaas_4)(x <- dim(vaas_4))stopifnot(identical(x, c(4L, 384L, 96L)))

discrete Convert to discrete characters

Description

Convert a vector of continuous characters to discrete ones. One of the uses of this functions is tocreate character data suitable for phylogenetic studies with programs such as PAUP* and RAXML.These accept only discrete characters with at most 32 states, coded as 0 to 9 followed by A to V. Forthe full export one additionally needs phylo_data. The matrix method is just a wrapper that takescare of the matrix dimensions, and the data-frame method is a wrapper for that method.

Usage

## S4 method for signature ’numeric’discrete(x, range, gap = FALSE,

output = c("character", "integer", "logical", "factor", "numeric"),middle.na = TRUE, states = 32L, ...)

## S4 method for signature ’MOA’

Page 28: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

28 discrete

discrete(x, ...)

## S4 method for signature ’data.frame’discrete(x, as.labels = NULL, sep = " ",

...)

Arguments

x Numeric vector or a MOA object convertible to a numeric vector. The data-framemethod first calls extract, restricting the columns to the numeric ones.

range In non-gap mode (see next argument) the assumed real range of the data; mustcontain all elements of x, but can be much wider. In gap mode, it must, incontrast, lie within the range of x. If range is set to TRUE, the empirical rangeof x is used in non-gap mode. In gap mode, the range is determined usingrun_kmeans with the number of clusters set to 3 and then applying borders tothe result. The number of clusters is set to 2 if range is FALSE in gap mode.

gap Logical scalar. If TRUE, always convert to binary or ternary characters, ignoringstates. range then indicates a subrange of x within which character conversionis ambiguous and has to be treated as either missing information or intermediatecharacter state, depending on middle.na. If FALSE (the default), apply an equal-width-intervals discretization with the widths determined from the number ofrequested states and range.

output String determining the output mode: ‘character’, ‘integer’, ‘logical’, ‘factor’,or ‘numeric’. ‘numeric’ simply returns x, but performs the range checks. Onecannot combine ‘logical’ with TRUE values for both ‘gap’ and ‘middle.na’.

middle.na Logical scalar. Only relevant in gap mode: if TRUE, the middle value yields NA(uncertain whether negative or positive). If FALSE, the middle value lies betweenthe left and the right one (i.e., a third character state meaning ‘weak’). This issimply coded as 0-1-2 and thus cannot be combined with ‘logical’ as outputsetting.

states Integer or character vector. Ignored in gap mode and if output is not ‘character’.Otherwise, (i) a single-element character vector, which is split into its elements,(ii) a multi-element character vector which is used directly, or (iii) an integervector indicating the elements to pick from the default character states. In thelatter case, a single integer is interpreted as the upper bound of an integer vectorstarting at 1.

as.labels Vector of data-frame indices. See extract.

sep Character scalar. See extract.

... Optional arguments passed between the methods or, if requested, to run_kmeans(except object and k, see there).

Details

The term ‘character’ as used here has nothing to do per se with the eponymous mode or class of R.Rather, the term is borrowed from taxonomic classification in biology, where, technically, a single

Page 29: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

discrete 29

‘character’ is stored in one column of a data matrix if each organism is stored in one row. Charactersare the quasi-independent units of evolution on the one hand and of phylogenetic reconstruction(and thus taxonomic classification) on the other hand.

Value

Double, integer, character or logical vector or factor, depending on output. For the matrix method,a matrix composed of a vector as produced by the numeric method, the original dimensions andthe original dimnames attributes of x.

References

Dougherty, J., Kohavi, R., Sahami, M. 1995 Supervised and unsupervised discretization of con-tinuous features. In: Prieditis, A., Russell, S. (eds.) Machine Learning: Proceedings of the fifthinternational conference.

Ventura, D., Martinez, T. R. 1995 An empirical comparison of discretization methods. Proceedingsof the Tenth International Symposium on Computer and Information Sciences, p. 443–450.

Wiley, E. O., Lieberman, B. S. 2011 Phylogenetics: Theory and Practice of Phylogenetic System-atics. Hoboken, New Jersey: Wiley-Blackwell.

Bunuel, L. 1972 Le charme discret de la bourgeoisie. France/Spain, 96 min.

See Also

base::cut

Other discretization-functions: best_cutoff, do_disc

Examples

# Treat everything between 3.4 and 4.5 as ambiguous(x <- discrete(1:5, range = c(3.5, 4.5), gap = TRUE))stopifnot(x == c("0", "0", "0", "?", "1"))

# Treat everything between 3.4 and 4.5 as intermediate(x <- discrete(1:5, range = c(3.5, 4.5), gap = TRUE, middle.na = FALSE))stopifnot(x == c("0", "0", "0", "1", "2"))

# Boring example: real and possible range as well as the number of states# to code the data have a 1:1 relationship(x <- discrete(1:5, range = c(1, 5), states = 5))stopifnot(identical(x, as.character(0:4)))

# Now fit the data into a potential range twice as large, and at the# beginning of it(x <- discrete(1:5, range = c(1, 10), states = 5))stopifnot(identical(x, as.character(c(0, 0, 1, 1, 2))))

# Matrix and data-frame methodsx <- matrix(as.numeric(1:10), ncol = 2)(y <- discrete(x, range = c(3.4, 4.5), gap = TRUE))stopifnot(identical(dim(x), dim(y)))

Page 30: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

30 discretized

(yy <- discrete(as.data.frame(x), range = c(3.4, 4.5), gap = TRUE))stopifnot(y == yy)

# K-means based discretization of PM data (prefer do_disc() for this)data(vaas_4)x <- extract(vaas_4, as.labels = list("Species", "Strain"),

in.parens = FALSE)head(y <- discrete(x, range = TRUE, gap = TRUE))stopifnot(c("0", "?", "1") %in% y)

discretized Get discretized kinetic data

Description

This yields the discretized values of the curve parameter ‘maximum height’.

Usage

## S4 method for signature ’OPMD’discretized(object)

## S4 method for signature ’OPMS’discretized(object, ...)

Arguments

object OPMD or OPMS object.

... Optional arguments passed between the methods.

Value

Logical vector or matrix.

Note

See do_disc for generating discretized data.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,duplicated, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Page 31: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

disc_settings 31

Examples

# ’OPM’ methoddata(vaas_1)(x <- discretized(vaas_1))stopifnot(is.logical(x), !is.matrix(x), length(x) == dim(x)[2L])stopifnot(names(x) == colnames(aggregated(vaas_1)))

# ’OPMS’ methoddata(vaas_4)(x <- discretized(vaas_4))stopifnot(is.logical(x), is.matrix(x), ncol(x) == dim(x)[2L])stopifnot(colnames(x) == colnames(aggregated(vaas_1)))

disc_settings Get discretization settings

Description

The settings used for discretizing the aggregated kinetic data.

Usage

## S4 method for signature ’OPMD’disc_settings(object)

## S4 method for signature ’OPMS’disc_settings(object, ...)

Arguments

object OPMD object.

... Optional arguments passed between the methods.

Value

Named list. See the examples for details.

Note

See do_disc for generating discretized data.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, discretized,duplicated, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Page 32: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

32 do_aggr

Examples

# ’OPM’ methoddata(vaas_1)(x <- disc_settings(vaas_1))stopifnot(is.list(x), !is.null(names(x)))

# ’OPMS’ methoddata(vaas_4)summary(x <- disc_settings(vaas_4))stopifnot(is.list(x), is.null(names(x)), length(x) == length(vaas_4))stopifnot(duplicated(x)[-1])

do_aggr Aggregate kinetics using curve-parameter estimation

Description

Aggregate the kinetic data using curve-parameter estimation, i.e. infer parameters from the kineticdata stored in an OPM object using either the grofit package or the built-in method. Optionallyinclude the aggregated values in a novel OPMA object together with previously collected information.

Usage

## S4 method for signature ’OPM’do_aggr(object, boot = 100L, verbose = FALSE,

cores = 1L, options = list(), method = "grofit", plain = FALSE,program = method)

## S4 method for signature ’matrix’do_aggr(object, by, fun, sep = ".", ...)

## S4 method for signature ’OPMS’do_aggr(object, ...)

Arguments

object OPM or OPMS object. There is also a helper method for matrix objects.

boot Integer scalar. Number of bootstrap replicates used to estimate 95-percent con-fidence intervals (CIs) for the parameters. Set this to zero to omit bootstrapping,resulting in NA entries for the CIs.

verbose Logical scalar. Print progress messages?

cores Integer scalar. Number of cores to use. Setting this to a value > 1 requires themulticore package. Has no effect if ‘opm-fast’ is chosen (see below).

Page 33: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

do_aggr 33

options List. For its use in ‘grofit’ mode, see grofit.control in the grofit package.The boot and verbose settings, as the most important ones, are added separately(see above). The verbose mode is not very useful in parallel processing. For itsuse in ‘opm-fast’ mode, see fast_estimate.

method Character scalar. The aggregation method to use. Currently only the followingmethods are supported:

grofit The grofit function in the eponymous package, with spline fitting asdefault.

opm-fast The native, faster parameter estimation. This will only yield two ofthe four parameters, the area under the curve and the maximum height.The area under the curve is estimated as the sum of the areas given by thetrapezoids defined by each pair of adjacent time points. The maximumheight is just the result of max. By default, however, the median bootstrapvalue is preferred as point estimate over the real point estimate.

program Deprecated. Use ‘method’ instead. If provided, ‘program’ has precedence over‘method’, but ‘program’ will eventually be removed.

plain Logical scalar. If TRUE, only the aggregated values are returned (as a matrix, fordetails see below). Otherwise they are integrated in an OPMA object together withobject.

by List, passed by the matrix method to aggregate from the stats package. Canalso be another vector, which is then used as single list element.

fun Function, passed by the matrix method as FUN argument to aggregate from thestats package.

sep Character scalar. Used for joining the vectors within by together to form rownames.

... Arguments passed from the OPMS to the OPM method, and from the matrix methodto fun.

Details

Behaviour is special if the plate_type is one of those that have to be explicitly set using gen_iiiand there is just one point measurement. Because this behaviour is usual for plates measured eitherin Generation-III (identification) mode or on a MicroStation™, the point estimate is simply regardedas ‘A’ parameter (maximum height) and all other parameters are set to NA.

Value

If plain is FALSE, an OPMA object. Otherwise a numeric matrix of the same structure than theone returned by aggregated but with an additional ‘settings’ attribute containing the (potentiallymodified) list proved via the settings argument, and a ‘method’ attribute corresponding to themethod argument. The matrix method returns a matrix.

Note

• The aggregated values can be queried for using has_aggr and received using aggregated.

• The ‘OPMS’ method just applies the ‘OPM’ method to each contained plate in turn; there arenot inter-dependencies.

Page 34: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

34 do_aggr

• Examples with plain = TRUE are not given, as only the return value is different: Let x bethe normal result of do_aggr(). The matrix returned if plain is TRUE could then be receivedusing aggregated(x), whereas the ‘method’ and the ‘settings’ attributes could be obtained ascomponents of the list returned by aggr_settings(x).

References

Brisbin, I. L., Collins, C. T., White, G. C., McCallum, D. A. 1986 A new paradigm for the analysisand interpretation of growth data: the shape of things to come. The Auk 104, 552–553.

Efron, B. 1979 Bootstrap methods: another look at the jackknife. Annals of Statistics 7, 1–26.

Kahm, M., Hasenbrink, G., Lichtenberg-Frate, H., Ludwig, J., Kschischo, M. grofit: Fitting biolog-ical growth curves with R. Journal of Statistical Software 33, 1–21.

Vaas, L. A. I., Sikorski, J., Michael, V., Goeker, M., Klenk H.-P. 2012 Visualization and curveparameter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoSONE 7, e34846.

See Also

grofit::grofit

Other aggregation-functions: fast_estimate, param_names

Examples

# OPM methoddata(vaas_1)

# Run a fast estimate of A and AUC without bootstrappingcopy <- do_aggr(vaas_1, method = "opm-fast", boot = 0,

options = list(as.pe = "pe"))aggr_settings(vaas_1)aggr_settings(copy)stopifnot(has_aggr(vaas_1), has_aggr(copy))

# Compare the results to the ones precomputed with grofit# (1) Aa.grofit <- aggregated(vaas_1, "A", ci = FALSE)a.fast <- aggregated(copy, "A", ci = FALSE)plot(a.grofit, a.fast)stopifnot(cor.test(a.fast, a.grofit)$estimate > 0.999)# (2) AUCauc.grofit <- aggregated(vaas_1, "AUC", ci = FALSE)auc.fast <- aggregated(copy, "AUC", ci = FALSE)plot(auc.grofit, auc.fast)stopifnot(cor.test(auc.fast, auc.grofit)$estimate > 0.999)

## Not run:

# Without confidence interval (CI) estimationx <- do_aggr(vaas_1, boot = 0, verbose = TRUE)aggr_settings(x)

Page 35: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

do_disc 35

aggregated(x)

# Calculate CIs with 100 bootstrap (BS) replicates, using 4 coresx <- do_aggr(vaas_1, boot = 100, verbose = TRUE, cores = 4)aggr_settings(x)aggregated(x)

## End(Not run)

# matrix methodx <- matrix(1:10, ncol = 2, dimnames = list(letters[1:5], LETTERS[1:2]))grps <- c("a", "b", "a", "b", "a")(y <- do_aggr(x, by = grps, fun = mean))stopifnot(is.matrix(y), dim(y) == c(2, 2), colnames(y) == colnames(x))stopifnot(mode(y) == "numeric")

do_disc Discretize curve parameters

Description

Discretize the aggregated kinetic data, i.e. infer discrete values from the curve parameters storedin an OPMA or OPMS object. Here, only discretization into positive, negative and ambiguous reac-tions is supported, and only based on the ‘maximum height’ curve parameter (which is biologicallyreasonable though).

Usage

## S4 method for signature ’OPMA’do_disc(object, cutoff, plain = FALSE)

## S4 method for signature ’OPMS’do_disc(object, cutoff = TRUE, groups = FALSE,

plain = FALSE, ...)

Arguments

object OPMA or OPMS object.

cutoff If non-empty, passed as range argument to discrete (with gap set to TRUE).If NULL, a cutoff is determined using best_cutoff, which is only possible forOPMS objects.

groups List or character vector passed to extract, logical scalar or NULL. If TRUE,groups are automatically created with one plate per group. If FALSE, group-ing is not used. behaviour differs depending on cutoff; if that is empty, too,an error is raised since best_cutoff needs groups with more than a single ele-ment. Otherwise, if combined is FALSE, groups are automatically created withone plate per group.

Page 36: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

36 do_disc

plain Logical scalar indicating whether or not an OPMD or OPMS object should be cre-ated.

... Optional arguments passed to extract. Only relevant for certain settings ofgroups, see above.

Value

If plain is FALSE, an OPMD or OPMS object. Otherwise a logical vector whose length corresponds tothe number of wells in object with an additional ‘settings’ attribute describing the run. The vectorand its attribute would correspond to the discretized and disc_settings entries of a resultingOPMD object, respectively.

Note

The discretized values can be queried for using has_disc and received using discretized.

See Also

Other discretization-functions: best_cutoff, discrete

Examples

mustbe <- function(a, b) stopifnot(identical(a, b))

## OPMA methoddata(vaas_1)

# arbitrary threshold, no ambiguitysummary(x <- do_disc(vaas_1, cutoff = 100))stopifnot(has_disc(x), dim(x) == dim(vaas_1), !is.na(discretized(x)))# the settings used have been stored in the resulting object(y <- disc_settings(x))mustbe(y$method, "direct")mustbe(y$options, list(cutoffs = 100, datasets = 1L))

# arbitrary thresholds, allowing intermediate (’weak’) reactionssummary(x <- do_disc(vaas_1, cutoff = c(75, 125)))stopifnot(has_disc(x), dim(x) == dim(vaas_1), any(is.na(discretized(x))))(y <- disc_settings(x))mustbe(y$method, "direct")mustbe(y$options, list(cutoffs = c(75, 125), datasets = 1L))

# using k-means, no ambiguitysummary(x <- do_disc(vaas_1, cutoff = FALSE))stopifnot(has_disc(x), dim(x) == dim(vaas_1), !is.na(discretized(x)))(y <- disc_settings(x))mustbe(y$method, "kmeans")mustbe(length(y$options$cutoffs), 1L)

# using k-means, allowing intermediate (’weak’) reactionssummary(x <- do_disc(vaas_1, cutoff = TRUE))stopifnot(has_disc(x), dim(x) == dim(vaas_1), any(discretized(x)))

Page 37: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

do_disc 37

(y <- disc_settings(x))mustbe(y$method, "kmeans")mustbe(length(y$options$cutoffs), 2L) # now 2 cutoff values

# OPMS methoddata(vaas_4)

# arbitrary threshold, no ambiguity, no groupssummary(x <- do_disc(vaas_4, cutoff = 100))stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))# the settings used have been stored in the resulting object(y <- disc_settings(x)[[1]])mustbe(y$method, "direct")mustbe(y$options, list(cutoffs = 100, datasets = 4L))

# arbitrary threshold, no ambiguity, with groups, 1 plate per groupsummary(x <- do_disc(vaas_4, cutoff = 100, groups = TRUE))stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))(y <- disc_settings(x)[[1]])mustbe(y$method, "direct")# here, the plate numbers yield the group namesmustbe(y$options, list(cutoffs = 100, datasets = 1L, group = "1"))

# arbitrary threshold, no ambiguity, with specified groupssummary(x <- do_disc(vaas_4, cutoff = 100, groups = "Species"))stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))(y <- disc_settings(x)[[1]])mustbe(y$method, "direct")# now, groups are from the metadata (but played no role)mustbe(y$options,

list(cutoffs = 100, datasets = 2L, group = "Escherichia coli"))

# using k-means, no ambiguity, with specified groupssummary(x <- do_disc(vaas_4, cutoff = TRUE, groups = "Species"))stopifnot(has_disc(x), dim(x) == dim(vaas_4), any(is.na(discretized(x))))(y <- disc_settings(x)[[1]])mustbe(y$method, "kmeans")# grouping by species, discretized separatelymustbe(y$options$group, "Escherichia coli")mustbe(y$options$datasets, 2L)mustbe(length(y$options$cutoffs), 2L)

# using best_cutoff()summary(x <- do_disc(vaas_4, cutoff = NULL, groups = "Species"))stopifnot(has_disc(x), dim(x) == dim(vaas_4), any(is.na(discretized(x))))(y <- disc_settings(x)[[1]])mustbe(y$method, "best-cutoff")# groups as abovemustbe(y$options$group, "Escherichia coli")mustbe(y$options$datasets, 2L)# ...but some additional entries:stopifnot(c("cutoffs", "score") %in% names(y$options))

Page 38: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

38 duplicated

duplicated Determine duplicated plates

Description

Check whether duplicated OPM or OPMA objects are contained within an OPMS object. For reasons ofconsistency, the OPM method always returns FALSE.

Usage

## S4 method for signature ’OPM,ANY’duplicated(x, incomparables, ...)

## S4 method for signature ’OPMS,missing’duplicated(x, incomparables, ...)

## S4 method for signature ’OPMS,ANY’duplicated(x, incomparables,

what = c("all", "csv", "metadata"), ...)

Arguments

x OPMS object.

incomparables Vector passed to duplicated from the base package. By default this is FALSE.

what Character scalar indicating which parts of x should be compared. ‘all’ com-pares entire OPM objects; ‘csv’ compares the CSV data entries setup_time andposition; ‘metadata’ compares the entire metadata content. If what does notmatch any of these, or is not a character scalar at all, it is passed as key argumentto metadata, and the resulting metadata subsets are compared.

... Optional arguments passed to duplicated from the base package.

Value

Logical vector.

See Also

base::duplicated

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, filename, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Page 39: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

explode_dir 39

Examples

# ’OPM’ methoddata(vaas_1)(x <- duplicated(vaas_1))stopifnot(identical(x, FALSE))

# ’OPMS’ methoddata(vaas_4)stopifnot(!duplicated(vaas_4))stopifnot(!duplicated(vaas_4, what = list("Species", "Strain")))stopifnot(duplicated(vaas_4, what = "Species") == rep(c(FALSE, TRUE), 2))x <- vaas_4[c(1, 1)]stopifnot(c(FALSE, TRUE) == duplicated(x))

explode_dir Conversion of directory names to file names

Description

Turn a mixed file/directory list into a list of files. This is not normally directly called by an opmuser but by the other IO functions of the package. One can use their demo argument directly fortesting the results of the applied filename patterns.

Usage

explode_dir(names, include = NULL, exclude = NULL,ignore.case = TRUE, wildcard = TRUE, recursive = TRUE,missing.error = TRUE, remove.dups = TRUE)

Arguments

names Character vector containing filenames or directories, or convertible to such.

include If a character scalar, used as regular expression or wildcard (see the wildcardargument) for selecting from the input files. If NULL, ignored. If a list, used asarguments of file_pattern and its result used as regular expression. Note thatselection is done after expanding the directory names to filenames.

exclude Like include, but for excluding matching input files. Note that exclusion isdone after applying include.

ignore.case Logical scalar. Ignore differences between uppercase and lowercase when usinginclude and exclude? Has no effect for NULL values for include or exclude,respectively.

wildcard Logical scalar. Are include and exclude wildcards (as used by UNIX shells)that first need to be concerted to regular expressions? Has no effect if lists areused for include or exclude, respectively. See glob_to_regex for details onsuch wildcards (a.k.a. globbing patterns).

Page 40: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

40 explode_dir

recursive Logical scalar. Traverse directories recursively and also consider all subdirecto-ries? See list.files from the base package for details.

missing.error Logical scalar. If a file/directory does not exist, raise an error or only a warning?

remove.dups Logical scalar. Remove duplicates from names? Note that if requested this isdone before expanding the names of directories, if any.

Value

Character vector (which would be empty if all existing files, if any, had been unselected).

Note

Other functions that call this function should have a demo argument which, if set to TRUE, causedthe respective function to do no real work but print the names of the files that it would process innormal running mode.

See Also

base::list.files base::Sys.glob

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, file_pattern, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

# Example with temporary directorytd <- tempdir()tf <- tempfile()(x <- explode_dir(td))write(letters, tf)(y <- explode_dir(td))stopifnot(length(y) > length(x))unlink(tf)(y <- explode_dir(td))stopifnot(length(y) == length(x))

# Example with R installation directory(x <- explode_dir(R.home(), include = "*/doc/html/*"))(y <- explode_dir(R.home(), include = "*/doc/html/*", exclude = "*.html"))stopifnot(length(x) == 0L || length(x) > length(y))

# More interesting use cases are provided by the functions that call# explode_dir(). Consider to first try them in ’demo’ mode. Globbing# examples are given under glob_to_regex().

Page 41: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

extract 41

extract Extract aggregated values

Description

Extract selected aggregated or discretized values into common matrix or data frame. The data-framemethod creates a matrix by extracting the numeric columns and optionally adds row names.

Usage

## S4 method for signature ’OPMS’extract(object, as.labels,

subset = opm_opt("curve.param"), ci = FALSE, trim = "full",dataframe = FALSE, as.groups = NULL, sep = " ", dups = "warn",exact = TRUE, strict = TRUE, full = TRUE, max = 10000L, ...)

## S4 method for signature ’data.frame’extract(object, as.labels,

as.groups = NULL, sep = " ", what = "numeric")

Arguments

object OPMS object or data frame.as.labels List. Metadata to be joined and used as row names (if dataframe is FALSE) or

additional columns (if otherwise). Ignored if NULL.subset Character vector. The parameter(s) to put in the matrix. If it is ‘disc’, discretized

data are returned, and ci is ignored.ci Logical scalar. Also return the CIs?trim Character scalar. See aggregated for details.dataframe Logical scalar. Return data frame or matrix?as.groups List. Metadata to be joined and used as ‘row.groups’ attribute of the output

matrix. See heat_map for its usage. Ignored if NULL and if dataframe is FALSE.For the data-frame method, a vector.

sep Character scalar. See extract_columns.dups Character scalar. See extract_columns.exact Logical scalar. See extract_columns.strict Logical scalar. See extract_columns.full Logical scalar indicating whether full substrate names shall be used. This is

passed to wells, but in contrast to what flatten is doing the argument hererefers to the generation of the column names.

max Numeric scalar. Passed to wells.... Optional other arguments passed to wells.what Character scalar. The name of the class to extract from the data frame to form

the matrix values.

Page 42: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

42 extract_columns

Value

Numeric matrix or data frame; always a numeric matrix for the data-frame method.

See Also

base::data.frame base::as.data.frame base::matrix base::as.matrix

Other conversion-functions: extract_columns, flatten, gen_iii, merge, oapply, plates, rep,rev, sort, thin_out, to_yaml, unique

Examples

# ’OPMS’ methoddata(vaas_4)# Matrix(x <- extract(vaas_4, as.labels = list("Species", "Strain")))stopifnot(is.matrix(x), identical(dim(x), c(4L, 96L)), is.numeric(x))# Data frame(x <- extract(vaas_4, as.labels = list("Species", "Strain"),

dataframe = TRUE))stopifnot(is.data.frame(x), identical(dim(x), c(4L, 99L)))# All parameters in a single data framex <- lapply(param_names(), function(name) extract(vaas_4, subset = name,

as.labels = list("Species", "Strain"), dataframe = TRUE))x <- do.call(rbind, x)# Get discretized data(x <- extract(vaas_4, subset = "disc", as.labels = list("Strain")))stopifnot(is.matrix(x), identical(dim(x), c(4L, 96L)), is.logical(x))

# data-frame methodx <- data.frame(a = 1:26, b = letters, c = LETTERS)(y <- extract(x, as.labels = "b", what = "integer", as.groups = "c"))stopifnot(is.matrix(y), dim(y) == c(26, 1), rownames(y) == x$b)stopifnot(identical(attr(y, "row.groups"), x$c))

extract_columns Create data frame or vector from metadata

Description

Extract selected metadata entries for use as additional columns in a data frame or (after joining) ascharacter vector with labels. This is not normally directly called by an opm user because extractis available, which uses this function, but can be used for testing the applied metadata selectionsbeforehand. The data-frame method is trivial: it extracts the selected columns and joins them toform a character vector.

Page 43: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

extract_columns 43

Usage

## S4 method for signature ’OPMS’extract_columns(object, what, join = FALSE,

sep = " ", dups = c("warn", "error", "ignore"), exact = TRUE,strict = TRUE)

## S4 method for signature ’data.frame’extract_columns(object, what, sep = " ")

Arguments

object OPMS object or data frame.

what List of metadata keys to consider, or single such key; passed to metadata. Forthe data-frame method, just the names of the columns to extract, or their indices,as vector.

join Logical scalar. Join each row together to yield a character vector? Otherwise itis just attempted to construct a data frame.

sep Character scalar. Used as separator between the distinct metadata entries if theseare to be pasted together. Ignored unless join is TRUE. The data-frame methodalways joins the data.

dups Character scalar specifying what to do in the case of duplicate labels: either‘warn’, ‘error’ or ‘ignore’. Ignored unless join is TRUE.

exact Logical scalar. Also passed to metadata.

strict Logical scalar. Also passed to metadata.

Value

Data frame or character vector, depending on the join argument. The data-frame method alwaysreturns a character vector.

See Also

base::data.frame base::as.data.frame base::cbind

Other conversion-functions: extract, flatten, gen_iii, merge, oapply, plates, rep, rev, sort,thin_out, to_yaml, unique

Examples

# ’OPMS’ methoddata(vaas_4)

# Create data frame(x <- extract_columns(vaas_4, what = list("Species", "Strain")))stopifnot(is.data.frame(x), identical(dim(x), c(4L, 2L)))

# Create a character vector

Page 44: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

44 fast_estimate

(x <- extract_columns(vaas_4, what = list("Species", "Strain"), join = TRUE))stopifnot(is.character(x), length(x) == 4L)(x <- try(extract_columns(vaas_4, what = list("Species"), join = TRUE,

dups = "error"), silent = TRUE))stopifnot(inherits(x, "try-error"))(x <- try(extract_columns(vaas_4, what = list("Species"), join = TRUE,

dups = "warn"), silent = TRUE))stopifnot(is.character(x), length(x) == 4L)

# data-frame methodx <- data.frame(a = 1:26, b = letters, c = LETTERS)(y <- extract_columns(x, c("a", "b"), sep = "-"))stopifnot(grepl("^\\s*\\d+-[a-z]$", y))

fast_estimate Fast curve-parameter estimation

Description

Quickly estimate the curve parameters AUC (area under the curve) or A (maximum height). This isnot normally directly called by an opm user but via do_aggr.

Usage

## S4 method for signature ’matrix’fast_estimate(x, what = c("AUC", "A"),

boot = 100L, ci = 0.95, as.pe = "median", ci.type = "norm",time.pos = 1L, transposed = FALSE, raw = FALSE, ...)

Arguments

x Matrix as output by measurements, i.e. with the time points in the first columnsand the measurements in the remaining columns (there must be at least two).For deviations from this scheme see time.pos and transposed.

what Character scalar. Which parameter to estimate. Currently only two are sup-ported.

boot Integer scalar. Number of bootstrap replicates. Note that under the default set-tings for as.pe, bootstrapping is also necessary to obtain the point estimate.

ci Confidence interval to use in the output. Ignored if boot is not positive.

as.pe Character scalar determining what to output as the point estimate. Either ‘me-dian’, ‘mean’ or ‘pe’; the first two calculate the point estimate from the boot-strapping replicates, the third one use the real point estimate. If boot is 0, as.peis reset to ‘pe’, if necessary, and a warning is issued.

ci.type Character scalar determining the way the confidence intervals are calculated.Either ‘norm’, ‘basic’ or ‘perc’; see boot.ci from the boot package for details.

Page 45: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

filename 45

time.pos Character or integer scalar indicating the position of the column (or row, seenext argument) with the time points.

transposed Character or integer scalar indicating whether the matrix is transposed comparedto the default.

raw Logical scalar. Return the raw bootstrapping result without CI estimation andconstruction of the usually resulting matrix?

... Optional arguments passed to boot from the eponymous package.

Value

Numeric matrix with three rows (point estimate, lower and upper CI) and as many columns as datacolumns (or rows) in x. If raw is TRUE, an object of the class ‘boot’.

See Also

boot::boot grofit::grofit

Other aggregation-functions: do_aggr, param_names

Examples

data(vaas_1)summary(x <- fast_estimate(measurements(vaas_1)))stopifnot(identical(dim(x), c(3L, 96L)))

filename Original input filename

Description

Get the name of the original CSV input file. This is a convenience function for one of the moreimportant entries of csv_data.

Usage

## S4 method for signature ’OPM’filename(object)

## S4 method for signature ’OPMS’filename(object, ...)

Arguments

object OPM object.

... Optional arguments passed between the methods.

Page 46: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

46 file_pattern

Value

Character scalar.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, has_aggr, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- filename(vaas_1))stopifnot(is.character(x), length(x) == 1L)

# ’OPMS’ methoddata(vaas_4)(x <- filename(vaas_4))stopifnot(is.character(x), length(x) == 4L)

file_pattern File pattern

Description

Create a regular expression matching certain file extensions. This is not normally directly called byan opm user but by the other IO functions of the package.

Usage

file_pattern(type = c("both", "csv", "yaml", "any", "empty"),compressed = TRUE, literally = FALSE)

Arguments

type Character scalar indicating the file types to be matched by extension.

compressed Logical scalar. Shall compressed files also be matched?

literally Logical scalar. Interpret type literally? Also allow vectors with more than asingle element.

Value

Character scalar, holding a regular expression.

Page 47: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

find_positions 47

See Also

tools::file_ext

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, explode_dir, opm_files, read_opm, read_single_opm, split_files, to_metadata

Examples

(x <- file_pattern())(y <- file_pattern(type = "csv", compressed = FALSE))stopifnot(nchar(x) > nchar(y))

find_positions Identify positions of substrates

Description

Identify the positions of substrates, i.e. the plate(s) and well(s) in which they occur. The querynames must be written exactly as used in the stored plate annotations. To determine their spelling,use find_substrate.

Usage

## S4 method for signature ’character’find_positions(object)

## S4 method for signature ’list’find_positions(object)

## S4 method for signature ’factor’find_positions(object, ...)

Arguments

object Query character vector or query list.

... Optional arguments passed between the methods.

Value

The character method returns a list of character matrices (empty if nothing was found), with onerow per position found, the plate name in the first column and the well name in the second. Thenames of this list correspond to names. The list method returns lists of such lists.

See Also

Other naming-functions: find_substrate, listing, substrate_info, well_to_substrate

Page 48: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

48 find_substrate

Examples

# Character method; compare correct and misspelled substrate name(x <- find_positions(c("D-Glucose", "D-Gloucose")))stopifnot(length(x[[1]]) > length(x[[2]]))

# Factor method(y <- find_positions(as.factor(c("D-Glucose", "D-Gloucose"))))stopifnot(identical(y, x))

# List method(x <- find_positions(find_substrate(c("D-Glucose", "D-Gloucose"))))stopifnot(length(x[[1]]) > length(x[[2]]))

find_substrate Identify substrates

Description

Identify the names of substrates as used in the stored plate annotations. Exact or error-tolerantmatching can be used, as well as globbing and regular-expression matching.

Usage

## S4 method for signature ’character’find_substrate(object,

search = c("exact", "glob", "approx", "regex", "pmatch"), max.dev = 0.2)

## S4 method for signature ’factor’find_substrate(object, ...)

Arguments

object Query character vector or factor.

search Character scalar indicating the search mode. If ‘exact’, query names must ex-actly match (parts of) the well annotations. If ‘glob’, shell globbing is used. If‘approx’, approximate matching is used; the number or proportion of errors al-lowed is set using max.dev, and neither globbing or regular-expression matchingis done in that case. If ‘regex’, regular-expression matching is used. If ‘pmatch’,uses pmatch from the base package. All matching is case-insensitive except for‘exact’ and ‘pmatch’ search modes.

max.dev Numeric scalar indicating the maximum allowed deviation. If < 1, the propor-tion of characters that might deviate, otherwise their absolute number. It canalso be a list; see the ‘max.distance’ argument of agrep in the base package fordetails. Has an effect only if ‘approx’ is chosen as search mode (see the searchargument).

... Optional arguments passed between the methods.

Page 49: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

flatten 49

Value

List of character vectors (empty if nothing was found), with duplicates removed and the rest sorted.The names of the list correspond to names.

Note

See glob_to_regex for a description of globbing patterns.

See Also

base::grep base::agrep

Other naming-functions: find_positions, listing, substrate_info, well_to_substrate

Examples

# Note that ’exact’ search matches parts of the names, whereas globbing# matches entire strings if there are no wildcards(x <- find_substrate("a-D-Glucose", search = "exact"))(y <- find_substrate("a-D-Glucose", search = "glob"))stopifnot(length(x[[1]]) > length(y[[1]]))

# ’pmatch’ matching matches partially at the beginning and returns at most# one match (the first one)(y <- find_substrate("a-D-Glucose", search = "pmatch"))stopifnot(length(x[[1]]) > length(y[[1]]))

# Now allowing mismatches(z <- find_substrate("a-D-Glucose", search = "approx"))stopifnot(length(z[[1]]) > length(x[[1]]))

# Factor method(zz <- find_substrate(as.factor("a-D-Glucose"), search = "approx"))stopifnot(identical(z, zz))

flatten Flatten measurements from OPM or OPMS objects

Description

Convert into ‘flat’ data frame, including all measurements in a single column (suitable, e.g., forlattice).

Usage

## S4 method for signature ’OPM’flatten(object, include = NULL, fixed = NULL,

factors = TRUE, exact = TRUE, strict = TRUE, full = TRUE, ...)

Page 50: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

50 flatten

## S4 method for signature ’OPMS’flatten(object, include = NULL, fixed = list(),

...)

Arguments

object OPM or OPMS object or list.

include NULL, character vector or list. If not NULL, include this meta-information in thedata frame, replicated in each row. Otherwise it converted to a list and passed tometadata. See there for details.

fixed NULL or list. If not NULL, include these items in the data frame, replicated in eachrow.

factors Logical scalar. See the ‘stringsAsFactors’ argument of data.frame and as.data.frame.

exact Logical scalar. Passed to metadata.

strict Logical scalar. Passed to metadata.

full Logical scalar. Replace well coordinates by full names?

... Optional other arguments passed to wells, or from the OPMS to the OPM method.

Value

Dataframe. Column names are unchecked (not converted to variable names). The three last columnsare: ‘Time’, ‘Well’, ‘Value’, with the obvious meanings. The OPMS method yields an additionalcolumn named ‘Plate’, which contains each plate’s number within object.

See Also

stats::reshape

Other conversion-functions: extract, extract_columns, gen_iii, merge, oapply, plates, rep,rev, sort, thin_out, to_yaml, unique

Examples

# OPM methoddata(vaas_1)head(x <- flatten(vaas_1))stopifnot(is.data.frame(x), identical(dim(x), c(36864L, 3L)))head(x <- flatten(vaas_1, fixed = "TEST"))stopifnot(is.data.frame(x), identical(dim(x), c(36864L, 4L)))head(x <- flatten(vaas_1, fixed = "TEST", include = "Strain"))stopifnot(is.data.frame(x), identical(dim(x), c(36864L, 5L)))

# OPMS methoddata(vaas_4)head(x <- flatten(vaas_4))stopifnot(is.data.frame(x), identical(dim(x), c(147456L, 4L)))head(x <- flatten(vaas_4, fixed = "TEST"))stopifnot(is.data.frame(x), identical(dim(x), c(147456L, 5L)))

Page 51: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

gen_iii 51

head(x <- flatten(vaas_4, fixed = "TEST", include = "Strain"))stopifnot(is.data.frame(x), identical(dim(x), c(147456L, 6L)))

gen_iii Change to Generation III (or other plate type)

Description

Change the plate type of an OPM object to ‘Generation III’ or another plate type. The actual spellingused might differ but is internally consistent. It is an error to set one of the PM plate types or toassign an unknown plate type.

Usage

## S4 method for signature ’OPM’gen_iii(object, to = "gen.iii")

## S4 method for signature ’OPMS’gen_iii(object, ...)

Arguments

object OPM object.

to Character scalar indicating the plate type. User-defined plate types must begiven literally. For generation-III plates, use ‘gen.iii’; for ecoplates, use ‘eco’;the remaining allowed values are only ‘sf.n2’ and ‘sf.p2’, but matching is case-insensitive.

... Optional arguments passed between the methods.

Value

Novel OPM object.

Note

This is currently the only function to change plate names. It is intended for Generation-III plateswhich were run like PM plates. Usually they will be annotated as some PM plate by the OmniLog®

system. In contrast, input ID-mode plates are automatically detected (see read_single_opm).

See Also

Other conversion-functions: extract, extract_columns, flatten, merge, oapply, plates, rep,rev, sort, thin_out, to_yaml, unique

Page 52: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

52 glob_to_regex

Examples

# ’OPM’ methoddata(vaas_1)summary(copy <- gen_iii(vaas_1))stopifnot(identical(vaas_1, copy)) # the dataset already had that plate typesummary(copy <- gen_iii(vaas_1, "eco")) # which is wrong, actuallystopifnot(!identical(vaas_1, copy))

# ’OPMS’ methoddata(vaas_4)summary(copy <- gen_iii(vaas_4))stopifnot(identical(vaas_4, copy)) # as abovesummary(copy <- gen_iii(vaas_4, "eco"))stopifnot(!identical(vaas_4, copy)) # as above

glob_to_regex Convert wildcard to regular expression

Description

Change a shell globbing wildcard into a regular expression. This is just a slightly extended versionof glob2rx from the utils package, but more conversion steps might need to be added here in thefuture.

Usage

## S4 method for signature ’character’glob_to_regex(object)

## S4 method for signature ’factor’glob_to_regex(object)

Arguments

object Character vector or factor.

Details

The here used globbing search patterns contain only two special characters, ‘?’ and ‘*’, and arethus more easy to master than regular expressions. ‘?’ matches a single arbitrary character, whereas‘*’ matches zero to an arbitrary number of arbitrary characters. Some examples:

a?c Matches ‘abc’, ‘axc’, ‘a c’ etc. but not ‘abbc’, ‘abbbc’, ‘ac’ etc.a*c Matches ‘abc’, ‘abbc’, ‘ac’ etc. but not ‘abd’ etc.ab* Matches ‘abc’, ‘abcdefg’, ‘abXYZ’ etc. but not ‘acdefg’ etc.?bc Matches ‘abc’, ‘Xbc’, ‘ bc’ etc. but not ‘aabc’, ‘abbc’, ‘bc’ etc.

Despite their simplicity, globbing patterns are often sufficient for selecting filenames.

Page 53: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

has_aggr 53

Value

Character vector (or factor).

Note

This is not normally directly called by an opm user because particularly explode_dir and the IOfunctions calling that function internally use glob_to_regex anyway.

See Also

utils::glob2rx base::regex

Other auxiliary-functions: contains, kubrick, map_names, map_values, opm_opt, separate

Examples

x <- "*what glob2rx() can’t handle because a ’+’ is included*"(y <- glob_to_regex(x))(z <- glob2rx(x))stopifnot(!identical(y, z))# Factor method(z <- glob_to_regex(as.factor(x)))stopifnot(identical(as.factor(y), z))

has_aggr Are aggregated data present?

Description

Check whether aggregated data are present. This always returns FALSE for the OPM class, but notnecessarily for its child classes.

Usage

## S4 method for signature ’OPM’has_aggr(object)

## S4 method for signature ’OPMS’has_aggr(object, ...)

Arguments

object OPM or OPMS object.

... Optional arguments passed between the methods.

Value

Logical vector, one element per plate.

Page 54: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

54 has_disc

Note

See do_aggr for generating aggregated data.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_disc, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)stopifnot(has_aggr(vaas_1))

# ’OPMS’ methoddata(vaas_4)stopifnot(has_aggr(vaas_4))

has_disc Are discretized data present?

Description

Check whether discretized data are present. This always returns FALSE for the OPM class, but notnecessarily for its child classes.

Usage

## S4 method for signature ’OPM’has_disc(object)

## S4 method for signature ’OPMS’has_disc(object, ...)

Arguments

object OPM or OPMS object.

... Optional arguments passed between the methods.

Value

Logical vector, one element per plate.

Note

See do_disc for generating discretized data.

Page 55: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

heat_map 55

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, hours, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- has_disc(vaas_1))stopifnot(x)

# ’OPMS’ methoddata(vaas_4)(x <- has_disc(vaas_4))stopifnot(x)

heat_map Heat map

Description

A wrapper for heatmap from the stats package and heatmap.2 from the gplots package with someadaptations likely to be useful for OmniLog® data. The data-frame and ‘OPMS’ methods extract anumeric matrix from a given data frame or ‘OPMS’ object and pass the result to the matrix method.

Usage

## S4 method for signature ’matrix’heat_map(object,

hclustfun = "ward", distfun = "euclidean", scale = "none",r.groups = "row.groups", r.col = opm_opt("colors"),c.groups = "col.groups", c.col = opm_opt("colors"),magnif = 4, cexRow = magnif[1L] / sqrt(nrow(object)),cexCol = magnif[length(magnif)] / sqrt(ncol(object)),borders = c(0.55, 0.75),margins = if (use.fun[1L] == "gplots")c(borders[1L] * cexCol * max(nchar(colnames(object))),borders[length(borders)] * cexRow * max(nchar(rownames(object))))

elsec(5, 5),

col = topo.colors(120L),...,use.fun = c("gplots", "stats"))

## S4 method for signature ’data.frame’heat_map(object, as.labels,

Page 56: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

56 heat_map

as.groups = NULL, sep = " ", ...)

## S4 method for signature ’OPMS’heat_map(object, as.labels,

subset = opm_opt("curve.param"), as.groups = NULL, sep = " ",extract.args = list(), ...)

Arguments

object Matrix, data frame or ‘OPMS’ object. The matrix method is mainly designedfor curve-parameter matrices as created by extract but can be used with anynumeric matrix. If a data frame, it must contain at least one column with numericdata.

as.labels Character, numeric or logical vector indicating the positions of the columns tobe joined and used as row labels. If NULL or empty, the row names of objectare used. See extract for details.

as.groups Character, numeric or logical vector indicating the positions of the columns tobe joined and used as group indicators. If NULL or empty, groups are ignored.

sep Character scalar determining how to join row and group names. See extractfor details.

subset Character scalar passed to the ‘OPMS’ method of extract.

extract.args Optional list of arguments passed to that method.

hclustfun Determines the clustering method used. If a function, used directly. If a charac-ter scalar, used as the ‘method’ argument of hclust. If a list, passed as argumentlist to hclust.

distfun Determines the distance method used. If a function, used directly. If a characterscalar, used as the ‘method’ argument of dist. If a list, passed as argument listto dist.

scale Character scalar. See heatmap for details. The default was changed to no rescal-ing because the curve parameters estimated from OmniLog® data have the samescale. If the relative changes per substrate are of interest, ‘column’ should beused.

r.groups Determines the plotting of a colour bar indicating row groups. If NULL, ignored.If a function, applied to the row names of object; should then yield one groupname for each row name. If a character scalar, the name of an attribute of objectthat contains the row group affiliations (ignored if this is not found). Otherwise,coerced to ‘character’ mode. Finally the groups are converted to a factor andused for selecting from r.col.

r.col Character vector of colour names used by r.groups. Ignored if that is NULL.

c.groups Determines the plotting of a colour bar indicating column groups. If NULL, ig-nored. If a function, applied to the column names of object; should then yieldone group name for each column name. If a character scalar, the name of anattribute of object that contains the column group affiliations (ignored if thisis not found). Otherwise, coerced to ‘character’ mode. Finally the groups areconverted to a factor and used for selecting from c.col.

Page 57: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

heat_map 57

c.col Character vector of colour names used by c.groups. Ignored if that is NULL.

magnif Numeric vector. Factor(s) used per default by cexRow and cexCol.

cexRow Magnification of the row labels.

cexCol Magnification of the column labels.

borders Numeric vector. Factor(s) used per default by margin and cexCol.

margins Two-element numeric vector determining the relative size of the margin (i) atthe bottom and (ii) at the left.

col Character vector containing the proper heatmap colours.

... Optional arguments passed to heatmap or heatmap.2. Note that some defaultsof heatmap.2 are overwritten even though this is not transparent from the ar-gument list of heat_map. If set explicitly, the default heatmap.2 behaviour isrestored. ... also represents all arguments passed from the ‘OPMS’ or data-frame methods to the matrix method.

use.fun Character scalar. If ‘gplots’, it is attempted to load the gplots package and use itsheatmap.2 function (the default). If this fails, a warning is issued, and heatmapfrom the stats package (the default) is called instead.

Value

A list as output by heatmap or heatmap.2 with the additional entries ‘rowColMap’ or ‘colColMap’giving the mapping(s) of group names to colours as named character vector(s), if this feature wasused.

See Also

stats::heatmap gplots::heatmap.2

Other plotting-functions: ci_plot, level_plot, radial_plot, select_colors, show, xy_plot

Examples

data("vaas_4")

# Matrix methodx <- extract(vaas_4, as.labels = list("Strain"),

as.groups = list("Species"))hm <- heat_map(x)stopifnot(identical(metadata(vaas_4, "Species"), names(hm$rowColMap)))

# ’OPMS’ methodhm.2 <- heat_map(vaas_4, as.labels = "Strain", as.groups = "Species")stopifnot(identical(hm[-3], hm.2[-3]))

# Data-frame methodx <- extract(vaas_4, as.labels = list("Species", "Strain"), dataframe = TRUE)hm <- heat_map(x, as.labels = "Strain", as.groups = "Species")stopifnot(identical(metadata(vaas_4, "Species"), names(hm$rowColMap)))

Page 58: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

58 hours

hours Overall measuring hours

Description

Get the total number of measurements hours as stored in an OPM object.

Usage

## S4 method for signature ’OPM’hours(object,

what = c("max", "all", "size", "summary", "interval", "minmax"))

## S4 method for signature ’OPMS’hours(object, ...)

Arguments

object OPM object.

what Character scalar determining the output mode as follows:

all Numeric vector: all time points, in order.

interval The difference between each pair of adjacent time points, NA if this isirregular or only one time point is left.

max Numeric scalar: the largest time point.

minmax Numeric scalar: the smallest maximum. For OPM objects this is appar-ently identical to ‘max’.

size Integer scalar: the number of time points.

summary Display a summary.

... Optional arguments passed between the methods.

Value

Dependent on the what argument; see there.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, length, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Page 59: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

html_args 59

Examples

# ’OPM’ methoddata(vaas_1)(x <- hours(vaas_1)) # the default is ’max’stopifnot(identical(x, 95.75))(x <- hours(vaas_1, "minmax"))stopifnot(identical(x, 95.75))(x <- hours(vaas_1, "summary"))stopifnot(is.table(x))(x <- hours(vaas_1, "interval"))stopifnot(identical(x, 0.25))(x <- hours(vaas_1, "size"))stopifnot(identical(x, 384L))

# ’OPMS’ methoddata(vaas_4)(x <- hours(vaas_4))stopifnot(length(x) == 4, x == 95.75)

html_args Default HTML formatting arguments

Description

A helper function for phylo_data allowing for the easy fine-tuning of the generated HTML output.

Usage

html_args(character.states = c(‘negative reaction‘ = "-", ‘weak reaction‘ = "w", ‘positive reaction‘ = "+"),multiple.sep = "/", organisms.start = "Organisms: ",states.start = "Symbols: ", legend.dot = TRUE,legend.sep.1 = ", ", legend.sep.2 = "; ",table.summary = "character matrix",greek.letters = TRUE, css.file = opm_opt("css.file"),...)

Arguments

character.states

Character vector used for mapping integers to the elements in the correspondingposition. It is also used in conjunction with its names to create the table legend.The default value is useful for data of mode ‘logical’, mapping FALSE, NA andTRUE, in this order. Data of this kind are by default internally converted to anaccording integer vector.

multiple.sep Character scalar used for joining multi-state characters together.organisms.start

Character scalar prepended to the organism part of the table legend. Ignored ifempty.

Page 60: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

60 html_args

states.start Character scalar prepended to the character-states part of the table legend. Ig-nored if empty.

legend.dot Logical scalar indicating whether or not a dot shall be appended to the table-legend entries.

legend.sep.1 Character scalar used for the first pass of joining the table-legend entries to-gether.

legend.sep.2 Character scalar used for the second pass of joining the table-legend entriestogether.

table.summary Character scalar inserted as ‘summary’ attribute of the resulting HTML table.

greek.letters Logical scalar indicating whether or not letters between ‘a’ and ‘a’ within sub-strate names should be converted to the corresponding Greek letters.

css.file Character vector indicating the name of one to several CSS files to link. Emptrystrings and empty vectors are ignored. It is no error if the file does not exist, butthe page will then probably not be displayed as intended. Under Windows it isrecommended to convert a filename f beforehand using normalizePath(f, winslash = "/").

... Optional other arguments available for inserting user-defined HTML content.Currently the following ones (in their order of insertion) are not ignored, andcan even be provided several times:

meta Used as (additional) ‘meta’ entries within the HTML head.headline Override the use of the title argument as headline (placed above the

table legend). An empty argument would turn it off.prepend List or character vector to be inserted before the table legend. Lists are

converted recursively. List names will be converted to ‘title’ and ‘class’ at-tributes (if missing, names are inferred from the nesting level; see opm_opt,entry ‘html.class’). Names of other vectors, if any, are converted to ‘title’and ‘span’ attributes. Character vectors are converted using safe_labelsunless they inherit from ‘AsIs’ (see I from the base package).

insert As above, but inserted between the legend and the table.append As above, but inserted after the table.

Value

List.

See Also

base::normalizePath

Other phylogeny-functions: phylo_data, safe_labels

Examples

# see phylo_data()

Page 61: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

include_metadata 61

include_metadata Add metadata (from file or data frame)

Description

Include metadata by mapping CSV data and column names in a data frame.

Usage

## S4 method for signature ’OPM’include_metadata(object, md,

keys = opm_opt("csv.keys"), replace = FALSE, skip.failure = FALSE,remove.keys = TRUE, ...)

## S4 method for signature ’OPMS’include_metadata(object, ...)

Arguments

object OPM object.md Dataframe containing keys as column names, or name of file from which to read

the data frame. Handled by to_metadata.keys Character vector.replace Logical scalar indicating whether the previous metadata, if any, shall be replaced

by the novel ones, or whether these shall be appended.skip.failure Logical scalar. Do not stop with an error message if (unambiguous) selection is

impossible but raise a warning only?remove.keys Logical scalar. When including md in the metadata, discard the keys columns?... Optional argument passed to to_metadata.

Value

Novel OPM object.

See Also

Other metadata-functions: map_metadata, metadata.set, metadata_chars

Examples

data(vaas_1)(x <- collect_template(vaas_1, add.cols = "Location")) # generate data framex[1, "Location"] <- "Braunschweig" # insert additional informationcopy <- include_metadata(vaas_1, x) # include the data in new OPM objectstopifnot(is.null(metadata(vaas_1, "Location")))stopifnot(identical(metadata(copy, "Location"), "Braunschweig"))

Page 62: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

62 length

kubrick Stanley Kubrick

Description

Stanley Kubrick memorial function. Prints a quote from one of his movies.

Usage

kubrick(movie = character())

Arguments

movie Character scalar (name of the movie) or convertible to such. If empty, the quo-tation is chosen randomly. Otherwise, partial matching is allowed.

Value

Character scalar (quotation), returned invisibly.

See Also

Other auxiliary-functions: contains, glob_to_regex, map_names, map_values, opm_opt, separate

Examples

x <- kubrick()stopifnot(is.character(x), length(x) == 1L)

length OPMS length (number of plates)

Description

Get the number of plates stored in an OPMS object.

Usage

## S4 method for signature ’OPMS’length(x)

Arguments

x OPMS object.

Page 63: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

level_plot 63

Value

Numeric scalar.

See Also

base::length

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, max, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

data(vaas_4)(x <- length(vaas_4))stopifnot(identical(x, 4L))

level_plot Levelplot

Description

Levelplot for OPM and OPMS objects using the function from the lattice package.

Usage

## S4 method for signature ’OPM’level_plot(x, main = list(),

colors = opm_opt("color.borders"), cex = NULL, space = "Lab", bias = 0.5,num.colors = 200L, ...)

## S4 method for signature ’OPMS’level_plot(x, main = list(),

colors = opm_opt("color.borders"), panel.headers = TRUE, cex = NULL,strip.fmt = list(), striptext.fmt = list(), legend.sep = " ",space = "Lab", bias = 0.5, num.colors = 200L, ...)

Arguments

x OPM or OPMS object.

main The settings controlling the construction of the main title. Works like the mainargument of xy_plot.

colors Character vector indicating the colours (at least two).

panel.headers NULL, logical scalar, expression or character vector. NULL and FALSE turn panelheaders off. TRUE causes the panel headers to be constructed from the platenumbers or those metadata that were included by flatten (see there). Charactervectors and expressions are directly used for the text within these panel headers.

Page 64: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

64 level_plot

cex Numeric scalar. Magnification of axis annotation. If NULL, automatically adaptedto the number of wells (at least a good guess is made).

strip.fmt List controlling the format of the description strip above each panel. For in-stance, the background colour is set using the ‘bg’ key. For further details, seestrip.custom from the lattice package. strip.fmt is ignored if panel.headersis FALSE.

striptext.fmt List controlling the format of the text within the strip above each panel. Seexy_plot for details, which has an argument of the same name.

legend.sep Character scalar. This works like the eponymous argument to flatten (seethere); it is ignored unless metadata are chosen for constructing the panel head-ers.

space Character scalar passed to colorRampPalette from the grDevices package.These and the following arguments are for fine-tuning the colour palette usedfor plotting.

bias Numeric scalar also passed to colorRampPalette.

num.colors Numeric scalar passed to the function returned by colorRampPalette.

... Arguments that are passed to flatten.

Value

An object of class ‘trellis’. See levelplot from the lattice package for details.

References

Jacobsen, J. S., Joyner, D. C., Borglin, S. E., Hazen, T. C., Arkin, A. P. et al. 2007 Visualizationof growth curve data from phenotype microarray experiments. 11th International Conference onInformation Visualization (IV07). Zuerich, Switzerland, July 4-6 2007. Published by the IEEEComputer Society.

Sarkar, D. 2008 Lattice: Multivariate Data Visualization with R. New York: Springer, 265 p.

Vaas, L. A. I., Sikorski, J., Michael, V., Goeker, M., Klenk H.-P. 2012 Visualization and curveparameter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoSONE 7, e34846.

See Also

lattice::levelplot grDevices::colorRampPalette

Other plotting-functions: ci_plot, heat_map, radial_plot, select_colors, show, xy_plot

Examples

# OPM methoddata(vaas_1)level_plot(vaas_1, main = "Levelplot example")

# OPMS method## Not run:data(vaas_4)

Page 65: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

listing 65

# headers include species and strainlevel_plot(vaas_4, include = c("Species", "Strain"))

## End(Not run)

listing Create textual listing

Description

This creates a textual listing of the discretized values. This is useful to describe OmniLog® pheno-type microarray results in a manuscript.

Usage

## S4 method for signature ’OPMD’listing(x, downcase = TRUE, full = TRUE,

in.parens = FALSE, ...)

## S4 method for signature ’OPMS’listing(x, as.groups, cutoff = 0.5, sep = " ",

exact = TRUE, strict = TRUE, downcase = TRUE, full = TRUE,in.parens = FALSE, ...)

Arguments

x OPMD or OPMS object.

downcase Logical scalar passed to wells.

full Logical scalar passed to wells.

in.parens Logical scalar passed to wells.

as.groups List or NULL. If a list, passed as ‘key’ argument to metadata. The extractedmetadata define groups for which the discretized data are aggregated.

cutoff Numeric scalar used if ‘as.groups’ is a list. If the relative frequency of the mostfrequent entry within the discretized values to be joined is below that cutoff, NAis used.

sep Character scalar used for joining the ‘as.groups’ entries (if any).

exact Logical scalar passed to metadata.

strict Logical scalar also passed to metadata.

... Optional arguments passed between the methods or to wells.

Value

Character vector or matrix. See the examples for details.

Page 66: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

66 map_metadata

Note

See do_disc for generating discretized data.

See Also

Other naming-functions: find_positions, find_substrate, substrate_info, well_to_substrate

Examples

# ’OPMD’ methoddata(vaas_1)

# this yields one sentence for each kind of reaction:(x <- listing(vaas_1))stopifnot(is.character(x), length(x) == 3, !is.null(names(x)))

# ’OPMS’ methoddata(vaas_4)

# no grouping, no names(y <- listing(vaas_4, as.groups = NULL))stopifnot(is.matrix(y), dim(y) == c(4, 3))stopifnot(is.null(rownames(y)), !is.null(colnames(y)))

# in effect no grouping, but names(y <- listing(vaas_4, as.groups = list("Species", "Strain")))stopifnot(is.matrix(y), dim(y) == c(4, 3))stopifnot(!is.null(rownames(y)), !is.null(colnames(y)))

# two groups(y <- listing(vaas_4, as.groups = list("Species")))stopifnot(is.matrix(y), dim(y) == c(2, 3))stopifnot(!is.null(rownames(y)), !is.null(colnames(y)))

map_metadata Map metadata

Description

Modify meta-information stored together with the measurements by using a function (this is just awrapper for rapply, with how set to ‘replace’, if values is TRUE) or a ‘character’ vector-based map-ping. The OPMS method applies this to all plates in turn and returns an OPMS object with accordinglymodified metadata.

Usage

## S4 method for signature ’WMD,function’map_metadata(object, mapping,

values = TRUE, classes = "ANY", ...)

Page 67: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

map_metadata 67

## S4 method for signature ’WMD,character’map_metadata(object, mapping,

values = TRUE, classes = "factor")

## S4 method for signature ’WMD,formula’map_metadata(object, mapping)

## S4 method for signature ’OPMS,ANY’map_metadata(object, mapping, ...)

Arguments

object WMD object or OPMS object.

mapping A function. It is applied to all non-list elements of metadata, which is traversedrecursively. Alternatively, a character vector. See map_values for usage details.metadata_chars can be used to create a template for such a vector. mappingcan also be a formula; in that case, metadata is replaced by the result of thelist+formula method of map_values. If the left side of the formula is missing,the entire metadata are replaced by the result, which is an error if the result isnot a list.

values Logical scalar. If FALSE, metadata names, not values, are mapped, and classesis ignored (names are always of class ‘character’).

classes Character vector or (for the character vector-based mapping) TRUE. For the map-ping with a function or vector, this specifies the classes in addition to ‘character’that are mapped (after converting to ‘character’ mode). If classes is TRUE,mapping is treated as a mapping between class names, and the according con-versions are applied. See the coerce argument of map_values for details.

... Optional argument passed to mapping if it is a function, and from the OPMSmethod to the WMD method.

Value

WMD or OPMS object with modified metadata.

See Also

Other metadata-functions: include_metadata, metadata.set, metadata_chars

Examples

# WMD methodsdata(vaas_1)

# WMD+function methodcopy <- map_metadata(vaas_1, identity)stopifnot(identical(copy, vaas_1))copy <- map_metadata(vaas_1, identity, values = FALSE)

Page 68: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

68 map_metadata

stopifnot(identical(copy, vaas_1))copy <- map_metadata(vaas_1, function(x) paste(x, "!"), values = FALSE)(x <- metadata_chars(vaas_1, values = FALSE))(y <- metadata_chars(copy, values = FALSE))stopifnot(identical(as.character(y), paste(x, "!")))

# WMD+character method: mapping a valuemap <- metadata_chars(vaas_1)map["First replicate"] <- "Rep. 1"copy <- map_metadata(vaas_1, map)stopifnot(identical(names(metadata(copy)), names(metadata(vaas_1))))stopifnot(!identical(metadata(copy, "Experiment"),

metadata(vaas_1, "Experiment")))

# WMD+character method: mapping a namemap <- metadata_chars(vaas_1, values = FALSE)map["Plate number"] <- "Plate no."copy <- map_metadata(vaas_1, map, values = FALSE)stopifnot(!identical(names(metadata(copy)), names(metadata(vaas_1))))

# WMD+formula methodcopy <- map_metadata(vaas_1, Organism ~ paste(Species, Strain))(x <- setdiff(metadata_chars(copy), metadata_chars(vaas_1)))stopifnot(length(x) == 1, x == "Escherichia coli DSM30083T")

# OPMS methoddata(vaas_4)

# using a functioncopy <- map_metadata(vaas_4, identity)stopifnot(identical(copy, vaas_4))copy <- map_metadata(vaas_4, identity, values = FALSE)stopifnot(identical(copy, vaas_4))copy <- map_metadata(vaas_4, function(x) paste(x, "!"), values = FALSE)(x <- metadata_chars(vaas_4, values = FALSE))(y <- metadata_chars(copy, values = FALSE))stopifnot(identical(as.character(y), paste(x, "!")))

# using a character vectormap <- metadata_chars(vaas_4)map["First replicate"] <- "Rep. 1"copy <- map_metadata(vaas_4, map)x <- metadata(vaas_4, "Experiment")stopifnot(x == "First replicate")y <- metadata(copy, "Experiment")stopifnot(y == "Rep. 1")

# using a formulacopy <- map_metadata(vaas_4, Organism ~ paste(Species, Strain))(x <- setdiff(metadata_chars(copy), metadata_chars(vaas_4)))stopifnot(length(x) == 4) # one entry per plate

Page 69: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

map_names 69

map_names Map names

Description

Use a character vector or a function for recursively mapping list names, or mapping the ‘colnames’and ‘rownames’ attributes of a data frame. In the case of lists, the function is not applied to listelements which are not themselves lists, even if they have a ‘names’ attribute. Such elements andtheir names, if any, are returned unchanged. If a ‘names’, ‘colnames’ or ‘rownames’ attribute isNULL, it is ignored. Alternatively, instead of mapping the names, collect them and return them as asingle character vector, sorted and with duplicates removed. The collected names are added as theirown names attribute; this might be useful if the result is later on used for some mapping (using thisfunction or map_values).

Usage

## S4 method for signature ’list,function’map_names(object, mapping, ...)

## S4 method for signature ’list,character’map_names(object, mapping)

## S4 method for signature ’list,missing’map_names(object)

## S4 method for signature ’data.frame,function’map_names(object, mapping,

...)

## S4 method for signature ’data.frame,character’map_names(object, mapping)

## S4 method for signature ’data.frame,missing’map_names(object)

## S4 method for signature ’MOA,function’map_names(object, mapping, ...)

## S4 method for signature ’MOA,character’map_names(object, mapping)

## S4 method for signature ’MOA,missing’map_names(object)

## S4 method for signature ’ANY,function’map_names(object, mapping, ...)

Page 70: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

70 map_names

## S4 method for signature ’ANY,character’map_names(object, mapping)

## S4 method for signature ’ANY,missing’map_names(object)

Arguments

object Any R object. The default method applies the mapping to the ‘names’ attribute.The behaviour is special for lists, which are traversed recursively to also considersublists with names. Data frames and MOA objects (that is, including matricesand arrays) are also treated specially because the ‘dimnames’ attribute, not the‘names’ attribute is considered.

mapping Mapping function that takes a character vector as first argument, or charactervector used for mapping from its names to its values, or missing. It is guaranteedthat NULL input remains NULL, irrespective of the value of mapping.

... Optional further arguments to mapping (if it is a function).

Value

Character vector if mapping is missing, otherwise an R object of the same class than object.

Note

This function is not normally directly called by an opm user because map_metadata is available.

See Also

base::rapply base::list base::as.list

Other auxiliary-functions: contains, glob_to_regex, kubrick, map_values, opm_opt, separate

Examples

# List/function methodx <- list(a = 1:8, c = 9, d = ’x’)map <- function(x) sprintf("%s%s", x, x)(y <- map_names(x, map))stopifnot(identical(as.character(x), as.character(y)))stopifnot(!identical(names(x), names(y)))

# List/character methodx <- list(a = 1:8, c = 9, d = ’x’)map <- c(a = "b", e = "f", x = "y")(y <- map_names(x, map))stopifnot(identical(as.character(x), as.character(y)))stopifnot(!identical(names(x), names(y)))# compare with the map_values() example

# List/missing method

Page 71: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

map_values 71

x <- list(a = 1:8, c = 9, d = ’x’)(y <- map_names(x))stopifnot(identical(as.vector(y), names(x)))stopifnot(identical(names(y), names(x)))# Now a recursive listx <- list(a = 1:8, c = 9, d = list(d1 = ’x’, d2 = ’y’))(y <- map_names(x))stopifnot(length(y) > length(names(x)))

# Data frame/function methodx <- data.frame(a = 1:3, b = letters[1:3])(y <- map_names(x, toupper))stopifnot(identical(y[[1]], x[[1]]), identical(y[[2]], x[[2]]))stopifnot(identical(names(y), c("A", "B")))

# Data frame/character method(y <- map_names(x, c(a = "b", b = "a")))stopifnot(x == y, names(y) == c("b", "a"))

# Data frame/missing method(y <- map_names(x))stopifnot(is.character(y), y == names(y), length(y) == 5)

# Matrix/function methodx <- as.matrix(x)(y <- map_names(x, toupper))stopifnot(x == y, toupper(colnames(x)) == colnames(y))

# Matrix/character method(y <- map_names(x, c(a = "b", b = "a")))stopifnot(x == y, colnames(y) == c("b", "a"))

# Matrix/missing method(y <- map_names(x))stopifnot(y == c("a", "b"), names(y) == y)

map_values Map values

Description

Map ‘character’ data using another ‘character’ vector, or recursively apply a mapping function toall ‘character’ values within a list, or non-recursively to a data frame. Optionally coerce other datatypes to ‘character’; return remaining ones unchanged. It is also possible to map between classesusing coercion functions. For convenience in programming, methods for the ‘NULL’ class are alsoavailable.

Usage

## S4 method for signature ’list,character’

Page 72: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

72 map_values

map_values(object, mapping,coerce = character())

## S4 method for signature ’list,function’map_values(object, mapping,

coerce = character(), ...)

## S4 method for signature ’list,missing’map_values(object,

coerce = character())

## S4 method for signature ’list,formula’map_values(object, mapping)

## S4 method for signature ’data.frame,function’map_values(object, mapping,

coerce = character(), ...)

## S4 method for signature ’data.frame,character’map_values(object, mapping,

coerce = character())

## S4 method for signature ’data.frame,missing’map_values(object,

coerce = character())

## S4 method for signature ’MOA,character’map_values(object, mapping,

coerce = TRUE)

## S4 method for signature ’MOA,missing’map_values(object, coerce = TRUE)

## S4 method for signature ’MOA,function’map_values(object, mapping, ...)

## S4 method for signature ’character,function’map_values(object, mapping,

...)

## S4 method for signature ’character,character’map_values(object, mapping)

## S4 method for signature ’character,missing’map_values(object)

## S4 method for signature ’factor,function’map_values(object, mapping,

Page 73: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

map_values 73

...)

## S4 method for signature ’factor,character’map_values(object, mapping)

## S4 method for signature ’factor,missing’map_values(object)

## S4 method for signature ’NULL,function’map_values(object, mapping, ...)

## S4 method for signature ’NULL,character’map_values(object, mapping)

## S4 method for signature ’NULL,missing’map_values(object, mapping)

Arguments

object List (may be nested), data frame or character vector. If it has names, they arepreserved. NULL can also be given and yields NULL or an empty named charactervector (if mapping is missing). object may also belong to the virtual class MOA,comprising matrices and arrays.

mapping Character vector, function, formula, or missing. If a character vector used as amapping from its names to its values. Values from object are searched for inthe names attribute of mapping; those found are replaced by the correspondingvalues of mapping. If mapping is missing, a character vector is returned (sortedand with duplicates removed) whose names are identical to the values. Thiseases the construction of mapping vectors specific for object. If mapping ismissing, the coerce argument must be named. mapping changes its usage ifcoerce is TRUE. For MOA objects, if mapping was a function, it would be appliedto object after conversion with as.vector, and it would be attempted to addthe original attributes (particularly important are ‘dim’ and ‘dimnames’ back tothe result. For MOA objects, if mapping is the usual character vector, it then isused for mapping the storage.mode, not the class of object. mapping canalso be a formula, it is then used to compute on lists. The see examples below.

coerce Character vector with the names of classes that are coerced to ‘character’ toallow the mapping. Other classes are returned unchanged. Note that the coerceddata are not converted back to their original data type. ‘ANY’ can be used toindicate that all classes will be considered. Alternatively, coerce can be TRUE.mapping is then interpreted as a mapping between the names of classes, andas from the methods package is used for conducting the requested coercions.Attempting an undefined coercion will result in an error.

... Optional further arguments to mapping (if it is a function).

Page 74: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

74 map_values

Value

List, data frame, character vector or NULL.

Note

This function is not normally directly called by an opm user because map_metadata is available.

See Also

base::rapply base::list base::as.list methods::as base::class base::storage.mode base::as.vector

Other auxiliary-functions: contains, glob_to_regex, kubrick, map_names, opm_opt, separate

Examples

# Character/character methodmap <- lettersnames(map) <- rev(LETTERS)(x <- map_values(LETTERS, map))stopifnot(rev(x) == letters)

# Character/missing method(x <- map_values(letters))stopifnot(x == letters, names(x) == letters)

# Character/function methodx <- letters[1:4]names(x) <- LETTERS[1:4](y <- map_values(x, function(z) sprintf("%s%s", z, z)))stopifnot(names(y) == names(x), y != x)

# List/character methodx <- list(a = 1:8, c = 9, d = ’x’)map <- c(a = "b", e = "f", x = "y")(y <- map_values(x, map))stopifnot(identical(x[1:2], y[1:2]), !identical(x[3], y[3]))(y <- map_values(x, map, coerce = "integer"))stopifnot(identical(x[2], y[2]), !identical(x[1], y[1]),

!identical(x[3], y[3]))(y <- map_values(x, map, coerce = TRUE))stopifnot(identical(x, y))(y <- map_values(x, c(numeric = "character"), coerce = TRUE))stopifnot(identical(x[1], y[1]), !identical(x[2], y[2]),

identical(x[3], y[3]))

# List/function method(y <- map_values(x, identity, coerce = "ANY"))stopifnot(identical(x, y))(y <- map_values(x, class, coerce = "ANY"))stopifnot(sapply(y, class) == "character", names(y) == names(x))

# List/missing method

Page 75: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

map_values 75

(y <- map_values(x))stopifnot(y == "x", names(y) == y)(y <- map_values(x, coerce = "integer"))stopifnot(length(y) == 9, names(y) == y)(y <- map_values(x, coerce = c("integer", "numeric")))stopifnot(length(y) == 10, names(y) == y)(y <- map_values(x, coerce = "ANY")) # same effectstopifnot(length(y) == 10, names(y) == y)(y <- map_values(x, coerce = TRUE))stopifnot(y == c("character", "integer", "numeric"), names(y) == y)

# List/formula method(y <- map_values(x, ~ a + c))stopifnot(is.numeric(y), y == c(10:17))(y <- map_values(x, b ~ a + c))stopifnot(is.list(y), y$b == c(10:17))

# List/formula method applied to a data framex <- data.frame(a = 1:5, b = 6:10)(y <- map_values(x, c ~ a + b))stopifnot(is.data.frame(y), dim(y) == c(5, 3))(z <- map_values(x, ~ a + b))stopifnot(identical(z, y$c))

# Data frame/character methodx <- data.frame(a = 1:3, b = letters[1:3])stopifnot(sapply(x, class) == c("integer", "factor"))map <- c(a = "A", b = "B", c = "C", ‘1‘ = "5")(y <- map_values(x, map))stopifnot(identical(x, y))(y <- map_values(x, map, coerce = "factor"))stopifnot(!identical(x, y), y[[2]] == c("A", "B", "C"))(y <- map_values(x, map, coerce = "ANY"))stopifnot(y[[1]] == c("5", "2", "3"), y[[2]] == c("A", "B", "C"))(y <- map_values(x, map, coerce = TRUE))stopifnot(identical(x, y))map <- c(factor = "character", integer = "complex")(y <- map_values(x, map, coerce = TRUE))stopifnot(sapply(y, class) == c("complex", "character"))

# Data frame/function method(y <- map_values(x, ‘+‘, coerce = "integer", y = 1L))stopifnot(y$a == x$a + 1L)(y <- map_values(x, as.character, coerce = "factor"))stopifnot(sapply(y, class) == c("integer", "character"))

# Data frame/missing method(y <- map_values(x))stopifnot(is.character(y), length(y) == 0)(y <- map_values(x, coerce = "factor"))stopifnot(is.character(y), y == letters[1:3], names(y) == y)(y <- map_values(x, coerce = "ANY"))stopifnot(is.character(y), length(y) == 6, names(y) == y)

Page 76: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

76 max

(y <- map_values(x, coerce = TRUE))stopifnot(is.character(y), y == c("factor", "integer"), names(y) == y)

# Matrix/character method(x <- matrix(1:6, nrow = 2))(y <- map_values(x, c(integer = "numeric"), coerce = TRUE))stopifnot(storage.mode(x) != storage.mode(y))(y <- map_values(x, c(‘1‘ = "7"), coerce = "integer"))stopifnot(is.character(y), y[-1] == x[-1])

# Matrix/function method(y <- map_values(x, identity))stopifnot(identical(x, y))(y <- map_values(x, ‘+‘, y = 1)) # useless because ’+’ is directly availablestopifnot(dim(y) == dim(x), y == x + 1)

# Matrix/missing method(y <- map_values(x))stopifnot(y == "integer", names(y) == y)(y <- map_values(x, coerce = "ANY"))stopifnot(is.character(y), y == 1:6, names(y) == y)

# Factor/function methodx <- as.factor(c("a", "b", "a"))(y <- map_values(x, toupper))stopifnot(is.factor(y), y == toupper(x))

# Factor/character method(y <- map_values(x, c(b = "c", k = "h")))stopifnot(is.factor(y), levels(y) == c("a", "c"))

# Factor/missing method(y <- map_values(x))stopifnot(levels(x) == y, names(y) == y)

max Maximum

Description

Get the maximal value of all wells or (a) specified one(s). The OPMS method works by calling theOPM method on all plates and then determining the overall maximum.

Usage

## S4 method for signature ’OPM’max(x, ..., na.rm = FALSE)

## S4 method for signature ’OPMS’max(x, ..., na.rm = FALSE)

Page 77: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

measurements 77

Arguments

x OPM or OPMS object.

... Coordinate of one to several wells. If missing, the maximum of all wells isreturned. See well for details.

na.rm Logical scalar. See max from the base package. Has no effect here because NAvalues are not allowed within the measurements.

Value

Numeric scalar.

See Also

base::max

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, measurements, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# OPM methoddata(vaas_1)(x <- max(vaas_1))(y <- max(vaas_1, 1)) # this is the negative controlstopifnot(x > y)

# OPMS methoddata(vaas_4)(x <- max(vaas_4))(y <- max(vaas_4, 1)) # this is the negative controlstopifnot(x > y)

measurements Stored measurements

Description

Return the measurements. The first column contains the hours, the other ones contain the valuesfrom each well. There is one row per time point. Column names are appropriately set, but nottranslated (as, e.g., to substrate names). It is possible to select wells, but the time points are alwaysincluded as first column (in contrast to well). The i argument refers only to the remaining matrix.

Page 78: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

78 measurements

Usage

## S4 method for signature ’OPM’measurements(object, i)

## S4 method for signature ’OPMS’measurements(object, ...)

Arguments

object OPM or OPMS object.

i Optional character or numeric vector with name(s) or position(s) of well(s).

... Optional arguments passed between the methods.

Value

Numeric matrix with column names indicating the well coordinate and a first column containingthe time points.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, metadata,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)x <- measurements(vaas_1)stopifnot(is.matrix(x), is.numeric(x))stopifnot(identical(dim(x), c(384L, 97L)))y <- measurements(vaas_1, "B03")stopifnot(is.matrix(y), is.numeric(y))stopifnot(identical(dim(y), c(384L, 2L)))

# ’OPMS’ methoddata(vaas_4)x <- measurements(vaas_4)stopifnot(is.list(x), length(x) == length(vaas_4))stopifnot(sapply(x, is.matrix), sapply(x, is.numeric))

Page 79: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

merge 79

merge Merge plates

Description

Combine all plates in a single OPM object by treating them as originating from subsequent runs ofthe same experimental plate. Adjust the times accordingly.

Usage

## S4 method for signature ’OPMS,numeric’merge(x, y, sort.first = TRUE,

parse = TRUE)

## S4 method for signature ’OPMS,missing’merge(x, sort.first = TRUE,

parse = TRUE)

## S4 method for signature ’CMAT,ANY’merge(x, y)

Arguments

x OPMS object.

y Numeric vector indicating the time(s) (in hours) between two subsequent plates.Must be positive throughout, and its length should fit to the number of plates(e.g., either 1 or length(x) - 1 would work). If missing, 0.25 is used.

sort.first Logical scalar. Sort the plates according to their setup times before merging?

parse Logical scalar. Ignored unless sort.first is TRUE. For sorting, parse the setuptimes using strptime from the base package? It is an error if this does notwork.

Value

OPM object. The metadata and csv_data will be taken from the first contained plate, but aggregatedvalues, if any, will be dropped.

Note

This function is intended for dealing with slowly growing or reacting organisms that need to be ana-lyzed with subsequent runs of the same plate in PM mode. Results obtained with Geodermatophilusstrains and Generation-III plates indicate that this works well in practice.

Page 80: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

80 metadata

See Also

Other conversion-functions: extract, extract_columns, flatten, gen_iii, oapply, plates,rep, rev, sort, thin_out, to_yaml, unique

Examples

data(vaas_4) # merge() is biologically unreasonable for these data!summary(x <- merge(vaas_4))stopifnot(is(x, "OPM"), dim(x) == c(sum(hours(vaas_4, "size")), 96))

metadata Get metadata

Description

Get meta-information stored together with the data.

Usage

## S4 method for signature ’WMD’metadata(object, key = NULL, exact = TRUE,

strict = FALSE)

## S4 method for signature ’OPMS’metadata(object, ...)

Arguments

object WMD object.

key If NULL or otherwise empty, return all metadata. If a non-empty list, treat it as listof keys and return list of corresponding metadata values. Here, character vectorsof length > 1 can be used to query nested metadata lists. If neither empty nora list (i.e. usually a character or numeric scalar), treat key as a single list key.Factors are converted to ‘character’ mode.

exact Logical scalar. Use exact or partial matching of keys? Has no effect if key isempty.

strict Logical scalar. Is it an error if a NULL value results from fetching a metadatakey?

... Optional arguments passed between the methods.

Value

List (empty if metadata were not set or if subselection using key did not result).

Page 81: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

metadata.set 81

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,minmax, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- metadata(vaas_1, "Strain"))stopifnot(identical(x, "DSM30083T"))

# ’OPMS’ methoddata(vaas_4)(x <- metadata(vaas_4, "Strain"))stopifnot(x == c("DSM18039", "DSM30083T", "DSM1707", "429SC1"))

metadata.set Replace metadata

Description

Set the meta-information stored together with the data. The OPMS methods set the meta-informationstored together with the measurements for all plates at once (but can address the plates individuallyif value is a formula or a data frame, see below).

Usage

## S4 replacement method for signature ’WMD,missing,list’metadata(object) <- value

## S4 replacement method for signature ’WMD,missing,formula’metadata(object) <- value

## S4 replacement method for signature ’WMD,numeric,list’metadata(object, key) <- value

## S4 replacement method for signature ’WMD,list,list’metadata(object, key) <- value

## S4 replacement method for signature ’WMD,character,ANY’metadata(object, key) <- value

## S4 replacement method for signature ’WMD,factor,ANY’metadata(object, key) <- value

## S4 replacement method for signature ’OPMS,missing,list’

Page 82: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

82 metadata.set

metadata(object) <- value

## S4 replacement method for signature ’OPMS,missing,formula’metadata(object) <- value

## S4 replacement method for signature ’OPMS,missing,data.frame’metadata(object) <- value

## S4 replacement method for signature ’OPMS,ANY,ANY’metadata(object, key) <- value

## S4 replacement method for signature ’OPMS,ANY,data.frame’metadata(object, key) <- value

## S4 replacement method for signature ’OPMS,character,data.frame’metadata(

object, key) <- value

## S4 replacement method for signature ’OPMS,factor,data.frame’metadata(

object, key) <- value

Arguments

object WMD or OPMS object..key Missing, numeric scalar, character vector, factor, or list. If missing, replace all

metadata by value (unless value is a formula that specifies the key to replace).If a numeric scalar, then if positive, prepend value to old metadata. If negative,append value to old metadata. If zero, replace old metadata entirely by value.If a list, treat it as list of keys; expect value to be a list of corresponding meta-data values to be set. Names are replaced by the values of either list if they aremissing. If a character vector, use it as key and set/replace this metadata entryto/by value. It is an error if key has zero length. If it contains more than one en-try, a nested query is done. See [[ from the base package for details. The factormethod calls the character method after converting key to mode ‘character’.

value If key is a character vector, this can be arbitrary value(s) to be included in themetadata (if NULL, this metadata entry is deleted). If key is otherwise, valuemust be list of values to be prepended, appended or set as metadata, either en-tirely or specifically, depending on key. Formulas can also be used as value.In that case, the formula can specify the key to be replaced. See the examplesbelow and map_values for details. If object is of class ‘OPMS’, value canbe a data frame whose number of rows must be equal to the number of plates.Metadata to be set will then be selected from each individual row in turn and ininput order.

Value

value.

Page 83: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

metadata.set 83

See Also

Other metadata-functions: include_metadata, map_metadata, metadata_chars

Examples

############################################################## WMD methodsdata(vaas_1)

# WMD/missing/list methodcopy <- vaas_1new.md <- list(Species = "Thermomicrobium roseum")metadata(copy) <- new.mdstopifnot(identical(metadata(copy), new.md))

# WMD/missing/formula method (operates on previous entries!)copy <- vaas_1metadata(copy) <- Organism ~ paste(Species, Strain)(x <- metadata(copy, "Organism"))stopifnot(is.null(metadata(vaas_1, "Organism")), !is.null(x))

# WMD/numeric/list methodcopy <- vaas_1metadata(copy, 1) <- list(Authors = "Vaas et al.")stopifnot(length(metadata(copy)) > length(metadata(vaas_1)))

# WMD/list/list methodcopy <- vaas_1stopifnot(identical(metadata(copy, "Species"), "Escherichia coli"))

# You can use this to translate the keys on-the-fly...metadata(copy, list(Organism = "Species")) <- list(

Organism = "Bacillus subtilis")stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))stopifnot(identical(metadata(copy, "Species"), "Bacillus subtilis"))stopifnot(is.null(metadata(copy, "Organism"))) # this was not set!

# ...but you need notmetadata(copy, list("Species")) <- list(Species = "Yersinia pestis")stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))stopifnot(identical(metadata(copy, "Species"), "Yersinia pestis"))

# Names need not be duplicatedmetadata(copy, list("Species")) <- list("Gen. sp.")stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))stopifnot(identical(metadata(copy, "Species"), "Gen. sp."))

# ...but this would delete the entry because nothing would be found in# ’value’metadata(copy, list("Species")) <- list(Organism = "E. coli")stopifnot(length(metadata(copy)) < length(metadata(vaas_1)))

Page 84: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

84 metadata_chars

stopifnot(is.null(metadata(copy, "Species")))

# ...this yields a general mechanism for metadata deletion by providing an# empty list as ’value’.

# WMD/character/any methodcopy <- vaas_1metadata(copy, "Strain") <- "08/15"stopifnot(length(metadata(copy)) == length(metadata(vaas_1)))stopifnot(metadata(copy, "Strain") != metadata(vaas_1, "Strain"))

# WMD/factor/any methodmetadata(copy, as.factor("Strain")) <- metadata(vaas_1, "Strain")stopifnot(metadata(copy, "Strain") == metadata(vaas_1, "Strain"))

############################################################## OPMS methodsdata(vaas_4)

# OPMS/missing/list methodcopy <- vaas_4(metadata(copy) <- list(x = -99))stopifnot(identical(unique(metadata(copy)), list(list(x = -99))))

# OPMS/missing/formula methodcopy <- vaas_4metadata(copy) <- Organism ~ paste(Species, Strain)(x <- metadata(copy, "Organism"))stopifnot(length(x) == length(metadata(vaas_4, "Organism")) + 4)

# OPMS/ANY/ANY methodcopy <- vaas_4(metadata(copy, "Species") <- "Bacillus subtilis")stopifnot(identical(unique(metadata(copy, "Species")), "Bacillus subtilis"))

# OPMS/character/data frame methodcopy <- vaas_4(x <- data.frame(Type = grepl("T$", metadata(vaas_4, "Strain"))))metadata(copy, "Type") <- x# one-column data frames are simplifiedstopifnot(identical(metadata(copy, "Type"), x$Type))# if keys match, a subselection of the data frame is used(x <- cbind(x, Notype = !x$Type))metadata(copy, "Type") <- xstopifnot(identical(metadata(copy, "Type"), x$Type))# if keys do not match, the entire data-frame rows are includedmetadata(copy, "Type2") <- xstopifnot(!identical(metadata(copy, "Type2"), x$Type))

metadata_chars Get metadata characters

Page 85: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

metadata_chars 85

Description

Collect all ‘character’ entries from the meta-information stored together with the measurements.Optionally coerce data of other types. The result can be used to create a mapping for map_metadata.The OPMS method just applies the WMD method to all contained plates in turn.

Usage

## S4 method for signature ’WMD’metadata_chars(object, values = TRUE,

classes = "factor")

## S4 method for signature ’OPMS’metadata_chars(object, ...)

Arguments

object WMD or OPMS object.values Logical scalar. If FALSE, metadata names, not values, are collected, and classes

is ignored (names are always of class ‘character’ and need not be coerced).classes Character vector containing the names of classes that should also be collected

(and coerced to ‘character’), or TRUE. In that case, a mapping template for theclasses themselves is returned. See the coerce argument of map_values fordetails.

... Optional argument passed from the OPMS to the WMD method.

Value

Character vector, sorted and made unique. Original names attributes, if any, are dropped and re-placed by the character vector itself. (This might be convenient regarding its use with map_metadata.)

See Also

Other metadata-functions: include_metadata, map_metadata, metadata.set,

Examples

# WMD methoddata(vaas_1)(x <- metadata_chars(vaas_1, values = FALSE))stopifnot(names(x) == x)(x <- metadata_chars(vaas_1, values = TRUE))stopifnot(names(x) == x)# See map_metadata() for a potential usage of the metadata_chars() result

# OPMS methoddata(vaas_4)(x <- metadata_chars(vaas_4, values = TRUE)) # the values(y <- metadata_chars(vaas_4, values = FALSE)) # the keysstopifnot(length(x) > length(y))

Page 86: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

86 minmax

minmax Smallest maximum

Description

Get the smallest maximum among all wells. The OPMS method works by calling the OPM method onall plates and then determining the overall minimum.

Usage

## S4 method for signature ’OPM’minmax(x, ..., na.rm = FALSE)

## S4 method for signature ’OPMS’minmax(x, ..., na.rm = FALSE)

Arguments

x OPM or OPMS object.... Coordinate of one to several wells. If missing, the smallest maximum of all

wells is returned. See well for details. If only as single well is selected, theresult is actually identical to the one of max.

na.rm Logical scalar. See max.

Value

Numeric scalar.

See Also

base::min base::max

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, plate_type, position, select, seq, setup_time, subset, summary, well, wells

Examples

# OPM methoddata(vaas_1)(x <- max(vaas_1))(y <- minmax(vaas_1))stopifnot(x > y)

# OPMS methoddata(vaas_4)(x <- max(vaas_4))(y <- minmax(vaas_4))stopifnot(x > y)

Page 87: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

MOA 87

MOA MOA class

Description

This is a virtual class facilitating the implementation of functionality for both matrices and arrays.Methods defined for objects from the class can be applied to either kind of object, but this class isnot directly dealt with by an opm user.

Details

‘MOA’ is an acronym for ‘matrix or array’.

See Also

methods::Methods base::matrix base::array

Other classes: OPM, OPMA, OPMD, OPMS, OPMX, WMD, YAML_VIA_LIST

oapply Apply method for OPMS objects

Description

Apply a function to all OPM or OPMA objects within an OPMS object. Optionally simplify the result toan OPMS object if possible, or other structures simpler than a list.

Usage

## S4 method for signature ’OPM’oapply(object, fun, ..., simplify = TRUE)

## S4 method for signature ’OPMS’oapply(object, fun, ..., simplify = TRUE)

Arguments

object OPMS object. An OPM method is also defined but simply applies fun once (toobject).

fun A function. Should expect an OPM (or OPMA) object as first argument.

... Optional other arguments passed to fun.

simplify Logical scalar. If FALSE, the result is a list. If TRUE, it is attempted to simplifythe result to a vector or matrix or to an OPMS object (if the result is a list of OPMor OPMA objects). If this is impossible, a list is returned.

Page 88: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

88 OPM

Value

List, vector, matrix or OPMS object.

See Also

base::sapply

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, plates, rep,rev, sort, thin_out, to_yaml, unique

Examples

data(vaas_4)x <- oapply(vaas_4, identity)stopifnot(identical(x, vaas_4))x <- oapply(vaas_4, identity, simplify = FALSE)stopifnot(is.list(x), length(x) == 4, sapply(x, class) == "OPMD")

OPM OPM class

Description

Class for holding single-plate OmniLog® phenotype microarray data without aggregated values, butwith information read from the original input CSV files as well as an additional arbitrary amount ofarbitrarily organised metadata. OPM is an acronym for ‘OmniLog® Phenotype Microarray’.

Details

Objects of this class are usually created by inputting files with read_single_opm or read_opm.

Note

Regarding the coercion of this class to other classes (see the coerce methods listed above and asfrom the methods package), consider the following:

• The coercion of this class (and its child classes) to a list (and vice versa) relies on a mappingbetween slot names and keys in the list, i.e. the list must be appropriately named. For instance,this is the mechanism when reading from and writing to YAML, see to_yaml.

• Coercions to other data frames and matrices first coerce the measurements and then add theother slots as attributes.

• Methods such as flatten might be more appropriate for converting OPM objects.

See Also

methods::Methods methods::new

Other classes: MOA, OPMA, OPMD, OPMS, OPMX, WMD, YAML_VIA_LIST

Page 89: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

opm.package 89

opm.package The opm package

Description

Package for analysing OmniLog Phenotype MicroArray data.

Note

As a brief guideline for using this manual, including the definition of frequently used terms, considerthe following:

families All functions and methods are assigned to one or several families of functions and methodswith similar purposes. The respective other family members are listed under each ‘See Also’entry.

classes To make sense of this package, one usually has to create at least one object of one of theclasses OPM, OPMA, OPMD or OPMS. The documentation entry for each class contains a completelist of its user-level methods. Conceptually, all these classes store PM data; they differ inwhether they also contain aggregated values (OPMA) or aggregated and discretized values(OPMD), and whether they contain more than a single plate (OPMS). Note that objects of theclass OPMS may also contain aggregated or both aggregated and discretized values.

methods The class OPMA inherits from the class OPM and, hence, has all its methods, even thoughthey are not listed as OPMA methods. OPM itself inherits from WMD and has all its methods.Objects of the OPMS class act as containers for OPM and/or OPMA objects, and its methods usuallytraverse the contained objects in some manner.

input Most opm users will start with data input using either read_single_opm or read_opm, whichcreate the appropriate objects. OmniLog® phenotype microarray data are structured in plates.Each plate has 12 x 8 well layout, and each well contains the respiration measurements on onesubstrate or inhibitor, or combination of substrates or inhibitors. For input example files, seeopm_files.

global options Options affecting the default parameters of a number of opm functions can be setand queried for using opm_opt.

coercion functions Coercion functions for the three classes are only briefly listed under each classdocumentation entry. For details, see the documentation of as from the methods package.

scalars This documentation uses the term ‘scalar’ for single-element vectors, even though techni-cally these are, well, vectors.

YAML Input and output of YAML files is based on the yaml package. Up to opm version 0.7, thispackage was not required for the installation of opm. It is now mandatory to install one of thenewer versions of yaml (>= v2.1.5). These are based on libyaml as parser instead of Syck,are faster and contain some bug fixes. The YAML-related functions of opm are to_yaml andbatch_opm_to_yaml.

running time Computations on such high-dimensional data may take some time. The limitingsteps are aggregating (curve-parameter estimation) and plotting many curves together. Theformer step can be conducted in parallel if the multicore package is available. It is not requiredfor the installation of opm. There is also a fast estimation method for the parameters ‘areaunder the curve’ and ‘maximum height’. See do_aggr and the methods it refers to for details.

Page 90: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

90 OPMA

advanced plotting The gplots package is also not required for the installation of opm but can beused to draw more advanced heatmaps. See heat_map and its accompanying methods fordetails.

References

http://www.biolog.com/

Bochner, B. R., Gadzinski, P., Panomitros, E. 2001 Phenotype MicroArrays for high throughputphenotypic testing and assay of gene function. Genome Research 11, 1246–1255.

Bochner, B. R. 2009 Global phenotypic characterization of bacteria. FEMS Microbiological Re-views 33, 191–205.

http://opm.dsmz.de/

Vaas, L. A. I., Sikorski, J., Michael, V., Goeker, M., Klenk H.-P. 2012 Visualization and curveparameter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoSONE 7, e34846.

http://www.yaml.org/

OPMA OPMA class

Description

Class for holding single-plate OmniLog® phenotype microarray data together with aggregated val-ues. For further details see its parent class, OPM. OPMA is an acronym for ‘acronymOPM, aggre-gated’.

Details

Objects of this class are usually created by calling do_aggr on an OPM object, or by inputting fileswith read_single_opm or read_opm if these files already contain aggregated data.

See Also

methods::Methods methods::new

Other classes: MOA, OPM, OPMD, OPMS, OPMX, WMD, YAML_VIA_LIST

Page 91: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

OPMD 91

OPMD OPMD class

Description

Class for holding single-plate OmniLog® phenotype microarray data together with aggregated anddiscretized values. For further details see its parent class, OPMA. OPMD is an acronym for ‘OPM,discretized’.

Details

Objects of this class are usually created by calling do_disc on an OPMA object, or by inputting fileswith read_single_opm or read_opm if these files already contain discretized data.

See Also

methods::Methods methods::new

Other classes: MOA, OPM, OPMA, OPMS, OPMX, WMD, YAML_VIA_LIST

OPMS OPMS class

Description

Class for holding multi-plate OmniLog® phenotype microarray data with or without aggregatedvalues. The data may have been obtained from distinct organisms and/or replicates, but must cor-respond to the same plate type and must contain the same wells. Regarding the name: OPMS is justthe plural of OPM.

Details

Objects of this class are usually created by calling opms or other combination functions on OPM orOPM-derived objects, or by inputting files with read_opm if these files altogether contain more thana single plate.

Note

As a rule, OPMS has the same methods as the OPM class, but adapted to a collection of more thanone OPM object. Also, OPMS can hold OPMD and OPMA as well as OPM objects, even though this is notindicated for all its methods in this manual.

See Also

methods::Methods methods::new

Other classes: MOA, OPM, OPMA, OPMD, OPMX, WMD, YAML_VIA_LIST

Page 92: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

92 opms

opms OPMS constructor

Description

Easily build OPMS objects.

Usage

opms(..., precomputed = TRUE, skip = FALSE,group = FALSE)

Arguments

... One to several objects which are either potentially nested lists of OPMS, OPM orOPMA objects, or really nested lists whose sublists can be converted to an OPM orOPMA object.

precomputed Logical scalar. If TRUE, sublists have already been converted to one of the threeclasses. Otherwise, suitable sublists will be converted.

skip Logical scalar. If precomputed is TRUE, silently skip non-list elements of nestedlists? If precomputed is FALSE, silently skip objects that do not belong to thethree target classes? Otherwise, an error is generated if such a list element isencountered.

group Logical or character scalar. If TRUE, split the list of collected OPM objects accord-ing to the plate type and convert the sublists seperately if they contain more thanone plate; otherwise just keep the OPM object. FALSE is the default: all plates aretried to be forced into a single OPMS object. If a character scalar, the name of theplate type to be extracted.

Details

While otherwise rather flexible, this function will fail to return an OPMS object if the plate typesdo not match (simply because such OPMS objects are disallowed) and group is set to FALSE. Butif group is set to TRUE, a list, not a single OPMS object will be returned; and if group is of mode‘character’, this extracts the plate type(s) of interest.

Value

OPMS object, or list of such objects (and/or OPM objects), or OPM object, or NULL.

Note

Consider also the plate-type selection options of read_opm.

See Also

Other combination-functions: c, plus

Page 93: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

OPMX 93

Examples

## Testing distinct OPM/OPMS combinations -- all should workdata(vaas_1, vaas_4)

(x <- opms())stopifnot(is.null(x))

summary((x <- opms(vaas_1)))stopifnot(identical(x, vaas_1))

summary((x <- opms(vaas_4, group = plate_type(vaas_4))))stopifnot(identical(x, vaas_4))

summary((x <- opms(vaas_4, group = "PM01")))stopifnot(is.null(x))

summary(x <- opms(vaas_1, vaas_1))stopifnot(is(x, "OPMS"), length(x) == 2L)

summary(x <- opms(vaas_4, vaas_1))stopifnot(is(x, "OPMS"), length(x) == 5L)

summary(x <- opms(vaas_1, vaas_4))stopifnot(is(x, "OPMS"), length(x) == 5L)

summary(x <- opms(vaas_4, vaas_4))stopifnot(is(x, "OPMS"), length(x) == 8L)

OPMX OPMX class

Description

This is a virtual class containing helper methods for plotting OPM and OPMS objects. It is not directlyapplied by an opm user. Regarding the name: OPMX stands for ‘OPM or OPMS’.

See Also

methods::Methods

Other classes: MOA, OPM, OPMA, OPMD, OPMS, WMD, YAML_VIA_LIST

Page 94: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

94 opm_files

opm_files Opm files

Description

Get list of files from the opm package of interest for the user.

Usage

opm_files(what = c("scripts", "testdata", "auxiliary"))

Arguments

what Character scalar indicating the subdirectory to search in. Currently the followingones are included:

auxiliary Miscellaneous files which are neither executable scripts nor test data.For instance, examples CSS files for HTML files generated by phylo_dataare found here.

scripts R script files for non-interactive uses of the opm package, particularlyfor the batch processing of many files. When called without input argu-ments or with the ‘-h’ switch, the scripts output usage information.

testdata Files as output by the OmniLog® instrument for testing data input andmetadata management.

Value

Character vector of filenames.

Note

This might fail with unusual installations of the opm package.

See Also

pkgutils::pkg_files

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, explode_dir, file_pattern, read_opm, read_single_opm, split_files,to_metadata

Examples

(x <- opm_files("auxiliary"))if (length(x))

stopifnot(!grepl("\\.R$", x, ignore.case = TRUE))(x <- opm_files("scripts"))if (length(x))

stopifnot(grepl("\\.R$", x, ignore.case = TRUE))

Page 95: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

opm_opt 95

(x <- opm_files("testdata"))if (length(x))

stopifnot(!grepl("\\.R$", x, ignore.case = TRUE))

# On UNIX systems you should be able to do this if Rscript and the optparse# package are properly installed:# invisible(sapply(opm_files(), function(f) system(paste("Rscript", f))))# ...and get the usage messages of all scripts.

opm_opt OPM options

Description

Get and set global opm options.

Usage

## S4 method for signature ’list’opm_opt(x)

## S4 method for signature ’missing’opm_opt(x, ...)

## S4 method for signature ’character’opm_opt(x)

Arguments

x Character scalar or list. If not given, all current settings are returned (as a namedlist). If a list, it is expected to contain key-value pairs that can be set. In that case,it is an error if a key is unknown or if the value’s class(es) is/are not compatiblewith the previously stored value’s class(es). If x is a character scalar, it is usedfor querying for a value.

... Optional arguments. If x is missing, these arguments are concatenated into a listand used as if x was given as a list (see above). That is, the argument names areused as the keys for setting values.

Details

The following keys can be used with the following kinds of values:

colors Default color set used by the OPMS method of xy_plot and other plotting functions.

color.borders Character vector with default color borders between which level_plot interpolatesto obtain a colour palette.

css.file Character scalar. Default CSS file linked by phylo_data when producing HTML output.Ignored if empty.

Page 96: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

96 opm_opt

csv.keys Character vector with names of entries of csv_data be used by include_metadata.Should be kept a subset of opm_opt("csv.selection").

csv.selection Character vector with names of entries of csv_data (must be a valid ‘keys’ argument)to be extracted by collect_template.

curve.param Character scalar. Default ‘subset’ argument of extract and the plotting functions.

digits Integer scalar. Number of digits used by some functions generating output text.

file.encoding Character scalar. Character encoding in input files as assumed by read_opm.

gen.iii Character scalar indicating whether read_opm and other IO functions based on it automati-cally convert to this plate type. If empty, nothing is changed.

html.attr Used by phylo_data for automatically creating HTML ‘title’ and ‘class’ attributes.

phylo.fmt Character scalar indicating the default output format used by phylo_data.

split Character scalar indicating the default spliiting characters used by separate.

time.zone Character scalar indicating the time zone to be used when parsing setup_time entries.This is relevant for merge, which by default attempts to sort by parsed setup times

time.fmt Character vector indicating the time formats used for parsing the setup_time entries (inthe given order). Also relevant for merge by default.

It is an error to set novel values whose classes are not identical to, or derived from, the classes ofthe old value. It is also an error to use a name that is not already contained (opm would never queryfor it anyway).

Value

List or atomic vector. If one to several values are set, the previous entries are returned invisibly.

See Also

base::options base::getOption

Other auxiliary-functions: contains, glob_to_regex, kubrick, map_names, map_values, separate

Examples

# fetching a value(digits <- opm_opt("digits"))stopifnot(digits == 4)

# setting a value; previous value is returned as list(old.opts <- opm_opt(digits = 5L))stopifnot(is.list(old.opts), length(old.opts) == 1L)stopifnot(old.opts$digits == 4)

# fetching the value again: should now be changed(digits <- opm_opt("digits"))stopifnot(digits == 5)

# resetting the value(old.opts <- opm_opt(old.opts))

Page 97: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

param_names 97

stopifnot(is.list(old.opts), length(old.opts) == 1L)stopifnot(old.opts$digits == 5)(digits <- opm_opt("digits"))stopifnot(digits == 4)

param_names Names of curve parameters

Description

Yield the names of the estimated curve parameters used internally and in the output.

Usage

param_names()

Value

Character vector.

See Also

Other aggregation-functions: do_aggr, fast_estimate

Examples

(x <- param_names())stopifnot(is.character(x), length(x) == 4L, identical(unique(x), x))

phylo_data Export phylogenetic data

Description

Create entire character matrix (include header and footer) in a file format suitable for exportingphylogenetic data. Return it or write it to a file. This function can also produce HTML tablessuitable for displaying PM data in taxonomic journals such as IJSEM.

Page 98: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

98 phylo_data

Usage

## S4 method for signature ’matrix’phylo_data(object,

format = opm_opt("phylo.fmt"), outfile = "", enclose = TRUE, indent = 3L,paup.block = FALSE, delete = c("none", "uninf", "constant", "ambig"),join = FALSE, cutoff = 0, digits = opm_opt("digits"),comments = comment(object), html.args = html_args(),prefer.char = format == "html", run.tidy = FALSE, ...)

## S4 method for signature ’data.frame’phylo_data(object, as.labels = NULL,

what = "numeric", sep = " ", ...)

## S4 method for signature ’OPMS’phylo_data(object, as.labels, subset = "disc",

sep = " ", extract.args = list(), join = TRUE,discrete.args = list(range = TRUE, gap = TRUE), ...)

Arguments

object Data frame, numeric matrix or ‘OPMS’ object (with aggregated values). Cur-rently only ‘integer’, ‘logical’, ‘double’ and ‘character’ matrix content is sup-ported. The data-frame and ‘OPMS’ methods first call extract and then thematrix method.

format Character scalar, either ‘epf’ (Extended Phylip Format), ‘nexus’, ‘phylip’, ‘hen-nig’ or ‘html’. If ‘nexus’ or ‘hennig’ format are chosen, a non-empty commentattribute will be output together with the data (and appropriately escaped). Incase of ‘html’ format, a non-empty comment yields the title of the HTML docu-ment. The main difference between ‘epf’ and ‘phylip’ is that the former can uselabels with more than ten characters, but its labels must not contain whitespace.(These adaptations are done automatically with safe_labels.)

outfile Character scalar. If a non-empty character scalar, resulting lines are directlywritten to this file. Otherwise, they are returned.

enclose Logical scalar. Shall labels be enclosed in single quotes? Ignored unless formatis ‘nexus’.

indent Integer scalar. Indentation of subcommands in NEXUS format. Ignored unlessformat is ‘nexus’ (and a matter of taste anyway).

paup.block Logical scalar. Append a PAUP* block with selected (recommended) defaultvalues? Has no effect unless ‘nexus’ is selected as ‘format’.

delete Character scalar. If ‘uninf’, columns are removed which are either constant (inthe strict sense) or are columns in which some fields contain polymorphisms,and no pairs of fields share no character states. If ‘ambig’, columns with am-biguities (multiple states in at least one single field) are removed. If ‘constant’,columns which are constant in the strict sense are removed. delete is currentlyignored for formats other than ‘html’, and note that columns become rows in thefinal HTML output.

Page 99: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

phylo_data 99

join Logical scalar, vector or factor. Unless FALSE, rows of object are joined to-gether, either according to the row names (if join is TRUE), or directly accordingto join. This can be used to deal with measurements repetitions for the sameorganism or treatment.

cutoff Numeric scalar. If joining results in multi-state characters, they can be filteredby removing all entries with a relative frequency less than ‘cutoff’. Makes notmuch sense for non-integer numeric data.

digits Numeric scalar. Used for rounding, and thus ignored unless object is of mode‘numeric’.

comments Character vector. Comments to be added to the output (as title if HTML is cho-sen). Ignored if the output format does not allow for comments. If empty, adefault comment is chosen.

html.args List of arguments used to modify the generated HTML. See html_args for thesupported list elements and their meaning.

prefer.char Logical scalar indicating whether or not to use NA as intermediary characterstate. Has only an effect for ‘logical’ and ‘integer’ characters. A warning isissued if integers are not within the necessary range, i.e. either 0 or 1.

run.tidy Logical scalar. Filter the resulting HTML through the Tidy program? Ignoredunless format is ‘html’. Otherwise, if TRUE, it is an error if the Tidy executableis not found.

as.labels Vector of data-frame indices or ‘OPMS’ metadata entries. See extract.

what Character scalar. See extract.

sep Character scalar. See extract.

subset Character scalar passed to the ‘OPMS’ method of extract.

extract.args Optional list of arguments passed to that method.

discrete.args Optional list of arguments passed from the ‘OPMS’ method to discrete. If setto NULL, discretization is turned off. Ignored if precomputed discretized valuesare chosen by setting subset to ‘disc’.

... Optional arguments passed between the methods (i.e., from the other methodsto the matrix method) or to hwrite from the hwriter package. Note that ‘ta-ble.summary’ is set via html.args and that ‘page’, ‘x’ and ‘div’ cannot be used.

Details

• Exporting PM data in such formats allows one to either infer trees from the data under themaximum-likelihood and/or the maximum-parsimony criterion, or to reconstruct the evolutionof PM characters on given phylogenetic trees, or to nicely display the data in HTML format.

• For exporting NEXUS format, the matrix should normally be converted beforehand by apply-ing discrete. Exporting HTML is optimized for data discretized with gap set to TRUE. Forother data, the character.states argument should be modified, see html_args. The ‘hen-nig’ (Hennig86) format is the one used by TNT; it allows continuous characters to be analysedas such.

• ‘epf’ or ‘extended PHYLIP’ is sometimes called ‘relaxed PHYLIP’.

Page 100: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

100 phylo_data

• The generated HTML is guaranteed to produce neither errors nor warnings if checked using theTidy program. It deliberately contains no formatting instructions but a rich annotation with‘class’ attributes which allows for CSS-based formatting. This annotation includes the namingof all sections and all kinds of textual content. Whether the characters show differences be-tween at least one organism and the others is also indicated. For the CSS files that come withthe package, see the examples below and opm_files.

Value

Character vector, each element representing a line in a potential output file, returned invisibly ifoutfile is given.

Note

Regarding the meaning of ‘character’ as used here, see the ‘details’ section of discrete.

References

Berger, S. A., Stamatakis, A. 2010 Accuracy of morphology-based phylogenetic fossil placementunder maximum likelihood. 8th ACS/IEEE International Conference on Computer Systems andApplications (AICCSA-10). Hammamet, Tunisia [analysis of phenotypic data with RAxML].

Felsenstein, J. 2005 PHYLIP (Phylogeny Inference Package) version 3.6. Distributed by the author.Seattle: University of Washington, Department of Genome Sciences [the PHYLIP program].

Goloboff, P.A., Farris, J.S., Nixon, K.C. 2008 TNT, a free program for phylogenetic analysis.Cladistics 24, 774–786 [the TNT program].

Goloboff, P.A., Mattoni, C., Quinteros, S. 2005 Continuous characters analyzed as such. Cladistics22, 589–601.

Maddison, D. R., Swofford, D. L., Maddison, W. P. 1997 Nexus: An extensible file format forsystematic information. Syst Biol 46, 590–621 [the NEXUS format].

Stamatakis, A. 2006 RAxML-VI-HPC: Maximum likelihood-based phylogenetic analyses withthousands of taxa and mixed models Bioinformatics 22, 2688–2690. [the RAxML program].

Swofford, D. L. 2002 PAUP*: Phylogenetic Analysis Using Parsimony (*and Other Methods),Version 4.0 b10. Sunderland, Mass.: Sinauer Associates [the PAUP* program].

http://ijs.sgmjournals.org/ [IJSEM journal]

http://tidy.sourceforge.net/ [HTML Tidy]

See Also

base::comment base::write hwriter::hwrite

Other phylogeny-functions: html_args, safe_labels

Examples

# simple helper functionsecho <- function(x) write(x, file = "")is_html <- function(x) is.character(x) &&

c("<html>", "<head>", "<body>", "</html>", "</head>", "</body>") %in% x

Page 101: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

phylo_data 101

longer <- function(x, y) any(nchar(x) > nchar(y)) &&!any(nchar(x) < nchar(y))

# dummy data setx <- matrix(c(0:9, letters[1:22]), nrow = 2)colnames(x) <- LETTERS[1:16]rownames(x) <- c("Ahoernchen", "Behoernchen") # Chip and Dale in German

# EPF is a comparatively restricted formatecho(y.epf <- phylo_data(x, format = "epf"))stopifnot(is.character(y.epf), length(y.epf) == 3)stopifnot(identical(y.epf, phylo_data(as.data.frame(x), what = "factor",

format = "epf")))

# PHYLIP is even more restricted (shorter labels!)echo(y.phylip <- phylo_data(x, format = "phylip"))stopifnot((y.epf == y.phylip) == c(TRUE, FALSE, FALSE))

# NEXUS allows for more content; note the comment and the character labelsecho(y.nexus <- phylo_data(x, format = "nexus"))nexus.len.1 <- length(y.nexus)stopifnot(is.character(y.nexus), nexus.len.1 > 10)

# adding a PAUP* block with (hopefully useful) default settingsecho(y.nexus <- phylo_data(x, format = "nexus", paup.block = TRUE))stopifnot(is.character(y.nexus), length(y.nexus) > nexus.len.1)

# adding our own commentcomment(x) <- c("This is", "a test") # yields two linesecho(y.nexus <- phylo_data(x, format = "nexus"))stopifnot(identical(length(y.nexus), nexus.len.1 + 1L))

# Hennig86/TNT also includes the commentecho(y.hennig <- phylo_data(x, format = "hennig"))hennig.len.1 <- length(y.hennig)stopifnot(is.character(y.hennig), hennig.len.1 > 10)

# without an explicit comment, the default one will be usedcomment(x) <- NULLecho(y.hennig <- phylo_data(x, format = "hennig"))stopifnot(identical(length(y.hennig), hennig.len.1 - 1L))

# examples with real data and HTMLdata(vaas_4)

# setting the CSS file that comes with opm as defaultopm_opt(css.file = grep("[.]css$", opm_files("auxiliary"), value = TRUE))

# see discrete() for the conversion and note the OPMS example below: one# could also get the results directly from OPMS objectsx <- extract(vaas_4, as.labels = list("Species", "Strain"),

in.parens = FALSE)x <- discrete(x, range = TRUE, gap = TRUE)

Page 102: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

102 phylo_data

echo(y <- phylo_data(x, format = "html",html.args = html_args(organisms.start = "Strains: ")))

# this yields HTML with the usual tags, a table legend, and the table itself# in a single line; the default ’organisms.start’ could also be usedstopifnot(is_html(y))

# now with joining of the results per species (and changing the organism# description accordingly)x <- extract(vaas_4, as.labels = list("Species"), in.parens = FALSE)x <- discrete(x, range = TRUE, gap = TRUE)echo(y <- phylo_data(x, format = "html", join = TRUE,

html.args = html_args(organisms.start = "Species: ")))stopifnot(is_html(y))# Here and in the following examples note the highlighting of the variable# (uninformative or informative) characters. The uninformative ones are those# that are not constant but show overlap regarding the sets of character# states between all organisms. The informative ones are those that are fully# distinct between all organisms.

# ’OPMS’ method, yielding the same results than above but directlyecho(yy <- phylo_data(vaas_4, as.labels = "Species", format = "html",

join = TRUE, extract.args = list(in.parens = FALSE),html.args = html_args(organisms.start = "Species: ")))

# the timestamps might differ, but otherwise the result is as abovestopifnot(length(y) == length(yy) && length(which(y != yy)) < 2)

# appending user-defined sectionsecho(yy <- phylo_data(vaas_4, as.labels = "Species", format = "html",

join = TRUE, extract.args = list(in.parens = FALSE),html.args = html_args(organisms.start = "Species: ",append = list(section.1 = "additional text", section.2 = "more text"))))

stopifnot(length(y) < length(yy), length(which(!y %in% yy)) < 2)# note the position -- there are also ’prepend’ and ’insert’ arguments

# effect of deletionecho(y <- phylo_data(x, "html", delete = "none", join = FALSE))echo(y.noambig <- phylo_data(x, "html", delete = "ambig", join = FALSE))stopifnot(length(which(y != y.noambig)) < 2) # timestamps might differ# ambiguities are created only by joiningecho(y <- phylo_data(x, "html", delete = "none", join = TRUE))echo(y.noambig <- phylo_data(x, "html", delete = "ambig", join = TRUE))stopifnot(longer(y, y.noambig))echo(y.nouninf <- phylo_data(x, "html", delete = "uninf", join = TRUE))stopifnot(longer(y, y.nouninf))echo(y.noconst <- phylo_data(x, "html", delete = "const", join = TRUE))stopifnot(longer(y.noconst, y.nouninf))

# getting real numbers, not discretized onesecho(yy <- phylo_data(vaas_4, as.labels = "Species", format = "html",

join = TRUE, extract.args = list(in.parens = FALSE), subset = "A",discrete.args = NULL,html.args = html_args(organisms.start = "Species: ")))

stopifnot(is_html(yy), length(yy) == length(y) - 1) # no symbols list

Page 103: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

plates 103

# the highlighting is also used here, based on the following heuristic:# if mean+/-2*sd does not overlap, the character is informative; else# if mean+/-sd does not overlap, the character is uninformative; otherwise# is is constant

# this can also be used for formats other than HTML (but not all make sense)echo(yy <- phylo_data(vaas_4, as.labels = "Species", format = "hennig",

join = TRUE, extract.args = list(in.parens = FALSE), subset = "A",discrete.args = NULL))

stopifnot(is.character(yy), length(yy) > 10)

plates Get available plates

Description

Get all plates contained in an OPMS object or a list, or create a list containing a single OPM object aselement. The list method traverses the input recursively and skips all objects of other classes thanOPM (see also opms, which is somewhat similar but more flexible).

Usage

## S4 method for signature ’OPMS’plates(object)

## S4 method for signature ’OPM’plates(object)

## S4 method for signature ’list’plates(object)

Arguments

object List, OPM or OPMS object.

Value

List of OPM objects (may be empty instead if object is a list).

See Also

base::list base::as.list

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, rep,rev, sort, thin_out, to_yaml, unique

Page 104: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

104 plate_type

Examples

# ’OPM’ methoddata(vaas_1)summary(x <- plates(vaas_1))stopifnot(is.list(x), length(x) == 1L, sapply(x, inherits, what = "OPM"))

# ’OPMS’ methoddata(vaas_4)summary(x <- plates(vaas_4))stopifnot(is.list(x), length(x) == 4L, sapply(x, inherits, what = "OPM"))

# list methodx <- list(vaas_1, letters, vaas_4, 1:10)summary(x <- plates(x))stopifnot(is.list(x), length(x) == 5, sapply(x, inherits, what = "OPM"))

plate_type Plate type used or normalized

Description

Get the type of the OmniLog® plate used in the measuring. This is a convenience function for oneof the more important entries of csv_data with additional options useful for creating plot titles.The character method normalizes the names of OmniLog® PM plates to the internally used namingscheme. Unrecognized names are returned unchanged. This needs not normally be called by theopm user but might be of interest.

Usage

## S4 method for signature ’OPM’plate_type(object, full = FALSE, in.parens = TRUE,

max = 100L, clean = TRUE, brackets = FALSE, word.wise = FALSE,paren.sep = " ", downcase = FALSE)

## S4 method for signature ’character’plate_type(object, subtype = FALSE)

## S4 method for signature ’factor’plate_type(object, subtype = FALSE)

## S4 method for signature ’OPMS’plate_type(object, ...)

Arguments

object OPM or OPMS object, or character vector of original plate name(s), or factor.

Page 105: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

plate_type 105

full Logical scalar. If TRUE, add (or replace by) the full name of the plate type (ifavailable); otherwise, return it as-is.

in.parens Logical scalar. This and the five next arguments work like the eponymous onesof wells, but here are applied to the plate name. See there for details.

max Numeric scalar.

clean Logical scalar.

brackets Logical scalar.

word.wise Logical scalar.

paren.sep Character scalar.

downcase Logical scalar.

subtype Logical scalar. Keep the plate subtype indicator, if any? Only relevant for thecharacter or factor method.

... Optional arguments passed between the methods.

Value

Character scalar in the case of the OPM and OPMS methods, otherwise a character vector with thesame length than object, or a corresponding factor.

See Also

base::strtrim base::abbreviate base::gsub

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, position, select, seq, setup_time, subset, summary, well, wells

Examples

## ’OPM’ methoddata(vaas_1)(x <- plate_type(vaas_1, full = FALSE))(y <- plate_type(vaas_1, full = TRUE))(z <- plate_type(vaas_1, full = TRUE, in.parens = FALSE))stopifnot(nchar(x) < nchar(y), nchar(z) < nchar(y))

## Not run:

# Splitting a list of ’OPM’ objects according to the plate type is easy:x <- split(x), sapply(x, plate_type))# but see also opms() and read_opm() which can do this internally

## End(Not run)

## ’OPMS’ methoddata(vaas_4)(xx <- plate_type(vaas_4, full = FALSE))stopifnot(identical(x, xx))

Page 106: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

106 plus

## Character method

# Entirely unrecognized strings are returned as-isx <- plate_type(letters)stopifnot(identical(x, letters))

# Something more realistic(x <- plate_type(y <- c("PM1", "PM-11C", "PMM04-a"), TRUE))stopifnot(x != y)

# Factor method(z <- plate_type(as.factor(y), TRUE))stopifnot(is.factor(z), z == x)

plus Addition

Description

Combine an OPM or OPMS object with another OPM or OPMS object or a list of such objects. Raise anerror if the objects are incompatible.

Usage

## S4 method for signature ’OPM,OPM’e1 + e2

## S4 method for signature ’OPM,OPMS’e1 + e2

## S4 method for signature ’OPM,list’e1 + e2

## S4 method for signature ’OPMS,OPMS’e1 + e2

## S4 method for signature ’OPMS,OPM’e1 + e2

## S4 method for signature ’OPMS,list’e1 + e2

Arguments

e1 OPM or OPMS object.

e2 OPM or OPMS object, or list.

Page 107: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

position 107

Value

OPMS object that contains the plates from both e1 and e2.

See Also

Other combination-functions: c, opms

Examples

data(vaas_1)data(vaas_4)# the examples do not show particularly useful additions, as the plates# are either entirely or partially identical

# OPM+OPM methodsummary(x <- vaas_1 + vaas_1)stopifnot(identical(dim(x), c(2L, dim(vaas_1))))

# OPM+OPMS methodsummary(x <- vaas_1 + vaas_4)stopifnot(identical(dim(x), c(5L, dim(vaas_1))))

# OPM+list methodsummary(x <- vaas_1 + list(vaas_1, vaas_1))stopifnot(identical(dim(x), c(3L, dim(vaas_1))))

# OPMS+OPMS methodsummary(x <- vaas_4 + vaas_4)stopifnot(identical(dim(x), c(8L, dim(vaas_4)[-1L])))

# OPMS+OPM methodsummary(x <- vaas_4 + vaas_1)stopifnot(identical(dim(x), c(5L, dim(vaas_1))))

# OPMS+list methodsummary(x <- vaas_4 + list(vaas_1))stopifnot(identical(dim(x), c(5L, dim(vaas_1))))

position Position of a plate

Description

Get the position of the plate within the OmniLog® instrument. This is a convenience function forone of the more important entries of csv_data.

Page 108: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

108 radial_plot

Usage

## S4 method for signature ’OPM’position(object)

## S4 method for signature ’OPMS’position(object, ...)

Arguments

object OPM object.

... Optional arguments passed between the methods.

Value

Character scalar.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, select, seq, setup_time, subset, summary, well, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- position(vaas_1))stopifnot(identical(x, " 7-B"))

# ’OPMS’ methoddata(vaas_4)(x <- position(vaas_4))stopifnot(is.character(x), length(x) == length(vaas_4))

radial_plot Radial plot

Description

A wrapper for radial.plot from the plotrix package with some adaptations likely to be useful forOmniLog® data. The data frame and ‘OPMS’ methods extract a numeric matrix from a given dataframe or ‘OPMS’ object and pass the result to the matrix method.

Page 109: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

radial_plot 109

Usage

## S4 method for signature ’matrix’radial_plot(object, rp.type = "p",

radlab = FALSE, show.centroid = TRUE, show.grid.labels = 1, lwd = 3,mar = c(2, 2, 2, 2), line.col = opm_opt("colors"), draw.legend = TRUE,x = "bottom", y = NULL, xpd = TRUE, pch = 15, legend.args = list(), ...)

## S4 method for signature ’data.frame’radial_plot(object, as.labels, sep = " ",

...)

## S4 method for signature ’OPMS’radial_plot(object, as.labels,

subset = opm_opt("curve.param"), sep = " ", extract.args = list(), ...)

Arguments

object Data frame, numeric matrix or ‘OPMS’ object (with aggregated values) to beplotted.

rp.type Character vector. These and the following arguments are passed to plotrix::radial.plot.See there for details.

radlab Logical scalar.show.centroid Logical scalar.show.grid.labels

Logical scalar.lwd Numeric scalar.mar Numeric vector of length 4.line.col Character or numeric vector.... Optional arguments passed to plotrix::radial.plot.draw.legend Logical scalar. Whether to draw a legend. Ignored unless object has row names

(because these are used to generate the description).x Legend position, passed to legend from the graphics package. Ignored unless

draw.legend is TRUE.y Optional 2nd legend coordinate. Also passed to that function.xpd Logical scalar. Also passed to that function.pch Integer scalar. Also passed to that function.legend.args List of optional other arguments passed to that function.as.labels Character, numeric or logical vector indicating the positions of the columns to

be joined and used as row labels. If NULL or empty, the row names of objectare used. See extract for details.

sep Character scalar determining how to join row names. See extract for details.subset Character scalar passed to the ‘OPMS’ method of extract.extract.args Optional list of arguments passed to that method.

Page 110: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

110 read_opm

Value

A vector with the row names of object as names and the corresponding colours as values, equiva-lent to the legend; NULL if no row names are present.

Note

The default positioning of the legend is not necessarily very useful, but suitable combinations ofmargin, x and y can be found for given data sizes. Plotting entire plates usually makes not muchsense (see the examples).

See Also

plotrix::radial.plot graphics::legend

Other plotting-functions: ci_plot, heat_map, level_plot, select_colors, show, xy_plot

Examples

data("vaas_4")

# Matrix methodx <- extract(vaas_4, as.labels = list("Species", "Strain"))(y <- radial_plot(x[, 1:5]))stopifnot(is.character(y), names(y) == rownames(x))

# ’OPMS’ method(yy <- radial_plot(vaas_4[, , 1:5], as.labels = list("Species", "Strain")))stopifnot(identical(y, yy)) # should also yield the same picture than above

# Data-frame methodx <- extract(vaas_4, as.labels = list("Species", "Strain"), dataframe = TRUE)(y <- radial_plot(x[, 1:8], as.labels = c("Species", "Strain")))stopifnot(is.character(y), names(y) == paste(x$Species, x$Strain))

read_opm Read multiple PM files at once

Description

Read OmniLog® or opm data file(s) in one of three possible formats: either new- or old-styleOmniLog® CSV or opm YAML format. Files compressed using gzip, bzip2, lzma or xz are alsounderstood (but may be excluded using include and/or exclude).

Usage

read_opm(names,convert = c("try", "no", "yes", "sep", "grp"),gen.iii = opm_opt("gen.iii"), include = list(), ...,demo = FALSE)

Page 111: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

read_opm 111

Arguments

names Character vector with names of files in one of three formats accepted by read_opm,or names of directories containing such files, or both; or convertible to such avector. See the include argument of read_opm and explode_dir for how toselect subsets from the input files or directories.

convert Character scalar. If ‘no’, always return a list. If ‘yes’, convert to NULL, OPMobject, or OPMS object, depending on the number of files read (0, 1, or more).‘try’ behaves like ‘yes’ but does not result in an error message if conversionto OPMS is impossible; a list is returned in that case. ‘sep’ returns a nestedlist, each sublist containing OPM objects of the same plate type. ‘grp’ also splitsinto such sublists but converts them to OPMS objects if more than one plate isencountered. An error is raised if this is impossible (in contrast to ‘try’).

gen.iii Logical or character scalar. If TRUE, invoke gen_iii on each plate. This isautomatically done with CSV input if the plate type is given as ‘OTH’ (which isusually the case for plates run in ID mode). If a character scalar, it is used as theto argument of gen_iii to set other plate types unless it is empty.

include Pattern for selecting from the input files. The default value results in the outputof file_pattern, which should be sufficient in most cases. See explode_dirfor details on other possibilities.

... Optional further arguments passed to explode_dir.

demo Logical scalar. Do not read files, but print a vector with the names of the filesthat would be (attempted to) read, and return them invisibly?

Value

OPM object (maybe OPMA in case of YAML input), or list of such objects, or OPMS object. If demo isTRUE, a character vector instead.

Note

Regarding the CSV format, see the remark to read_single_opm. For splitting lists of OPM objectsaccording to the plate type, see plate_type, and consider the plate-type selection options of opms.

References

http://www.yaml.org/

http://www.biolog.com/

See Also

utils::read.csv yaml::yaml.load_file

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, explode_dir, file_pattern, opm_files, read_single_opm, split_files,to_metadata

Page 112: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

112 read_single_opm

Examples

test.files <- grep("Multiple|Ecoplate", opm_files("testdata"), invert = TRUE,value = TRUE, perl = TRUE)

if (length(test.files) > 0L) { # if the folder is foundx <- read_opm(test.files, demo = TRUE) # check first what you would getstopifnot(identical(test.files, x))x <- read_opm(test.files[1:2]) # these two have the same plate typeclass(x)dim(x)summary(x)stopifnot(is(x, "OPMS"), identical(dim(x), c(2L, 384L, 96L)))

}# This can be repeated for the other input test files. Instead of a several# file names one can also provide a single one, one to several directory# names, or mixture of file and directory names.

## Not run:

# Reading all files from the current working directory is also easy:x <- read_opm(getwd())# orx <- read_opm(".")

## End(Not run)

read_single_opm Read single PM file

Description

Read single OmniLog® or opm data file in either new- or old-style CSV or YAML format. Filescompressed using gzip, bzip2, lzma or xz are also understood.

Usage

read_single_opm(filename)

Arguments

filename Character scalar, or convertible to such, with the obvious meaning.

Value

OPM object. In the case of YAML input, this might also be an OPMA object or a list of such objects,but not an OPMS object.

Page 113: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

rep 113

Note

• The expected CSV format is what is output by the OmniLog® instrument, one plate per file.Other formats, or OmniLog® files re-saved with distinct CSV settings, are not understood. Forthis reason, if any editing of the files was necessary at all, it is advisable to do this in an editorfor plain text, not in a spreadsheet program.

• It is impossible to read CSV files that contain more than one plate. For splitting old-style andnew-style CSV files into one file per plate, see the example under split_files.

• In contrast, input YAML files can contain data from more than one plate.

• Plates run in ID mode are automatically detected as such (their plate type is changed from‘OTH’ to the internally used spelling of ‘Generation III’). A generation-III plate type can alsobe forced later on by using gen_iii.

References

http://www.yaml.org/

http://www.biolog.com/

See Also

utils::read.csv

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, explode_dir, file_pattern, opm_files, read_opm, split_files, to_metadata

Examples

test.files <- opm_files("testdata")if (length(test.files) > 0) { # if the folder is found

x <- read_single_opm(test.files[1])class(x)dim(x)summary(x)stopifnot(is(x, "OPM"), identical(dim(x), c(384L, 96L)))

}# this can be repeated for the other input test files

rep Repeat OPMS objects

Description

Repeat OPMS or OPM objects zero times, once, or several times, and accordingly create a novel OPMSor OPM object (NULL if zero length is chosen).

Page 114: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

114 rep

Usage

## S4 method for signature ’OPM’rep(x, ...)

## S4 method for signature ’OPMS’rep(x, ...)

Arguments

x OPMS or OPM object.

... Optional parameters passed to rep from the base package.

Value

OPMS object with another number of plates, or or OPM object, or NULL.

See Also

base::rep

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, plates,rev, sort, thin_out, to_yaml, unique

Examples

## ’OPMS’ methoddata(vaas_4)summary(x <- rep(vaas_4))stopifnot(identical(x, vaas_4))summary(x <- rep(vaas_4, times = 2))stopifnot(length(x) == length(vaas_4) * 2)summary(y <- rep(vaas_4, each = 2))stopifnot(length(y) == length(vaas_4) * 2, !identical(x, y))stopifnot(is.null(rep(vaas_4, 0)))

## ’OPM’ methoddata(vaas_1)summary(x <- rep(vaas_1, 1))stopifnot(identical(x, vaas_1))summary(x <- rep(vaas_1, 2))stopifnot(length(x) == 2, is(x, "OPMS"))stopifnot(is.null(rep(vaas_4, 0)))

Page 115: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

rev 115

rev Revert OPMS objects

Description

Revert the order of plates within an OPMS object. This should be slightly more efficient than callingthe default rev method. There is also an OPM method which just returns the input data (to avoiddestructive effects due to the way the default rev interacts with OPM indexing).

Usage

## S4 method for signature ’OPM’rev(x)

## S4 method for signature ’OPMS’rev(x)

Arguments

x OPMS or OPM object.

Value

OPMS object with the reversed order of plates, or or OPM object.

See Also

base::rev

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, plates,rep, sort, thin_out, to_yaml, unique

Examples

## ’OPMS’ methoddata(vaas_4)summary(x <- rev(vaas_4))stopifnot(dim(x) == dim(vaas_4), !identical(x, vaas_4))stopifnot(identical(rev(x), vaas_4))

## ’OPMS’ methoddata(vaas_1)summary(x <- rev(vaas_1))stopifnot(identical(x, vaas_1))

Page 116: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

116 run_kmeans

run_kmeans Conduct k-means partitioning

Description

Run a k-means partitioning analysis. This function is used by discrete in ‘gap’ mode to automat-ically determine the range of ambiguous data. If applied to such one-dimensional data, it uses anexact algorithm from the Ckmeans.1d.dp package.

Usage

## S4 method for signature ’numeric,numeric’run_kmeans(object, k)

## S4 method for signature ’matrix,numeric’run_kmeans(object, k,

nstart = 10L, ...)

Arguments

object Numeric vector or matrix.

k Numeric vector. Number of clusters requested.

nstart Numeric scalar. Ignored if ‘Ckmeans.1d.dp’ is called. Otherwise passed to‘kmeans’ from the stats package.

... List of optional arguments passed to ‘kmeans’ from the stats package.

Value

S3 object of class ‘kmeanss’.

References

Wang, H., Song, M. 2011 Ckmeans.1d.dp: Optimal k-means clustering in one dimension by dy-namic programming. The R Journal 3, p. 29–33.

See Also

stats::kmeans Ckmeans.1d.dp::Ckmeans.1d.dp

Other kmeans-functions: borders, calinski, hist.Ckmeans.1d.dp, hist.kmeans, hist.kmeanss,plot.kmeanss, to_kmeans,

Page 117: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

safe_labels 117

Examples

data(vaas_4)x <- as.vector(extract(vaas_4, as.labels = NULL, subset = "A"))summary(x.km <- run_kmeans(x, k = 1:10))stopifnot(inherits(x.km, "kmeanss"), length(x.km) == 10)stopifnot(sapply(x.km, class) == "kmeans", names(x.km) == 1:10)

safe_labels Safe labels

Description

Convert strings to safe phylogenetic taxon labels: replace disallowed characters or include all labelsin single quotes, and double pre-existing single quotes, if any. This is not normally called directlyby an opm user but by phylo_data; see there for further details.

Usage

safe_labels(x, format, enclose = TRUE, pad = FALSE)

Arguments

x Character vector or convertible to such.

format Character scalar. See phylo_data.

enclose Logical scalar. See phylo_data.

pad Logical scalar. Bring labels to the same number of characters by appendingspaces? Has no effect for ‘phylip’ and ‘html’ output format.

Value

Character vector.

See Also

base::gsub

Other phylogeny-functions: html_args, phylo_data

Examples

# Some animals you might knowx <- c("Elephas maximus", "Loxodonta africana", "Giraffa camelopardalis")

(y <- safe_labels(x, "phylip"))stopifnot(nchar(y) == 10L)

(y <- safe_labels(x, "epf"))stopifnot(nchar(y) == nchar(x))

Page 118: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

118 select

(y <- safe_labels(x, "epf", pad = TRUE))stopifnot(nchar(y) == 22)

(y <- safe_labels(x, "nexus", enclose = TRUE))stopifnot(grepl("^’.*’$", y))

select Select a subset of the plates (or time points) [deprecated]

Description

Select a subset of the plates in an OPMS object based on the content of the metadata. Alternatively,select a common subset of time points from all plates. The data-frame method selects columns thatbelong to certain classes.

Usage

## S4 method for signature ’OPMS’select(object, query, ...)

## S4 method for signature ’data.frame’select(object, query)

Arguments

object OPMS object.

query Logical, numeric or character vector, or list (other objects can be provided butare coerced to class ‘character’). If a logical or numeric vector, query is directlyused as the first argument of [, and all following arguments, if any, are ignored.If a list or a character vector, it is used for conducting a query based on one of theinfix operators as described below. The data-frame method expects a charactervector containing class names.

... Optional arguments passed to subset.

Value

NULL or OPM or OPMS object. This depends on how many plates are selected; see [ for details. Thedata-frame method returns a data frame.

Note

The use of this function is deprecated. Please use subset instead.

Page 119: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

select 119

See Also

base::‘[‘ base::‘[[‘ base::subset

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, seq, setup_time, subset, summary, well, wells

Examples

## ’OPMS’ methoddata(vaas_4)# simple object comparison functionmustbe <- function(a, b) stopifnot(identical(a, b))

# all plates have that entry: selection identical to original objectmustbe(vaas_4, vaas_4["Species" %k% vaas_4, ])mustbe(vaas_4, select(vaas_4, list(Species = "Escherichia coli"),

values = FALSE)) # equivalent

# two plates also have that value: yielding OPMS object with only two platesmustbe(vaas_4[1:2], vaas_4[list(Species = "Escherichia coli") %q% vaas_4, ])mustbe(vaas_4[1:2], select(vaas_4, list(Species = "Escherichia coli")))

# select all plates that have aggregated valuesx <- select(vaas_4, has_aggr(vaas_4))mustbe(x, vaas_4) # all have such values

# select a common set of time pointsx <- select(vaas_4, time = TRUE)mustbe(x, vaas_4) # the time points had already been identical# create unequal time pointscopy <- vaas_4[, list(1:10, 1:20, 1:15, 1:10)]mustbe(hours(copy), c(2.25, 4.75, 3.50, 2.25))# now restrict to common subsetx <- select(copy, time = TRUE)mustbe(hours(x), rep(2.25, 4))# see also the example with split() given under "["

# select all wells that have positive reactionssummary(x <- select(vaas_4, use = "p")) # in at least one platestopifnot(dim(x)[3] < dim(vaas_4)[3])summary(y <- select(vaas_4, use = "P")) # in all platesstopifnot(dim(y)[3] < dim(x)[3])

# select all wells that have non-negative reactions in at least one platesummary(y <- select(vaas_4, use = "N", invert = TRUE))stopifnot(dim(y)[3] > dim(x)[3])

## data-frame methodx <- data.frame(a = 1:5, b = letters[1:5], c = LETTERS[1:5])(y <- select(x, "factor"))stopifnot(dim(y) == c(5, 2))

Page 120: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

120 select_colors

(y <- select(x, "integer"))stopifnot(dim(y) == c(5, 1))(y <- select(x, c("factor", "integer")))mustbe(x, y)

select_colors Select colours

Description

Select a set of colours for plotting. See xy_plot for usage example. This is not normally directlycalled by an opm user but could be used for testing before doing some serious plotting.

Usage

select_colors(set = c("w3c", "w3c.i", "nora", "nora.i", "brewer", "brewer.i", "roseo", "roseo.i"))

Arguments

set Character scalar. Name of the colour vector to use. Colour vectors have beenoptimized for maximum contrast between adjacent colours, either manually orusing max_rgb_contrast from the pkgutils package. Names ending in ‘.i’ indi-cate vectors in inverse order (compared to the vector with the same name except‘.i’).

Value

Character vector (names of colours).

References

http://www.colorbrewer.org

See Also

grDevices::colors grDevices::rainbow grDevices::grey

Other plotting-functions: ci_plot, heat_map, level_plot, radial_plot, show, xy_plot

Examples

(x <- select_colors("nora"))(y <- select_colors("nora.i"))stopifnot(is.character(x), length(x) > 0L, identical(x, rev(y)))

Page 121: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

separate 121

separate Regularly split character vectors if possible

Description

From a given set of splitting characters select the ones that split a character vector in a regular way,yielding the same number of parts for all vector elements. Then apply these splitting characters tocreate a matrix. The data frame method applies this to all character vectors (and optionally also allfactors) within a data frame.

Usage

## S4 method for signature ’character’separate(object, split = opm_opt("split"),

simplify = FALSE, keep.const = TRUE, list.wise = FALSE,strip.white = list.wise)

## S4 method for signature ’factor’separate(object, split = opm_opt("split"),

simplify = FALSE, keep.const = TRUE, ...)

## S4 method for signature ’data.frame’separate(object, split = opm_opt("split"),

keep.const = TRUE, coerce = TRUE, name.sep = ".", ...)

Arguments

object Character vector to be split, or data frame in which character vectors (or factors)shall be attempted to be split, or factor.

split Character vector or TRUE. If a character vector, used as container of the split-ting characters and converted to a vector containing only non-duplicated single-character strings. For instance, the default split argument ".-_" yields c(".", "-", "_").If a vector of only empty strings or TRUE, strings with substrings represent-ing fixed-width fields are assumed, and splitting is done at whitespace-onlycolumns. Beforehand, equal-length strings are created by padding with spaces atthe right. After splitting in fixed-width mode, whitespace characters are trimmedfrom both ends of the resulting strings.

simplify Logical scalar indicating whether a resulting matrix with one column should besimplified to a vector (or such a data frame to a factor).

keep.const Logical scalar indicating whether constant columns should be kept or removed.Ignored if only a single column is present.

coerce Logical scalar indicating whether factors should be coerced to ‘character’ modeand then also be attempted to be split. The resulting columns will be coercedback to factors.

Page 122: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

122 separate

name.sep Character scalar to be inserted in the constructed column names. If more thanone column results from splitting, the names will contain (i) the original columnname, (ii) name.sep and (iii) their index, thus creating unique column names (ifthe original ones were unique).

list.wise Logical scalar. Ignored if split is TRUE. Otherwise, object is assumed to con-tains word lists separated by split. The result is a logical matrix in which thecolumns represent these words and the fields indicate whether or not a word waspresent in a certain item contained in object.

strip.white Logical scalar. Remove whitespace from the ends of each resulting characterscalar after splitting? Has an effect on the removal of constant columns. Whites-pace is always removed if split is TRUE.

... Optional arguments passed between the methods.

Value

Character matrix, its number of rows being equal to the length of object, or data frame with thesame number of rows as object but potentially more columns. May be character vector of factorwith character or factor input and simplify set to TRUE.

See Also

base::strsplit utils::read.fwf

Other auxiliary-functions: contains, glob_to_regex, kubrick, map_names, map_values, opm_opt

Examples

# Splitting by charactersx <- c("a-b-cc", "d-ff-g")(y <- separate(x, ".")) # a split character that does not occurstopifnot(is.matrix(y), y[, 1L] == x)(y <- separate(x, "-")) # a split character that does occurstopifnot(is.matrix(y), dim(y) == c(2, 3))

# Fixed-with splittingx <- c(" abd efgh", " ABCD EFGH ", " xyz")(y <- separate(x, TRUE))stopifnot(is.matrix(y), dim(y) == c(3, 2))

# Applied to factorsxx <- as.factor(x)(yy <- separate(xx, TRUE))stopifnot(identical(yy, as.data.frame(y)))

# List-wise splittingx <- c("a,b", "c,b", "a,c")(y <- separate(x, ",", list.wise = TRUE))stopifnot(is.matrix(y), dim(y) == c(3, 3), is.logical(y))

# Data-frame methodx <- data.frame(a = 1:2, b = c("a-b-cc", "a-ff-g"))

Page 123: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

seq 123

(y <- separate(x, coerce = FALSE))stopifnot(identical(x, y))(y <- separate(x))stopifnot(is.data.frame(y), dim(y) == c(2, 4))stopifnot(sapply(y, class) == c("integer", "factor", "factor", "factor"))(y <- separate(x, keep.const = FALSE))stopifnot(is.data.frame(y), dim(y) == c(2, 3))stopifnot(sapply(y, class) == c("integer", "factor", "factor"))

seq Sequence of plate indexes

Description

Get the indexes of all plates contained in an OPMS object. This is mainly useful for looping oversuch objects. See [ for a loop-construct usage example, and note that oapply is also available.

Usage

## S4 method for signature ’OPM’seq(...)

## S4 method for signature ’OPMS’seq(...)

Arguments

... OPMS objects. Several ones can be provided, but all but the first one are ignored.For reasons of comparability, the OPM method deliberately results in an error.

Value

Integer vector (starting with 1 and at least of length 2).

See Also

base::seq

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, setup_time, subset, summary, well, wells

Page 124: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

124 setup_time

Examples

# ’OPMS’ methoddata(vaas_4)(x <- seq(vaas_4))stopifnot(identical(x, 1:4))(y <- seq(vaas_4, letters, LETTERS)) # other arguments are ignoredstopifnot(identical(x, y))

# ’OPM’ methoddata(vaas_1)(x <- try(seq(vaas_1), silent = TRUE))stopifnot(inherits(x, "try-error"))

setup_time Setup time of the measuring

Description

Get the setup time of the PM experiment as recorded by the OmniLog® instrument. This is aconvenience function for one of the more important entries of csv_data.

Usage

## S4 method for signature ’OPM’setup_time(object)

## S4 method for signature ’OPMS’setup_time(object, ...)

Arguments

object OPM object.

... Optional arguments passed between the methods.

Value

Character vector or ‘POSIXlt’ object.

See Also

base::strptime

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, seq, subset, summary, well, wells

Page 125: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

show 125

Examples

# ’OPM’ methoddata(vaas_1)(x <- setup_time(vaas_1))# WARNING: It is unlikely that all OmniLog output has this setup time format(parsed <- strptime(x, format = "%m/%d/%Y %I:%M:%S %p"))stopifnot(inherits(parsed, "POSIXlt"), length(parsed) == 1)

# ’OPMS’ methoddata(vaas_4)(x <- setup_time(vaas_4))(parsed <- strptime(x, format = "%m/%d/%Y %I:%M:%S %p"))stopifnot(inherits(parsed, "POSIXlt"), length(parsed) == 4)

show Show OPM or OPMS objects

Description

Display an OPM or OPMS object on screen. Currently this is just a wrapper for the summary methodfor these objects with an additional call to print.

Usage

## S4 method for signature ’OPMX’show(object)

## S4 method for signature ’CMAT’show(object)

Arguments

object OPM or OPMS object.

Value

See summary.

See Also

methods::show base::print

Other plotting-functions: ci_plot, heat_map, level_plot, radial_plot, select_colors, xy_plot

Page 126: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

126 sort

Examples

# OPMA methoddata(vaas_1)vaas_1

# OPMS methoddata(vaas_4)vaas_4

sort Sort OPMS objects

Description

Sort an OPMS object based on one to several metadata or CSV data entries. There is also an OPMmethod which returns the input data (to avoid destructive effects due to the way the default sortinteracts with OPM indexing).

Usage

## S4 method for signature ’OPMX,missing’sort(x, decreasing, ...)

## S4 method for signature ’OPM,logical’sort(x, decreasing, ...)

## S4 method for signature ’OPMS,logical’sort(x, decreasing, by = "setup_time",

parse = TRUE, exact = TRUE, strict = TRUE, na.last = TRUE)

Arguments

x OPMS or OPM object.

decreasing Logical scalar. Passed to order from the base package.

by List or character vector. If a list, a list of one to several keys passed as keyargument to metadata. If a character vector of length one, by must specify thename of one of the functions setup_time, filename or position. If longer,passed step-by-step to csv_data as keys argument.

parse Logical scalar. Convert the setup_time via strptime before ordering? Hasonly an effect if by is ‘setup_time’. It is an error if the time format is not recog-nized.

exact Logical scalar. Passed to metadata. Affects only metadata querying, not di-rectly the sorting.

Page 127: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

sort 127

strict Logical scalar. Is it an error if metadata keys are not found? If FALSE, x getsordered according to only the found keys, and remains in the original order ifnone of the keys in by are found at all. Note that it is always an error if keys arefound in the metadata of some of theplates but not in those of others.

na.last Logical scalar. Also passed to order.

... Optional arguments passed between the methods.

Value

OPMS object with not necessarily the same order of plates than before, or OPM object.

See Also

base::order base::sort base::strptime

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, plates,rep, rev, thin_out, to_yaml, unique

Examples

## ’OPMS’ methoddata(vaas_4)

# Existing keysstopifnot(is.unsorted(metadata(vaas_4, "Strain")))x <- sort(vaas_4, by = list("Strain"))stopifnot(is(x, "OPMS"), !is.unsorted(metadata(x, "Strain")))x <- sort(vaas_4, by = list("Strain"), decreasing = TRUE)stopifnot(is(x, "OPMS"), is.unsorted(metadata(x, "Strain")))

# Non-existing keysx <- try(sort(vaas_4, by = list("Not there", "Missing"), strict = TRUE))stopifnot(inherits(x, "try-error"))x <- try(sort(vaas_4, by = list("Not there", "Missing"), strict = FALSE))stopifnot(identical(x, vaas_4))

# CSV-data basedcopy <- sort(vaas_4) # default: by setup timesetup_time(vaas_4)setup_time(copy)stopifnot(!identical(copy, vaas_4))copy <- sort(vaas_4, by = c("Position", "Setup Time"))position(vaas_4)position(copy)stopifnot(!is.unsorted(position(copy)), is.unsorted(position(vaas_4)))

## ’OPMS’ methoddata(vaas_1)summary(x <- sort(vaas_1))stopifnot(identical(x, vaas_1))

Page 128: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

128 split_files

split_files Split files

Description

Split files, i.e. subdivide each file into sections which are written individually to newly generatedfiles. Sections are determined with patterns that match the start of a section.

Usage

split_files(files, pattern, outdir = "", demo = FALSE,single = TRUE, wildcard = FALSE, invert = FALSE,include = TRUE, format = "%s-%05i.%s",compressed = TRUE, ...)

Arguments

files Character vector or convertible to such. Names of the files to be split.

pattern Regular expression or shell globbing pattern for matching the separator lines ifinvert is FALSE (the default) or matching the non-separator lines if otherwise.Conceptually each of the sections into which a file is split comprises a separatorline followed by non-separator lines. That is, separator lines followed by anotherseparator line are ignored. Non-separator lines not preceded by a separator lineare treated as a section of their own, however.

outdir Character scalar determining the output directory. If empty, each file’s inputdirectory is used.

demo Logical scalar. Do not create files, just return the usual list containing all po-tentially created files. Note that in contrast to the demo arguments of other IOfunctions, this requires the input files to be read.

single Logical scalar. If there is only one group per file, i.e. only one output file wouldresult from the splitting, create this file anyway? Such cases could be recognizedby empty character vectors as values of the returned list (see below).

wildcard Logical scalar. Is pattern a shell-globbing wildcard that first needs to be con-verted to a regular expression?

invert Logical scalar. Invert pattern matching, i.e. treat all lines that not match patternas separators?

include Logical scalar. Also include the separator lines in the output files?

format Character scalar determining the outfile name format. It is passed to sprintfand expects three placeholders: (i) the basename of the file; (ii) the index of thesection; and (iii) the file extension. Getting format wrong might result in non-unique filenames and thus probably in overwritten files; accordingly, it shouldbe used with care.

compressed Logical scalar. Passed to file_pattern, but here only affects the way filenamesare split in extensions and basenames. Should only be set to FALSE if input filesare not compressed (and have according file extensions).

Page 129: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

subset 129

... Optional arguments passed to grepl, which is used for matching the seperatorlines. See also invert listed above.

Value

List of character vectors, each vector containing the names of the newly generated files. The namesof the list are the input filenames. The list is returned invisibly.

See Also

base::split base::strsplit

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, explode_dir, file_pattern, opm_files, read_opm, read_single_opm, to_metadata

Examples

# Splitting an old-style CSV file containing several plates(x <- grep("Multiple", opm_files("testdata"), value = TRUE, fixed = TRUE))if (length(x) > 0) {

outdir <- tempdir()# For old-style CSV, use either "^Data File" as pattern or "Data File*"# with ’wildcard’ set to TRUE:(result <- split_files(x, pattern = "^Data File", outdir = outdir))stopifnot(is.list(result), length(result) == length(x))stopifnot(sapply(result, length) == 3)result <- unlist(result)stopifnot(file.exists(result))unlink(result) # tidy up

}## One could split new-style CSV as follows (if x is a vector of filenames):# split_files(x, pattern = ’^"Data File",’)## note the correct setting of the quotes## A pattern that covers both old and new-style CSV is:# split_files(x, pattern = ’^("Data File",|Data File)’)## This is used by the run_opm.R script

subset Select a subset of the plates (or time points)

Description

Select a subset of the plates in an OPMS object based on the content of the metadata. Alternatively,select a common subset of time points from all plates. The data-frame method selects columns thatbelong to certain classes.

Page 130: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

130 subset

Usage

## S4 method for signature ’OPMS’subset(x, query, values = TRUE,

invert = FALSE, exact = FALSE, time = FALSE,positive = c("ignore", "any", "all"),negative = c("ignore", "any", "all"),use = c("i", "I", "k", "K", "n", "N", "p", "P", "q", "Q", "t", "T"))

Arguments

x OPMS object.query Logical, numeric or character vector, or list (other objects can be provided but

are coerced to class ‘character’). If a logical or numeric vector, query is directlyused as the first argument of [, and all following arguments, if any, are ignored.If a list or a character vector, it is used for conducting a query based on one of theinfix operators as described below. The data-frame method expects a charactervector containing class names.

values Logical scalar. If TRUE, the values of query are also considered (by usinginfix.q or infix.largeq). If FALSE only the keys are considered (by usinginfix.k). That is, choose either the plates for which certain metadata entriescontain certain values, or choose the plates for which these metadata have beenset at all (to some arbitrary value). See the mentioned functions for details, andnote the special behavior if query is a character vector and values is FALSE.

invert Logical scalar. If TRUE, return the plates for which the condition is not TRUE.exact Logical scalar. If the values of query are considered, should this be done using

infix.q (when FALSE) or infix.largeq (when TRUE)? See these functions andcontains for details.

time Logical scalar. If TRUE, all other arguments are ignored and the object is reducedto the common subset of time points (measurement hours and minutes).

positive Character scalar. If ‘ignore’, not used, Otherwise all previous arguments exceptobject are ignored. If ‘any’, wells are selected that contain positive reactions inat least one plate. If ‘all’, wells are selected that contain positive reactions in allplates. This works only if all elements of object have discretized values. Usinginvert means selecting all negative or weak reactions.

negative Character scalar. Like positive, but returns the negative reactions. Usinginvert means selecting all positive or weak reactions.

use Character scalar. An alternative way to specify the settings. If ‘i’ or ‘I’, ignored.If ‘t’ or ‘T’, time is set to TRUE. If ‘p’ or ‘P’, positive is set to ‘any’ or ‘all’,respectively. If ‘n’ or ‘N’, non.negative is set to ‘any’ or ‘all’, respectively.Otherwise, use is taken directly as the one-latter name of the infix operators touse for plate selection, overriding values and exact.

Value

NULL or OPM or OPMS object. This depends on how many plates are selected; see [ for details. Thedata-frame method returns a data frame.

Page 131: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

substrate_info 131

See Also

base::‘[‘ base::‘[[‘ base::subset

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, seq, setup_time, summary, well, wells

Examples

## ’OPMS’ methoddata(vaas_4)# simple object comparison functionmustbe <- function(a, b) stopifnot(identical(a, b))

# all plates have that entry: selection identical to original objectmustbe(vaas_4, vaas_4["Species" %k% vaas_4, ])mustbe(vaas_4, subset(vaas_4, list(Species = "Escherichia coli"),

values = FALSE)) # equivalent

# two plates also have that value: yielding OPMS object with only two platesmustbe(vaas_4[1:2], vaas_4[list(Species = "Escherichia coli") %q% vaas_4, ])mustbe(vaas_4[1:2], subset(vaas_4, list(Species = "Escherichia coli")))

# select all plates that have aggregated valuesx <- subset(vaas_4, has_aggr(vaas_4))mustbe(x, vaas_4) # all have such values

# select a common set of time pointsx <- subset(vaas_4, time = TRUE)mustbe(x, vaas_4) # the time points had already been identical# create unequal time pointscopy <- vaas_4[, list(1:10, 1:20, 1:15, 1:10)]mustbe(hours(copy), c(2.25, 4.75, 3.50, 2.25))# now restrict to common subsetx <- subset(copy, time = TRUE)mustbe(hours(x), rep(2.25, 4))# see also the example with split() given under "["

# select all wells that have positive reactionssummary(x <- subset(vaas_4, use = "p")) # in at least one platestopifnot(dim(x)[3] < dim(vaas_4)[3])summary(y <- subset(vaas_4, use = "P")) # in all platesstopifnot(dim(y)[3] < dim(x)[3])

# select all wells that have non-negative reactions in at least one platesummary(y <- subset(vaas_4, use = "N", invert = TRUE))stopifnot(dim(y)[3] > dim(x)[3])

substrate_info Provide information on substrates

Page 132: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

132 substrate_info

Description

Return information on substrates such as their CAS number or KEGG ID. The query names must bewritten exactly as used in the stored plate annotations. To determine their spelling, use find_substrate.Alternatively, this functions converts the substrate names to lower case, protecting one-letter speci-fiers, acronyms and chemical symbols, and translating relevant characters from the Greek alphabet.

Usage

## S4 method for signature ’character’substrate_info(object,

what = c("cas", "kegg", "metacyc", "mesh", "downcase"))

## S4 method for signature ’list’substrate_info(object, ...)

## S4 method for signature ’factor’substrate_info(object, ...)

Arguments

object Query character vector or query list.

what Character scalar indicating which kind of information to output. See the ref-erences for the background of each possible value. ‘downcase’ is special; seeabove.

... Optional arguments passed between the methods.

Value

The character method returns a character vector with object used as names and either a matchedentry or NA as value. The factor method does the same, whereas the list method traverses a list andcalls substrate_info on its elements.

Note

Currently the information is incomplete, particularly for the PM-M plates. While it should eventu-ally be possible to link all substrates to CAS numbers, they are not necessarily contained in the otherdatabases.

References

Bochner, B. R., pers. comm.

http://en.wikipedia.org/wiki/CAS_registry_number

http://www.genome.jp/kegg/

http://metacyc.org/

http://www.ncbi.nlm.nih.gov/mesh

Page 133: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

summary 133

See Also

Other naming-functions: find_positions, find_substrate, listing, well_to_substrate

Examples

# Character method; compare correct and misspelled substrate name(x <- substrate_info(c("D-Glucose", "D-Gloucose")))

# Factor method(y <- substrate_info(as.factor(c("D-Glucose", "D-Gloucose"))))stopifnot(identical(x, y))

# Character method, safe conversion to lower case(x <- substrate_info(c("a-D-Glucose", "a-D-Gloucose"), "downcase"))stopifnot(nchar(x) > nchar(c("a-D-Glucose", "a-D-Gloucose")))# note the protection of ’D’ and the conversion of ’a’# whether ot not substrate names are known does not matter here

# List method(x <- substrate_info(find_substrate(c("D-Glucose", "D-Gloucose"))))stopifnot(length(x[[1]]) > length(x[[2]]))

summary Summarize OPM or OPMS objects

Description

Generate a summary (which also prints nicely to the screen).

Usage

## S4 method for signature ’OPM’summary(object, ...)

## S4 method for signature ’OPMS’summary(object, ...)

Arguments

object OPM or OPMS object.... Optional arguments passed to formatDL.

Value

For the OPM method, a named list of the class ‘OPM_Summary’, returned invisibly. The ‘metadata’entry is the number of non-list elements in metadata. For the OPMS method, a list of such lists (oneper plate), also returned invisibly, with the class set to ‘OPMS_Summary’ and some information onthe entire object in the attribute ‘overall’.

Page 134: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

134 thin_out

See Also

base::summary base::formatDL

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, seq, setup_time, subset, well, wells

Examples

# OPM methoddata(vaas_1)(x <- summary(vaas_1))stopifnot(is.list(x))

# OPMS methoddata(vaas_4)(x <- summary(vaas_4))stopifnot(is.list(x), length(x) == 4L, all(sapply(x, is.list)))

thin_out Thin out the measurements

Description

Thin out some OPM measurements by keeping only each n-th time point. A mainly experimentalfunction that might be of use in testing.

Usage

## S4 method for signature ’OPM’thin_out(object, factor, drop = FALSE)

## S4 method for signature ’OPMS’thin_out(object, ...)

Arguments

object OPM object.

factor Numeric scalar >= 1 indicating how much the dataset shall be thinned out.

drop Logical scalar. See [.

... Optional arguments passed between the methods.

Value

OPM object.

Page 135: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

to_kmeans 135

Note

Thinning the plates out is experimental insofar as it has not been tested whether and how this couldsensibly be applied before aggregating the data.

See Also

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, plates,rep, rev, sort, to_yaml, unique

Examples

# ’OPM’ methoddata(vaas_1)(x <- dim(vaas_1))stopifnot(identical(x, c(384L, 96L)))copy <- thin_out(vaas_1, 10) # keep every 10th time point and measurement(x <- dim(copy))stopifnot(identical(x, c(38L, 96L)), has_aggr(copy))copy <- thin_out(vaas_1, 10, drop = TRUE) # also remove the parameters(x <- dim(copy))stopifnot(identical(x, c(38L, 96L)), !has_aggr(copy))

# ’OPMS’ methoddata(vaas_4)(x <- dim(vaas_4))stopifnot(identical(x, c(4L, 384L, 96L)))copy <- thin_out(vaas_4, 10)(x <- dim(copy))stopifnot(identical(x, c(4L, 38L, 96L)))

to_kmeans Convert to kmeans

Description

Convert an object to one of class ‘kmeans’.

Usage

to_kmeans(x, ...)

## S3 method for class ’kmeans’to_kmeans(x, ...)

## S3 method for class ’kmeanss’to_kmeans(x, y, ...)

## S3 method for class ’Ckmeans.1d.dp’to_kmeans(x, y, ...)

Page 136: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

136 to_metadata

Arguments

x Object to be converted.

y Original numeric vector that was used to create a ‘Ckmeans.1d.dp’ object, orindex of an element of a ‘kmeanss’ object.

... Optional arguments passed to and from other methods, and/or between the meth-ods.

Value

Object of class ‘kmeans’.

See Also

Ckmeans.1d.dp::Ckmeans.1d.dp

Other kmeans-functions: borders, calinski, hist.Ckmeans.1d.dp, hist.kmeans, hist.kmeanss,plot.kmeanss, run_kmeans

Examples

x <- c(1, 2, 4, 5, 7, 8)summary(y <- kmeans(x, 3))stopifnot(identical(y, to_kmeans(y)))# see particularly run_kmeans() which uses this internally if clustering is# done with Ckmeans.1d.dp::Ckmeans.1d.dp()

to_metadata Input metadata

Description

The character method reads metadata from an input file and is only a thin wrapper for read.delimbut contains some useful adaptations (such as not converting strings to factors, and not modifyingcolumn names). The default method reads metadata from an object convertible to a data frame andis only a thin wrapper of as.data.frame but contains the same useful adaptations as the filenamemethod.

Usage

## S4 method for signature ’character’to_metadata(object,

sep = "\t", check.names = FALSE, strip.white = TRUE,stringsAsFactors = FALSE, ...)

## S4 method for signature ’ANY’to_metadata(object, stringsAsFactors = FALSE,

optional = TRUE, ...)

Page 137: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

to_yaml 137

Arguments

object Name of input file (character scalar), or any object convertible to a data frame.stringsAsFactors

Logical scalar passed to as.data.frame.

optional Logical scalar passed to as.data.frame or read.delim.

sep Character scalar. Field separator in input file. This and the following parametersare passed to read.delim.

check.names Logical scalar.

strip.white Logical scalar.

... Optional other arguments for read.delim or as.data.frame.

Value

Dataframe.

See Also

base::default.stringsAsFactors utils::read.delim base::as.data.frame

Other IO-functions: batch_collect, batch_opm_to_yaml, batch_process, clean_filenames,collect_template, explode_dir, file_pattern, opm_files, read_opm, read_single_opm, split_files

Examples

# Character method(x <- to_metadata(list(a = 7:8, ‘b c‘ = letters[1:2])))tmpfile <- tempfile()write.table(x, tmpfile, row.names = FALSE, sep = "\t")(x1 <- read.delim(tmpfile))(x2 <- to_metadata(tmpfile))stopifnot(identical(names(x2), names(x)), !identical(names(x1), names(x)))

# Default methodx <- list(a = 7:8, ‘b c‘ = letters[1:2])(x1 <- as.data.frame(x))(x2 <- to_metadata(x))stopifnot(!identical(names(x), names(x1)), identical(names(x), names(x2)))

to_yaml Convert to YAML

Description

Convert some R object to YAML. If the package yaml is not installed, a call of this function willresult in an error.

Page 138: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

138 to_yaml

Usage

## S4 method for signature ’YAML_VIA_LIST’to_yaml(object, sep = TRUE,

line.sep = "\n", ...)

Arguments

object Object of one of the classes belonging to YAML_VIA_LIST.

sep Logical scalar. Prepend YAML document separator ---?

line.sep Character scalar used as output line separator.

... Optional other arguments passed to as.yaml from the yaml package.

Details

YAML is a useful data-serialization standard that is understood by many programming languages. Itis particularly more human readable than XML, and vector-like data structures (such as PhenotypeMicroArray measurements) can be much more compactly encoded.

Value

Character scalar (YAML string).

Note

Many PM datasets can be batch-converted into YAML format using batch_opm_to_yaml. Theoutput format for the child classes is described in detail there, as well as other aspects relevant inpractice.

References

http://www.yaml.org/

See Also

yaml::as.yaml yaml::yaml.load_file

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, plates,rep, rev, sort, thin_out, unique

Examples

## Not run:

# Let ’x’ be a any convertible object# Store the data in file ’out.yml’ in YAML format.write(to_yaml(x), "out.yml")

## End(Not run)

Page 139: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

unique 139

unique Make OPMS objects unique

Description

Check whether duplicated OPM or OPMA objects are contained within an OPMS object and remove theduplicated ones. The OPM method just returns the object passed.

Usage

## S4 method for signature ’OPM,ANY’unique(x, incomparables, ...)

## S4 method for signature ’OPMS,missing’unique(x, incomparables, ...)

## S4 method for signature ’OPMS,ANY’unique(x, incomparables, ...)

Arguments

x OPMS or OPM object.

incomparables Vector passed to duplicated. The default is FALSE.

... Optional further arguments passed to duplicated. See the examples.

Value

OPMS or OPM object or NULL.

See Also

base::unique

Other conversion-functions: extract, extract_columns, flatten, gen_iii, merge, oapply, plates,rep, rev, sort, thin_out, to_yaml

Examples

## ’OPMS’ methoddata(vaas_4)(x <- unique(vaas_4))stopifnot(identical(x, vaas_4))(x <- unique(c(vaas_4, vaas_4)))stopifnot(identical(x, vaas_4))(x <- unique(vaas_4, what = "Species"))stopifnot(dim(x)[1L] < dim(vaas_4)[1L])(x <- unique(vaas_4, what = list("Species", "Strain")))

Page 140: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

140 vaas_1

stopifnot(identical(x, vaas_4))

## ’OPM’ methoddata(vaas_1)(x <- unique(vaas_1))stopifnot(identical(x, vaas_1))(x <- unique(vaas_1, what = list("Species", "Strain")))stopifnot(identical(x, vaas_1))

vaas_1 Example data set from Vaas et al. (2012), a single selected plate

Description

This OPMA object contains measurements from a single selected plate from the study by Vaas et al.(2012). Metadata have been added to fully describe the conducted PM experiments: this plate is the6th technical replicate from the first biological replicate for the strain Escherichia coli DSM30083T(yes, the type strain of E. coli). This is a a subset of vaas_4. The complete data set is available asvaas_et_al in the opmdata package.

Format

OPMD object with the dimensions 384 x 96, i.e. a single plate with 384 time points and 96 wells.

References

Vaas, L. A. I., Sikorski, J., Michael, V., Goeker, M., Klenk H.-P. 2012 Visualization and curveparameter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoSONE 7, e34846.

http://www.dsmz.de/catalogues/details/culture/DSM-30083.html

Examples

## Not run:

# Calling this yielded a variable vaas_1 containing the data. The opm# package must be loaded beforehand using library().data(vaas_1)

## End(Not run)

Page 141: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

vaas_4 141

vaas_4 Example data set from Vaas et al. (2012), four selected plates

Description

This OPMS object contains measurements from four selected plates from the study by Vaas et al.(2012). Metadata have been added to fully describe the conducted PM experiments: these plates arethe 6th technical replicate from the first biological replicate for the four bacterial strains consideredin the study. The complete data set is available as vaas_et_al in the opmdata package.

Format

OPMS object with the dimensions 4 x 384 x 96, i.e. 4 plates with 384 time points and 96 wells perplate.

References

Vaas, L. A. I., Sikorski, J., Michael, V., Goeker, M., Klenk H.-P. 2012 Visualization and curveparameter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoSONE 7, e34846.

Selezska, K., Kazmierczak, M., Muesken, M., Garbe, J., Schobert, M., Haeussler, S., Wiehlmann,L., Rohde, C., Sikorski, J. 2012 Pseudomonas aeruginosa population structure revisited under en-vironmental focus: impact of water quality and phage pressure. Environmental Microbiology 14,1952–1967.

http://www.dsmz.de/catalogues/details/culture/DSM-1707.html

http://www.dsmz.de/catalogues/details/culture/DSM-18039.html

http://www.dsmz.de/catalogues/details/culture/DSM-30083.html

Examples

## Not run:

# Calling this yielded a variable vaas_4 containing the data. The opm# package must be loaded beforehand using library().data(vaas_4)

## End(Not run)

Page 142: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

142 well

well Measurements from selected wells

Description

Get measurements from specified well(s) stored in an OPM object. This function will always ignorethe time points, in contrast to measurements.

Usage

## S4 method for signature ’OPM’well(object, i, drop = TRUE)

## S4 method for signature ’OPMS’well(object, ...)

Arguments

object OPM object.

i Character or numeric vector with name(s) or position(s) of well(s). Wells areoriginally named ‘A01’ to ‘H12’ but might have been subset beforehand.

drop Logical scalar. If only a single well was selected, simplify it to a vector?

... Optional arguments passed between the methods.

Value

Numeric matrix or vector (depending on i and drop).

Note

Do not confuse this with wells.

See Also

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, seq, setup_time, subset, summary, wells

Examples

# ’OPM’ methoddata(vaas_1)(x <- well(vaas_1, "B04"))stopifnot(is.numeric(x), length(x) == 384L)(x <- well(vaas_1, c("B08", "C07")))stopifnot(is.matrix(x), identical(dim(x), c(384L, 2L)))

Page 143: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

wells 143

# ’OPMS’ methoddata(vaas_4)(x <- well(vaas_4, "B04"))stopifnot(is.matrix(x), dim(x) == c(4, 384))

wells Available well names

Description

Get the names of the wells contained in an OPM object. Optionally the full substrate names can beadded in parentheses or brackets or used instead of the coordinate, and trimmed to a given length.

Usage

## S4 method for signature ’OPM’wells(object, full = FALSE, in.parens = TRUE,

max = 100L, brackets = FALSE, clean = TRUE, word.wise = FALSE,paren.sep = " ", downcase = FALSE)

## S4 method for signature ’OPMS’wells(object, ...)

Arguments

object OPM object.full Logical scalar. Return the full names of the wells (if available) or just their

coordinates on the plate? The following arguments have no effect if full isFALSE.

in.parens Logical scalar. If TRUE, add the full name of the substrate in parentheses (orbrackets) after the original name. If FALSE, replace by the full substrate name.Note that adding in parentheses (or brackets) is only done if the trimmed sub-strate names are not empty.

max Numeric scalar. Maximum number of characters allowed in the names. Longernames are truncated and the truncation is indicated by appending a dot.

brackets Logical scalar. Use brackets instead of parentheses?clean Logical scalar. If TRUE, clean trimmed end of full substrate name from non-word

characters; use an empty string if only the dot remained.word.wise Logical scalar. If TRUE, abbreviation works by truncating each word separately,

and removing vowels first.paren.sep Character scalar. What to insert before the opening parenthesis (or bracket).downcase Logical scalar indicating whether full names should be (carefully) converted

to lower case. This uses substrate_info in ‘downcase’ mode; see there fordetails.

... Optional arguments passed between the methods.

Page 144: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

144 well_to_substrate

Value

Character vector.

Note

Do not confuse this with well.

See Also

base::strtrim base::abbreviate

Other getter-functions: aggr_settings, aggregated, anyDuplicated, csv_data, dim, disc_settings,discretized, duplicated, filename, has_aggr, has_disc, hours, length, max, measurements,metadata, minmax, plate_type, position, select, seq, setup_time, subset, summary, well

Examples

# ’OPM’ methoddata(vaas_1)(x <- wells(vaas_1, full = FALSE))(y <- wells(vaas_1, full = TRUE))(z <- wells(vaas_1, full = TRUE, in.parens = FALSE))stopifnot(nchar(x) < nchar(y), nchar(z) < nchar(y))

# ’OPM’ methoddata(vaas_4)(xx <- wells(vaas_4, full = FALSE))stopifnot(identical(x, xx))

well_to_substrate Map well names to substrates

Description

Translate well names (which are basically their coordinates on the plate) to substrate names, giventhe name of the plate.

Usage

well_to_substrate(plate, well = 1L:96L)

Arguments

plate Character vector or factor. The type(s) of the plate(s). See plate_type. plate_typeis applied before searching for the substrate names, and partial matching is al-lowed.

well Character vector of original well names (coordinates on the plate), or integervector, or convertible to such.

Page 145: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

WMD 145

Value

Character vector or matrix (depending on the length of plate), containing NA values for plates andwells that could not be identified.

See Also

Other naming-functions: find_positions, find_substrate, listing, substrate_info

Examples

x <- c("A01", "B10")(y <- well_to_substrate("PM1", x))stopifnot(nchar(y) > nchar(x))

WMD WMD class

Description

This is a virtual class facilitating the management of metadata. No objects can be created from itbecause metadata without data make not much sense. It is used by its child classes such as OPM, butit is not directly applied by an opm user.

Details

• WMD is an acronym for ‘with metadata’.

• Conceptually, this class treats metadata as arbitrarily nested lists with arbitrary content. Con-tainers of objects that inherit from this class are not forced to contain the same metadataentries. Problems might arise if such data are queried and attempted to be converted to, e.g.,data frames because some values might be missing. But metadata can be queried beforehandfor the keys as well as the values they contain, and other methods support setting, modifyingand deleting metadata.

• For OPM and the other opm classes that use it, ‘metadata’ refers to information that, in contrastto, e.g., csv_data must be added by the user after reading OmniLog® CSV files. Metadatamight already be present in YAML files created by the opm package, however.

See Also

methods::Methods

Other classes: MOA, OPM, OPMA, OPMD, OPMS, OPMX, YAML_VIA_LIST

Page 146: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

146 xy_plot

xy_plot XY plot

Description

Customized plotting of a single or multiple PM plate(s), using xyplot from the lattice package. Theoptimal number of rows and columns is estimated from the number of selected wells. An optimalfont size of the panel headers is also chosen automatically, but can also be adapted by the user,much like most aspects of the resulting graphics output. In the case of the OPMS method, if metadataare selected, curve colours are determined according to the combinations of these metadata entries,otherwise each plate gets its own colour.

Usage

## S4 method for signature ’OPM’xy_plot(x, col = "midnightblue", lwd = 1,

neg.ctrl = "A01", base.col = "grey10", base.lwd = lwd,main = list(), xlab = "Time [h]", ylab = "Value [OmniLog units]",theor.max = TRUE, draw.grid = TRUE,strip.fmt = list(), striptext.fmt = list(),...)

## S4 method for signature ’OPMS’xy_plot(x, col = opm_opt("colors"), lwd = 1,

neg.ctrl = "A01", base.col = "black", base.lwd = lwd,main = list(), xlab = "Time [h]", ylab = "Value [OmniLog units]",theor.max = TRUE, draw.grid = TRUE, space = "top",strip.fmt = list(), striptext.fmt = list(),legend.fmt = list(), legend.sep = " ", draw.legend = TRUE,...)

## S4 method for signature ’data.frame’xy_plot(x, f, groups,

col = opm_opt("colors"), lwd = 1, neg.ctrl = NULL, base.col = "black",base.lwd = lwd, main = groups, xlab = elem(f, 3L:2L), ylab = elem(f, 2L),draw.grid = TRUE, space = "top", strip.fmt = list(), striptext.fmt = list(),legend.fmt = list(), legend.sep = " ", draw.legend = TRUE, ...)

Arguments

x OPM or OPMS object.

col For the OPM method, just a character scalar (colour name) determining the linecolour. For the OPMS method, either a character vector with colour codes or oneof the arguments of select_colors (for picking one of the predefined coloursets). It is an error if fewer colours are chosen than the number of plate groupinglevels (see the ... argument below). For user-chosen colour sets, keep in mind

Page 147: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

xy_plot 147

that the sets are not checked for duplicates, and see max_rgb_contrast fromthe pkgutils package as a method for optimally arranging user-defined colours.

lwd Numeric scalar determining the line width.

neg.ctrl Determine the height of a horizontal baseline drawn in each panel. If NULL orFALSE, no baseline will be drawn. If TRUE, the baseline’s height is the valueof minmax. If a character scalar, neg.ctrl is interpreted as the name of thewells regarded as negative control, and the baseline’s height becomes the valueof minmax applied to these wells only. Set neg.ctrl to a numeric value forassigning the height directly (at your own risk).

base.col Character scalar. Baseline colour (ignored if no baseline is drawn).

base.lwd Numeric scalar determining the width of the baseline (ignored if no baseline isdrawn).

main The settings controlling the construction of the main title. If a list, a namedlist with the following entries (if missing, they are replaced by the respectivedefaults):

predef Character scalar or expression. Predefined title. If set, the other entriesare ignored.

use Logical scalar. If FALSE, returns NULL.... Other arguments are passed to plate_type.

If settings is not a list but a character scalar or an expression, this is used asthe ‘predef’ entry of the above-mentioned list. If not a list but a logical scalar, itis used as the ‘use’ entry of this list. If not a list but a numeric value, it is usedas the ‘max’ entry of this list.

xlab Character scalar. Title of x-axis. Use NULL to turn it off.

ylab Character scalar. Title of y-axis. Use NULL to turn it off.

theor.max Logical scalar. Use the theoretical maximum as maximum of the y-axis? IfFALSE, use the empirical maximum with a small offset.

draw.grid Logical scalar. Insert background grid?

space Character scalar indicating the position of the legend; either ‘top’, ‘bottom’,‘left’ or ‘right’. Might be overwritten by legend.fmt.

strip.fmt List controlling the format of the description strip above each panel. For in-stance, the background colour is set using the ‘bg’ key. For further details, seestrip.custom from the lattice package. Note that the content of these descrip-tions is determined by arguments passed from xy_plot to wells; see there fordetails.

striptext.fmt List controlling the textual description at the top of each panel. For instance, therelative text size is set using the ‘cex’ key, the colour by ‘col’, the font by ‘font’and the number of lines by ‘lines’. The latter might be of interest in conjunctionwith the paren.sep argument of wells. See the argument ‘par.strip.text’ ofxyplot from the lattice package for details.

legend.fmt List controlling where and how to draw the legend. The content of the legend(mainly a description of the assignment of the colours to the curves) is deter-mined automatically. See argument ‘key’ of xyplot from the lattice packagefor details.

Page 148: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

148 xy_plot

legend.sep Character scalar. Relevant only if more than one columns of metadata have beenselected; will then be used as separator to join their names in the legend.

draw.legend Logical scalar. If FALSE, no legend is drawn, and the two aforementioned argu-ments are ignored.

... Arguments that are passed to flatten. For the OPMS method, include is par-ticularly important: the selected metadata are joined into a single factor, and theassignment of plates to this factor’s levels determines the curve colour for eachplate. That is, each combination of metadata entries as chosen using includeyields one colour. If no metadata are selected (the default), each plate gets acolour of its own. Also note that arguments passed via flatten to wells can begiven here which determine the content of the panel description.

f Formula (for the data-frame method).

groups Character vector (for the data-frame method).

Value

An object of class ‘trellis’. See xyplot from the lattice package for details.

Note

The data-frame method is not intended for phenotype microarray data. It is currently undocu-mented and potentially subject to frequent changes or even removal. Users interested in the methodshould contact the authors.

References

Sarkar, D. 2008 Lattice: Multivariate Data Visualization with R. New York: Springer, 265 p.

Vaas, L. A. I., Sikorski, J., Michael, V., Goeker, M., Klenk H.-P. 2012 Visualization and curveparameter estimation strategies for efficient exploration of Phenotype Microarray kinetics. PLoSONE 7, e34846.

See Also

lattice::xyplot

Other plotting-functions: ci_plot, heat_map, level_plot, radial_plot, select_colors, show

Examples

# OPM methoddata(vaas_1)## Not run:xy_plot(vaas_1) # note the default main title built from the plate type

## End(Not run)

x <- vaas_1[, 11:22]# Gives a warning message: we have deleted the default negative control:xy_plot(x)# Turn the baseline off => no warning:

Page 149: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

YAML_VIA_LIST 149

xy_plot(x, neg.ctrl = NULL)# Or guess a baselinexy_plot(x, neg.ctrl = 100)# Some like it ugly:xy_plot(x, neg.ctrl = 100, col = "pink", base.col = "yellow", main = "Ugly")

# OPMS methoddata(vaas_4)## Not run:# Color by species and strain; note default main titlexy_plot(vaas_4, include = c("Species", "Strain"))# Use the largest of the negative-control maxima as baselinexy_plot(vaas_4, include = c("Species", "Strain"),

neg.ctrl = max(vaas_4, "A01"))

## End(Not run)

YAML_VIA_LIST YAML_VIA_LIST class

Description

This is a virtual class facilitating the conversion to YAML format. It can currently be used by anyclass that can be coerced to a list, but it is not directly applied by an opm user.

See Also

methods::Methods

Other classes: MOA, OPM, OPMA, OPMD, OPMS, OPMX, WMD

[ Select subset

Description

Select a subset of the measurements. Return other slots unchanged. In contrast to the usual ‘[‘ func-tions, always return a matrix (as a component of the returned object), even if it could be simplifiedto a vector. The time column is not counted and always copied. It is an error to delete the entirematrix. In all other respects, this method behaves like the ‘[‘ functions from the base package.The OPMS method selects a subset of the plates and/or the measurements of the individual plates. Itsimplifies the outcome to a OPM or OPMA object if only a single plate remains and to NULL if no plateremains. This behaves like subsetting a three-dimensional array with plates as first dimension, timepoints as second, and wells as third.

Page 150: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

150 [

Usage

## S4 method for signature ’OPM’x[i, j, ..., drop = FALSE]

## S4 method for signature ’OPMA’x[i, j, ..., drop = FALSE]

## S4 method for signature ’OPMD’x[i, j, ..., drop = FALSE]

## S4 method for signature ’OPMS’x[i, j, k, ..., drop = FALSE]

Arguments

x OPM, OPMA or OPMS object.

i Vector or missing. For the OPM and OPMA method, the indexes of one to severaltime points. For the OPMS method, the indexes of one to several plates.

j Vector or missing. For the OPM and OPMA method, the indexes or names of one toseveral wells. For the OPMS method, the indexes of one to several time points. Inthat case, if j is a list, its values are passed to the respective OPM object separately,allowing for individual choices of time points. Otherwise j is used as the iargument of the OPM and OPMA method.

k Vector or missing. The OPMS method uses k as j argument of the OPM and OPMAmethod. That is, this parameter selects the wells.

... This should not be set. It is an error to specify additional dimensions.

drop Logical scalar. Remove the aggregated data and turn OPMA to OPM objects? Hasno effect if x already is an OPM object or contains only such objects.

Details

The OPMA method works like the OPM one, but the function applies the subsetting to the original andthe aggregated data in parallel. The aggregated data may also be dropped entirely; this might beappropriate if a subset of the time points is selected, potentially yielding aggregated values that donot fit to the measurements anymore.

Value

OPM, OPMA or OPMS object, or NULL.

See Also

base::‘[‘ base::‘[[‘

Page 151: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

[ 151

Examples

# OPM(A) methoddata(vaas_1)(x <- dim(vaas_1))stopifnot(identical(x, c(384L, 96L)))copy <- vaas_1[, 11:22](x <- dim(copy))stopifnot(identical(x, c(384L, 12L)))copy <- vaas_1[]stopifnot(has_aggr(copy))stopifnot(identical(copy, vaas_1))copy <- vaas_1[drop = TRUE]stopifnot(!has_aggr(copy))stopifnot(!identical(copy, vaas_1))

# OPMS methoddata(vaas_4)

# Create OPMS object with fewer plates (the first two ones)x <- vaas_4[1:2]stopifnot(dim(x) == c(2, 384, 96))

# If only a single plate is selected, this is reduced to OPM(A)x <- vaas_4[3]stopifnot(dim(x) == c(384, 96))

# Create OPMS object with fewer time points (the first 100 in that case;# usually this would correspond to the first 25 hours)x <- vaas_4[, 1:100]stopifnot(dim(x) == c(4, 100, 96))

# Create OPMS object with fewer wellsx <- vaas_4[, , 1:12]stopifnot(dim(x) == c(4, 384, 12))

# The same with well namesx <- vaas_4[, , sprintf("A%02i", 1:12)] # this yields A01...A12stopifnot(dim(x) == c(4, 384, 12))

# Select all plates that have aggregated valuesx <- vaas_4[has_aggr(vaas_4)]stopifnot(identical(x, vaas_4)) # all have such values!

# Split into list of OPMS objects with the same overall measurement hours;# the default split() method can be applied here based on "["x <- split(vaas_4, hours(vaas_4))stopifnot(class(x) == "list", length(x) == 1, class(x[[1]]) == "OPMS")# ... because the running times were actually already identical, the list# contains only a single element.

# Traverse all contained OPM objectsfor (i in seq(vaas_4)) { # OR: for (i in 1:length(vaas_4))

Page 152: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

152 %k%

x <- vaas_4[i]# now do something with ’x’...stopifnot(dim(x) == c(384, 96))

}# see also oapply() for a more elegant approach

%k% Search in metadata keys

Description

Using a character vector as query, this method tests whether all given keys are present in the top-level names of the metadata (these may be nested, but all sublists are ignored here). An empty queryvector results in TRUE. Note that the values of the character vector, not its names, if any, are used forquerying the metadata. Using a list as query, this method tests whether all given keys are present inthe names of the metadata. This works like the character method, but because a query list is given,the comparison of keys can be applied recursively (by using, of course, a nested query list). This isbased on contains with the values argument set to FALSE. The factor method first converts x to‘character’ mode.

Usage

## S4 method for signature ’character,WMD’x %k% table

## S4 method for signature ’list,WMD’x %k% table

## S4 method for signature ’factor,WMD’x %k% table

## S4 method for signature ’list,OPMS’x %k% table

## S4 method for signature ’character,OPMS’x %k% table

## S4 method for signature ’factor,OPMS’x %k% table

Arguments

x Character vector, factor or list.

table WMD object.

Page 153: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

%K% 153

Value

Logical scalar.

Examples

# The dataset contains the metadata keys ’Species’ and ’Experiment’ but# neither ’Trial’ nor ’Organism’ nor ’Run’:data(vaas_1)

# Character methodstopifnot("Experiment" %k% vaas_1)stopifnot("Species" %k% vaas_1)stopifnot(!"Run" %k% vaas_1)stopifnot(c("Species", "Experiment") %k% vaas_1)stopifnot(!c("Species", "Trial") %k% vaas_1)stopifnot(!c("Organism", "Experiment") %k% vaas_1)stopifnot(character() %k% vaas_1)

# List methodstopifnot(list(Experiment = "whatever") %k% vaas_1)stopifnot(list(Species = "ignored") %k% vaas_1)

# This fails because we query with a named sublist but ’Species’ is not# even a liststopifnot(!list(Species = list(Genus = "X", Epithet = "Y")) %k% vaas_1)

# This is OK because we query with an unnamed sublist: it has no names that# one would fail to findstopifnot(list(Species = list("X", "Y")) %k% vaas_1)

# More non-nested query examplesstopifnot(!list(Run = 99) %k% vaas_1)stopifnot(list(Species = "?", Experiment = NA) %k% vaas_1)stopifnot(!list(Species = "?", Trial = NA) %k% vaas_1)stopifnot(!list(Organism = "?", Experiment = NA) %k% vaas_1)stopifnot(list() %k% vaas_1)

%K% Search in metadata keys

Description

Using a character vector as query, this method tests whether a given key is present in the metadataand fetches an object that is not NULL. If the key has a length > 1, sublists are queried. An emptyvector results in TRUE. Note that the values of the character vector, not its names, if any, are usedfor querying the metadata. Using a list as query, this function behaves like infix.k. The factormethod first converts x to ‘character’ mode.

Page 154: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

154 %K%

Usage

## S4 method for signature ’character,WMD’x %K% table

## S4 method for signature ’list,WMD’x %K% table

## S4 method for signature ’factor,WMD’x %K% table

## S4 method for signature ’list,OPMS’x %K% table

## S4 method for signature ’character,OPMS’x %K% table

## S4 method for signature ’factor,OPMS’x %K% table

Arguments

x Character vector, factor or list.

table WMD object.

Value

Logical scalar.

Examples

# The dataset contains the metadata keys ’Species’ and ’Experiment’ but# neither ’Trial’ nor ’Organism’ nor ’Run’:data(vaas_1)

# Character method

# Single-element queriesstopifnot("Experiment" %K% vaas_1)stopifnot("Species" %K% vaas_1)stopifnot(!"Run" %K% vaas_1)stopifnot(!"Trial" %K% vaas_1)stopifnot(!"Organism" %k% vaas_1)

# Zero-element queriesstopifnot(character() %K% vaas_1)

# Querying with vectors of length > 1 mean nested queries; compare this to# the behavior of %k%!stopifnot(!c("Species", "Experiment") %K% vaas_1)

Page 155: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

%Q% 155

# List method# See %k% -- the behavior is identical for lists.

%Q% Query metadata (strict version)

Description

Using a character vector as query, test whether all given query keys are present in the top-levelnames of the metadata and refer to the same query elements (without coercion to character). Usinga list, conduct an exact query with this query list. The factor method first converts x to ‘character’mode.

Usage

## S4 method for signature ’character,WMD’x %Q% table

## S4 method for signature ’list,WMD’x %Q% table

## S4 method for signature ’factor,WMD’x %Q% table

## S4 method for signature ’list,OPMS’x %Q% table

## S4 method for signature ’character,OPMS’x %Q% table

## S4 method for signature ’factor,OPMS’x %Q% table

Arguments

x Character vector, factor or list used as query. If a character vector, the resultis identical to the one of infix.q except for the fact that metadata elementsare not coerced to ‘character’ mode, making the query more strict. If a list, thecomparison is applied recursively using contains with the arguments valuesand exact set to TRUE. This might be too strict for most applications. The mainadvantage of using a list over the character-based search is that it allows one anested query.

table WMD object.

Page 156: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

156 %q%

Value

Logical scalar.

Examples

# The dataset contains the metadata keys ’Species’ and ’Experiment’ with the# values ’Escherichia coli’ and ’First replicate’:data(vaas_1)

# Character methodstopifnot(c(Experiment = "First replicate") %Q% vaas_1)

# This does not work because the value has the wrong typestopifnot(!c(‘Plate number‘ = "6") %Q% vaas_1)# Compare to %q%stopifnot(c(‘Plate number‘ = "6") %q% vaas_1)

# Combined querystopifnot(c(Species = "Escherichia coli",

Experiment = "First replicate") %Q% vaas_1)

stopifnot(character() %Q% vaas_1) # Empty query

# List methodstopifnot(list(Experiment = "First replicate") %Q% vaas_1)

# Choice among alternatives is not done here: this query fails unless this# two-element vector is contained. Compare to %q%.stopifnot(!list(Experiment = c("First replicate",

"Second replicate")) %Q% vaas_1)

stopifnot(list() %Q% vaas_1) # Empty query

%q% Query metadata (non-exact version)

Description

Using a character vector, test whether all given query keys are present in the top-level names of themetadata and refer to the same query elements. Using a list, conduct a non-exact query with a querylist. The factor method first converts x to ‘character’ mode.

Usage

## S4 method for signature ’character,WMD’x %q% table

## S4 method for signature ’list,WMD’x %q% table

Page 157: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

%q% 157

## S4 method for signature ’factor,WMD’x %q% table

## S4 method for signature ’list,OPMS’x %q% table

## S4 method for signature ’character,OPMS’x %q% table

## S4 method for signature ’factor,OPMS’x %q% table

Arguments

x Character vector, factor or list used as query. If a character vector, its namesare used to select elements from the top level of the metadata. These elementsare then converted to ‘character’ mode before comparison with the values of x.A non-empty vector without a names attribute is accepted but will always yieldFALSE. In contrast, an entirely empty vector yields TRUE. If a list, the comparisonis applied recursively using contains with the values argument set to TRUE butexact set to FALSE. The main advantage of using a list over the character-basedsearch is that it allows one a nested query.

table WMD object.

Value

Logical scalar.

Examples

# The dataset contains the metadata keys ’Species’ and ’Experiment’ with the# values ’Escherichia coli’ and ’First replicate’:data(vaas_1)

# Character methodstopifnot(!"Experiment" %q% vaas_1) # wrong query here; compare to %k%stopifnot(!"First replicate" %q% vaas_1) # again wrong querystopifnot(c(Experiment = "First replicate") %q% vaas_1) # right query

stopifnot(!"Species" %q% vaas_1)stopifnot(!"Escherichia coli" %q% vaas_1)stopifnot(c(Species = "Escherichia coli") %q% vaas_1)

stopifnot(c(Species = "Escherichia coli",Experiment = "First replicate") %q% vaas_1) # Combined query

stopifnot(character() %q% vaas_1) # Empty query

Page 158: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

158 %q%

# List methodstopifnot(list(Experiment = "First replicate") %q% vaas_1)

# Choice among alternativesstopifnot(list(Experiment = c("First replicate",

"Second replicate")) %q% vaas_1)stopifnot(!list(Experiment = c("Second replicate",

"Third replicate")) %q% vaas_1)

# Combined query together with choice among alternativesstopifnot(list(Experiment = c("First replicate", "Second replicate"),

Species = c("Escherichia coli", "Bacillus subtilis")) %q% vaas_1)

stopifnot(list() %q% vaas_1) # Empty query

Page 159: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

Index

∗Topic IObatch_collect, 7batch_opm_to_yaml, 8batch_process, 11collect_template, 21explode_dir, 39html_args, 59phylo_data, 97read_opm, 110read_single_opm, 112to_metadata, 136to_yaml, 137

∗Topic attribute%K%, 153%Q%, 155%k%, 152%q%, 156aggr_settings, 5aggregated, 4anyDuplicated, 6collect_template, 21contains, 24csv_data, 25dim, 26disc_settings, 31discretized, 30duplicated, 38filename, 45has_aggr, 53has_disc, 54hours, 58length, 62max, 76measurements, 77metadata, 80metadata_chars, 85minmax, 86plate_type, 104plates, 103

position, 107seq, 123setup_time, 124show, 125summary, 133well, 142wells, 143

∗Topic categorybest_cutoff, 13discrete, 27do_disc, 35listing, 65

∗Topic characterbest_cutoff, 13discrete, 27do_disc, 35explode_dir, 39find_substrate, 48glob_to_regex, 52html_args, 59listing, 65phylo_data, 97plate_type, 104safe_labels, 117separate, 121to_yaml, 137

∗Topic classesMOA, 87OPM, 88OPMA, 90OPMD, 91OPMS, 91OPMX, 93WMD, 145YAML_VIA_LIST, 149

∗Topic clusterborders, 14calinski, 17html_args, 59

159

Page 160: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

160 INDEX

phylo_data, 97run_kmeans, 116

∗Topic colorselect_colors, 120

∗Topic datasetsvaas_1, 140vaas_4, 141

∗Topic dplotextract, 41extract_columns, 42flatten, 49max, 76minmax, 86

∗Topic hplotborders, 14calinski, 17ci_plot, 18heat_map, 55level_plot, 63radial_plot, 108xy_plot, 146

∗Topic listcontains, 24map_names, 69map_values, 71

∗Topic manip[, 149c, 16extract, 41extract_columns, 42flatten, 49gen_iii, 51include_metadata, 61map_metadata, 66map_names, 69map_values, 71merge, 79metadata.set, 81oapply, 87opms, 92plus, 106rep, 113rev, 115select, 118separate, 121sort, 126subset, 129thin_out, 134

to_kmeans, 135to_metadata, 136unique, 139

∗Topic methodsMOA, 87OPM, 88OPMA, 90OPMD, 91OPMS, 91OPMX, 93WMD, 145YAML_VIA_LIST, 149

∗Topic packageopm.package, 89

∗Topic smoothdo_aggr, 32fast_estimate, 44

∗Topic utilitiesclean_filenames, 20file_pattern, 46find_positions, 47find_substrate, 48kubrick, 62opm_files, 94opm_opt, 95param_names, 97plate_type, 104split_files, 128substrate_info, 131well_to_substrate, 144

+,OPM,OPM-method (plus), 106+,OPM,OPMS-method (plus), 106+,OPM,list-method (plus), 106+,OPMS,OPM-method (plus), 106+,OPMS,OPMS-method (plus), 106+,OPMS,list-method (plus), 106[, 19, 118, 123, 130, 134, 149[,OPM-method ([), 149[,OPMA-method ([), 149[,OPMD-method ([), 149[,OPMS-method ([), 149%K%,character,OPMS-method (%K%), 153%K%,character,WMD-method (%K%), 153%K%,factor,OPMS-method (%K%), 153%K%,factor,WMD-method (%K%), 153%K%,list,OPMS-method (%K%), 153%K%,list,WMD-method (%K%), 153%Q%,character,OPMS-method (%Q%), 155

Page 161: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

INDEX 161

%Q%,character,WMD-method (%Q%), 155%Q%,factor,OPMS-method (%Q%), 155%Q%,factor,WMD-method (%Q%), 155%Q%,list,OPMS-method (%Q%), 155%Q%,list,WMD-method (%Q%), 155%k%,character,OPMS-method (%k%), 152%k%,character,WMD-method (%k%), 152%k%,factor,OPMS-method (%k%), 152%k%,factor,WMD-method (%k%), 152%k%,list,OPMS-method (%k%), 152%k%,list,WMD-method (%k%), 152%q%,character,OPMS-method (%q%), 156%q%,character,WMD-method (%q%), 156%q%,factor,OPMS-method (%q%), 156%q%,factor,WMD-method (%q%), 156%q%,list,OPMS-method (%q%), 156%q%,list,WMD-method (%q%), 156%K%, 153%Q%, 155%k%, 152%q%, 156

aggr_settings, 5, 5, 7, 26, 27, 30, 31, 38, 46,54, 55, 58, 63, 77, 78, 81, 86, 105,108, 119, 123, 124, 131, 134, 142,144

aggr_settings,OPMA-method(aggr_settings), 5

aggr_settings,OPMS-method(aggr_settings), 5

aggr_settings-methods (aggr_settings), 5aggregated, 4, 6, 7, 26, 27, 30, 31, 33, 38, 41,

46, 54, 55, 58, 63, 77, 78, 81, 86,105, 108, 119, 123, 124, 131, 134,142, 144

aggregated,OPMA-method (aggregated), 4aggregated,OPMS-method (aggregated), 4aggregated-methods (aggregated), 4anyDuplicated, 5, 6, 6, 26, 27, 30, 31, 38, 46,

54, 55, 58, 63, 77, 78, 81, 86, 105,108, 119, 123, 124, 131, 134, 142,144

anyDuplicated,OPM,ANY-method(anyDuplicated), 6

anyDuplicated,OPMS,ANY-method(anyDuplicated), 6

anyDuplicated,OPMS,missing-method(anyDuplicated), 6

anyDuplicated-methods (anyDuplicated), 6

batch_collect, 7, 11, 12, 21–23, 40, 47, 94,111, 113, 129, 137

batch_opm_to_yaml, 8, 8, 11, 12, 21, 23, 40,47, 89, 94, 111, 113, 129, 137, 138

batch_process, 8–11, 11, 21, 23, 40, 47, 94,111, 113, 129, 137

best_cutoff, 13, 29, 35, 36best_cutoff,matrix,character-method

(best_cutoff), 13best_cutoff,matrix,factor-method

(best_cutoff), 13best_cutoff-methods (best_cutoff), 13borders, 14, 18, 28, 116, 136bracket,OPM-method ([), 149bracket,OPMA-method ([), 149bracket,OPMD-method ([), 149bracket,OPMS-method ([), 149bracket-methods ([), 149

c, 16, 92, 107c,OPMX-method (c), 16c-methods (c), 16calinski, 16, 17, 116, 136ci_plot, 18, 57, 64, 110, 120, 125, 148ci_plot,data.frame-method (ci_plot), 18ci_plot,OPMS-method (ci_plot), 18ci_plot-methods (ci_plot), 18clean_filenames, 8, 11, 12, 20, 23, 40, 47,

94, 111, 113, 129, 137collect_template, 7, 8, 11, 12, 21, 21, 40,

47, 94, 96, 111, 113, 129, 137collect_template,character-method

(collect_template), 21collect_template,OPM-method

(collect_template), 21collect_template,OPMS-method

(collect_template), 21collect_template-methods

(collect_template), 21contains, 24, 53, 62, 70, 74, 96, 122, 130,

152, 155, 157contains,list,list-method (contains), 24contains,OPMS,OPM-method (contains), 24contains-methods (contains), 24csv_data, 5–7, 22, 25, 27, 30, 31, 38, 45, 46,

54, 55, 58, 63, 77–79, 81, 86, 96,104, 105, 107, 108, 119, 123, 124,126, 131, 134, 142, 144, 145

csv_data,OPM-method (csv_data), 25

Page 162: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

162 INDEX

csv_data,OPMS-method (csv_data), 25csv_data-methods (csv_data), 25

dim, 5–7, 26, 26, 30, 31, 38, 46, 54, 55, 58, 63,77, 78, 81, 86, 105, 108, 119, 123,124, 131, 134, 142, 144

dim,OPM-method (dim), 26dim,OPMS-method (dim), 26dim-methods (dim), 26disc_settings, 5–7, 26, 27, 30, 31, 36, 38,

46, 54, 55, 58, 63, 77, 78, 81, 86,105, 108, 119, 123, 124, 131, 134,142, 144

disc_settings,OPMD-method(disc_settings), 31

disc_settings,OPMS-method(disc_settings), 31

disc_settings-methods (disc_settings),31

discrete, 14, 27, 36, 99, 100, 116discrete,data.frame-method (discrete),

27discrete,MOA-method (discrete), 27discrete,numeric-method (discrete), 27discrete-methods (discrete), 27discretized, 5–7, 26, 27, 30, 31, 36, 38, 46,

54, 55, 58, 63, 77, 78, 81, 86, 105,108, 119, 123, 124, 131, 134, 142,144

discretized,OPMD-method (discretized),30

discretized,OPMS-method (discretized),30

discretized-methods (discretized), 30do_aggr, 5, 6, 9, 32, 44, 45, 54, 89, 90, 97do_aggr,matrix-method (do_aggr), 32do_aggr,OPM-method (do_aggr), 32do_aggr,OPMS-method (do_aggr), 32do_aggr-methods (do_aggr), 32do_disc, 9, 14, 29–31, 35, 54, 66, 91do_disc,OPMA-method (do_disc), 35do_disc,OPMS-method (do_disc), 35do_disc-methods (do_disc), 35duplicated, 5–7, 26, 27, 30, 31, 38, 46, 54,

55, 58, 63, 77, 78, 81, 86, 105, 108,119, 123, 124, 131, 134, 139, 142,144

duplicated,OPM,ANY-method (duplicated),38

duplicated,OPMS,ANY-method(duplicated), 38

duplicated,OPMS,missing-method(duplicated), 38

duplicated-methods (duplicated), 38

explode_dir, 8, 9, 11, 12, 21, 23, 39, 47, 53,94, 111, 113, 129, 137

extract, 19, 28, 35, 36, 41, 42, 43, 50, 51, 56,80, 88, 96, 98, 99, 103, 109, 114,115, 127, 135, 138, 139

extract,data.frame-method (extract), 41extract,OPMS-method (extract), 41extract-methods (extract), 41extract_columns, 41, 42, 42, 50, 51, 80, 88,

103, 114, 115, 127, 135, 138, 139extract_columns,data.frame-method

(extract_columns), 42extract_columns,OPMS-method

(extract_columns), 42extract_columns-methods

(extract_columns), 42

fast_estimate, 33, 34, 44, 97fast_estimate,matrix-method

(fast_estimate), 44fast_estimate-methods (fast_estimate),

44file_pattern, 8, 11, 12, 21, 23, 39, 40, 46,

94, 111, 113, 128, 129, 137filename, 5–7, 26, 27, 30, 31, 38, 45, 54, 55,

58, 63, 77, 78, 81, 86, 105, 108, 119,123, 124, 126, 131, 134, 142, 144

filename,OPM-method (filename), 45filename,OPMS-method (filename), 45filename-methods (filename), 45find_positions, 47, 49, 66, 133, 145find_positions,character-method

(find_positions), 47find_positions,factor-method

(find_positions), 47find_positions,list-method

(find_positions), 47find_positions-methods

(find_positions), 47find_substrate, 47, 48, 66, 132, 133, 145find_substrate,character-method

(find_substrate), 48

Page 163: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

INDEX 163

find_substrate,factor-method(find_substrate), 48

find_substrate-methods(find_substrate), 48

flatten, 41–43, 49, 51, 63, 64, 80, 88, 103,114, 115, 127, 135, 138, 139, 148

flatten,OPM-method (flatten), 49flatten,OPMS-method (flatten), 49flatten-methods (flatten), 49

gen_iii, 9, 33, 42, 43, 50, 51, 80, 88, 103,111, 113–115, 127, 135, 138, 139

gen_iii,OPM-method (gen_iii), 51gen_iii,OPMS-method (gen_iii), 51gen_iii-methods (gen_iii), 51glob_to_regex, 25, 39, 49, 52, 62, 70, 74, 96,

122glob_to_regex,character-method

(glob_to_regex), 52glob_to_regex,factor-method

(glob_to_regex), 52glob_to_regex-methods (glob_to_regex),

52

has_aggr, 5–7, 26, 27, 30, 31, 33, 38, 46, 53,55, 58, 63, 77, 78, 81, 86, 105, 108,119, 123, 124, 131, 134, 142, 144

has_aggr,OPM-method (has_aggr), 53has_aggr,OPMS-method (has_aggr), 53has_aggr-methods (has_aggr), 53has_disc, 5–7, 26, 27, 30, 31, 36, 38, 46, 54,

54, 58, 63, 77, 78, 81, 86, 105, 108,119, 123, 124, 131, 134, 142, 144

has_disc,OPM-method (has_disc), 54has_disc,OPMS-method (has_disc), 54has_disc-methods (has_disc), 54heat_map, 20, 41, 55, 64, 90, 110, 120, 125,

148heat_map,data.frame-method (heat_map),

55heat_map,matrix-method (heat_map), 55heat_map,OPMS-method (heat_map), 55heat_map-methods (heat_map), 55hist.Ckmeans.1d.dp, 18, 116, 136hist.Ckmeans.1d.dp (borders), 14hist.kmeans, 18, 116, 136hist.kmeans (borders), 14hist.kmeanss, 18, 116, 136hist.kmeanss (borders), 14

hours, 4–7, 26, 27, 30, 31, 38, 46, 54, 55, 58,63, 77, 78, 81, 86, 105, 108, 119,123, 124, 131, 134, 142, 144

hours,OPM-method (hours), 58hours,OPMS-method (hours), 58hours-methods (hours), 58html_args, 59, 99, 100, 117

include_metadata, 9, 21, 61, 67, 83, 85, 96include_metadata,OPM-method

(include_metadata), 61include_metadata,OPMS-method

(include_metadata), 61include_metadata-methods

(include_metadata), 61infix.k, 130, 153infix.k (%k%), 152infix.k,character,OPMS-method (%k%), 152infix.k,character,WMD-method (%k%), 152infix.k,factor,OPMS-method (%k%), 152infix.k,factor,WMD-method (%k%), 152infix.k,list,OPMS-method (%k%), 152infix.k,list,WMD-method (%k%), 152infix.k-methods (%k%), 152infix.largek (%K%), 153infix.largek,character,OPMS-method

(%K%), 153infix.largek,character,WMD-method

(%K%), 153infix.largek,factor,OPMS-method (%K%),

153infix.largek,factor,WMD-method (%K%),

153infix.largek,list,OPMS-method (%K%), 153infix.largek,list,WMD-method (%K%), 153infix.largek-methods (%K%), 153infix.largeq, 130infix.largeq (%Q%), 155infix.largeq,character,OPMS-method

(%Q%), 155infix.largeq,character,WMD-method

(%Q%), 155infix.largeq,factor,OPMS-method (%Q%),

155infix.largeq,factor,WMD-method (%Q%),

155infix.largeq,list,OPMS-method (%Q%), 155infix.largeq,list,WMD-method (%Q%), 155infix.largeq-methods (%Q%), 155

Page 164: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

164 INDEX

infix.q, 130, 155infix.q (%q%), 156infix.q,character,OPMS-method (%q%), 156infix.q,character,WMD-method (%q%), 156infix.q,factor,OPMS-method (%q%), 156infix.q,factor,WMD-method (%q%), 156infix.q,list,OPMS-method (%q%), 156infix.q,list,WMD-method (%q%), 156infix.q-methods (%q%), 156

kubrick, 25, 53, 62, 70, 74, 96, 122

length, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58,62, 77, 78, 81, 86, 105, 108, 119,123, 124, 131, 134, 142, 144

length,OPMS-method (length), 62length-methods (length), 62level_plot, 20, 57, 63, 95, 110, 120, 125, 148level_plot,OPM-method (level_plot), 63level_plot,OPMS-method (level_plot), 63level_plot-methods (level_plot), 63listing, 47, 49, 65, 133, 145listing,OPMD-method (listing), 65listing,OPMS-method (listing), 65listing-methods (listing), 65

map_metadata, 61, 66, 70, 74, 83, 85map_metadata,OPMS,ANY-method

(map_metadata), 66map_metadata,WMD,character-method

(map_metadata), 66map_metadata,WMD,formula-method

(map_metadata), 66map_metadata,WMD,function-method

(map_metadata), 66map_metadata-methods (map_metadata), 66map_names, 25, 53, 62, 69, 74, 96, 122map_names,ANY,character-method

(map_names), 69map_names,ANY,function-method

(map_names), 69map_names,ANY,missing-method

(map_names), 69map_names,data.frame,character-method

(map_names), 69map_names,data.frame,function-method

(map_names), 69map_names,data.frame,missing-method

(map_names), 69

map_names,list,character-method(map_names), 69

map_names,list,function-method(map_names), 69

map_names,list,missing-method(map_names), 69

map_names,MOA,character-method(map_names), 69

map_names,MOA,function-method(map_names), 69

map_names,MOA,missing-method(map_names), 69

map_names-methods (map_names), 69map_values, 25, 53, 62, 67, 69, 70, 71, 82, 96,

122map_values,character,character-method

(map_values), 71map_values,character,function-method

(map_values), 71map_values,character,missing-method

(map_values), 71map_values,data.frame,character-method

(map_values), 71map_values,data.frame,function-method

(map_values), 71map_values,data.frame,missing-method

(map_values), 71map_values,factor,character-method

(map_values), 71map_values,factor,function-method

(map_values), 71map_values,factor,missing-method

(map_values), 71map_values,list,character-method

(map_values), 71map_values,list,formula-method

(map_values), 71map_values,list,function-method

(map_values), 71map_values,list,missing-method

(map_values), 71map_values,MOA,character-method

(map_values), 71map_values,MOA,function-method

(map_values), 71map_values,MOA,missing-method

(map_values), 71map_values,NULL,character-method

Page 165: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

INDEX 165

(map_values), 71map_values,NULL,function-method

(map_values), 71map_values,NULL,missing-method

(map_values), 71map_values-methods (map_values), 71max, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58, 63,

76, 78, 81, 86, 105, 108, 119, 123,124, 131, 134, 142, 144

max,OPM-method (max), 76max,OPMS-method (max), 76max-methods (max), 76measurements, 5–7, 26, 27, 30, 31, 38, 44, 46,

54, 55, 58, 63, 77, 77, 81, 86, 88,105, 108, 119, 123, 124, 131, 134,142, 144

measurements,OPM-method (measurements),77

measurements,OPMS-method(measurements), 77

measurements-methods (measurements), 77merge, 42, 43, 50, 51, 79, 88, 96, 103, 114,

115, 127, 135, 138, 139merge,CMAT,ANY-method (merge), 79merge,OPMS,missing-method (merge), 79merge,OPMS,numeric-method (merge), 79merge-methods (merge), 79metadata, 5–7, 26, 27, 30, 31, 38, 43, 46, 50,

54, 55, 58, 63, 65, 67, 77–79, 80, 86,105, 108, 119, 123, 124, 126, 127,131, 133, 134, 142, 144

metadata,OPMS-method (metadata), 80metadata,WMD-method (metadata), 80metadata-methods (metadata), 80metadata.set, 61, 67, 81, 85metadata.set,OPMS,ANY,ANY-method

(metadata.set), 81metadata.set,OPMS,ANY,data.frame-method

(metadata.set), 81metadata.set,OPMS,character,data.frame-method

(metadata.set), 81metadata.set,OPMS,factor,data.frame-method

(metadata.set), 81metadata.set,OPMS,missing,data.frame-method

(metadata.set), 81metadata.set,OPMS,missing,formula-method

(metadata.set), 81metadata.set,OPMS,missing,list-method

(metadata.set), 81metadata.set,WMD,character,ANY-method

(metadata.set), 81metadata.set,WMD,factor,ANY-method

(metadata.set), 81metadata.set,WMD,list,list-method

(metadata.set), 81metadata.set,WMD,missing,formula-method

(metadata.set), 81metadata.set,WMD,missing,list-method

(metadata.set), 81metadata.set,WMD,numeric,list-method

(metadata.set), 81metadata.set-methods (metadata.set), 81metadata<- (metadata.set), 81metadata<-,OPMS,ANY,ANY-method

(metadata.set), 81metadata<-,OPMS,ANY,data.frame-method

(metadata.set), 81metadata<-,OPMS,character,data.frame-method

(metadata.set), 81metadata<-,OPMS,factor,data.frame-method

(metadata.set), 81metadata<-,OPMS,missing,data.frame-method

(metadata.set), 81metadata<-,OPMS,missing,formula-method

(metadata.set), 81metadata<-,OPMS,missing,list-method

(metadata.set), 81metadata<-,WMD,character,ANY-method

(metadata.set), 81metadata<-,WMD,factor,ANY-method

(metadata.set), 81metadata<-,WMD,list,list-method

(metadata.set), 81metadata<-,WMD,missing,formula-method

(metadata.set), 81metadata<-,WMD,missing,list-method

(metadata.set), 81metadata<-,WMD,numeric,list-method

(metadata.set), 81metadata_chars, 61, 67, 83, 84metadata_chars,OPMS-method

(metadata_chars), 85metadata_chars,WMD-method

(metadata_chars), 85metadata_chars-methods

(metadata_chars), 85

Page 166: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

166 INDEX

minmax, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58,63, 77, 78, 81, 86, 105, 108, 119,123, 124, 131, 134, 142, 144, 147

minmax,OPM-method (minmax), 86minmax,OPMS-method (minmax), 86minmax-methods (minmax), 86MOA, 28, 70, 73, 87, 88, 90, 91, 93, 145, 149MOA-class (MOA), 87

oapply, 42, 43, 50, 51, 80, 87, 103, 114, 115,123, 127, 135, 138, 139

oapply,OPM-method (oapply), 87oapply,OPMS-method (oapply), 87oapply-methods (oapply), 87OPM, 6, 16, 21, 22, 24, 26, 27, 32, 33, 38, 45,

50, 51, 53, 54, 58, 61, 63, 76–79,86–88, 88, 89–93, 103–106, 108,111–115, 118, 123–127, 130, 133,134, 139, 142, 143, 145, 146, 149,150

OPM-class (OPM), 88opm.package, 89opm.package-package (opm.package), 89opm_files, 8, 11, 12, 21, 23, 40, 47, 89, 94,

100, 111, 113, 129, 137opm_opt, 10, 25, 53, 60, 62, 70, 74, 89, 95, 122opm_opt,character-method (opm_opt), 95opm_opt,list-method (opm_opt), 95opm_opt,missing-method (opm_opt), 95opm_opt-methods (opm_opt), 95OPMA, 4, 6, 32, 33, 35, 38, 87–89, 90, 91–93,

111, 112, 139, 140, 145, 149, 150OPMA-class (OPMA), 90OPMD, 30, 31, 36, 65, 87–91, 91, 93, 140, 145,

149OPMD-class (OPMD), 91OPMS, 6, 7, 16, 18, 19, 21, 22, 24, 26, 27, 30,

32, 33, 35, 36, 38, 41, 43, 50, 53, 54,62, 63, 65–67, 76–79, 81, 82, 85–91,91, 92, 93, 95, 103–107, 111–115,118, 123, 125–127, 129, 130, 133,139, 141, 145, 146, 148–150

opms, 17, 91, 92, 103, 107, 111OPMS-class (OPMS), 91OPMX, 16, 87, 88, 90, 91, 93, 145, 149OPMX-class (OPMX), 93

param_names, 4, 19, 34, 45, 97phylo_data, 27, 59, 60, 94–96, 97, 117

phylo_data,data.frame-method(phylo_data), 97

phylo_data,matrix-method (phylo_data),97

phylo_data,OPMS-method (phylo_data), 97phylo_data-methods (phylo_data), 97plate_type, 5–7, 26, 27, 30, 31, 33, 38, 46,

54, 55, 58, 63, 77, 78, 81, 86, 104,108, 111, 119, 123, 124, 131, 134,142, 144, 147

plate_type,character-method(plate_type), 104

plate_type,factor-method (plate_type),104

plate_type,OPM-method (plate_type), 104plate_type,OPMS-method (plate_type), 104plate_type-methods (plate_type), 104plates, 42, 43, 50, 51, 80, 88, 103, 114, 115,

127, 135, 138, 139plates,list-method (plates), 103plates,OPM-method (plates), 103plates,OPMS-method (plates), 103plates-methods (plates), 103plot.kmeanss, 16, 116, 136plot.kmeanss (calinski), 17plus, 17, 92, 106plus,OPM,list-method (plus), 106plus,OPM,OPM-method (plus), 106plus,OPM,OPMS-method (plus), 106plus,OPMS,list-method (plus), 106plus,OPMS,OPM-method (plus), 106plus,OPMS,OPMS-method (plus), 106plus-methods (plus), 106position, 5–7, 26, 27, 30, 31, 38, 46, 54, 55,

58, 63, 77, 78, 81, 86, 105, 107, 119,123, 124, 126, 131, 134, 142, 144

position,OPM-method (position), 107position,OPMS-method (position), 107position-methods (position), 107print, 125

radial_plot, 20, 57, 64, 108, 120, 125, 148radial_plot,data.frame-method

(radial_plot), 108radial_plot,matrix-method

(radial_plot), 108radial_plot,OPMS-method (radial_plot),

108radial_plot-methods (radial_plot), 108

Page 167: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

INDEX 167

read_opm, 8, 9, 11, 12, 21–23, 25, 40, 47,88–92, 94, 96, 110, 111, 113, 129,137

read_single_opm, 8, 10–12, 21, 23, 25, 40,47, 51, 88–91, 94, 111, 112, 129, 137

rep, 42, 43, 50, 51, 80, 88, 103, 113, 115, 127,135, 138, 139

rep,OPM-method (rep), 113rep,OPMS-method (rep), 113rep-methods (rep), 113rev, 42, 43, 50, 51, 80, 88, 103, 114, 115, 127,

135, 138, 139rev,OPM-method (rev), 115rev,OPMS-method (rev), 115rev-methods (rev), 115run_kmeans, 16, 18, 28, 116, 136run_kmeans,matrix,numeric-method

(run_kmeans), 116run_kmeans,numeric,numeric-method

(run_kmeans), 116run_kmeans-methods (run_kmeans), 116

safe_labels, 60, 98, 100, 117select, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58,

63, 77, 78, 81, 86, 105, 108, 118,123, 124, 131, 134, 142, 144

select,data.frame-method (select), 118select,OPMS-method (select), 118select-methods (select), 118select_colors, 20, 57, 64, 110, 120, 125,

146, 148separate, 25, 53, 62, 70, 74, 96, 121separate,character-method (separate),

121separate,data.frame-method (separate),

121separate,factor-method (separate), 121separate-methods (separate), 121seq, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58, 63,

77, 78, 81, 86, 105, 108, 119, 123,124, 131, 134, 142, 144

seq,OPM-method (seq), 123seq,OPMS-method (seq), 123seq-methods (seq), 123setup_time, 5–7, 26, 27, 30, 31, 38, 46, 54,

55, 58, 63, 77, 78, 81, 86, 96, 105,108, 119, 123, 124, 126, 131, 134,142, 144

setup_time,OPM-method (setup_time), 124

setup_time,OPMS-method (setup_time), 124setup_time-methods (setup_time), 124show, 20, 57, 64, 110, 120, 125, 148show,CMAT-method (show), 125show,OPMX-method (show), 125show-methods (show), 125sort, 42, 43, 50, 51, 80, 88, 103, 114, 115,

126, 135, 138, 139sort,OPM,logical-method (sort), 126sort,OPMS,logical-method (sort), 126sort,OPMX,missing-method (sort), 126sort-methods (sort), 126split_files, 8, 11, 12, 21, 23, 40, 47, 94,

111, 113, 128, 137subset, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58,

63, 77, 78, 81, 86, 105, 108, 118,119, 123, 124, 129, 134, 142, 144

subset,OPMS-method (subset), 129subset-methods (subset), 129substrate_info, 47, 49, 66, 131, 143, 145substrate_info,character-method

(substrate_info), 131substrate_info,factor-method

(substrate_info), 131substrate_info,list-method

(substrate_info), 131substrate_info-methods

(substrate_info), 131summary, 5–7, 26, 27, 30, 31, 38, 46, 54, 55,

58, 63, 77, 78, 81, 86, 105, 108, 119,123–125, 131, 133, 142, 144

summary,OPM-method (summary), 133summary,OPMS-method (summary), 133summary-methods (summary), 133

thin_out, 42, 43, 50, 51, 80, 88, 103, 114,115, 127, 134, 138, 139

thin_out,OPM-method (thin_out), 134thin_out,OPMS-method (thin_out), 134thin_out-methods (thin_out), 134to_kmeans, 16, 18, 116, 135to_metadata, 8, 11, 12, 21–23, 40, 47, 61, 94,

111, 113, 129, 136to_metadata,ANY-method (to_metadata),

136to_metadata,character-method

(to_metadata), 136to_metadata-methods (to_metadata), 136

Page 168: Package ‘opm’ · Package ‘opm’ February 15, 2013 Version 0.8-0 Date 2013-01-23 Title Tools for analysing OmniLog(R) Phenotype Microarray data Author Markus Goeker, with contributions

168 INDEX

to_yaml, 10, 42, 43, 50, 51, 80, 88, 89, 103,114, 115, 127, 135, 137, 139

to_yaml,YAML_VIA_LIST-method (to_yaml),137

to_yaml-methods (to_yaml), 137

unique, 42, 43, 50, 51, 80, 88, 103, 114, 115,127, 135, 138, 139

unique,OPM,ANY-method (unique), 139unique,OPMS,ANY-method (unique), 139unique,OPMS,missing-method (unique), 139unique-methods (unique), 139

vaas_1, 140vaas_4, 140, 141

well, 5–7, 26, 27, 30, 31, 38, 46, 54, 55, 58,63, 77, 78, 81, 86, 105, 108, 119,123, 124, 131, 134, 142, 144

well,OPM-method (well), 142well,OPMS-method (well), 142well-methods (well), 142well_to_substrate, 47, 49, 66, 133, 144wells, 5–7, 26, 27, 30, 31, 38, 41, 46, 50, 54,

55, 58, 63, 65, 77, 78, 81, 86, 105,108, 119, 123, 124, 131, 134, 142,143, 147, 148

wells,OPM-method (wells), 143wells,OPMS-method (wells), 143wells-methods (wells), 143WMD, 67, 80, 82, 85, 87–91, 93, 145, 149, 152,

154, 155, 157WMD-class (WMD), 145

xy_plot, 20, 57, 63, 64, 95, 110, 120, 125, 146xy_plot,data.frame-method (xy_plot), 146xy_plot,OPM-method (xy_plot), 146xy_plot,OPMS-method (xy_plot), 146xy_plot-methods (xy_plot), 146

YAML_VIA_LIST, 87, 88, 90, 91, 93, 138, 145,149

YAML_VIA_LIST-class (YAML_VIA_LIST), 149