View source: R/MainFunctions.R
randomizeSinglePlate | R Documentation |
Randomize up to 96 samples across a single 96 well plate.
randomizeSinglePlate(designTable, outputFile = NULL, primaryGroup = "SampleGroup", batchColumns = NULL, nIter = 10000, nCores = 4)
designTable |
The meta data table - a data.frame/tibble. |
outputFile |
The root name for the output files if required. |
primaryGroup |
The name of a column in the metadata table to use for optimising the distribution of samples across the plate |
batchColumns |
A character vector wit the names of additional columns in the metadata table to use in assessing the distribution of the samples across the plate. |
nIter |
The number of random layouts to generate and assess. |
nCores |
The number of cores to use. Set to 1 to run serial. |
The metadata (designTable
) should be a data.frame/tibble. The
column names can be anything. By default the function expects one column
named SampleGroup
that it will use to distribute the samples across
the plate. This can be set to any other column using the primaryGroup
argument.
The columns specified in batchColumns
are used in addition
to primaryGroup
to assess which of the nIter
layouts is
optimal in terms of the distribution of samples. This is assessed based on
the sum of Euclidean distances between replicate samples within each column.
If no outputFile
is provided, a tibble containing the original
metadata and the well assignments for each sample. If an outputFile
is
provided, nothing - the function writes out the plate layout to a tsv file
and a plot for each of 'primaryGroup' and 'batchColumns' to png files.
library(readr) designSheet <- system.file("extdata", "metadata_12x3.tsv", package = "PlateLayout") bColumns <- c("ExtractionInformation", "PassageNumber") designTable <- read_tsv(designSheet) # Create an R object in the session plateLayout <- randomizeSinglePlate(designTable, batchColumns = bColumns, nIter = 100) # Or directly output a table and plots outputFile <- "Test" randomizeSinglePlate(designTable, outputFile = outputFile, batchColumns = bColumns, nIter = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.