Skip to content

Instantly share code, notes, and snippets.

@shamansim
Last active April 13, 2016 07:24
Show Gist options
  • Save shamansim/041302ba9cfcb3e93855fe8ec101446e to your computer and use it in GitHub Desktop.
Save shamansim/041302ba9cfcb3e93855fe8ec101446e to your computer and use it in GitHub Desktop.
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)
# 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment