Plot plate layouts

plot_plate(
  .tbl,
  plate = plate,
  row = row,
  column = column,
  .color,
  .alpha = NULL,
  .pattern = NULL,
  title = paste("Layout by", rlang::as_name(rlang::enquo(plate))),
  add_excluded = FALSE,
  rename_empty = FALSE
)

Arguments

.tbl

a tibble (or data.frame) with the samples assigned to locations. Alternatively a BatchContainter with samples can be supplied here.

plate

optional dimension variable used for the plate ids

row

the dimension variable used for the row ids

column

the dimension variable used for the column ids

.color

the continuous or discrete variable to color by

.alpha

a continuous variable encoding transparency

.pattern

a discrete variable encoding tile pattern (needs ggpattern)

title

string for the plot title

add_excluded

flag to add excluded wells (in bc$exclude) to the plot. A BatchContainer must be provided for this.

rename_empty

whether NA entries in sample table should be renamed to 'empty`.

Value

the ggplot object

Author

siebourj

Examples

nPlate <- 3
nColumn <- 4
nRow <- 6

treatments <- c("CTRL", "TRT1", "TRT2")
timepoints <- c(1, 2, 3)


bc <- BatchContainer$new(
  dimensions = list(
    plate = nPlate,
    column = list(values = letters[1:nColumn]),
    row = nRow
  )
)

sample_sheet <- tibble::tibble(
  sampleID = 1:(nPlate * nColumn * nRow),
  Treatment = rep(treatments, each = floor(nPlate * nColumn * nRow) / length(treatments)),
  Timepoint = rep(timepoints, floor(nPlate * nColumn * nRow) / length(treatments))
)

# assign samples from the sample sheet
bc <- assign_random(bc, samples = sample_sheet)

plot_plate(bc$get_samples(),
  plate = plate, column = column, row = row,
  .color = Treatment, .alpha = Timepoint
)


# \donttest{
plot_plate(bc$get_samples(),
  plate = plate, column = column, row = row,
  .color = Treatment, .pattern = Timepoint
)

# }