| BatchContainer | R Documentation |
Describes container dimensions and samples to container location assignment.
A typical workflow starts with creating a BatchContainer. Then
samples can be assigned to locations in that container.
traceOptimization trace, a tibble::tibble()
scoring_fScoring functions used for optimization. Each scoring function should receive a BatchContainer. This function should return a floating point score value for the assignment. This a list of functions. Upon assignment a single function will be automatically converted to a list In the later case each function is called.
has_samplesReturns TRUE if BatchContainer has samples.
has_samples_attrReturns TRUE if BatchContainer has sample atrributes assigned.
n_locationsReturns number of locations in a BatchContainer.
n_dimensionsReturns number of dimensions in a BatchContainer.
This field cannot be assigned.
dimension_namescharacter vector with dimension names. This field cannot be assigned.
samplesSamples in the batch container. When assigning data.frame should not have column named .sample_id column.
samples_attrExtra attributes of samples. If set, this is included into
BatchContainer$get_samples() output.
assignmentSample assignment vector. Should contain NAs for empty locations.
Assigning this field is deprecated, please use $move_samples() instead.
new()Create a new BatchContainer object.
BatchContainer$new(locations_table, dimensions, exclude = NULL)
locations_tableA table with available locations.
dimensionsA vector or list of dimensions. Every dimension
should have a name. Could be an integer vector of dimensions or
a named list. Every value of a list could be either dimension size
or parameters for
BatchContainerDimension$new().
Can be used as an alternative to passing locations_table.
excludedata.frame with excluded locations of a container. Only used together with dimensions.
bc <- BatchContainer$new(
dimensions = list(
"plate" = 3,
"row" = list(values = letters[1:3]),
"column" = list(values = c(1, 3))
),
exclude = data.frame(plate = 1, row = "a", column = c(1, 3), stringsAsFactors = FALSE)
)
bc
get_samples()Return table with samples and sample assignment.
BatchContainer$get_samples( assignment = TRUE, include_id = FALSE, remove_empty_locations = FALSE, as_tibble = TRUE )
assignmentReturn sample assignment. If FALSE, only samples table is returned, with out batch assignment.
include_idKeep .sample_id in the table. Use TRUE for
lower overhead.
remove_empty_locationsRemoves empty locations from the result tibble.
as_tibbleReturn tibble.
If FALSE returns data.table. This should have
lower overhead, as internally there is a cached data.table.
table with samples and sample assignment.
get_locations()Get a table with all the locations in a BatchContainer.
BatchContainer$get_locations()
A tibble with all the available locations.
move_samples()Move samples between locations
This method can receive either src and dst or locations_assignment.
BatchContainer$move_samples(src, dst, location_assignment)
srcinteger vector of source locations
dstinteger vector of destination locations (the same length as src).
location_assignmentinteger vector with location assignment.
The length of the vector should match the number of locations,
NA should be used for empty locations.
BatchContainer, invisibly
score()Score current sample assignment,
BatchContainer$score(scoring)
scoringa function or a names list of scoring functions. Each function should return a numeric vector.
Returns a named vector of all scoring functions values.
copy()Create an independent copy (clone) of a BatchContainer
BatchContainer$copy()
Returns a new BatchContainer
print()Prints information about BatchContainer.
BatchContainer$print(...)
...not used.
scores_table()Return a table with scores from an optimization.
BatchContainer$scores_table(index = NULL, include_aggregated = FALSE)
indexoptimization index, all by default
include_aggregatedinclude aggregated scores
a tibble::tibble() with scores
plot_trace()Plot trace
BatchContainer$plot_trace(index = NULL, include_aggregated = FALSE, ...)
indexoptimization index, all by default
include_aggregatedinclude aggregated scores
...not used.
a ggplot2::ggplot() object
List of scoring functions.
Tibble with batch container locations.
Tibble with sample information and sample ids.
Sample attributes, a data.table.
Vector with assignment of sample ids to locations.
Cached data.table with samples assignment.
Validate sample assignment.
## ------------------------------------------------
## Method `BatchContainer$new`
## ------------------------------------------------
bc <- BatchContainer$new(
dimensions = list(
"plate" = 3,
"row" = list(values = letters[1:3]),
"column" = list(values = c(1, 3))
),
exclude = data.frame(plate = 1, row = "a", column = c(1, 3), stringsAsFactors = FALSE)
)
bc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.