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)
)
bcget_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.
get_locations()Get a table with all the locations in a BatchContainer.
A tibble with all the available locations.
move_samples()Move samples between locations
This method can receive either src and dst or locations_assignment.
score()Score current sample assignment,
print()Prints information about BatchContainer.
scores_table()Return a table with scores from an optimization.
a tibble::tibble() with scores
plot_trace()Plot trace
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
#> Batch container with 16 locations.
#> Dimensions: plate, row, column