Added support for heat maps of achieved growth on linear scale. Still having trouble with the input form in Rails.
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ Description: Imports high-throughput growth curve data from microtiter
|
||||
GCAT estimates important growth characteristics
|
||||
(specific growth rate, maximum growth capacity, and lag time)
|
||||
for each well in a read.
|
||||
Version: 6.0.1
|
||||
Version: 6.0.2
|
||||
Depends: pheatmap, gplots, methods
|
||||
Maintainer: Yury Bukhman <ybukhman@glbrc.wisc.edu>
|
||||
License: LGPL-3
|
||||
|
||||
@@ -107,7 +107,8 @@ global.version.number = packageDescription(pkg="GCAT")$Version
|
||||
#' @param overview.jpgs Should GCAT enable an overview image?
|
||||
#' @param return.fit Whether should a fit well object is returned or not.
|
||||
#' @param lagRange The heatmap specific range for lag time.
|
||||
#' @param totalRange The heatmap specific range for the achieved growth.
|
||||
#' @param totalRange The heatmap specific range for the achieved growth on log scale.
|
||||
#' @param totalODRange The heatmap specific range for the achieved growth on linear (OD) scale.
|
||||
#' @param specRange The heatmap specific range for spec growth rate.
|
||||
#'
|
||||
#' @return Depending on return.fit setting, an array of fitted well objects or a list of output files
|
||||
@@ -117,7 +118,7 @@ gcat.analysis.main = function(file.list, single.plate, layout.file = NULL,
|
||||
out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""),
|
||||
add.constant = 0, blank.value, start.index, growth.cutoff = 0.05,
|
||||
use.linear.param = F, use.loess = F, smooth.param=0.1,
|
||||
lagRange = NA, totalRange = NA, specRange = NA,
|
||||
lagRange = NA, totalRange = NA, totalODRange = NA, specRange = NA,
|
||||
points.to.remove = 0, remove.jumps = F, time.input = NA,
|
||||
plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0,
|
||||
multi.column.headers = c("Plate.ID", "Well", "OD", "Time"), single.column.headers = c("","A1"),
|
||||
@@ -184,7 +185,7 @@ gcat.analysis.main = function(file.list, single.plate, layout.file = NULL,
|
||||
source.file.list = source.file.list, upload.timestamp = upload.timestamp,
|
||||
growth.cutoff = growth.cutoff, add.constant = add.constant, blank.value = blank.value, start.index = start.index,
|
||||
points.to.remove = points.to.remove, remove.jumps = remove.jumps,
|
||||
lagRange = lagRange, specRange = specRange, totalRange = totalRange,
|
||||
lagRange = lagRange, specRange = specRange, totalRange = totalRange, totalODRange = totalODRange,
|
||||
out.dir = out.dir, graphic.dir = graphic.dir, overview.jpgs=overview.jpgs,
|
||||
use.linear.param=use.linear.param, use.loess=use.loess, plate.ncol = plate.ncol, plate.nrow = plate.nrow,
|
||||
silent = silent, main.envir = main.envir), silent = T)
|
||||
@@ -480,6 +481,7 @@ gcat.fit.main = function(file.name, input.data = NULL, load.type = "csv", layout
|
||||
#' @param plate.ncol The number of columns for a plate
|
||||
#' @param lagRange The heatmap specific range for lag time.
|
||||
#' @param totalRange The heatmap specific range for the achieved growth.
|
||||
#' @param totalODRange The heatmap specific range for the achieved growth on linear (OD) scale.
|
||||
#' @param specRange The heatmap specific range for spec growth rate.
|
||||
#' @param main.envir starting environment of gcat.analysis.main(), captured as a list, printed out for debugging
|
||||
#'
|
||||
@@ -487,7 +489,7 @@ gcat.fit.main = function(file.name, input.data = NULL, load.type = "csv", layout
|
||||
gcat.output.main = function(fitted.well.array, out.prefix = "", source.file.list, upload.timestamp = NULL,
|
||||
add.constant, blank.value, start.index, growth.cutoff, points.to.remove, remove.jumps,
|
||||
out.dir = getwd(), graphic.dir = paste(out.dir,"/pics",sep = ""), overview.jpgs = T,
|
||||
use.linear.param=F, use.loess=F, lagRange = NA, totalRange = NA, specRange = NA,
|
||||
use.linear.param=F, use.loess=F, lagRange = NA, totalRange = NA, totalODRange = NA, specRange = NA,
|
||||
plate.nrow = 8, plate.ncol = 12, unlog = F, silent = T, main.envir){
|
||||
|
||||
# Prepare timestamp for addition to output file names.
|
||||
@@ -558,7 +560,7 @@ gcat.output.main = function(fitted.well.array, out.prefix = "", source.file.list
|
||||
|
||||
graphic.files = try(pdf.by.plate(fitted.well.array, out.prefix=out.prefix, upload.timestamp = upload.timestamp,
|
||||
unlog=unlog,constant.added=add.constant,overview.jpgs=overview.jpgs, lagRange = lagRange, specRange = specRange, totalRange = totalRange,
|
||||
plate.ncol = plate.ncol, plate.nrow = plate.nrow),silent=silent)
|
||||
totalODRange = totalODRange, plate.ncol = plate.ncol, plate.nrow = plate.nrow),silent=silent)
|
||||
|
||||
if (class(graphic.files) == "try-error")
|
||||
stop("Error in <pdf.by.plate>: ", graphic.files)
|
||||
|
||||
+17
-12
@@ -298,12 +298,13 @@ plot_residuals = function(input.well, xlim = NULL, lowess = T, ...){
|
||||
#'
|
||||
#' @param fitted.well.array matrix containing well array object data
|
||||
#' @param attribute the data type we should use to create a heatmap
|
||||
#' @param unlog transform values to linear scale
|
||||
#' @param MinMax The specific range for the heatmap.
|
||||
#' @param constant.added the numeric constant that was added to each curve before the log transform:
|
||||
#' same as \code{add.constant} in \link{gcat.analysis.main}
|
||||
#'
|
||||
#' @return path of heatmap pdf file
|
||||
#'
|
||||
create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL){
|
||||
create.heatmap = function(fitted.well.array, attribute, MinMax = NA, constant.added){
|
||||
# debug
|
||||
#browser()
|
||||
|
||||
@@ -312,13 +313,14 @@ create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL)
|
||||
if(class(fitted.well.array) == "matrix"){
|
||||
#We may want to sub() out periods from plate.ID if it causes problems
|
||||
plate.ID = unique(unlist(aapply(fitted.well.array,plate.name)))[1]
|
||||
if(is.null(unlog)) {
|
||||
spec.growth = unlist(aapply(fitted.well.array, attribute))
|
||||
}
|
||||
# currently only total growth needs to be unlogged if unlog == T
|
||||
else {
|
||||
if (attr.name == "achieved.growth.OD") {
|
||||
# Need to pass constant.added to the attribute computation function
|
||||
spec.growth = unlist(aapply(fitted.well.array, attribute, constant.added = constant.added))
|
||||
} else {
|
||||
# The attribute computation function does not have a constant.added argument
|
||||
spec.growth = unlist(aapply(fitted.well.array, attribute))
|
||||
}
|
||||
|
||||
num.dig = 3 #how many digits should be put on pdf?
|
||||
max = round(max(spec.growth, na.rm=T), digits=num.dig)
|
||||
min = round(min(spec.growth, na.rm=T), digits=num.dig)
|
||||
@@ -614,7 +616,7 @@ well.fit.legend = function(xlim, ylim, scale = 1, constant.added){
|
||||
# Generate pdf files
|
||||
pdf.by.plate = function(fitted.data, out.prefix = "", upload.timestamp = NULL,
|
||||
out.dir = getwd(), unlog = F, constant.added, silent = T, overview.jpgs = T, plate.ncol = 12, plate.nrow = 8,
|
||||
lagRange = NA, specRange = NA, totalRange = NA, ...){
|
||||
lagRange = NA, specRange = NA, totalRange = NA, totalODRange = NA, ...){
|
||||
|
||||
# Prepare timestamp for addition to output file names.
|
||||
filename.timestamp = strftime(upload.timestamp, format="_%Y-%m-%d_%H.%M.%S")
|
||||
@@ -645,17 +647,20 @@ pdf.by.plate = function(fitted.data, out.prefix = "", upload.timestamp = NULL,
|
||||
if(num.wells > 1){
|
||||
#Heatmap block##########################################################
|
||||
#alongside the jpgs file create 3 heatmaps for each plate. NWD
|
||||
spec.heat.file = create.heatmap(fitted.data[,,i], max.spec.growth.rate, MinMax = specRange)
|
||||
spec.heat.file = create.heatmap(fitted.data[,,i], max.spec.growth.rate, MinMax = specRange, constant.added)
|
||||
if(spec.heat.file == "Error")
|
||||
stop("Error in <create.heatmap> for specific growth")
|
||||
lag.heat.file = create.heatmap(fitted.data[,,i], lag.time, MinMax = lagRange)
|
||||
lag.heat.file = create.heatmap(fitted.data[,,i], lag.time, MinMax = lagRange, constant.added)
|
||||
if(lag.heat.file == "Error")
|
||||
stop("Error in <create.heatmap> for lag time")
|
||||
total.heat.file = create.heatmap(fitted.data[,,i], achieved.growth, MinMax = totalRange)
|
||||
total.heat.file = create.heatmap(fitted.data[,,i], achieved.growth, MinMax = totalRange, constant.added)
|
||||
if(total.heat.file == "Error")
|
||||
stop("Error in <create.heatmap> for total growth")
|
||||
total.OD.heat.file = create.heatmap(fitted.data[,,i], achieved.growth.OD, MinMax = totalODRange, constant.added)
|
||||
if(total.OD.heat.file == "Error")
|
||||
stop("Error in <create.heatmap> for total growth")
|
||||
# Add name of file if successfully written to file list output. Including heatmap files NWD
|
||||
file.list.out = c(file.list.out, spec.heat.file, lag.heat.file, total.heat.file)
|
||||
file.list.out = c(file.list.out, spec.heat.file, lag.heat.file, total.heat.file, total.OD.heat.file)
|
||||
########################################################################
|
||||
}
|
||||
jpg.name = paste(out.dir, "/", plate.ID, "_overview", ".jpg", sep="")
|
||||
|
||||
+16
-4
@@ -3,18 +3,30 @@
|
||||
# This script generates heat maps with pre-set limits. Manually check output directory to see if they make sense.
|
||||
|
||||
INPUT.DIR = system.file("extdata/YPDAFEXglucoseTests_2-25-10",package="GCAT")
|
||||
OUTPUT.DIR = paste(system.file("extdata/heatmap_tests",package="GCAT"),"temp",sep="/")
|
||||
OUTPUT.DIR.1 = paste(system.file("extdata/heatmap_tests",package="GCAT"),"temp1",sep="/")
|
||||
OUTPUT.DIR.2 = paste(system.file("extdata/heatmap_tests",package="GCAT"),"temp2",sep="/")
|
||||
INPUT.FILE = "YPDAFEXglucoseTests_2-25-10.csv"
|
||||
|
||||
# Run GCAT
|
||||
library(GCAT)
|
||||
setwd(INPUT.DIR)
|
||||
time.input=1/3600
|
||||
out = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||
out.dir = OUTPUT.DIR, graphic.dir = OUTPUT.DIR,
|
||||
# - do not specify parameter ranges
|
||||
out1 = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||
out.dir = OUTPUT.DIR.1, graphic.dir = OUTPUT.DIR.1,
|
||||
add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
|
||||
use.linear.param=F, use.loess=F, smooth.param=0.1,
|
||||
points.to.remove = integer(), remove.jumps = F, time.input=time.input,
|
||||
silent = F, verbose = T, return.fit = T, overview.jpgs = T)
|
||||
|
||||
# - do specify parameter ranges
|
||||
out2 = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||
out.dir = OUTPUT.DIR.2, graphic.dir = OUTPUT.DIR.2,
|
||||
add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
|
||||
use.linear.param=F, use.loess=F, smooth.param=0.1,
|
||||
points.to.remove = integer(), remove.jumps = F, time.input=time.input,
|
||||
silent = F, verbose = T, return.fit = T, overview.jpgs = T,
|
||||
lagRange = c(0,3), totalRange = c(0.2,0.82), specRange = c(0.04,0.13))
|
||||
lagRange = c(0,3), totalRange = c(0.2,0.82), totalODRange = c(0.06,1), specRange = c(0.04,0.13))
|
||||
|
||||
# Verify that specifying parameter ranges did not affect any computations except for how the heat maps are drawn
|
||||
all.equal(out1,out2)
|
||||
@@ -4,7 +4,7 @@
|
||||
\alias{create.heatmap}
|
||||
\title{Create a heat map of a plate}
|
||||
\usage{
|
||||
create.heatmap(fitted.well.array, attribute, MinMax = NA, unlog = NULL)
|
||||
create.heatmap(fitted.well.array, attribute, MinMax = NA, constant.added)
|
||||
}
|
||||
\arguments{
|
||||
\item{fitted.well.array}{matrix containing well array object data}
|
||||
@@ -13,7 +13,8 @@ create.heatmap(fitted.well.array, attribute, MinMax = NA, unlog = NULL)
|
||||
|
||||
\item{MinMax}{The specific range for the heatmap.}
|
||||
|
||||
\item{unlog}{transform values to linear scale}
|
||||
\item{constant.added}{the numeric constant that was added to each curve before the log transform:
|
||||
same as \code{add.constant} in \link{gcat.analysis.main}}
|
||||
}
|
||||
\value{
|
||||
path of heatmap pdf file
|
||||
|
||||
@@ -8,12 +8,13 @@ gcat.analysis.main(file.list, single.plate, layout.file = NULL,
|
||||
out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""),
|
||||
add.constant = 0, blank.value, start.index, growth.cutoff = 0.05,
|
||||
use.linear.param = F, use.loess = F, smooth.param = 0.1,
|
||||
lagRange = NA, totalRange = NA, specRange = NA, points.to.remove = 0,
|
||||
remove.jumps = F, time.input = NA, plate.nrow = 8, plate.ncol = 12,
|
||||
input.skip.lines = 0, multi.column.headers = c("Plate.ID", "Well", "OD",
|
||||
"Time"), single.column.headers = c("", "A1"),
|
||||
layout.sheet.headers = c("Strain", "Media Definition"), silent = T,
|
||||
verbose = F, return.fit = F, overview.jpgs = T)
|
||||
lagRange = NA, totalRange = NA, totalODRange = NA, specRange = NA,
|
||||
points.to.remove = 0, remove.jumps = F, time.input = NA,
|
||||
plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0,
|
||||
multi.column.headers = c("Plate.ID", "Well", "OD", "Time"),
|
||||
single.column.headers = c("", "A1"), layout.sheet.headers = c("Strain",
|
||||
"Media Definition"), silent = T, verbose = F, return.fit = F,
|
||||
overview.jpgs = T)
|
||||
}
|
||||
\arguments{
|
||||
\item{file.list}{A list of full paths to .csv files. all files must be in the same format (see <single.plate>)}
|
||||
@@ -42,7 +43,9 @@ gcat.analysis.main(file.list, single.plate, layout.file = NULL,
|
||||
|
||||
\item{lagRange}{The heatmap specific range for lag time.}
|
||||
|
||||
\item{totalRange}{The heatmap specific range for the achieved growth.}
|
||||
\item{totalRange}{The heatmap specific range for the achieved growth on log scale.}
|
||||
|
||||
\item{totalODRange}{The heatmap specific range for the achieved growth on linear (OD) scale.}
|
||||
|
||||
\item{specRange}{The heatmap specific range for spec growth rate.}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ gcat.output.main(fitted.well.array, out.prefix = "", source.file.list,
|
||||
growth.cutoff, points.to.remove, remove.jumps, out.dir = getwd(),
|
||||
graphic.dir = paste(out.dir, "/pics", sep = ""), overview.jpgs = T,
|
||||
use.linear.param = F, use.loess = F, lagRange = NA, totalRange = NA,
|
||||
specRange = NA, plate.nrow = 8, plate.ncol = 12, unlog = F,
|
||||
silent = T, main.envir)
|
||||
totalODRange = NA, specRange = NA, plate.nrow = 8, plate.ncol = 12,
|
||||
unlog = F, silent = T, main.envir)
|
||||
}
|
||||
\arguments{
|
||||
\item{fitted.well.array}{A list of fitted well objects.}
|
||||
@@ -50,6 +50,8 @@ This is for backwards compatibility with the old web server.}
|
||||
|
||||
\item{totalRange}{The heatmap specific range for the achieved growth.}
|
||||
|
||||
\item{totalODRange}{The heatmap specific range for the achieved growth on linear (OD) scale.}
|
||||
|
||||
\item{specRange}{The heatmap specific range for spec growth rate.}
|
||||
|
||||
\item{plate.nrow}{The number of rows for a plate.}
|
||||
|
||||
Reference in New Issue
Block a user