This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Pretty display of values for samples arranged in a 384-well plate (in R).

There are many experiments where samples are stored in 384-well plates (or 96-well plates etc.) and a measurement is made on each sample. Typical technical biases may affect spatial regions of the plate, for instance the borders (evaporation, ...), or large bands when the thermocycling (in PCR) is preformed by separate independent controllers, etc. In some more complicated experiments, each well may contain a NGS library, for which multiple quality control scores can be computed.

I searched for R functions for pretty printing of values arranged in the geometry of a multiwell plate and I was surprised that I did not find anything obvious. Perhaps because the solution is too trivial ? Still, I would be happy to use a well-thought packaged function instead of a quick-and-dirty ad-hoc home-made wheel reinvention.

Here is an example below. The problems with this script are that 1) it requires flipping some levels that should stay as they are otherwise and 2) SVG or PDF version had a very ugly appearance as each square was strongly smoothed...

My question is whether there are good packaged tools (in R) to do such plots and more operations on representations of multiwell plates.

plate <- data.frame( Row = rep(LETTERS[1:16], 24)
                   , Col = unlist(lapply(1:24, rep, 16)))

plate$Row <-  factor(plate$Row, levels=rev(levels(plate$Row)))

set.seed(1)
plate[001:096, "val"] <- rpois(96,10)
plate[097:384, "val"] <- rpois(96, 6)

png("plate.png", h=400,w=600)
  ggplot2::ggplot(plate, ggplot2::aes(Col, Row, fill=val)) + ggplot2::geom_raster()
dev.off()

384-well plate with random values

qpcr 384-well plate 96-well plate plot r

3 answers

HTqPCR has a function named plotCtArray and another named plotCtCard. They are not so stylish, but you can avoid having to create a new function.

To complete this answer, a script could be

# plate needs to be sorted as follows: A1, A2, ..., P23, P24
plate$position <- paste0(plate$Row, plate$Col)
plate$position <- sub("^(.)(.)$", "\\10\\2", plate$position, perl=T)
plate <- plate[order(plate$position),]

library(HTqPCR)
mat <- matrix(plate$val, nrow = nrow(plate))
raw <- new("qPCRset", exprs = mat, featureCategory = as.data.frame(array("OK", nrow(plate))))
sampleNames(raw) <- "sampleName"
featureNames(raw) <- paste0("feature", 1:nrow(plate))

png("plate.png", h=400,w=600)
HTqPCR::plotCtCard(raw, col.range = c(0, 16), well.size = 2.6)
dev.off()

plate.png

I made an R package for plotting platemaps with a few utility functions. Mainly just a wrapper round some ggplot2 code, with a few functions for converting between formats (matrix <-> Well_ID+value).

https://github.com/swarchal/platetools

Thanks, I started to use it ! Here the same data as above, but plotted with platetools.

384-well plate with random values, plotted with platetools

Thanks ,very useful. https://ballyabio.com/what-is-a-96-well-plates/

Log in to answer this question.