Updated master to SVN trunk revision 572

pull/3/head
Yury V Bukhman 9 years ago
parent 67544a10e6
commit 2d658405a1

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,159 +0,0 @@
library(GCAT)
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4_old/trunk/R/GCAT/R/addingParams.R')
library(GCAT)
source('~/Documents/GCAT4_old/trunk/R/GCAT/R/addingParams.R')
t
warnings()
library(GCAT)
source('~/Documents/GCAT4_old/trunk/R/GCAT/R/addingParams.R')
warnings()
library(GCAT)
source('~/Documents/GCAT4_old/trunk/R/GCAT/R/addingParams.R')
warnings()
library(GCAT)
source('~/Documents/GCAT4_old/trunk/R/GCAT/R/addingParams.R')
library(GCAT)
library(GCAT)
library("GCAT")
library("codetools")
checkUsagePackage("GCAT")
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
checkUsagePackage("GCAT")
library("codetoolds")
library("codetoolss")
library("codetools")
checkUsagePackage("GCAT")
library(GCAT)
library("codetools")
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
checkUsagePackage("GCAT")
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/fit.model.R')
library(GCAT)
checkUsagePackage("GCAT")
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
checkUsagePackage("GCAT")
source('~/Documents/GCAT4/trunk/R/GCAT/R/class.model.R')
library(GCAT)
checkUsagePackage("GCAT")
library(GCAT)
checkUsagePackage("GCAT")
library(GCAT)
checkUsagePackage("GCAT")
?? checkusagePackage
checkUsagePackage("GCAT", all + T)
checkUsagePackage("GCAT", all = T)
checkUsagePackage("GCAT")
checkUsagePackage("GCAT")
source('~/Documents/GCAT4/trunk/R/GCAT/R/plot.fit.R')
library(GCAT)
checkUsagePackage("GCAT")
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
source('~/Documents/GCAT4/trunk/R/GCAT/R/plot.fit.R')
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/plot.fit.R')
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/table2well.R')
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library("codetools")
library("GCAT")
checkUsagePackage(GCAT)
checkUsagePackage("GCAT)
checkUsagePackage("GCAT")
checkUsagePackage("GCAT")
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R')
t
checkUsagePack(GCAT)
checkUsagePackage(GCAT)
checkUsagePackage("GCAT")
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/normalize.and.transform.R')
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
source('~/Documents/GCAT4/trunk/R/GCAT/R/plot.fit.R')
library(GCAT)
library(GCAT)
library(GCAT)
?? plot
? plot
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library(GCAT)
library("codetools")
checkPackageUsage("GCAT")
checkUsagePackage("GCAT")
checkUsagePackage("GCAT", all = T)

@ -1,4 +0,0 @@
auto_roxygenize_for_build_and_reload="1"
auto_roxygenize_for_build_package="1"
auto_roxygenize_for_check="1"
makefile_args=""

@ -1,9 +0,0 @@
build-last-errors="[]"
build-last-errors-base-dir="~/Documents/GCAT4/trunk/R/GCAT/"
build-last-outputs="[{\"output\":\"==> roxygenize('.', roclets=c('rd'))\\n\\n\",\"type\":0},{\"output\":\"* checking for changes ... \",\"type\":1},{\"output\":\"DONE\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source GCAT\\n\\n\",\"type\":0},{\"output\":\"* installing to library /home/minh/R/x86_64-pc-linux-gnu-library/3.0\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing *source* package GCAT ...\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** inst\\n\",\"type\":1},{\"output\":\"** preparing package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"Reading input files...\",\"type\":1},{\"output\":\"Error in try(gcat.load.data(file.name = file.name, input.data = input.data, : \\n\",\"type\":1},{\"output\":\" could not find function \\\"gcat.load.data\\\"\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"Creating a generic function for 'plot' from package 'graphics' in package 'GCAT'\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"No man pages found in package 'GCAT' \\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* DONE (GCAT)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
console_procs="[]"
files.monitored-path=""
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
imageDirtyState="1"
saveActionState="-1"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,16 +0,0 @@
{
"contents" : "#Copyright 2012 The Board of Regents of the University of Wisconsin System.\n#Contributors: Jason Shao, James McCurdy, Enhai Xie, Adam G.W. Halstead, \n#Michael H. Whitney, Nathan DiPiazza, Trey K. Sato and Yury V. Bukhman\n#\n#This file is part of GCAT.\n#\n#GCAT is free software: you can redistribute it and/or modify\n#it under the terms of the GNU Lesser General Public License as published by\n#the Free Software Foundation, either version 3 of the License, or\n#(at your option) any later version.\n#\n#GCAT is distributed in the hope that it will be useful,\n#but WITHOUT ANY WARRANTY; without even the implied warranty of\n#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n#GNU Lesser General Public License for more details.\n#\n#You should have received a copy of the GNU Lesser General Public License \n#along with GCAT. If not, see <http://www.gnu.org/licenses/>.\n\n# Wrapper for sapply to use lapply over an array, conserving the dimensions.\naapply = function(x, FUN,...){\n dim.values = dim(x)\n\tdim.names = dimnames(x)\n\tx = lapply(x, function(x){FUN(x,...)})\n\tdim(x) = dim.values\n\tdimnames(x) = dim.names\n\treturn(x)\n\t}\n\n# A function to manually create an unchecked exception.\nexception = function(class, msg)\n{\n cond <- simpleError(msg)\n class(cond) <- c(class, \"MyException\", class(cond))\n stop(cond)\n}\n",
"created" : 1425413273698.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3044086993",
"id" : "4E20D973",
"lastKnownWriteTime" : 1424208963,
"path" : "~/Documents/GCAT4/trunk/R/GCAT/R/misc.R",
"project_path" : "R/misc.R",
"properties" : {
},
"source_on_save" : false,
"type" : "r_source"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,16 +0,0 @@
{
"contents" : "# Default NAMESPACE created by R\n# Remove the previous line if you edit this file\n\n# Export all names\nexportPattern(\".\")\n\n# Import all packages listed as Imports or Depends\nimport(\"pheatmap\", \"gplots\")\n",
"created" : 1428439772005.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "749067415",
"id" : "907B51DB",
"lastKnownWriteTime" : 1423260997,
"path" : "~/Documents/GCAT4/trunk/R/GCAT/NAMESPACE",
"project_path" : "NAMESPACE",
"properties" : {
},
"source_on_save" : false,
"type" : "r_namespace"
}

@ -1,16 +0,0 @@
{
"contents" : "#Copyright 2012 The Board of Regents of the University of Wisconsin System.\n#Contributors: Jason Shao, James McCurdy, Enhai Xie, Adam G.W. Halstead,\n#Michael H. Whitney, Nathan DiPiazza, Trey K. Sato and Yury V. Bukhman\n#\n#This file is part of GCAT.\n#\n#GCAT is free software: you can redistribute it and/or modify\n#it under the terms of the GNU Lesser General Public License as published by\n#the Free Software Foundation, either version 3 of the License, or\n#(at your option) any later version.\n#\n#GCAT is distributed in the hope that it will be useful,\n#but WITHOUT ANY WARRANTY; without even the implied warranty of\n#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n#GNU Lesser General Public License for more details.\n#\n#You should have received a copy of the GNU Lesser General Public License \n#along with GCAT. If not, see <http://www.gnu.org/licenses/>.\n########################################################################\n# #\n# <model> class definition and functions. Objects contain equations #\n# and other information for parameterized growth curve models. #\n# #\n########################################################################\nsetClass(\"model\", representation(name = \"character\",\n expression = \"expression\",\n formula = \"formula\",\n guess = \"function\"))\n# Slots:\n# name - a simple description of the model.\n# expression - an object of class \"expression\" that evaluates the response (transformed OD) with respect to the variable Time.\n# formula - same as expression, but with y as the response.\n# guess - a function that computes initial guesses for the parameters given a well object with a valid \"screen.data\" slot\n# containing useable OD values and slope estimates\n# --------------------------------------------------------------------\n###################### BEGIN PROTOTYPING ACCESSOR METHODS##############\n\n# Minh: Let this code fragment be F1.\nif (!isGeneric(\"getName\")){\n if (is.function(\"getName\"))\n fun <- getName\n else\n fun <- function(object) standardGeneric(\"getName\")\n setGeneric(\"getName\", fun)\n}\n# End of F1\nsetMethod(\"getName\", \"model\", function(object) object@name)\n\n# Minh: Let this line be F2.\nsetGeneric(\"getExpression\", function(object){standardGeneric(\"getExpression\")})\n# Question: How is F1 different from F2?\n\nsetMethod(\"getExpression\", \"model\",\n function(object){\n return(object@expression)\n })\n\nsetGeneric(\"getFormula\", function(object){standeardGeneric(\"getFormula\")})\nsetMethod(\"getFormula\", \"model\", \n function(object){\n return(object@formula)\n })\n\nsetGeneric(\"getGuess\", function(object){standeardGeneric(\"getGuess\")})\nsetMethod(\"getGuess\", \"model\", \n function(object){\n return(object@guess)\n })\n######################## ENG PROTOTYPING ########################\n\n# Function to create a new model\n#' Model \n#' \n#' Function to create a new model \n#' @param name The name of the model \n#' @param expression Expression of the model \n#' @param formula The formula of this model \n#' @param guess The guess of this model \n#' @return The new model \nmodel = function(name, expression, formula, guess){\n new(\"model\", name = name, expression = expression, formula = formula, guess = guess)\n}\n\nloess.g = function(well,smooth.param=0.75){\n #data = data.from(well)\n #growth = data[,2]\n #Time = data[,1]\n Time = data.from(well)[,1]\n \n # predicted growth values to be used in estimating growth curve parameters\n loess.fit = loess(data.from(well)[,2]~Time,span=smooth.param)\n t = seq(from = min(Time), to = max(Time), by = (max(Time)-min(Time))/1000)\n y = predict(loess.fit, data.frame(Time=t))\n attr(y,\"names\") = NULL # need to remove the names to prevent them from showing up in the returned vector\n \n # Remove any data points where y has not been estimated\n filt = is.finite(y)\n t = t[filt]\n y = y[filt] # remove any NA etc\n \n # specific growth using loess to find max derivative\n delta.t = diff(t)\n dydt = diff(y)/delta.t\n u = max(dydt)\n \n # lower and upper asymptotes\n b = min(y)\n A = max(y) - min(y)\n \n # inflection point\n inflection.pt.index = which.max(dydt)\n inflection.time = t[inflection.pt.index]\n inflection.y = y[inflection.pt.index]\n \n # lag time\n lam = inflection.time - (inflection.y-b)/u\n \n # Return named array of estimates\n c(A = A, b = b, lam = lam, u = u)\n}\n\n\n",
"created" : 1425419995370.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "2225975310",
"id" : "992E3490",
"lastKnownWriteTime" : 1425511077,
"path" : "~/Documents/GCAT4/trunk/R/GCAT/R/class.model.R",
"project_path" : "R/class.model.R",
"properties" : {
},
"source_on_save" : false,
"type" : "r_source"
}

File diff suppressed because one or more lines are too long

@ -1,17 +0,0 @@
{
"contents" : "setwd(\"~/Downloads/\")\nfile.list = file.name = \"YPDAFEXglucoseTests_2-25-10.csv\"\nlayout.file = \"YPDAFEXglucoseTests_2-25-10_Layout.csv\"\nsingle.plate = T\nout.dir = getwd()\ngraphic.dir = paste(out.dir, \"/pics\", sep = \"\")\nadd.constant = 1\nblank.value = NULL\nstart.index = 2\ngrowth.cutoff = 0.05\nuse.linear.param = F\nuse.loess = F\nsmooth.param = 0.6\npoints.to.remove = 0\nremove.jumps = F\nsilent = F\nverbose = T\nreturn.fit = F\noverview.jpgs = T\nplate.nrow = 8\nplate.ncol = 12\ninput.skip.lines = 0\nmulti.column.headers = c(\"Plate ID\", \"Well\", \"OD\", \"Time\")\nsingle.column.headers = c(\"\",\"A1\")\nlayout.sheet.headers = c(\"Strain\", \"Media Definition\")\n\nt = gcat.analysis.main(file.list, single.plate, layout.file = NULL, \n out.dir = getwd(), graphic.dir = paste(out.dir, \"/pics\", sep = \"\"), \n add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,\n use.linear.param=use.linear.param, use.loess=use.loess, smooth.param=0.1,\n points.to.remove = 0, remove.jumps = F, time.input = NA,\n plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0,\n multi.column.headers = c(\"Plate.ID\", \"Well\", \"OD\", \"Time\"), single.column.headers = c(\"\",\"A1\"), \n layout.sheet.headers = c(\"Strain\", \"Media Definition\"),\n silent = F, verbose = F, return.fit = F, overview.jpgs = T)\n",
"created" : 1425413468083.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3533220190",
"id" : "E3886516",
"lastKnownWriteTime" : 1425422563,
"path" : "~/Documents/GCAT4/trunk/R/GCAT/R/addingParams.R",
"project_path" : "R/addingParams.R",
"properties" : {
"tempName" : "Untitled1"
},
"source_on_save" : false,
"type" : "r_source"
}

@ -1,3 +0,0 @@
{
"tempName" : "Untitled1"
}

@ -1,3 +0,0 @@
{
"tempName" : "Untitled1"
}

@ -1,18 +0,0 @@
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FNAMESPACE="972C75E0"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2FGCAT.main.R="11120BC5"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2FaddingParams.R="54A894D0"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Fclass.model.R="9127986F"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Fclass.well.R="8250000E"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Ffit.model.R="3F8DCF42"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Ffitted.calculations.R="E533697B"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Fmisc.R="8341E8EB"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Fnormalize.and.transform.R="EDBD9DE"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Fplot.fit.R="2E01469A"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Fslope.analysis.R="4E0B0FCA"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Ftable.output.R="B005EA5F"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2FR%2Ftable2well.R="A3297EED"
~%2FDocuments%2FGCAT4%2Ftrunk%2FR%2FGCAT%2Fman%2Fgcat.load.data.Rd="2A2D32C6"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2FGCAT.main.R="61AC4784"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2FaddingParams.R="DEDB5126"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Fclass.model.R="8CEE19EC"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Ffit.model.R="9D1E246E"

@ -9,9 +9,10 @@ Description: Imports high-throughput growth curve data from microtiter
(specific growth rate, maximum growth capacity, and lag time) (specific growth rate, maximum growth capacity, and lag time)
for each well in a read. for each well in a read.
The code was written by Jason Shao (no longer at GLBRC) and Nate DiPiazza. The code was written by Jason Shao (no longer at GLBRC) and Nate DiPiazza.
Version: 5.0 Version: 5.0.2
Depends: pheatmap, gplots Depends: pheatmap, gplots, methods
Maintainer: Yury Bukhman <ybukhman@glbrc.wisc.edu> Maintainer: Yury Bukhman <ybukhman@glbrc.wisc.edu>
License: LGPL-3 License: LGPL-3
Date: 2014-02-10 Date: 2015-04-21
Author: Jason Shao, Nate DiPiazza <ndipiazza@wisc.edu>, Minh Duc Bui, Yury V Bukhman Author: Jason Shao, Nate DiPiazza <ndipiazza@wisc.edu>, Minh Duc Bui, Yury V Bukhman
Suggests: testthat

@ -1,8 +1,24 @@
# Default NAMESPACE created by R # Generated by roxygen2 (4.1.1): do not edit by hand
# Remove the previous line if you edit this file
# Export all names export(gcat.analysis.main)
exportPattern(".") exportClasses(well)
exportMethods(getAddInfo)
# Import all packages listed as Imports or Depends exportMethods(getCurPar)
import("pheatmap", "gplots") exportMethods(getEquation)
exportMethods(getFitErr)
exportMethods(getFitInfo)
exportMethods(getFitPar)
exportMethods(getInflectionTime)
exportMethods(getLoess)
exportMethods(getModelName)
exportMethods(getNorm)
exportMethods(getPosition)
exportMethods(getRSS)
exportMethods(getScreenData)
exportMethods(getStartIndex)
exportMethods(getUseLog)
exportMethods(getWellInfo)
exportMethods(getnls)
import(gplots)
import(methods)
import(pheatmap)

@ -1,17 +0,0 @@
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
BuildType: Package
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,16 +0,0 @@
{
"contents" : "#Copyright 2012 The Board of Regents of the University of Wisconsin System.\n#Contributors: Jason Shao, James McCurdy, Enhai Xie, Adam G.W. Halstead,\n#Michael H. Whitney, Nathan DiPiazza, Trey K. Sato and Yury V. Bukhman\n#\n#This file is part of GCAT.\n#\n#GCAT is free software: you can redistribute it and/or modify\n#it under the terms of the GNU Lesser General Public License as published by\n#the Free Software Foundation, either version 3 of the License, or\n#(at your option) any later version.\n#\n#GCAT is distributed in the hope that it will be useful,\n#but WITHOUT ANY WARRANTY; without even the implied warranty of\n#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n#GNU Lesser General Public License for more details.\n#\n#You should have received a copy of the GNU Lesser General Public License \n#along with GCAT. If not, see <http://www.gnu.org/licenses/>.\n########################################################################\n# #\n# <model> class definition and functions. Objects contain equations #\n# and other information for parameterized growth curve models. #\n# #\n########################################################################\nsetClass(\"model\", representation(name = \"character\",\n expression = \"expression\",\n formula = \"formula\",\n guess = \"function\"))\n# Slots:\n# name - a simple description of the model.\n# expression - an object of class \"expression\" that evaluates the response (transformed OD) with respect to the variable Time.\n# formula - same as expression, but with y as the response.\n# guess - a function that computes initial guesses for the parameters given a well object with a valid \"screen.data\" slot\n# containing useable OD values and slope estimates\n# --------------------------------------------------------------------\n# Function to create a new model \t \n#' Model \n#' \n#' Function to create a new model \n#' @param name The name of the model \n#' @param expression Expression of the model \n#' @param formula The formula of this model \n#' @param guess The guess of this model \n#' @return The new model \nmodel = function(name, expression, formula, guess){\n new(\"model\", name = name, expression = expression, formula = formula, guess = guess)\n}\n\nloess.g = function(well,smooth.param=0.75){\n data = data.from(well)\n growth = data[,2]\n Time = data[,1]\n \n # predicted growth values to be used in estimating growth curve parameters\n loess.fit = loess(growth~Time,span=smooth.param)\n t = seq(from = min(Time), to = max(Time), by = (max(Time)-min(Time))/1000)\n y = predict(loess.fit, data.frame(Time=t))\n attr(y,\"names\") = NULL # need to remove the names to prevent them from showing up in the returned vector\n \n # Remove any data points where y has not been estimated\n filt = is.finite(y)\n t = t[filt]\n y = y[filt] # remove any NA etc\n \n # specific growth using loess to find max derivative\n delta.t = diff(t)\n dydt = diff(y)/delta.t\n u = max(dydt)\n \n # lower and upper asymptotes\n b = min(y)\n A = max(y) - min(y)\n \n # inflection point\n inflection.pt.index = which.max(dydt)\n inflection.time = t[inflection.pt.index]\n inflection.y = y[inflection.pt.index]\n \n # lag time\n lam = inflection.time - (inflection.y-b)/u\n \n # Return named array of estimates\n c(A = A, b = b, lam = lam, u = u)\n}\n\n\n",
"created" : 1423869204555.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3423035371",
"id" : "EE21755B",
"lastKnownWriteTime" : 1423869219,
"path" : "~/Documents/GCAT4_old/trunk/R/GCAT/R/class.model.R",
"project_path" : "class.model.R",
"properties" : {
},
"source_on_save" : false,
"type" : "r_source"
}

@ -1,7 +0,0 @@
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2FGCAT.main.R="59ABD774"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Fclass.model.R="6E6918EE"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Ffit.model.R="5C623936"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Ffitted.calculations.R="2ACDF6EF"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Fnormalize.and.transform.R="F3CF638E"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Fplot.fit.R="EFF3E540"
~%2FDocuments%2FGCAT4_old%2Ftrunk%2FR%2FGCAT%2FR%2Ftable2well.R="9402820B"

@ -1,6 +1,6 @@
#Copyright 2012 The Board of Regents of the University of Wisconsin System. #Copyright 2012 The Board of Regents of the University of Wisconsin System.
#Contributors: Jason Shao, James McCurdy, Enhai Xie, Adam G.W. Halstead, #Contributors: Jason Shao, James McCurdy, Enhai Xie, Adam G.W. Halstead,
#Michael H. Whitney, Nathan DiPiazza, Trey K. Sato and Yury V. Bukhman #Michael H. Whitney, Nathan DiPiazza, Minh Bui, Trey K. Sato and Yury V. Bukhman
# #
#This file is part of GCAT. #This file is part of GCAT.
# #
@ -17,13 +17,30 @@
#You should have received a copy of the GNU Lesser General Public License #You should have received a copy of the GNU Lesser General Public License
#along with GCAT. If not, see <http://www.gnu.org/licenses/>. #along with GCAT. If not, see <http://www.gnu.org/licenses/>.
# GCAT version 5.00 ########################################################################
# Notes by Jason # #
# 08/18/2011 # Package-level documentation and imports #
# #
########################################################################
#' GCAT: Growth Curve Analysis Tool
#'
#' Mathematical modeling and parameter estimation of high volume microbial growth data.
#'
#' @details
#' GCAT input is in .csv format. GCAT analysis is accessed using \code{\link{gcat.analysis.main}}
#'
#' GCAT utilizes the \code{\link[stats]{nls}} function in the R stats package to fit logistic, Gompertz and Richards models to growth curve
#' data. Best model is selected automatically. Alternatively, the user may choose LOESS local regression fits, implemented using
#' \code{\link[stats]{loess}} function in the R stats package
#'
#' Internally, the data are stored in an array of \linkS4class{well} objects
#'
#' @import pheatmap gplots methods
#' @docType package
#' @name GCAT
NULL
# Initialization # Initialization
PLATE.LETTERS = paste(rep(c("", LETTERS), each = 26), rep(LETTERS, 26), sep="") PLATE.LETTERS = paste(rep(c("", LETTERS), each = 26), rep(LETTERS, 26), sep="")
global.version.number = packageDescription(pkg="GCAT")$Version global.version.number = packageDescription(pkg="GCAT")$Version
@ -88,32 +105,46 @@ global.version.number = packageDescription(pkg="GCAT")$Version
#' @param silent Shoulde messages be returned to the console? #' @param silent Shoulde messages be returned to the console?
#' @param verbose Should sub-functions return messages to console? (when I say verbose, I mean it!) #' @param verbose Should sub-functions return messages to console? (when I say verbose, I mean it!)
#' @param overview.jpgs Should GCAT enable an overview image? #' @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 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
#' #'
#' @return A list of the output files. #' @export
gcat.analysis.main = function(file.list, single.plate, layout.file = NULL, gcat.analysis.main = function(file.list, single.plate, layout.file = NULL,
out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""), out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""),
add.constant = 0.1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05, add.constant = 0, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
use.linear.param = F, use.loess = F, smooth.param=0.1, 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, points.to.remove = 0, remove.jumps = F, time.input = NA,
plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0, plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0,
multi.column.headers = c("Plate.ID", "Well", "OD", "Time"), single.column.headers = c("","A1"), multi.column.headers = c("Plate.ID", "Well", "OD", "Time"), single.column.headers = c("","A1"),
layout.sheet.headers = c("Strain", "Media Definition"), layout.sheet.headers = c("Strain", "Media Definition"),
silent = T, verbose = F, return.fit = F, overview.jpgs = T){ silent = T, verbose = F, return.fit = F, overview.jpgs = T){
# MB: Prototyping system unwanted argument guarding. Proper function # Capture the starting environment for debugging
# will be added in the future. main.envir = c(as.list(environment()))
# Not the best solution.
# MB: Not the best solution.
if (is.na(time.input)) { if (is.na(time.input)) {
if (single.plate) if (single.plate)
time.input = 1/3600 time.input = 1/3600
else else
exception("Error: ", "time.input is NA.") exception("", "time.input is NA.")
} }
if (add.constant < 0) # MB: Now add.constant will always be 0.
exception("Error: ", "The constant r should not be negative.") # No need to check.
#if (add.constant < 0)
# exception("", "The constant r should not be negative.")
# End prototyping temporary solution. # End prototyping temporary solution.
# YB: seem to need this to avoid spurious discarding of some wells in example multiplate dataset: Trac ticket 1780.
# however, this causes an error in Rails
if(length(points.to.remove)==0) points.to.remove = 0
upload.timestamp = strftime(Sys.time(), format="%Y-%m-%d %H:%M:%S") # Get a timestamp for the time of upload. upload.timestamp = strftime(Sys.time(), format="%Y-%m-%d %H:%M:%S") # Get a timestamp for the time of upload.
fitted.well.array.master = list() fitted.well.array.master = list()
source.file.list = c() source.file.list = c()
@ -148,9 +179,10 @@ gcat.analysis.main = function(file.list, single.plate, layout.file = NULL,
source.file.list = source.file.list, upload.timestamp = upload.timestamp, 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, 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, points.to.remove = points.to.remove, remove.jumps = remove.jumps,
lagRange = lagRange, specRange = specRange, totalRange = totalRange,
out.dir = out.dir, graphic.dir = graphic.dir, overview.jpgs=overview.jpgs, 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, use.linear.param=use.linear.param, use.loess=use.loess, plate.ncol = plate.ncol, plate.nrow = plate.nrow,
silent = silent), silent = T) silent = silent, main.envir = main.envir), silent = T)
# Return file list or error message otherwise return "successful analysis" message (?) # Return file list or error message otherwise return "successful analysis" message (?)
@ -209,7 +241,7 @@ gcat.analysis.main = function(file.list, single.plate, layout.file = NULL,
#' @param input.skip.lines If specified, this number of lines shall be skipped from the top when reading the input file with read.csv #' @param input.skip.lines If specified, this number of lines shall be skipped from the top when reading the input file with read.csv
#' @param multi.column.headers The headers of the column when analyzing multiple plates. #' @param multi.column.headers The headers of the column when analyzing multiple plates.
#' @param single.column.headers The headers of the column when analyzing a single plate. #' @param single.column.headers The headers of the column when analyzing a single plate.
#' @param layour.sheet.headers The headers of the layout file. #' @param layout.sheet.headers The headers of the layout file.
#' @param growth.model What growth model should be used? #' @param growth.model What growth model should be used?
#' @param backup.growth.model If the main growth model fails, the back up model will be used. #' @param backup.growth.model If the main growth model fails, the back up model will be used.
#' @param silent Surpress all messages. #' @param silent Surpress all messages.
@ -246,7 +278,7 @@ gcat.fit.main = function(file.name, input.data = NULL, load.type = "csv", layout
# "first": subtracts the first OD, assumed to be the blank, from all ODs # "first": subtracts the first OD, assumed to be the blank, from all ODs
# "none": does nothing, assumes no blank. highly recommend log(OD+1) transform in this case. # "none": does nothing, assumes no blank. highly recommend log(OD+1) transform in this case.
# "average.first": forces all filled wells on each plate to match the average value at <start.index> (after subtracting the first OD) # "average.first": forces all filled wells on each plate to match the average value at <start.index> (after subtracting the first OD)
# add.constant - a numeric constant that will be added to each curve before the log transform (defaults to 1) # add.constant - a numeric constant that will be added to each curve before the log transform (default is 0)
# use.log - should a log transform be applied to the data after normalization? # use.log - should a log transform be applied to the data after normalization?
# points.to.remove - a list of numbers referring to troublesome points that should be removed across all wells. # points.to.remove - a list of numbers referring to troublesome points that should be removed across all wells.
@ -326,6 +358,7 @@ gcat.fit.main = function(file.name, input.data = NULL, load.type = "csv", layout
# Return an error if there is a problem with normalization # Return an error if there is a problem with normalization
if (class(well.array) == "try-error") if (class(well.array) == "try-error")
stop("Error in <normalize.ODs>: ", well.array) stop("Error in <normalize.ODs>: ", well.array)
#well.array = try(subtract.blank(well.array, blank.value), silent = silent)
# Transform ODs on the logarithmic scale, regardless of whether <use.log> is true # Transform ODs on the logarithmic scale, regardless of whether <use.log> is true
# an extra column of log-transformed values is added to the "well.array" slot of each well # an extra column of log-transformed values is added to the "well.array" slot of each well
@ -433,15 +466,24 @@ gcat.fit.main = function(file.name, input.data = NULL, load.type = "csv", layout
#' This is for backwards compatibility with the old web server. #' This is for backwards compatibility with the old web server.
#' @param silent should messages be returned to the console? #' @param silent should messages be returned to the console?
#' @param unlog should exported graphics be transformed back to the OD scale? #' @param unlog should exported graphics be transformed back to the OD scale?
#' @param constant.added (should be the same value as add.constant above) - #' @param source.file.list A list of the source files' names.
#' used to readjust for the constant added during the log transform when plotting ODs. #' @param upload.timestamp The time format indicated by the user.
#' @param add.constant used to readjust for the constant added during the log transform when plotting ODs.
#' @param use.linear.param linear parameter is used or not?
#' @param use.loess Is LOESS model going to be used?
#' @param plate.nrow The number of rows for a plate.
#' @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 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
#'
#' @return A list of output files if success. #' @return A list of output files if success.
gcat.output.main = function(fitted.well.array, out.prefix = "", source.file.list, upload.timestamp = NULL, 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, 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, out.dir = getwd(), graphic.dir = paste(out.dir,"/pics",sep = ""), overview.jpgs = T,
use.linear.param=F, use.loess=F, plate.nrow = 8, plate.ncol = 12, use.linear.param=F, use.loess=F, lagRange = NA, totalRange = NA, specRange = NA,
unlog = F, silent = T){ plate.nrow = 8, plate.ncol = 12, unlog = F, silent = T, main.envir){
# Prepare timestamp for addition to output file names. # Prepare timestamp for addition to output file names.
filename.timestamp = strftime(upload.timestamp, format="_%Y-%m-%d_%H.%M.%S") filename.timestamp = strftime(upload.timestamp, format="_%Y-%m-%d_%H.%M.%S")
@ -510,7 +552,8 @@ gcat.output.main = function(fitted.well.array, out.prefix = "", source.file.list
# Use function <pdf.by.plate> to write fit graphics to file. # Use function <pdf.by.plate> to write fit graphics to file.
graphic.files = try(pdf.by.plate(fitted.well.array, out.prefix=out.prefix, upload.timestamp = upload.timestamp, 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, plate.ncol = plate.ncol, plate.nrow = plate.nrow),silent=silent) 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)
if (class(graphic.files) == "try-error") if (class(graphic.files) == "try-error")
stop("Error in <pdf.by.plate>: ", graphic.files) stop("Error in <pdf.by.plate>: ", graphic.files)
@ -550,7 +593,7 @@ gcat.output.main = function(fitted.well.array, out.prefix = "", source.file.list
"\n# - an 'I' indicates that the well was inoculated and growth was detected above the threshold. ", "\n# - an 'I' indicates that the well was inoculated and growth was detected above the threshold. ",
"\n# - an 'E*' indicates that the well was empty and growth was detected (possible contamination). ", "\n# - an 'E*' indicates that the well was empty and growth was detected (possible contamination). ",
"\n# - an '!' indicates that the well was inoculated and no growth was detected. ", "\n# - an '!' indicates that the well was inoculated and no growth was detected. ",
"\n# - asymp.not.reached: shows “L” if the bottom asymptote (baseline) was not reached and “U” if the upper asymptote (plateau) was not reached.", "\n# - asymp.not.reached: shows \"L\" if the bottom asymptote (baseline) was not reached and \"U\" if the upper asymptote (plateau) was not reached.",
"\n# - tank: (Tanking indicator) If a number is present then the growth trend was determined to tank at that timepoint index.", "\n# - tank: (Tanking indicator) If a number is present then the growth trend was determined to tank at that timepoint index.",
"\n# - other: Additional flag column. Displays information about whether jumps in OD were detected and what was done about them.", "\n# - other: Additional flag column. Displays information about whether jumps in OD were detected and what was done about them.",
"\n# - pdf.file and page.no: location of the figure for this well in the output .pdf files." "\n# - pdf.file and page.no: location of the figure for this well in the output .pdf files."
@ -569,7 +612,14 @@ gcat.output.main = function(fitted.well.array, out.prefix = "", source.file.list
"\n# - Index of inoculation timepoint", start.index, "\n# - Index of inoculation timepoint", start.index,
"\n# - Minimum growth threshold:", growth.cutoff, "\n# - Minimum growth threshold:", growth.cutoff,
"\n# - Removed points:", paste(points.to.remove, collapse = " "), "\n# - Removed points:", paste(points.to.remove, collapse = " "),
"\n# - Jump detection:", remove.jumps) "\n# - Jump detection:", remove.jumps
)
# gcat.analysis.main() starting environment
cat("\n#\n# -- gcat.analysis.main() starting environment --\n#")
print(main.envir)
# Done with text file output
sink() sink()
######################################################################## ########################################################################

@ -1,35 +0,0 @@
setwd("~/Downloads/")
file.list = file.name = "YPDAFEXglucoseTests_2-25-10.csv"
layout.file = "YPDAFEXglucoseTests_2-25-10_Layout.csv"
single.plate = T
out.dir = getwd()
graphic.dir = paste(out.dir, "/pics", sep = "")
add.constant = 1
blank.value = NULL
start.index = 2
growth.cutoff = 0.05
use.linear.param = F
use.loess = F
smooth.param = 0.6
points.to.remove = 0
remove.jumps = F
silent = F
verbose = T
return.fit = F
overview.jpgs = T
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")
t = gcat.analysis.main(file.list, single.plate, layout.file = NULL,
out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""),
add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
use.linear.param=use.linear.param, use.loess=use.loess, smooth.param=0.1,
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 = F, verbose = F, return.fit = F, overview.jpgs = T)

@ -22,6 +22,7 @@
# and other information for parameterized growth curve models. # # and other information for parameterized growth curve models. #
# # # #
######################################################################## ########################################################################
# Class to represent growth curve model objects
setClass("model", representation(name = "character", setClass("model", representation(name = "character",
expression = "expression", expression = "expression",
formula = "formula", formula = "formula",
@ -35,32 +36,26 @@ setClass("model", representation(name = "character",
# -------------------------------------------------------------------- # --------------------------------------------------------------------
###################### BEGIN PROTOTYPING ACCESSOR METHODS############## ###################### BEGIN PROTOTYPING ACCESSOR METHODS##############
# Minh: Let this code fragment be F1. # Get an object's @@name slot
if (!isGeneric("getName")){ setGeneric("getName", function(object) standardGeneric("getName"))
if (is.function("getName")) setMethod("getName", "model", function(object){return(object@name)})
fun <- getName
else
fun <- function(object) standardGeneric("getName")
setGeneric("getName", fun)
}
# End of F1
setMethod("getName", "model", function(object) object@name)
# Minh: Let this line be F2. # Get an object's @@expression slot
setGeneric("getExpression", function(object){standardGeneric("getExpression")}) setGeneric("getExpression", function(object){standardGeneric("getExpression")})
# Question: How is F1 different from F2?
setMethod("getExpression", "model", setMethod("getExpression", "model",
function(object){ function(object){
return(object@expression) return(object@expression)
}) })
# Get an object's @@formula slot
setGeneric("getFormula", function(object){standeardGeneric("getFormula")}) setGeneric("getFormula", function(object){standeardGeneric("getFormula")})
setMethod("getFormula", "model", setMethod("getFormula", "model",
function(object){ function(object){
return(object@formula) return(object@formula)
}) })
# Get an object's @@guess slot
setGeneric("getGuess", function(object){standeardGeneric("getGuess")}) setGeneric("getGuess", function(object){standeardGeneric("getGuess")})
setMethod("getGuess", "model", setMethod("getGuess", "model",
function(object){ function(object){
@ -81,6 +76,7 @@ model = function(name, expression, formula, guess){
new("model", name = name, expression = expression, formula = formula, guess = guess) new("model", name = name, expression = expression, formula = formula, guess = guess)
} }
# Initial guess of growth curve parameters using a loess model
loess.g = function(well,smooth.param=0.75){ loess.g = function(well,smooth.param=0.75){
#data = data.from(well) #data = data.from(well)
#growth = data[,2] #growth = data[,2]

@ -32,6 +32,29 @@ Sys.setlocale(locale="C")
# Treat nls and loess as S4 classes to avoid warnings # Treat nls and loess as S4 classes to avoid warnings
setOldClass("nls") setOldClass("nls")
setOldClass("loess") setOldClass("loess")
#' Class that contains well data
#'
#' @slot position - 3-member vector containing identifying information for the well: row (letters), column (numbers) and plate ID.
#' @slot well.info - a list containing strain and media names if provided
#' @slot screen.data - a data frame with Time and raw OD values. This is the only slot that is filled upon creation of a well object.
#' as different functions are run on the well the data frame gets filled with additional columns.
#' @slot start.index - integer index of the time point where growth curve starts, e.g. of the inoculation time point
#' @slot use.log - a single logical value denoting whether to return log-transformed values when data is requested from the well
#' @slot norm - a value to subtract from all OD values before returning data. filled by <normalize.ODs> (see normalize.and.transform.R)
#' @slot curve.par - a list of parameters that denote whether the well is empty, whether it contains ODs indicating a viable culture, whether it tanks at a certain timepoint.
#' @slot fit.par - will be a list containing the fitted model parameters
#' @slot fit.std.err - will be a list containing the standard errors for the fitted model parameters
#' @slot equation - will contain an expression for evaluating the successfully fitted model
#' @slot model.name - will contain the name of the successfully fit model
#' @slot fit.info - a message with info about whether the fit was successful, failed, or skipped.
#' @slot add.info - a message with info about whether jumps in OD were detected or removed, or if ODs were detected below the blank OD.
#' @slot inflection.time - the Time value at the point where the specific growth is located. no longer a formula param NWD
#' @slot rss - residual sum of squares
#' @slot loess - object returned by running loess on the normalized well data
#' @slot nls - object returned by running nls on the normalized well data
#'
#' @export
setClass("well", representation(position = "character", setClass("well", representation(position = "character",
well.info = "list", well.info = "list",
screen.data = "data.frame", screen.data = "data.frame",
@ -50,132 +73,170 @@ setClass("well", representation(position = "character",
loess = "loess", loess = "loess",
nls = "nls")) nls = "nls"))
# Slots: #' Accessors for the well class
# position - 3-member vector containing identifying information for the well: row (letters), column (numbers) and plate ID. #'
# well.info - a list containing strain and media names if provided #' @param object object of class \linkS4class{well}
# screen.data - a data frame with Time and raw OD values. This is the only slot that is filled upon creation of a well object. #' @name well-accessors
# as different functions are run on the well the data frame gets filled with additional columns. NULL
# use.log - a single logical value denoting whether to return log-transformed values when data is requested from the well
# norm - a value to subtract from all OD values before returning data. filled by <normalize.ODs> (see normalize.and.transform.R) #' @rdname well-accessors
# curve.par - a list of parameters that denote whether the well is empty, whether it contains ODs indicating a viable culture, whether it tanks at a certain timepoint. setGeneric("getPosition", function(object){standardGeneric("getPosition")})
#' @export
# if model fitting using <fit.model> is successful: #' @rdname well-accessors
# fit.par - will be a list containing the fitted model parameters
# fit.std.err - will be a list containing the standard errors for the fitted model parameters
# equation - will contain an expression for evaluating the successfully fitted model
# model.name - will contain the name of the successfully fit model
# fit.info - a message with info about whether the fit was successful, failed, or skipped.
# add.info - a message with info about whether jumps in OD were detected or removed, or if ODs were detected below the blank OD.
# inflection.time - the Time value at the point where the specific growth is located. no longer a formula param NWD
# rss - residual sum of squares
# loess - object returned by running loess on the normalized well data
# nls - object returned by running nls on the normalized well data
setGeneric("getPosition", function(object){standeardGeneric("getPosition")})
setMethod("getPosition", "well", setMethod("getPosition", "well",
function(object){ function(object){
return(object@position) return(object@position)
}) })
setGeneric("getWellInfo", function(object){standeardGeneric("getWellInfo")}) #' @rdname well-accessors
setGeneric("getWellInfo", function(object){standardGeneric("getWellInfo")})
#' @export
#' @rdname well-accessors
setMethod("getWellInfo", "well", setMethod("getWellInfo", "well",
function(object){ function(object){
return(object@well.info) return(object@well.info)
}) })
setGeneric("getScreenData", function(object){standeardGeneric("getScreenData")}) #' @rdname well-accessors
setGeneric("getScreenData", function(object){standardGeneric("getScreenData")})
#' @export
#' @rdname well-accessors
setMethod("getScreenData", "well", setMethod("getScreenData", "well",
function(object){ function(object){
return(object@screen.data) return(object@screen.data)
}) })
setGeneric("getStartIndex", function(object){standeardGeneric("getStartIndex")}) #' @rdname well-accessors
setGeneric("getStartIndex", function(object){standardGeneric("getStartIndex")})
#' @export
#' @rdname well-accessors
setMethod("getStartIndex", "well", setMethod("getStartIndex", "well",
function(object){ function(object){
return(object@start.index) return(object@start.index)
}) })
setGeneric("getUseLog", function(object){standeardGeneric("getUseLog")}) #' @rdname well-accessors
setGeneric("getUseLog", function(object){standardGeneric("getUseLog")})
#' @export
#' @rdname well-accessors
setMethod("getUseLog", "well", setMethod("getUseLog", "well",
function(object){ function(object){
return(object@use.log) return(object@use.log)
}) })
setGeneric("getNorm", function(object){standeardGeneric("getNorm")}) #' @rdname well-accessors
setGeneric("getNorm", function(object){standardGeneric("getNorm")})
#' @export
#' @rdname well-accessors
setMethod("getNorm", "well", setMethod("getNorm", "well",
function(object){ function(object){
return(object@norm) return(object@norm)
}) })
setGeneric("getCurPar", function(object){standeardGeneric("getCurPar")}) #' @rdname well-accessors
setGeneric("getCurPar", function(object){standardGeneric("getCurPar")})
#' @export
#' @rdname well-accessors
setMethod("getCurPar", "well", setMethod("getCurPar", "well",
function(object){ function(object){
return(object@curve.par) return(object@curve.par)
}) })
setGeneric("getFitErr", function(object){standeardGeneric("getFitErr")}) #' @rdname well-accessors
setGeneric("getFitErr", function(object){standardGeneric("getFitErr")})
#' @export
#' @rdname well-accessors
setMethod("getFitErr", "well", setMethod("getFitErr", "well",
function(object){ function(object){
return(object@fit.std.err) return(object@fit.std.err)
}) })
setGeneric("getEquation", function(object){standeardGeneric("getEquation")}) #' @rdname well-accessors
setGeneric("getEquation", function(object){standardGeneric("getEquation")})
#' @export
#' @rdname well-accessors
setMethod("getEquation", "well", setMethod("getEquation", "well",
function(object){ function(object){
return(object@equation) return(object@equation)
}) })
setGeneric("getModelName", function(object){standeardGeneric("getModelName")}) #' @rdname well-accessors
setGeneric("getModelName", function(object){standardGeneric("getModelName")})
#' @export
#' @rdname well-accessors
setMethod("getModelName", "well", setMethod("getModelName", "well",
function(object){ function(object){
return(object@model.name) return(object@model.name)
}) })
setGeneric("getFitInfo", function(object){standeardGeneric("getFitInfo")}) #' @rdname well-accessors
setGeneric("getFitInfo", function(object){standardGeneric("getFitInfo")})
#' @export
#' @rdname well-accessors
setMethod("getFitInfo", "well", setMethod("getFitInfo", "well",
function(object){ function(object){
return(object@fit.info) return(object@fit.info)
}) })
setGeneric("getAddInfo", function(object){standeardGeneric("getAddInfo")}) #' @rdname well-accessors
setGeneric("getAddInfo", function(object){standardGeneric("getAddInfo")})
#' @export
#' @rdname well-accessors
setMethod("getAddInfo", "well", setMethod("getAddInfo", "well",
function(object){ function(object){
return(object@add.info) return(object@add.info)
}) })
setGeneric("getInflectionTime", function(object){standeardGeneric("getInflectionTime")}) #' @rdname well-accessors
setGeneric("getInflectionTime", function(object){standardGeneric("getInflectionTime")})
#' @export
#' @rdname well-accessors
setMethod("getInflectionTime", "well", setMethod("getInflectionTime", "well",
function(object){ function(object){
return(object@inflection.time) return(object@inflection.time)
}) })
setGeneric("getRSS", function(object){standeardGeneric("getRSS")}) #' @rdname well-accessors
setGeneric("getRSS", function(object){standardGeneric("getRSS")})
#' @export
#' @rdname well-accessors
setMethod("getRSS", "well", setMethod("getRSS", "well",
function(object){ function(object){
return(object@rss) return(object@rss)
}) })
setGeneric("getLoess", function(object){standeardGeneric("getLoess")}) #' @rdname well-accessors
setGeneric("getLoess", function(object){standardGeneric("getLoess")})
#' @export
#' @rdname well-accessors
setMethod("getLoess", "well", setMethod("getLoess", "well",
function(object){ function(object){
return(object@loess) return(object@loess)
}) })
setGeneric("getnls", function(object){standeardGeneric("getnls")}) #' @rdname well-accessors
setGeneric("getnls", function(object){standardGeneric("getnls")})
#' @export
#' @rdname well-accessors
setMethod("getnls", "well", setMethod("getnls", "well",
function(object){ function(object){
return(object@nls) return(object@nls)
}) })
setGeneric("getFitPar", function(object){standeardGeneric("getFitPar")}) #' @rdname well-accessors
setGeneric("getFitPar", function(object){standardGeneric("getFitPar")})
#' @export
#' @rdname well-accessors
setMethod("getFitPar", "well", setMethod("getFitPar", "well",
function(object){ function(object){
return(object@fit.par) return(object@fit.par)
}) })
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# Function to create a new well
#
# Function to create a new well (requires only Time and OD vectors, which will fill slot "screen.data") # Function to create a new well (requires only Time and OD vectors, which will fill slot "screen.data")
# @details
# slots "nls" and "loess" are initialized to empty lists # slots "nls" and "loess" are initialized to empty lists
well = function(Time = NULL, OD = NULL){ well = function(Time = NULL, OD = NULL){
x = list() x = list()
@ -187,6 +248,7 @@ well = function(Time = NULL, OD = NULL){
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
#### A show method for well #### #### A show method for well ####
# A show method for well
setMethod("show", "well", setMethod("show", "well",
function(object) { function(object) {
print("Object of class well") print("Object of class well")
@ -229,20 +291,21 @@ setMethod("show", "well",
) )
#### A plot method for well #### #### A plot method for well ####
# x - object of class well #' A plot method for well
# y - not used #' @param x object of class well
# constant.added - used to readjust for the constant added during the log transform: log.OD = log(OD - blank + constant.added) #' @param y not used
# xlim - x axis limits, vector of length 2 #' @param constant.added used to readjust for the constant added during the log transform: log.OD = log(OD - blank + constant.added)
# ylim - y axis limits, vector of length 2 #' @param xlim x axis limits, vector of length 2
# scale - determines the font scale for the entire graph. all cex values are calculated from this #' @param ylim y axis limits, vector of length 2
# number.points - should points be labeled with numeric indices? #' @param scale determines the font scale for the entire graph. all cex values are calculated from this
# draw.symbols - should <check.slopes> be called on the well and markings drawn on the graph? #' @param number.points should points be labeled with numeric indices?
# show.text - show R^2 and growth curve parameters as text on the plot #' @param draw.symbols should <check.slopes> be called on the well and markings drawn on the graph?
# show.calc - draw lines that illustrate growth curve parameters #' @param show.text show R^2 and growth curve parameters as text on the plot
# draw.guess - initial guess model. Drawn if specified #' @param show.calc draw lines that illustrate growth curve parameters
# well.number - the number of the well in an array of wells #' @param draw.guess initial guess model. Drawn if specified
# ... - additional arguments passed to the generic plot function #' @param well.number the number of the well in an array of wells
#' @param ... additional arguments passed to the generic plot function
#'
setMethod("plot", setMethod("plot",
signature(x = "well", y="missing"), signature(x = "well", y="missing"),
function (x, y, constant.added = 1.0, xlim = NULL, ylim = NULL, function (x, y, constant.added = 1.0, xlim = NULL, ylim = NULL,
@ -271,11 +334,11 @@ setMethod("plot",
if (!is.null(well.number)) main = paste("[", well.number , "] ", main, sep="") if (!is.null(well.number)) main = paste("[", well.number , "] ", main, sep="")
# Draw the data and symbols if <draw.symbols> is true. # Draw the data and symbols if <draw.symbols> is true.
plot.data(x, main = main, scale = scale, constant.added=constant.added, plot_data(x, main = main, scale = scale, constant.added=constant.added,
number.points = number.points, draw.symbols = draw.symbols, xlim = xlim, ylim = ylim, ...) number.points = number.points, draw.symbols = draw.symbols, xlim = xlim, ylim = ylim, ...)
# Draw the fitted model. # Draw the fitted model.
plot.model(x, scale = scale, constant.added=constant.added) plot_model(x, scale = scale, constant.added=constant.added)
# Draw text info if specified. # Draw text info if specified.
if(show.text) if(show.text)
@ -302,9 +365,12 @@ setMethod("plot",
# Since many of these need to be applied to all wells over an array, while conserving the dimensions of # Since many of these need to be applied to all wells over an array, while conserving the dimensions of
# that array, this file includes a wrapper function <aapply> (see bottom of file). # that array, this file includes a wrapper function <aapply> (see bottom of file).
# Get plate name
plate.name = function(well) plate.name = function(well)
getPosition(well)[1] getPosition(well)[1]
# Return the full alphanumeric well name
#
# Return the full alphanumeric well name (with leading zeros if applicable) # Return the full alphanumeric well name (with leading zeros if applicable)
well.name = function(well){ well.name = function(well){
row = getPosition(well)[2] row = getPosition(well)[2]
@ -352,14 +418,22 @@ raw.data = function(well)
contains.fit = function(well) contains.fit = function(well)
length(getFitPar(well)) > 0 length(getFitPar(well)) > 0
#' Get the number of data points in a well
#'
#' @param x object of class \code{well}
setMethod("length", signature(x = "well"), function(x) length(x@screen.data[,1])) setMethod("length", signature(x = "well"), function(x) length(x@screen.data[,1]))
# Get well data
#
# @details
# The <data.from> function has some options: by default it returns a two-column data frame with time and OD # The <data.from> function has some options: by default it returns a two-column data frame with time and OD
# (or log OD if the <use.log> slot is true in the object), after normalization to the value specified in <norm> slot. # (or log OD if the <use.log> slot is true in the object), after normalization to the value specified in <norm> slot.
# - With <remove> set to true the rows specified in the <remove> column of the <screen.data> slot are not returned. # \itemize{
# - With <remove.tanking> set to true all the rows after the <tanking.start> index are removed. # \item{With <remove> set to true the rows specified in the <remove> column of the <screen.data> slot are not returned.}
# - Setting <raw.data> to true overrides all these settings and just returns 2 columns with Time and Raw OD. # \item{With <remove.tanking> set to true all the rows after the <tanking.start> index are removed.}
# \item{Setting <raw.data> to true overrides all these settings and just returns 2 columns with Time and Raw OD.}
# }
#
data.from = function(well, remove = T, remove.tanking = T, raw.data = F, na.rm = F){ data.from = function(well, remove = T, remove.tanking = T, raw.data = F, na.rm = F){
if (length(getUseLog(well)) == 0) if (length(getUseLog(well)) == 0)
@ -400,10 +474,10 @@ data.from = function(well, remove = T, remove.tanking = T, raw.data = F, na.rm =
output output
} }
# Compute growth curve slopes
# Functions much like <data.from> but gives a single vector containing the # @details
# Functions much like \code{\link{data.from}} but gives a single vector containing the
# slope at each point. Has a parameter allowing removal of NA values. # slope at each point. Has a parameter allowing removal of NA values.
slopes = function(well, remove = T, remove.tanking = T, na.rm = F){ slopes = function(well, remove = T, remove.tanking = T, na.rm = F){
if(remove.tanking & is.numeric(tanking.start(well))) if(remove.tanking & is.numeric(tanking.start(well)))
@ -423,9 +497,11 @@ slopes = function(well, remove = T, remove.tanking = T, na.rm = F){
# Well array functions: these must be used on entire arrays of well objects # Well array functions: these must be used on entire arrays of well objects
# instead of single ones. # instead of single ones.
# Get plate names
plate.names = function(well.array) plate.names = function(well.array)
dimnames(well.array)[[3]] dimnames(well.array)[[3]]
# Get tanking start values
tanking.start.values = function(well.array, array = F){ tanking.start.values = function(well.array, array = F){
if (array) if (array)
aapply(well.array, function(well) tanking.start(well)) aapply(well.array, function(well) tanking.start(well))

@ -39,9 +39,9 @@
#' @param backup.growth.model If \code{gowth.mode} fails, this model will be used. #' @param backup.growth.model If \code{gowth.mode} fails, this model will be used.
#' @param fit.if.no.growth should the function attempt to fit a well even if there was no growth detected? default is F #' @param fit.if.no.growth should the function attempt to fit a well even if there was no growth detected? default is F
#' @param silent output back to R console? #' @param silent output back to R console?
#' @param use.linear.param: Should an additional linear parameter (c) be used when fitting the data to the model? #' @param use.linear.param Should an additional linear parameter (c) be used when fitting the data to the model?
#' @param use.loess: Should Local Polynomial Regression Fitting (loess function) be used instead of nls? #' @param use.loess Should Local Polynomial Regression Fitting (loess function) be used instead of nls?
#' @param smooth.param: If loess is used, an optional smoothing parameter. Default is .6 #' @param smooth.param If loess is used, an optional smoothing parameter. Default is .6
fit.model = function(input.well, growth.model, backup.growth.model = NULL, fit.if.no.growth = F, fit.model = function(input.well, growth.model, backup.growth.model = NULL, fit.if.no.growth = F,
use.linear.param=F, use.loess=F, smooth.param, silent = T){ use.linear.param=F, use.loess=F, smooth.param, silent = T){
@ -138,11 +138,11 @@ fit.model = function(input.well, growth.model, backup.growth.model = NULL, fit.i
if(use.loess){ if(use.loess){
number.of.points = nrow(input.well@screen.data) number.of.points = nrow(input.well@screen.data)
if (smooth.param <= 1/number.of.points) if (smooth.param <= 1/number.of.points)
exception("Invalid input", "Smoothing parameter is out of range.") exception("", "Invalid input: Smoothing parameter is out of range.")
fit = try(loess(y~Time, data=input.data, span=smooth.param), silent=TRUE) fit = try(loess(y~Time, data=input.data, span=smooth.param), silent=TRUE)
input.well@loess = fit input.well@loess = fit
if (class(fit) != "loess") stop("loess fit failed on well", paste(input.well@position,collapse=" ")) if (class(fit) != "loess") stop("Loess fit failed on well", paste(input.well@position,collapse=" "))
input.well@fit.info = "Loess model fit successfully." input.well@fit.info = "Loess model fit successfully."
input.well@model.name = loess.model@name input.well@model.name = loess.model@name
input.well@equation = loess.model@expression input.well@equation = loess.model@expression
@ -224,10 +224,10 @@ fit.model = function(input.well, growth.model, backup.growth.model = NULL, fit.i
return(input.well) return(input.well)
} }
# Fit nls model to a well using a specified model #' Fit nls model to a well using a specified model
# Arguments: #'
# input.well: object of class well #' @param input.well object of class well
# model: object of class model, e.g. richards, gompertz or logistic #' @param model object of class model, e.g. richards, gompertz or logistic
fit.nls.model <- function (input.well, model) { fit.nls.model <- function (input.well, model) {
# Get OD vs. time data from well # Get OD vs. time data from well
input.data = data.from(input.well, na.rm = T) input.data = data.from(input.well, na.rm = T)

@ -23,7 +23,7 @@
# # # #
######################################################################## ########################################################################
# S3 generic # S3 generic for lag
lag <- function(fitted.well, ...) lag <- function(fitted.well, ...)
{ {
UseMethod("lag") UseMethod("lag")
@ -36,18 +36,13 @@ lag <- function(fitted.well, ...)
# constant.added - for returning values on the linear scale, what was the constant added before the log transform? # constant.added - for returning values on the linear scale, what was the constant added before the log transform?
# digits - passed to the <round> function, default is no rounding (infinity digits) # digits - passed to the <round> function, default is no rounding (infinity digits)
# Transform values back to OD scale
unlog = function(x, constant.added) { unlog = function(x, constant.added) {
######################################################################## exp(x) - constant.added
# Transform values back to OD scale #
########################################################################
exp(x) - constant.added
} }
# Evaluate estimated OD at any timepoints using the fitted model
well.eval = function(fitted.well, Time = NULL){ well.eval = function(fitted.well, Time = NULL){
########################################################################
# Evaluate estimated OD at any timepoints using the fitted model #
########################################################################
# If no timepoints are provided, use the ones collected in the experiment itself. # If no timepoints are provided, use the ones collected in the experiment itself.
if(!is.numeric(Time)) if(!is.numeric(Time))
Time = data.from(fitted.well)$Time Time = data.from(fitted.well)$Time
@ -73,10 +68,8 @@ well.eval = function(fitted.well, Time = NULL){
} }
} }
# Evaluate model residuals using the measured vs. fitted log.OD values
model.residuals = function(fitted.well, unlog = F){ model.residuals = function(fitted.well, unlog = F){
########################################################################
# Evaluate model residuals using the measured vs. fitted log.OD values #
########################################################################
measured.OD = data.from(fitted.well)[,2] measured.OD = data.from(fitted.well)[,2]
# Use <well.eval> with no Time argument to get fitted OD values at measured timepoints. # Use <well.eval> with no Time argument to get fitted OD values at measured timepoints.
@ -89,10 +82,8 @@ model.residuals = function(fitted.well, unlog = F){
return(measured.OD - predicted.OD) return(measured.OD - predicted.OD)
} }
# Evaluate deviations of log.OD values from the mean
dev.from.mean = function(fitted.well){ dev.from.mean = function(fitted.well){
########################################################################
# Evaluate deviations of log.OD values from the mean #
########################################################################
measured.ODs = data.from(fitted.well,remove=T,na.rm=T)[,2] measured.ODs = data.from(fitted.well,remove=T,na.rm=T)[,2]
# Get the mean values of these measured ODs. # Get the mean values of these measured ODs.
@ -104,21 +95,16 @@ dev.from.mean = function(fitted.well){
return (measured.ODs - mean.ODs) return (measured.ODs - mean.ODs)
} }
# Get the residual sum of square.
rss = function(fitted.well){ rss = function(fitted.well){
#######################################################################
# Get the residual sum of square. #
#######################################################################
if (length(fitted.well@rss) == 0) if (length(fitted.well@rss) == 0)
return (NA) return (NA)
else else
return (fitted.well@rss) return (fitted.well@rss)
} }
# Calculate a metric for fit accuracy using squared residuals
model.good.fit = function(fitted.well, digits = Inf){ model.good.fit = function(fitted.well, digits = Inf){
########################################################################
# Calculate a metric for fit accuracy using squared residuals #
########################################################################
# Sum of squared residuals # Sum of squared residuals
RSS = rss(fitted.well) RSS = rss(fitted.well)
@ -129,11 +115,8 @@ model.good.fit = function(fitted.well, digits = Inf){
return (1 - RSS/tot) return (1 - RSS/tot)
} }
# Output a string with values of fitted parameters
parameter.text = function(fitted.well){ parameter.text = function(fitted.well){
########################################################################
# Output a string with values of fitted parameters #
########################################################################
# Get a list of fitted parameters # Get a list of fitted parameters
fit.par = fitted.well@fit.par fit.par = fitted.well@fit.par
@ -177,21 +160,16 @@ parameter.text = function(fitted.well){
} }
} }
# Calculate maximum specific growth rate
max.spec.growth.rate = function(fitted.well, digits = Inf, ...){ max.spec.growth.rate = function(fitted.well, digits = Inf, ...){
########################################################################
# Calculate maximum specific growth rate #
########################################################################
if(length(fitted.well@fit.par) == 0) if(length(fitted.well@fit.par) == 0)
return(NA) return(NA)
round(fitted.well@fit.par$u,digits) round(fitted.well@fit.par$u,digits)
} }
# Calculate plateau log.OD from fitted parameters
plateau = function(fitted.well, digits = Inf){ plateau = function(fitted.well, digits = Inf){
########################################################################
# Calculate plateau log.OD from fitted parameters #
########################################################################
if(length(fitted.well@fit.par) == 0) if(length(fitted.well@fit.par) == 0)
return(NA) return(NA)
@ -205,10 +183,8 @@ plateau = function(fitted.well, digits = Inf){
return(plat) return(plat)
} }
# Calculate baseline log.OD from fitted parameters
baseline = function(fitted.well, digits = Inf){ baseline = function(fitted.well, digits = Inf){
########################################################################
# Calculate baseline log.OD from fitted parameters #
########################################################################
if(length(fitted.well@fit.par) == 0) if(length(fitted.well@fit.par) == 0)
return(NA) return(NA)
@ -226,11 +202,8 @@ baseline = function(fitted.well, digits = Inf){
return(base) return(base)
} }
# Calculate log.OD at inoculation from fitted parameters
inoc.log.OD = function(fitted.well, digits = Inf){ inoc.log.OD = function(fitted.well, digits = Inf){
########################################################################
# Calculate log.OD at inoculation from fitted parameters #
########################################################################
# Evaluated the fitted model at the inoculation timepoint (should be zero from using <start.times> from table2wells.R) # Evaluated the fitted model at the inoculation timepoint (should be zero from using <start.times> from table2wells.R)
if (is.null(well.eval(fitted.well))) if (is.null(well.eval(fitted.well)))
return(NA) return(NA)
@ -242,11 +215,8 @@ inoc.log.OD = function(fitted.well, digits = Inf){
} }
} }
# Calculate max log.OD from model fit
max.log.OD = function(fitted.well, digits = Inf, ...){ max.log.OD = function(fitted.well, digits = Inf, ...){
########################################################################
# Calculate max log.OD from model fit #
########################################################################
# Evaluated the fitted model at the final timepoint (just the last valid timepoint in the experiment) # Evaluated the fitted model at the final timepoint (just the last valid timepoint in the experiment)
if (is.null(well.eval(fitted.well))) if (is.null(well.eval(fitted.well)))
return(NA) return(NA)
@ -255,43 +225,31 @@ max.log.OD = function(fitted.well, digits = Inf, ...){
} }
} }
# Calculate projected growth: plateau minus the inoculated log.OD
projected.growth = function(fitted.well,digits=Inf) { projected.growth = function(fitted.well,digits=Inf) {
########################################################################
# Calculate projected growth: plateau minus the inoculated log.OD #
########################################################################
plateau(fitted.well,digits) - inoc.log.OD(fitted.well,digits) plateau(fitted.well,digits) - inoc.log.OD(fitted.well,digits)
} }
# Calculate projected growth: plateau minus the inoculated log.OD
projected.growth.OD = function(fitted.well,constant.added,digits=Inf) { projected.growth.OD = function(fitted.well,constant.added,digits=Inf) {
########################################################################
# Calculate projected growth: plateau minus the inoculated log.OD #
########################################################################
value = unlog(plateau(fitted.well),constant.added) - unlog(inoc.log.OD(fitted.well),constant.added) value = unlog(plateau(fitted.well),constant.added) - unlog(inoc.log.OD(fitted.well),constant.added)
round(value,digits) round(value,digits)
} }
# Calculate achieved growth: max.log.OD minus the inoculated log.OD
achieved.growth = function(fitted.well,digits=Inf) { achieved.growth = function(fitted.well,digits=Inf) {
########################################################################
# Calculate achieved growth: max.log.OD minus the inoculated log.OD #
########################################################################
max.log.OD(fitted.well,digits) - inoc.log.OD(fitted.well,digits) max.log.OD(fitted.well,digits) - inoc.log.OD(fitted.well,digits)
} }
# Calculate projected growth: plateau minus the inoculated log.OD
achieved.growth.OD = function(fitted.well,constant.added,digits=Inf) { achieved.growth.OD = function(fitted.well,constant.added,digits=Inf) {
########################################################################
# Calculate projected growth: plateau minus the inoculated log.OD #
########################################################################
value = unlog(max.log.OD(fitted.well),constant.added) - unlog(inoc.log.OD(fitted.well),constant.added) value = unlog(max.log.OD(fitted.well),constant.added) - unlog(inoc.log.OD(fitted.well),constant.added)
round(value,digits) round(value,digits)
} }
# Did the curve come close to the plateau OD during the experiment?
reach.plateau = function(fitted.well, cutoff = 0.75){ reach.plateau = function(fitted.well, cutoff = 0.75){
########################################################################
# Did the curve come close to the plateau OD during the experiment? #
########################################################################
plat = plateau(fitted.well) plat = plateau(fitted.well)
inoc = inoc.log.OD(fitted.well) inoc = inoc.log.OD(fitted.well)
final = max.log.OD(fitted.well) final = max.log.OD(fitted.well)
@ -310,11 +268,8 @@ reach.plateau = function(fitted.well, cutoff = 0.75){
# If no final OD was calculated (if curve was not fit properly) just return T. # If no final OD was calculated (if curve was not fit properly) just return T.
} }
# Calculate the lag time from the fitted OD
lag.time = function(fitted.well, digits = Inf, ...){ lag.time = function(fitted.well, digits = Inf, ...){
########################################################################
# Calculate the lag time from the fitted OD #
########################################################################
if(length(fitted.well@fit.par) == 0) if(length(fitted.well@fit.par) == 0)
return(NA) return(NA)
@ -322,7 +277,7 @@ lag.time = function(fitted.well, digits = Inf, ...){
} }
# new params for GCAT 4.0 # new params for GCAT 4.0
# Get amplitude
amplitude = function(fitted.well){ amplitude = function(fitted.well){
if(length(fitted.well@fit.par) == 0) if(length(fitted.well@fit.par) == 0)
return(NA) return(NA)
@ -330,43 +285,49 @@ amplitude = function(fitted.well){
return(fitted.well@fit.par$A) return(fitted.well@fit.par$A)
} }
# Get shape parameter
shape.par = function(fitted.well){ shape.par = function(fitted.well){
if(length(fitted.well@fit.par) == 0) if(length(fitted.well@fit.par) == 0)
return(NA) return(NA)
ifelse(is.null(fitted.well@fit.par$v), NA, fitted.well@fit.par$v) ifelse(is.null(fitted.well@fit.par$v), NA, fitted.well@fit.par$v)
} }
# Get standard error of the maximum specific growth rate value
max.spec.growth.rate.SE = function(fitted.well, ...){ max.spec.growth.rate.SE = function(fitted.well, ...){
if(length(fitted.well@fit.std.err) == 0) if(length(fitted.well@fit.std.err) == 0)
return(NA) return(NA)
ifelse(is.null(fitted.well@fit.std.err$u), NA, fitted.well@fit.std.err$u) ifelse(is.null(fitted.well@fit.std.err$u), NA, fitted.well@fit.std.err$u)
} }
# Get standard error of the lag time value
lag.time.SE = function(fitted.well, ...){ lag.time.SE = function(fitted.well, ...){
if(length(fitted.well@fit.std.err) == 0) if(length(fitted.well@fit.std.err) == 0)
return(NA) return(NA)
ifelse(is.null(fitted.well@fit.std.err$lam), NA, fitted.well@fit.std.err$lam) ifelse(is.null(fitted.well@fit.std.err$lam), NA, fitted.well@fit.std.err$lam)
} }
# Get standard error of the shape parameter
shape.par.SE = function(fitted.well){ shape.par.SE = function(fitted.well){
if(length(fitted.well@fit.std.err) == 0) if(length(fitted.well@fit.std.err) == 0)
return(NA) return(NA)
ifelse(is.null(fitted.well@fit.std.err$v), NA, fitted.well@fit.std.err$v) ifelse(is.null(fitted.well@fit.std.err$v), NA, fitted.well@fit.std.err$v)
} }
# Get standard error of the amplitude
amplitude.SE = function(fitted.well){ amplitude.SE = function(fitted.well){
if(length(fitted.well@fit.std.err) == 0) if(length(fitted.well@fit.std.err) == 0)
return(NA) return(NA)
ifelse(is.null(fitted.well@fit.std.err$A), NA, fitted.well@fit.std.err$A) ifelse(is.null(fitted.well@fit.std.err$A), NA, fitted.well@fit.std.err$A)
} }
# Get standard error of the baseline value
baseline.SE = function(fitted.well){ baseline.SE = function(fitted.well){
if(length(fitted.well@fit.std.err) == 0) if(length(fitted.well@fit.std.err) == 0)
return(NA) return(NA)
ifelse(is.null(fitted.well@fit.std.err$b), NA, fitted.well@fit.std.err$b) ifelse(is.null(fitted.well@fit.std.err$b), NA, fitted.well@fit.std.err$b)
} }
# used to calulate the inflection.time value # Calulate the inflection time value
inflection.time = function(well){ inflection.time = function(well){
if (length(well@loess) == 0 && length(well@nls) == 0) return(NA) # can' compute inflection time in the absence of a fit if (length(well@loess) == 0 && length(well@nls) == 0) return(NA) # can' compute inflection time in the absence of a fit
data = data.from(well) data = data.from(well)

@ -18,27 +18,33 @@
#along with GCAT. If not, see <http://www.gnu.org/licenses/>. #along with GCAT. If not, see <http://www.gnu.org/licenses/>.
######################################################################## ########################################################################
# #
# Normalize OD readings for an entire array of well objects #
# #
######################################################################## ########################################################################
# #' Normalize OD readings for an entire array of well objects
# Note: This function does not write any new OD values to the well objects in the array - it only #'
# fills the "norm" slot of each well object in the array with a value that will be subtracted #' @details
# from all OD measurements when returning data from the wells using the function <data.from> (see well.class.R) #' Note: This function does not write any new OD values to the well objects in the array - it only
# #' fills the "norm" slot of each well object in the array with a value that will be subtracted
# These functions make use of <raw.data> which simply returns the raw time and OD of a well (also see well.class.R) #' from all OD measurements when returning data from the wells using the function <data.from> (see well.class.R)
# #'
# well.array: an array of well objects. note this is the only normalization function that acts on an entire array instead of an individual well. #' These functions make use of <raw.data> which simply returns the raw time and OD of a well (also see well.class.R)
# normalize.method: #'
# - (default): subtracts the blank OD (either specified by <blank.value> or taken from the first timepoint as default) of each well from all timepoints in that well #' note this is the only normalization function that acts on an entire array instead of an individual well.
# - average.blank: subtracts the mean of all first OD timepoints on a plate from all timepoints in all wells on that plate #'
# - average.first: takes the mean of the difference between the OD of the specified <start> timepoint and the first timepoint of all wells on a plate #' normalize.method settings:
# and subtracts this value from all timepoints in all wells on that plate #' \describe{
# - anything else: do nothing #' \item{default}{subtracts the blank OD (either specified by <blank.value> or taken from the first timepoint as default)
# blank.value - user can enter a blank OD measurement for uninoculated wells. if NULL, defaults to the value of the first OD measurement of each well. #' of each well from all timepoints in that well}
# start.index - which timepoint should be used as the first one after inoculation (defaults to the 2th one) #' \item{average.blank}{subtracts the mean of all first OD timepoints on a plate from all timepoints in all wells on that plate}
# add.constant: add a numeric constant to all timepoints in all wells. #' \item{average.first}{takes the mean of the difference between the OD of the specified <start> timepoint and the first timepoint of all wells on a plate
#' and subtracts this value from all timepoints in all wells on that plate}
#' \item{anything else}{do nothing}
#' }
#'
#' @param normalize.method see Details
#' @param well.array an array of well objects.
#' @param blank.value user can enter a blank OD measurement for uninoculated wells. if NULL, defaults to the value of the first OD measurement of each well.
#' @param start.index which timepoint should be used as the first one after inoculation (defaults to the 2th one)
#' @param add.constant add a numeric constant to all timepoints in all wells.
normalize.ODs = function(well.array, normalize.method = "default", blank.value = NULL, start.index = 2, add.constant = 1){ normalize.ODs = function(well.array, normalize.method = "default", blank.value = NULL, start.index = 2, add.constant = 1){
if (normalize.method == "default"){ if (normalize.method == "default"){
@ -87,18 +93,17 @@ normalize.ODs = function(well.array, normalize.method = "default", blank.value =
} }
######################################################################## ########################################################################
# #
# Log-transform OD readings for a single well object #
# #
######################################################################## ########################################################################
# Must include this so that the checking process will not complain about # Must include this so that the checking process will not complain about
# inconsistency S3 generic/method. Though I don't know why. # inconsistency S3 generic/method. Though I don't know why.
# S3 generic
# @seealso \code{\link{transform.ODs}}
transform <- function(input.well, ...) { transform <- function(input.well, ...) {
UseMethod("transform") UseMethod("transform")
} }
#' Transform.Ods #' Log-transform OD readings for a single well object
#' #'
#' This function adds a "log.OD" column to the "screen.data" slot of a well object with log-transformed data. #' This function adds a "log.OD" column to the "screen.data" slot of a well object with log-transformed data.
#' The raw data is kept intact. #' The raw data is kept intact.
@ -110,6 +115,8 @@ transform <- function(input.well, ...) {
#' @param blank.value user can enter a blank OD measurement for uninoculated wells. if NULL, defaults to the value of the first OD measurement of each well. #' @param blank.value user can enter a blank OD measurement for uninoculated wells. if NULL, defaults to the value of the first OD measurement of each well.
#' @param start.index which timepoint should be used as the first one after inoculation (defaults to the 2th one) #' @param start.index which timepoint should be used as the first one after inoculation (defaults to the 2th one)
#' @param negative.OD.cutoff if any ODs below the specified blank value are detected before this index timepoint, the entire well is discarded. #' @param negative.OD.cutoff if any ODs below the specified blank value are detected before this index timepoint, the entire well is discarded.
#' @param constant.added similar to added.constant.
#' @param ... Additional arguments for this function.
transform.ODs = function(input.well, use.log = T, blank.value = NULL, start.index = 2, negative.OD.cutoff = 10, constant.added = 1.0, ...){ transform.ODs = function(input.well, use.log = T, blank.value = NULL, start.index = 2, negative.OD.cutoff = 10, constant.added = 1.0, ...){
# The default value for the log-transformed ODs will be NA. Valid values will be filled in. # The default value for the log-transformed ODs will be NA. Valid values will be filled in.
@ -148,22 +155,23 @@ transform.ODs = function(input.well, use.log = T, blank.value = NULL, start.inde
} }
######################################################################## ########################################################################
# #
# Remove timepoints from the analysis but not from the raw data #
# #
######################################################################## ########################################################################
# Remove timepoints from the analysis but not from the raw data #
# #
# @details
# Removes timepoints from further analysis. Does not remove them from the raw data; # Removes timepoints from further analysis. Does not remove them from the raw data;
# instead, this function creates or updates the Remove column in slot "screen.data" of the well which dictates whether # instead, this function creates or updates the Remove column in slot "screen.data" of the well which dictates whether
# individual timepoints are returned using the <load.data> function. # individual timepoints are returned using the <load.data> function.
# #
# <points> can be a vector containing: # parameter \emph{points} can be a vector containing:
# - any combination of positive and negative integers # \itemize{
# \item{any combination of positive and negative integers
# the timepoints at indices corresponding to positive integers will be set to be removed. # the timepoints at indices corresponding to positive integers will be set to be removed.
# the timepoints at indices corresponding to negative integers will be be re-added if they were previously set to be removed. # the timepoints at indices corresponding to negative integers will be be re-added if they were previously set to be removed.}
# - a single zero, which resets all timepoints (nothing will be removed) # \item{a single zero, which resets all timepoints (nothing will be removed)}
# - a logical vector to replace the Remove column and which will be cycled along the length of the timepoints. # \item{a logical vector to replace the Remove column and which will be cycled along the length of the timepoints.}
# }
#
remove.points = function(input.well, points){ remove.points = function(input.well, points){
# Copy the Remove column or create a new one if it doesn't yet exist # Copy the Remove column or create a new one if it doesn't yet exist
if (is.null(input.well@screen.data$Remove)) if (is.null(input.well@screen.data$Remove))
@ -192,7 +200,21 @@ remove.points = function(input.well, points){
input.well input.well
} }
# Add a column y = OD - blank.value for each well@screen.data
# switch Remove flag to TRUE if y < 0.
subtract.blank = function(well.array, blank.value = NULL) {
well.array = aapply(well.array, function(well, blank.value){
if (is.null(blank.value))
blank.value = well@screen.data$OD[1]
well@screen.data$y = well@screen.data$OD - blank.value
well = remove.points(well, well@screen.data$y < 0)
#newOD = well@screen.data$y
#oldOD = well@screen.data$OD
#well@screen.data$OD = newOD
#well@screen.data$y = oldOD
return(well)}, blank.value)
}

@ -28,14 +28,14 @@ require(gplots)
######################################################################## ########################################################################
# S3 Generic. # S3 Generic.
plot <- function(input.well, ...) { #plot <- function(input.well, ...) {
UseMethod("plot") # UseMethod("plot")
} #}
######################################################################## ########################################################################
# Basic function plots time vs. OD from a well object # # Basic function plots time vs. OD from a well object #
######################################################################## ########################################################################
#' plot.data #' plot_data
#' #'
#' Basic function plots time vs. OD from a well object #' Basic function plots time vs. OD from a well object
#' #'
@ -46,7 +46,10 @@ plot <- function(input.well, ...) {
#' @param scale determines the font scale for the entire graph. all cex values are calculated from this. #' @param scale determines the font scale for the entire graph. all cex values are calculated from this.
#' @param draw.symbols - should <check.slopes> be called on the well and markings drawn on the graph? #' @param draw.symbols - should <check.slopes> be called on the well and markings drawn on the graph?
#' @param ... additional arguments passed to plot() #' @param ... additional arguments passed to plot()
plot.data = function(input.well, view.raw.data = F, unlog = F, scale = 1, #' @param main ...
#' @param constant.added Similar to added.constant.
#' @param ylim ...
plot_data = function(input.well, view.raw.data = F, unlog = F, scale = 1,
main = paste(plate.name(input.well), well.name(input.well)), number.points = T, main = paste(plate.name(input.well), well.name(input.well)), number.points = T,
draw.symbols = F, constant.added, ylim, ...){ draw.symbols = F, constant.added, ylim, ...){
@ -58,7 +61,8 @@ plot.data = function(input.well, view.raw.data = F, unlog = F, scale = 1,
# Draw the axes and all text labels first. # Draw the axes and all text labels first.
par(mar = c(5, 4, 4, 5)+0.1) par(mar = c(5, 4, 4, 5)+0.1)
plot(input.data, main = main, xlab = "Time(hours)", ylab = "log(OD - blank + const)", plot(input.data, main = main, xlab = "Time(hours)", ylab = "log(OD - blank + const)",
mex = scale, cex.main = 1.5*scale, cex.axis = 1.2*scale, cex.lab = 1.2*scale, type ="n",...) mex = scale, cex.main = 1.5*scale, cex.axis = 1.2*scale, cex.lab = 1.2*scale,
type ="n", ylim=ylim, ...)
# Draw a second vertical axis, showing unlogged OD scale # Draw a second vertical axis, showing unlogged OD scale
# - Determine the range of the labels: from min.OD to max.OD # - Determine the range of the labels: from min.OD to max.OD
@ -94,12 +98,13 @@ plot.data = function(input.well, view.raw.data = F, unlog = F, scale = 1,
} }
######################################################################## ########################################################################
# Plots the fitted model curve from a well object if it exists #
######################################################################## ########################################################################
# Plot the fitted model curve from a well object if it exists
# #
# time: specify which points (in units of time) to plot fitted OD values for. if not specifies, plot all timepoints in range of well. # @details
# \strong{time:} specify which points (in units of time) to plot fitted OD values for. if not specifies, plot all timepoints in range of well.
plot.model = function(input.well, col = 1, scale = 1, lty = 1, time = NULL, unlog = F, constant.added=1, ...){ #
plot_model = function(input.well, col = 1, scale = 1, lty = 1, time = NULL, unlog = F, constant.added=1, ...){
#input.data = data.from(input.well) #input.data = data.from(input.well)
#growth = input.data[,2] #growth = input.data[,2]
@ -121,8 +126,8 @@ plot.model = function(input.well, col = 1, scale = 1, lty = 1, time = NULL, unlo
} }
######################################################################## ########################################################################
# Put various parameters and info in text form on the graphs #
######################################################################## ########################################################################
# Put various parameters and info in text form on the graphs #
# #
draw.text = function(input.well, scale = 0.5, xlim = 0, ylim = 0,...){ draw.text = function(input.well, scale = 0.5, xlim = 0, ylim = 0,...){
@ -185,11 +190,12 @@ draw.text = function(input.well, scale = 0.5, xlim = 0, ylim = 0,...){
} }
######################################################################## ########################################################################
# Draw lines on graph denoting calculated parameters #
######################################################################## ########################################################################
# Draw lines on graph denoting calculated parameters
#
# @details
# \strong{show.num} - should curve parameters be labeled?
# #
# <show.num> - should curve parameters be labeled?
draw.calc.par = function(input.well, scale = 0.5, unlog = F, constant.added, show.num = T){ draw.calc.par = function(input.well, scale = 0.5, unlog = F, constant.added, show.num = T){
# Don't do anything if well was not fit. # Don't do anything if well was not fit.
@ -262,10 +268,10 @@ draw.calc.par = function(input.well, scale = 0.5, unlog = F, constant.added, sho
} }
######################################################################## ########################################################################
# Draw residuals from the nonlinear fit with option for lowess line #
######################################################################## ########################################################################
# Draw residuals from the nonlinear fit with option for lowess line #
# #
plot.residuals = function(input.well, xlim = NULL, lowess = T, ...){ plot_residuals = function(input.well, xlim = NULL, lowess = T, ...){
well = input.well well = input.well
data = data.from(well, remove = F, remove.tanking = F) data = data.from(well, remove = F, remove.tanking = F)
@ -282,17 +288,22 @@ plot.residuals = function(input.well, xlim = NULL, lowess = T, ...){
} }
############################################################################## ##############################################################################
# This function is used to create a heatmap using:
# specific growth, total growth, and lag time
# for each well on a plate.
#
# @params
# fitted.well.array: matrix containing well array object data
# attribute: the data type we should use to create a heatmap
# @returns
# path of heatmap pdf file
############################################################################## ##############################################################################
create.heatmap = function(fitted.well.array, attribute, unlog=NULL){ #' Create a heat map of a plate
#'
#' @details
#' This function is used to create a heatmap using
#' specific growth, total growth, or lag time
#' for each well on a plate.
#'
#' @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.
#'
#' @return path of heatmap pdf file
#'
create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL){
attr.name <- deparse(substitute(attribute)) attr.name <- deparse(substitute(attribute))
pdf.name <- "" pdf.name <- ""
if(class(fitted.well.array) == "matrix"){ if(class(fitted.well.array) == "matrix"){
@ -322,9 +333,17 @@ create.heatmap = function(fitted.well.array, attribute, unlog=NULL){
pdf(pdf.name) pdf(pdf.name)
#heatmap(heat, Rowv=NA, Colv=NA, revC=T, scale="none", na.rm=T, main=plate.ID, col=rainbow(100), margins=c(6,6)) #heatmap(heat, Rowv=NA, Colv=NA, revC=T, scale="none", na.rm=T, main=plate.ID, col=rainbow(100), margins=c(6,6))
#mtext(paste("Max:", round(max(spec.growth, na.rm=T), digits=4),"Min:", round(min(spec.growth, na.rm=T), digits=4), "Avg:", round(mean(spec.growth, na.rm=T), digits=4)), side=1, line=3) #mtext(paste("Max:", round(max(spec.growth, na.rm=T), digits=4),"Min:", round(min(spec.growth, na.rm=T), digits=4), "Avg:", round(mean(spec.growth, na.rm=T), digits=4)), side=1, line=3)
pheatmap(heat, color=colorpanel(100, "red", "orange", "yellow"), if (length(MinMax) == 2){
border_color="black", cell_width=2, cell_height=3, Mean = mean(MinMax)
cluster_rows=F, cluster_cols=F, scale='none', main=heat.text, fontsize=16) bk = unique(c(seq(MinMax[1], Mean, length=50), seq(Mean, MinMax[2], length = 50)))
pheatmap(heat, color=colorpanel(100, "red", "orange", "yellow"), breaks = bk,
border_color="black", cell_width=2, cell_height=3,
cluster_rows=F, cluster_cols=F, scale='none', main=heat.text, fontsize=16)
} else {
pheatmap(heat, color=colorpanel(100, "red", "orange", "yellow"),
border_color="black", cell_width=2, cell_height=3,
cluster_rows=F, cluster_cols=F, scale='none', main=heat.text, fontsize=16)
}
dev.off() dev.off()
} }
else { else {
@ -334,11 +353,13 @@ create.heatmap = function(fitted.well.array, attribute, unlog=NULL){
} }
######################################################################## ########################################################################
########################################################################
# Plate overview graphic
#
# @details
# Draw grids of 96 points as a visual representation of fit status, # # Draw grids of 96 points as a visual representation of fit status, #
# and other info for an array of fitted well objects, plate by plate # # and other info for an array of fitted well objects, plate by plate #
########################################################################
# #
plate.overview = function(fitted.well.array, scale = 1, plate.ncol = 12, plate.nrow = 8){ plate.overview = function(fitted.well.array, scale = 1, plate.ncol = 12, plate.nrow = 8){
@ -452,11 +473,13 @@ plate.overview = function(fitted.well.array, scale = 1, plate.ncol = 12, plate.n
} }
######################################################################## ########################################################################
########################################################################
# Draw individual fitted wells
#
# @details
# Draw each well in an array of fitted well objects in succession. # # Draw each well in an array of fitted well objects in succession. #
# Include options for adding notations, text info and fit parameters. # # Include options for adding notations, text info and fit parameters. #
########################################################################
# #
view.fit = function(fitted.data, indices = 1:length(fitted.data), view.fit = function(fitted.data, indices = 1:length(fitted.data),
unlog = F, constant.added, xlim = NULL, ylim = NULL, display.legend = T, unlog = F, constant.added, xlim = NULL, ylim = NULL, display.legend = T,
show.text = T, show.calc = T, draw.guess = NULL, draw.symbols = F, number.points = T, show.text = T, show.calc = T, draw.guess = NULL, draw.symbols = F, number.points = T,
@ -513,7 +536,7 @@ view.fit = function(fitted.data, indices = 1:length(fitted.data),
if (show.residuals & is.numeric(model.residuals(fitted.well))){ if (show.residuals & is.numeric(model.residuals(fitted.well))){
if(user.advance) if(user.advance)
if (toupper(readline("<Enter> for residuals >>")) == "Q") break if (toupper(readline("<Enter> for residuals >>")) == "Q") break
plot.residuals(fitted.well) plot_residuals(fitted.well)
} }
# Allow user to advance the currently shown well if specified. # Allow user to advance the currently shown well if specified.
@ -534,7 +557,7 @@ view.fit = function(fitted.data, indices = 1:length(fitted.data),
} }
} }
# Draw legend on a well plot
well.fit.legend = function(xlim, ylim, scale = 1, constant.added){ well.fit.legend = function(xlim, ylim, scale = 1, constant.added){
par(mar = c(5, 4, 4, 5)+0.1) par(mar = c(5, 4, 4, 5)+0.1)
plot(0,0, main = "[Index] <Plate Name> <Well Position>\n<Strain Name>; <Media Definition>", plot(0,0, main = "[Index] <Plate Name> <Well Position>\n<Strain Name>; <Media Definition>",
@ -588,8 +611,10 @@ well.fit.legend = function(xlim, ylim, scale = 1, constant.added){
x.intersp=1, xjust = 1, y.intersp=1.5) x.intersp=1, xjust = 1, y.intersp=1.5)
} }
# Generate pdf files
pdf.by.plate = function(fitted.data, out.prefix = "", upload.timestamp = NULL, 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,...){ out.dir = getwd(), unlog = F, constant.added, silent = T, overview.jpgs = T, plate.ncol = 12, plate.nrow = 8,
lagRange = NA, specRange = NA, totalRange = NA, ...){
# Prepare timestamp for addition to output file names. # Prepare timestamp for addition to output file names.
filename.timestamp = strftime(upload.timestamp, format="_%Y-%m-%d_%H.%M.%S") filename.timestamp = strftime(upload.timestamp, format="_%Y-%m-%d_%H.%M.%S")
@ -620,13 +645,13 @@ pdf.by.plate = function(fitted.data, out.prefix = "", upload.timestamp = NULL,
if(num.wells > 1){ if(num.wells > 1){
#Heatmap block########################################################## #Heatmap block##########################################################
#alongside the jpgs file create 3 heatmaps for each plate. NWD #alongside the jpgs file create 3 heatmaps for each plate. NWD
spec.heat.file = create.heatmap(fitted.data[,,i], max.spec.growth.rate) spec.heat.file = create.heatmap(fitted.data[,,i], max.spec.growth.rate, MinMax = specRange)
if(spec.heat.file == "Error") if(spec.heat.file == "Error")
stop("Error in <create.heatmap> for specific growth") stop("Error in <create.heatmap> for specific growth")
lag.heat.file = create.heatmap(fitted.data[,,i], lag.time) lag.heat.file = create.heatmap(fitted.data[,,i], lag.time, MinMax = lagRange)
if(lag.heat.file == "Error") if(lag.heat.file == "Error")
stop("Error in <create.heatmap> for lag time") stop("Error in <create.heatmap> for lag time")
total.heat.file = create.heatmap(fitted.data[,,i], achieved.growth) total.heat.file = create.heatmap(fitted.data[,,i], achieved.growth, MinMax = totalRange)
if(total.heat.file == "Error") if(total.heat.file == "Error")
stop("Error in <create.heatmap> for total growth") stop("Error in <create.heatmap> for total growth")
# Add name of file if successfully written to file list output. Including heatmap files NWD # Add name of file if successfully written to file list output. Including heatmap files NWD

@ -18,14 +18,13 @@
#along with GCAT. If not, see <http://www.gnu.org/licenses/>. #along with GCAT. If not, see <http://www.gnu.org/licenses/>.
######################################################################## ########################################################################
# #
# Estimate the growth curve slope at each timepoint of a well #
# #
######################################################################## ########################################################################
# Estimate the growth curve slope at each timepoint of a well
# #
# @details
# uses the functions <data.from> and <well.name> (see well.class.R) # uses the functions <data.from> and <well.name> (see well.class.R)
# adds estimated slopes as a new column to the "screen.data" slot # adds estimated slopes as a new column to the "screen.data" slot
#
calculate.slopes = function(input.well, silent = T){ calculate.slopes = function(input.well, silent = T){
# Get the growth curve data (excluding removed points, but not excluding points marked as tanking) # Get the growth curve data (excluding removed points, but not excluding points marked as tanking)
growth.data = data.from(input.well, remove = T, remove.tanking = F) growth.data = data.from(input.well, remove = T, remove.tanking = F)
@ -54,34 +53,28 @@ calculate.slopes = function(input.well, silent = T){
######################################################################## ########################################################################
# #
# Use slope estimates to check growth curves for tanking and OD jumps #
# #
######################################################################## ########################################################################
# #' Use slope estimates to check growth curves for tanking and OD jumps #
# uses the functions <data.from> and <well.name> (see well.class.R) #'
# Arguments: #' @details
# ----- stringency parameters ---- #' Uses the functions <data.from> and <well.name> (see well.class.R)
# remove.jumps - should the program remove OD jumps? default F (just report them) - #'
# should be set to T if data contains distinct jumps in OD that need to be eliminated #' Fills the "curve.par" slot in the well with the starting index of tanking (NA if none is found)
# otherwise, this might be too stringent and will result in loss of data. #'
# check.start - which timepoint should checking for jumps and tanking start at? this is included because early timepoints can be unstable. #' Changed default values to parameters to account for settling
# fall.cutoff - what downward slope should constitute a fall in OD? #'
# jump.cutoffs - multipliers to determine whether a curve jumps up or down (see methods 1 and 2, below) #' @param input.well object of class \code{well} to check the slopes for
# tank.limit - how many timepoints in a row can have falling slopes until the curve is marked as tanking? #' @param remove.jumps should the program remove OD jumps? default F (just report them) -
# tank.cutoff - what proportion of the maximum OD can the curve go below until it is considered tanking? #' should be set to T if data contains distinct jumps in OD that need to be eliminated
#' otherwise, this might be too stringent and will result in loss of data.
# ---- input/output ---- #' @param check.start which timepoint should checking for jumps and tanking start at? this is included because early timepoints can be unstable.
# silent - output to R console? #' @param fall.cutoff what downward slope should constitute a fall in OD?
# draw - plot growth curve with curve checking details? #' @param jump.multipliers multipliers of fall.cutoff that determine whether a curve jumps up or down (see methods 1 and 2, below)
# #' @param tank.limit how many timepoints in a row can have falling slopes until the curve is marked as tanking?
# Fills the "curve.par" slot in the well with the starting index of tanking (NA if none is found) #' @param tank.cutoff what proportion of the maximum OD can the curve go below until it is considered tanking?
# #' @param silent output to R console?
#' @param draw plot growth curve with curve checking details?
#check.slopes = function(input.well, check.start = 8, fall.cutoff = -.0025, remove.jumps = F, #'
# jump.multipliers = -c(15, 500, 10), tank.cutoff = 1.0, tank.limit = 3, silent = T, draw = T){
#changed default values to parameters to account for settling
check.slopes = function(input.well, check.start = 22, fall.cutoff = -.0025, remove.jumps = F, check.slopes = function(input.well, check.start = 22, fall.cutoff = -.0025, remove.jumps = F,
jump.multipliers = -c(15, 500, 10), tank.cutoff = 1.0, tank.limit = 6, silent = T, draw = T){ jump.multipliers = -c(15, 500, 10), tank.cutoff = 1.0, tank.limit = 6, silent = T, draw = T){
@ -380,19 +373,32 @@ check.slopes = function(input.well, check.start = 22, fall.cutoff = -.0025, remo
} }
######################################################################## ########################################################################
# #
# Check wells for growth, remove from analysis if OD is too low #
# #
######################################################################## ########################################################################
# Check wells for growth, remove from analysis if OD is too low
# #
# @details
# The well will be tagged with no.growth = T in the slot "curve.par" if raw OD values (except for <points.to.remove>) # The well will be tagged with no.growth = T in the slot "curve.par" if raw OD values (except for <points.to.remove>)
# do not increase beyond <growth.cutoff> above the specified time of inoculation for that well (<start.index>) # do not increase beyond <growth.cutoff> above the specified time of inoculation for that well (<start.index>)
#
check.growth = function(input.well, growth.cutoff, start.index = 2){ check.growth = function(input.well, growth.cutoff, start.index = 2){
# Debug
#if (all(getPosition(input.well) == c("022510b.GLBRC200DH.2","D","5"))) browser()
# Get raw ODs (not including <points.to.remove>) and slope estimates from the well # Get raw ODs (not including <points.to.remove>) and slope estimates from the well
# as well as OD at inoculation timepoint <start.index> # as well as OD at inoculation timepoint <start.index>
well.pos = getPosition(input.well)
# Debug
#if (well.pos[[2]] == "A" && well.pos[[3]] == 1)
# browser()
raw.ODs = raw.data(input.well)[,2] raw.ODs = raw.data(input.well)[,2]
# Check for missing point.
if (any(is.na(raw.ODs)))
exception("Warning: ", "Missing data point detected. Please check the file and try again.")
start.OD = raw.ODs[start.index] start.OD = raw.ODs[start.index]
raw.ODs[input.well@screen.data$Remove] = NA raw.ODs[input.well@screen.data$Remove] = NA

@ -18,17 +18,18 @@
#along with GCAT. If not, see <http://www.gnu.org/licenses/>. #along with GCAT. If not, see <http://www.gnu.org/licenses/>.
######################################################################## ########################################################################
# #
# Populate an output table with parameters and other useful info for #
# each well in a fitted dataset. #
# #
######################################################################## ########################################################################
# #' Populate an output table with parameters and other useful info for each well in a fitted dataset.
# unlog - Should OD values be returned on the linear scale instead of log-transformed scale? #'
# constant.added - For returning values on linear scale, what constant was added to ODs before the log transform? #' @param fitted.data.set array of fitted well objects
# reach.cutoff - what proportion of the plateau OD must tbe reached by the last valid timepoint for the curve to be marked as reaching its plateau OD? #' @param unlog - Should OD values be returned on the linear scale instead of log-transformed scale?
# #' @param constant.added - For returning values on linear scale, what constant was added to ODs before the log transform?
#' @param reach.cutoff - what proportion of the plateau OD must tbe reached by the last valid timepoint for the curve to be marked as reaching
#' its plateau OD?
#' @param filename.timestamp timestamp for addition to output file names (for file references in last column of the output)
#' @param use.linear.param did the model formula contain a linear parameter? Should normally be FALSE, as the linear parameter is deprecated
#' @param use.loess was LOESS used to fit the data (instead of unsing a growth curve model formula)?
#'
table.out = function(fitted.data.set, unlog = F, constant.added, reach.cutoff = 0.90, filename.timestamp = NULL,use.linear.param=F, use.loess=F){ table.out = function(fitted.data.set, unlog = F, constant.added, reach.cutoff = 0.90, filename.timestamp = NULL,use.linear.param=F, use.loess=F){
# The idea is basically to use <unlist> and <aapply> on the fitted data array in order # The idea is basically to use <unlist> and <aapply> on the fitted data array in order

@ -38,11 +38,10 @@
#' @param input.data A list of tables representing input files read with \code{read.table}. Used to save time in cases #' @param input.data A list of tables representing input files read with \code{read.table}. Used to save time in cases
#' of running multiple analyses on the same dataset. If used, the function will ignore \code{file.name} entirely. #' of running multiple analyses on the same dataset. If used, the function will ignore \code{file.name} entirely.
#' @param load.type .csv by default. #' @param load.type .csv by default.
#' @param plate.laout Specifies the layout of the given plate. #' @param plate.layout Specifies the layout of the given plate.
#' @param single.plate.ID specifies a plate name for a single-plate read. If NULL, this is derived from the file name. #' @param single.plate.ID specifies a plate name for a single-plate read. If NULL, this is derived from the file name.
#' @param blank.value Blank OD measurement for uninoculated wells. By default(NULL), the value of the first OD #' @param blank.value Blank OD measurement for uninoculated wells. By default(NULL), the value of the first OD
#' measurement in each well is used. #' measurement in each well is used.
#' @param add.constant A value for r in the log(OD + r) transformation.
#' @param plate.nrow The number of rows in the input files. #' @param plate.nrow The number of rows in the input files.
#' @param plate.ncol The number of columns in the input files. #' @param plate.ncol The number of columns in the input files.
#' @param input.skip.lines specifies a plate name for a single-plate read. If NULL, this is derived from the file name. #' @param input.skip.lines specifies a plate name for a single-plate read. If NULL, this is derived from the file name.
@ -50,7 +49,8 @@
#' @param single.column.headers The headers of the column when analyzing a single plate. #' @param single.column.headers The headers of the column when analyzing a single plate.
#' @param layout.sheet.headers The headers of the layout file. #' @param layout.sheet.headers The headers of the layout file.
#' @param silent Surpress all messages. #' @param silent Surpress all messages.
#' @param verbose Display all messages when analyzing each well. #' @param start.index Which timepoint should be used as the first one after inoculation?
#' @param single.plate Is the plate single type?
#' #'
#' @return A list of well objects. #' @return A list of well objects.
gcat.load.data = function(file.name = NULL, load.type = "csv", input.data = NULL, single.plate.ID = NULL, gcat.load.data = function(file.name = NULL, load.type = "csv", input.data = NULL, single.plate.ID = NULL,
@ -64,9 +64,31 @@ gcat.load.data = function(file.name = NULL, load.type = "csv", input.data = NULL
######################################################################## ########################################################################
if(is.null(input.data)){ if(is.null(input.data)){
# Check for bad encoding.
file.name.cmd = paste("'", file.name, sep = "")
file.name.cmd = paste(file.name.cmd, "'", sep = "")
cmd = paste("enca -L none", file.name.cmd)
sys.msg = system(cmd, intern = TRUE)
if (length(attributes(sys.msg)) == 1) {
if (attributes(sys.msg)[1] == 1)
exception("", "Unrecognized encoding for input file. The file should be in UTF-8.")
}
# Either read from .csv. # Either read from .csv.
# Skipping temperature column.
colclasses = c(rep("integer", 1), rep("NULL", 1), rep("integer", 96))
# input.data = read.csv(file.name, colClasses = colclasses, stringsAsFactors=F, skip = input.skip.lines, fileEncoding='UTF-8')
input.data = read.csv(file.name, stringsAsFactors=F, skip = input.skip.lines, fileEncoding='UTF-8') input.data = read.csv(file.name, stringsAsFactors=F, skip = input.skip.lines, fileEncoding='UTF-8')
# Checking for temperature column.
# Reread the file if temp column is there.
# MB: Not the best solution.
if (length(input.data) == 98)
exception("", "The number of columns in the file is not 97 columns format. Please resubmit a valid file.")
# Determine single plate name if not specified. # Determine single plate name if not specified.
if (is.null(single.plate.ID)){ if (is.null(single.plate.ID)){
# Split the file name by "." and discard the last member (file extension). # Split the file name by "." and discard the last member (file extension).
@ -192,7 +214,7 @@ gcat.load.data = function(file.name = NULL, load.type = "csv", input.data = NULL
# Error if either no rows or more than one row matches the well # Error if either no rows or more than one row matches the well
if (length(layout.row.number) != 1) if (length(layout.row.number) != 1)
stop("incorrectly formatted plate layout! check names of columns, rows, and plates (if applicable).") stop("Incorrectly formatted plate layout! check names of columns, rows, and plates (if applicable).")
# Add any additional columns to the well's "well.info" slot # Add any additional columns to the well's "well.info" slot
well.info = plate.layout[layout.row.number,!(names(plate.layout) %in% c("Row","Column","Plate.ID",layout.sheet.headers))] well.info = plate.layout[layout.row.number,!(names(plate.layout) %in% c("Row","Column","Plate.ID",layout.sheet.headers))]
@ -234,12 +256,13 @@ gcat.load.data = function(file.name = NULL, load.type = "csv", input.data = NULL
# Reorganize data from single-plate input format before reading # # Reorganize data from single-plate input format before reading #
# # # #
######################################################################## ########################################################################
# Reorganize data from single-plate input format before reading #
# #
# This function reorganizes the data frame from a single-plate format file. # This function reorganizes the data frame from a single-plate format file.
# input.data - data frame read straight from a single-plate format data file. # @param input.data - data frame read straight from a single-plate format data file.
# single.plate.ID - specifies a plate name for a single-plate read, since none is given in the single-plate format # @param single.plate.ID - specifies a plate name for a single-plate read, since none is given in the single-plate format.
# The plate will be named Plate_1 unless otherwise specified. # The plate will be named Plate_1 unless otherwise specified.
#
gcat.reorganize.single.plate.data = function(input.data, blank.value = NULL, single.column.headers, single.plate.ID = "Plate_1", gcat.reorganize.single.plate.data = function(input.data, blank.value = NULL, single.column.headers, single.plate.ID = "Plate_1",
plate.nrow = 8, plate.ncol = 12, silent=T){ plate.nrow = 8, plate.ncol = 12, silent=T){
@ -252,12 +275,12 @@ gcat.reorganize.single.plate.data = function(input.data, blank.value = NULL, sin
header.row = min(which(input.data[,1] == single.column.headers[1])) header.row = min(which(input.data[,1] == single.column.headers[1]))
if (length(header.row) != 1 | is.infinite(header.row)) if (length(header.row) != 1 | is.infinite(header.row))
stop("could not locate header row in input file!") stop("Could not locate header row in input file!")
# The last row: where column 2 starts to be blank, or the total number of rows, whichever is smaller # The last row: where column 2 starts to be blank, or the total number of rows, whichever is smaller
extra.rows.start = min(which(input.data[-(1:header.row),2] == ""), which(is.na(input.data[-(1:header.row),2])), nrow(input.data[-(1:header.row),])) extra.rows.start = min(which(input.data[-(1:header.row),2] == ""), which(is.na(input.data[-(1:header.row),2])), nrow(input.data[-(1:header.row),]))
if (length(extra.rows.start) != 1 & is.infinite(extra.rows.start)) if (length(extra.rows.start) != 1 & is.infinite(extra.rows.start))
stop("could not locate last row in input file!") stop("Could not locate last row in input file!")
# Use header row to rename the columns, then cut off extra rows (including the ones above header) # Use header row to rename the columns, then cut off extra rows (including the ones above header)
names(input.data) = as.character(unlist(input.data[header.row,])) names(input.data) = as.character(unlist(input.data[header.row,]))
@ -332,9 +355,12 @@ gcat.reorganize.single.plate.data = function(input.data, blank.value = NULL, sin
# # # #
######################################################################## ########################################################################
# ---------------------------------------------------------- # ----------------------------------------------------------
# This function can append together arrays created using <load.data> #' Function to combine two well array datasets by plate
# Arguments: any number of array objects as long as they are all output straight from <load.data> #'
#' This function can append together arrays created using <load.data>
#'
#' @param ... any number of array objects as long as they are all output straight from <load.data>
#'
gcat.append.arrays = function(...){ gcat.append.arrays = function(...){
# Transfer arrays to a list # Transfer arrays to a list
@ -385,14 +411,16 @@ gcat.append.arrays = function(...){
# Convert timestamps to hours from start and sort timepoints # # Convert timestamps to hours from start and sort timepoints #
# # # #
######################################################################## ########################################################################
#' Convert timestamps to hours from start and sort timepoints
# #
# This function acts on a single well and modifies the raw data stored in slot "screen.data" #' This function acts on a single well and modifies the raw data stored in slot "screen.data"
# #'
# input.well - an object of class well #' @param input.well an object of class well
# time.format - specifies the time format. allowed values are "%S", for seconds, "%d", for days, or anything complying with ISO C / POSIX standards; see <strptime> #' @param time.input specifies time format in the input. allowed values are "%S", for seconds, "%d", for days, or anything complying with
# note: reading directly from excel to R results in timestamps being converted to days. #' ISO C / POSIX standards; see <strptime>.
# start.index - which timepoint should be used as the starting time at inoculation? #' @param start.index which timepoint should be used as the starting time at inoculation?
#'
#' @details note: reading directly from excel to R results in timestamps being converted to days.
gcat.start.times = function(input.well, time.input, start.index = 2) { gcat.start.times = function(input.well, time.input, start.index = 2) {
if(start.index > length(input.well)) if(start.index > length(input.well))

File diff suppressed because it is too large Load Diff

@ -0,0 +1,97 @@
Destination plate name,Row,Column,Well ID,Plate source,Well Source,Strain,Media Definition
Control strain plate,A,1,Empty,Empty,Empty,Empty,None
Control strain plate,A,2,Empty,Empty,Empty,Empty,None
Control strain plate,A,3,Empty,Empty,Empty,Empty,None
Control strain plate,A,4,Empty,Empty,Empty,Empty,None
Control strain plate,A,5,Empty,Empty,Empty,Empty,None
Control strain plate,A,6,Empty,Empty,Empty,Empty,None
Control strain plate,A,7,Empty,Empty,Empty,Empty,None
Control strain plate,A,8,Empty,Empty,Empty,Empty,None
Control strain plate,A,9,Empty,Empty,Empty,Empty,None
Control strain plate,A,10,Empty,Empty,Empty,Empty,None
Control strain plate,A,11,Empty,Empty,Empty,Empty,None
Control strain plate,A,12,Empty,Empty,Empty,Empty,None
Control strain plate,B,1,Empty,Empty,Empty,Empty,None
Control strain plate,B,2,Sample,USDA,,Lab strain,YP
Control strain plate,B,3,Sample,USDA,,Wild strain,YP
Control strain plate,B,4,Sample,Internal source,,Industrial strain,YP
Control strain plate,B,5,Sample,ATCC,,Engineered strain,YP
Control strain plate,B,6,Empty,Empty,Empty,Empty,None
Control strain plate,B,7,Sample,USDA,,Lab strain,AFEX
Control strain plate,B,8,Sample,USDA,,Wild strain,AFEX
Control strain plate,B,9,Sample,Internal source,,Industrial strain,AFEX
Control strain plate,B,10,Sample,ATCC,,Engineered strain,AFEX
Control strain plate,B,11,Empty,Empty,Empty,Empty,None
Control strain plate,B,12,Empty,Empty,Empty,Empty,None
Control strain plate,C,1,Empty,Empty,Empty,Empty,None
Control strain plate,C,2,Sample,USDA,,Lab strain,YP+0.25% glucose
Control strain plate,C,3,Sample,USDA,,Wild strain,YP+0.25% glucose
Control strain plate,C,4,Sample,Internal source,,Industrial strain,YP+0.25% glucose
Control strain plate,C,5,Sample,ATCC,,Engineered strain,YP+0.25% glucose
Control strain plate,C,6,Empty,Empty,Empty,Empty,Empty
Control strain plate,C,7,Sample,USDA,,Lab strain,AFEX+0.25% glucose
Control strain plate,C,8,Sample,USDA,,Wild strain,AFEX+0.25% glucose
Control strain plate,C,9,Sample,Internal source,,Industrial strain,AFEX+0.25% glucose
Control strain plate,C,10,Sample,ATCC,,Engineered strain,AFEX+0.25% glucose
Control strain plate,C,11,Empty,Empty,Empty,Empty,None
Control strain plate,C,12,Empty,Empty,Empty,Empty,None
Control strain plate,D,1,Empty,Empty,Empty,Empty,None
Control strain plate,D,2,Sample,USDA,,Lab strain,YP+0.5% glucose
Control strain plate,D,3,Sample,USDA,,Wild strain,YP+0.5% glucose
Control strain plate,D,4,Sample,Internal source,,Industrial strain,YP+0.5% glucose
Control strain plate,D,5,Sample,ATCC,,Engineered strain,YP+0.5% glucose
Control strain plate,D,6,Empty,Empty,Empty,Empty,Empty
Control strain plate,D,7,Sample,USDA,,Lab strain,AFEX+0.5% glucose
Control strain plate,D,8,Sample,USDA,,Wild strain,AFEX+0.5% glucose
Control strain plate,D,9,Sample,Internal source,,Industrial strain,AFEX+0.5% glucose
Control strain plate,D,10,Sample,ATCC,,Engineered strain,AFEX+0.5% glucose
Control strain plate,D,11,Empty,Empty,Empty,Empty,None
Control strain plate,D,12,Empty,Empty,Empty,Empty,None
Control strain plate,E,1,Empty,Empty,Empty,Empty,None
Control strain plate,E,2,Sample,USDA,,Lab strain,YP+1% glucose
Control strain plate,E,3,Sample,USDA,,Wild strain,YP+1% glucose
Control strain plate,E,4,Sample,Internal source,,Industrial strain,YP+1% glucose
Control strain plate,E,5,Sample,ATCC,,Engineered strain,YP+1% glucose
Control strain plate,E,6,Empty,Empty,Empty,Empty,Empty
Control strain plate,E,7,Sample,USDA,,Lab strain,AFEX+1% glucose
Control strain plate,E,8,Sample,USDA,,Wild strain,AFEX+1% glucose
Control strain plate,E,9,Sample,Internal source,,Industrial strain,AFEX+1% glucose
Control strain plate,E,10,Sample,ATCC,,Engineered strain,AFEX+1% glucose
Control strain plate,E,11,Empty,Empty,Empty,Empty,None
Control strain plate,E,12,Empty,Empty,Empty,Empty,None
Control strain plate,F,1,Empty,Empty,Empty,Empty,None
Control strain plate,F,2,Sample,USDA,,Lab strain,YP+2% glucose
Control strain plate,F,3,Sample,USDA,,Wild strain,YP+2% glucose
Control strain plate,F,4,Sample,Internal source,,Industrial strain,YP+2% glucose
Control strain plate,F,5,Sample,ATCC,,Engineered strain,YP+2% glucose
Control strain plate,F,6,Empty,Empty,Empty,Empty,Empty
Control strain plate,F,7,Sample,USDA,,Lab strain,AFEX+2% glucose
Control strain plate,F,8,Sample,USDA,,Wild strain,AFEX+2% glucose
Control strain plate,F,9,Sample,Internal source,,Industrial strain,AFEX+2% glucose
Control strain plate,F,10,Sample,ATCC,,Engineered strain,AFEX+2% glucose
Control strain plate,F,11,Empty,Empty,Empty,Empty,None
Control strain plate,F,12,Empty,Empty,Empty,Empty,None
Control strain plate,G,1,Empty,Empty,Empty,Empty,None
Control strain plate,G,2,Sample,USDA,,Lab strain,YP+5% glucose
Control strain plate,G,3,Sample,USDA,,Wild strain,YP+5% glucose
Control strain plate,G,4,Sample,Internal source,,Industrial strain,YP+5% glucose
Control strain plate,G,5,Sample,ATCC,,Engineered strain,YP+5% glucose
Control strain plate,G,6,Empty,Empty,Empty,Empty,Empty
Control strain plate,G,7,Sample,USDA,,Lab strain,AFEX+5% glucose
Control strain plate,G,8,Sample,USDA,,Wild strain,AFEX+5% glucose
Control strain plate,G,9,Sample,Internal source,,Industrial strain,AFEX+5% glucose
Control strain plate,G,10,Sample,ATCC,,Engineered strain,AFEX+5% glucose
Control strain plate,G,11,Empty,Empty,Empty,Empty,None
Control strain plate,G,12,Empty,Empty,Empty,Empty,None
Control strain plate,H,1,Empty,Empty,Empty,Empty,None
Control strain plate,H,2,Empty,Empty,Empty,Empty,None
Control strain plate,H,3,Empty,Empty,Empty,Empty,None
Control strain plate,H,4,Empty,Empty,Empty,Empty,None
Control strain plate,H,5,Empty,Empty,Empty,Empty,None
Control strain plate,H,6,Empty,Empty,Empty,Empty,None
Control strain plate,H,7,Empty,Empty,Empty,Empty,None
Control strain plate,H,8,Empty,Empty,Empty,Empty,None
Control strain plate,H,9,Empty,Empty,Empty,Empty,None
Control strain plate,H,10,Empty,Empty,Empty,Empty,None
Control strain plate,H,11,Empty,Empty,Empty,Empty,None
Control strain plate,H,12,Empty,Empty,Empty,Empty,None
1 Destination plate name Row Column Well ID Plate source Well Source Strain Media Definition
2 Control strain plate A 1 Empty Empty Empty Empty None
3 Control strain plate A 2 Empty Empty Empty Empty None
4 Control strain plate A 3 Empty Empty Empty Empty None
5 Control strain plate A 4 Empty Empty Empty Empty None
6 Control strain plate A 5 Empty Empty Empty Empty None
7 Control strain plate A 6 Empty Empty Empty Empty None
8 Control strain plate A 7 Empty Empty Empty Empty None
9 Control strain plate A 8 Empty Empty Empty Empty None
10 Control strain plate A 9 Empty Empty Empty Empty None
11 Control strain plate A 10 Empty Empty Empty Empty None
12 Control strain plate A 11 Empty Empty Empty Empty None
13 Control strain plate A 12 Empty Empty Empty Empty None
14 Control strain plate B 1 Empty Empty Empty Empty None
15 Control strain plate B 2 Sample USDA Lab strain YP
16 Control strain plate B 3 Sample USDA Wild strain YP
17 Control strain plate B 4 Sample Internal source Industrial strain YP
18 Control strain plate B 5 Sample ATCC Engineered strain YP
19 Control strain plate B 6 Empty Empty Empty Empty None
20 Control strain plate B 7 Sample USDA Lab strain AFEX
21 Control strain plate B 8 Sample USDA Wild strain AFEX
22 Control strain plate B 9 Sample Internal source Industrial strain AFEX
23 Control strain plate B 10 Sample ATCC Engineered strain AFEX
24 Control strain plate B 11 Empty Empty Empty Empty None
25 Control strain plate B 12 Empty Empty Empty Empty None
26 Control strain plate C 1 Empty Empty Empty Empty None
27 Control strain plate C 2 Sample USDA Lab strain YP+0.25% glucose
28 Control strain plate C 3 Sample USDA Wild strain YP+0.25% glucose
29 Control strain plate C 4 Sample Internal source Industrial strain YP+0.25% glucose
30 Control strain plate C 5 Sample ATCC Engineered strain YP+0.25% glucose
31 Control strain plate C 6 Empty Empty Empty Empty Empty
32 Control strain plate C 7 Sample USDA Lab strain AFEX+0.25% glucose
33 Control strain plate C 8 Sample USDA Wild strain AFEX+0.25% glucose
34 Control strain plate C 9 Sample Internal source Industrial strain AFEX+0.25% glucose
35 Control strain plate C 10 Sample ATCC Engineered strain AFEX+0.25% glucose
36 Control strain plate C 11 Empty Empty Empty Empty None
37 Control strain plate C 12 Empty Empty Empty Empty None
38 Control strain plate D 1 Empty Empty Empty Empty None
39 Control strain plate D 2 Sample USDA Lab strain YP+0.5% glucose
40 Control strain plate D 3 Sample USDA Wild strain YP+0.5% glucose
41 Control strain plate D 4 Sample Internal source Industrial strain YP+0.5% glucose
42 Control strain plate D 5 Sample ATCC Engineered strain YP+0.5% glucose
43 Control strain plate D 6 Empty Empty Empty Empty Empty
44 Control strain plate D 7 Sample USDA Lab strain AFEX+0.5% glucose
45 Control strain plate D 8 Sample USDA Wild strain AFEX+0.5% glucose
46 Control strain plate D 9 Sample Internal source Industrial strain AFEX+0.5% glucose
47 Control strain plate D 10 Sample ATCC Engineered strain AFEX+0.5% glucose
48 Control strain plate D 11 Empty Empty Empty Empty None
49 Control strain plate D 12 Empty Empty Empty Empty None
50 Control strain plate E 1 Empty Empty Empty Empty None
51 Control strain plate E 2 Sample USDA Lab strain YP+1% glucose
52 Control strain plate E 3 Sample USDA Wild strain YP+1% glucose
53 Control strain plate E 4 Sample Internal source Industrial strain YP+1% glucose
54 Control strain plate E 5 Sample ATCC Engineered strain YP+1% glucose
55 Control strain plate E 6 Empty Empty Empty Empty Empty
56 Control strain plate E 7 Sample USDA Lab strain AFEX+1% glucose
57 Control strain plate E 8 Sample USDA Wild strain AFEX+1% glucose
58 Control strain plate E 9 Sample Internal source Industrial strain AFEX+1% glucose
59 Control strain plate E 10 Sample ATCC Engineered strain AFEX+1% glucose
60 Control strain plate E 11 Empty Empty Empty Empty None
61 Control strain plate E 12 Empty Empty Empty Empty None
62 Control strain plate F 1 Empty Empty Empty Empty None
63 Control strain plate F 2 Sample USDA Lab strain YP+2% glucose
64 Control strain plate F 3 Sample USDA Wild strain YP+2% glucose
65 Control strain plate F 4 Sample Internal source Industrial strain YP+2% glucose
66 Control strain plate F 5 Sample ATCC Engineered strain YP+2% glucose
67 Control strain plate F 6 Empty Empty Empty Empty Empty
68 Control strain plate F 7 Sample USDA Lab strain AFEX+2% glucose
69 Control strain plate F 8 Sample USDA Wild strain AFEX+2% glucose
70 Control strain plate F 9 Sample Internal source Industrial strain AFEX+2% glucose
71 Control strain plate F 10 Sample ATCC Engineered strain AFEX+2% glucose
72 Control strain plate F 11 Empty Empty Empty Empty None
73 Control strain plate F 12 Empty Empty Empty Empty None
74 Control strain plate G 1 Empty Empty Empty Empty None
75 Control strain plate G 2 Sample USDA Lab strain YP+5% glucose
76 Control strain plate G 3 Sample USDA Wild strain YP+5% glucose
77 Control strain plate G 4 Sample Internal source Industrial strain YP+5% glucose
78 Control strain plate G 5 Sample ATCC Engineered strain YP+5% glucose
79 Control strain plate G 6 Empty Empty Empty Empty Empty
80 Control strain plate G 7 Sample USDA Lab strain AFEX+5% glucose
81 Control strain plate G 8 Sample USDA Wild strain AFEX+5% glucose
82 Control strain plate G 9 Sample Internal source Industrial strain AFEX+5% glucose
83 Control strain plate G 10 Sample ATCC Engineered strain AFEX+5% glucose
84 Control strain plate G 11 Empty Empty Empty Empty None
85 Control strain plate G 12 Empty Empty Empty Empty None
86 Control strain plate H 1 Empty Empty Empty Empty None
87 Control strain plate H 2 Empty Empty Empty Empty None
88 Control strain plate H 3 Empty Empty Empty Empty None
89 Control strain plate H 4 Empty Empty Empty Empty None
90 Control strain plate H 5 Empty Empty Empty Empty None
91 Control strain plate H 6 Empty Empty Empty Empty None
92 Control strain plate H 7 Empty Empty Empty Empty None
93 Control strain plate H 8 Empty Empty Empty Empty None
94 Control strain plate H 9 Empty Empty Empty Empty None
95 Control strain plate H 10 Empty Empty Empty Empty None
96 Control strain plate H 11 Empty Empty Empty Empty None
97 Control strain plate H 12 Empty Empty Empty Empty None

@ -0,0 +1,42 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/slope.analysis.R
\name{check.slopes}
\alias{check.slopes}
\title{Use slope estimates to check growth curves for tanking and OD jumps #}
\usage{
check.slopes(input.well, check.start = 22, fall.cutoff = -0.0025,
remove.jumps = F, jump.multipliers = -c(15, 500, 10), tank.cutoff = 1,
tank.limit = 6, silent = T, draw = T)
}
\arguments{
\item{input.well}{object of class \code{well} to check the slopes for}
\item{check.start}{which timepoint should checking for jumps and tanking start at? this is included because early timepoints can be unstable.}
\item{fall.cutoff}{what downward slope should constitute a fall in OD?}
\item{remove.jumps}{should the program remove OD jumps? default F (just report them) -
should be set to T if data contains distinct jumps in OD that need to be eliminated
otherwise, this might be too stringent and will result in loss of data.}
\item{jump.multipliers}{multipliers of fall.cutoff that determine whether a curve jumps up or down (see methods 1 and 2, below)}
\item{tank.cutoff}{what proportion of the maximum OD can the curve go below until it is considered tanking?}
\item{tank.limit}{how many timepoints in a row can have falling slopes until the curve is marked as tanking?}
\item{silent}{output to R console?}
\item{draw}{plot growth curve with curve checking details?}
}
\description{
Use slope estimates to check growth curves for tanking and OD jumps #
}
\details{
Uses the functions <data.from> and <well.name> (see well.class.R)
Fills the "curve.par" slot in the well with the starting index of tanking (NA if none is found)
Changed default values to parameters to account for settling
}

@ -0,0 +1,29 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/plot.fit.R
\name{create.heatmap}
\alias{create.heatmap}
\title{Create a heat map of a plate}
\usage{
create.heatmap(fitted.well.array, attribute, MinMax = NA, unlog = NULL)
}
\arguments{
\item{fitted.well.array}{matrix containing well array object data}
\item{attribute}{the data type we should use to create a heatmap}
\item{MinMax}{The specific range for the heatmap.}
\item{unlog}{transform values to linear scale}
}
\value{
path of heatmap pdf file
}
\description{
Create a heat map of a plate
}
\details{
This function is used to create a heatmap using
specific growth, total growth, or lag time
for each well on a plate.
}

@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/fit.model.R
\name{fit.model} \name{fit.model}
\alias{fit.model} \alias{fit.model}
\title{fit.model} \title{fit.model}
@ -16,13 +17,13 @@ fit.model(input.well, growth.model, backup.growth.model = NULL,
\item{fit.if.no.growth}{should the function attempt to fit a well even if there was no growth detected? default is F} \item{fit.if.no.growth}{should the function attempt to fit a well even if there was no growth detected? default is F}
\item{silent}{output back to R console?} \item{use.linear.param}{Should an additional linear parameter (c) be used when fitting the data to the model?}
\item{use.linear.param:}{Should an additional linear parameter (c) be used when fitting the data to the model?} \item{use.loess}{Should Local Polynomial Regression Fitting (loess function) be used instead of nls?}
\item{use.loess:}{Should Local Polynomial Regression Fitting (loess function) be used instead of nls?} \item{smooth.param}{If loess is used, an optional smoothing parameter. Default is .6}
\item{smooth.param:}{If loess is used, an optional smoothing parameter. Default is .6} \item{silent}{output back to R console?}
} }
\description{ \description{
This function will use the function stored in the "guess" slot of \code{growth.model} to calculate initial guesses This function will use the function stored in the "guess" slot of \code{growth.model} to calculate initial guesses

@ -0,0 +1,17 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/fit.model.R
\name{fit.nls.model}
\alias{fit.nls.model}
\title{Fit nls model to a well using a specified model}
\usage{
fit.nls.model(input.well, model)
}
\arguments{
\item{input.well}{object of class well}
\item{model}{object of class model, e.g. richards, gompertz or logistic}
}
\description{
Fit nls model to a well using a specified model
}

@ -1,30 +1,20 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/GCAT.main.R
\docType{package}
\name{GCAT} \name{GCAT}
\alias{GCAT} \alias{GCAT}
\title{ \alias{GCAT-package}
Growth Curve Analysis Tool \title{GCAT: Growth Curve Analysis Tool}
}
\description{ \description{
Mathematical modeling and parameter estimation of high volume microbial growth data. Mathematical modeling and parameter estimation of high volume microbial growth data.
} }
\details{ \details{
GCAT utilizes the \code{\link{nls}} function in the R base package to fit logistic and Richards models to GCAT input is in .csv format. GCAT analysis is accessed using \code{\link{gcat.analysis.main}}
growth curve data. Input is in .csv format and analysis is accessed using \code{\link{gcat.analysis.main}}
or \code{\link{gcat.fit.main}}. Output is in .txt and .pdf format, and is accessed using \code{\link{gcat.analysis.main}}
or \code{\link{gcat.output.main}}.
\tabular{ll}{ GCAT utilizes the \code{\link[stats]{nls}} function in the R stats package to fit logistic, Gompertz and Richards models to growth curve
Version: \tab 5.0\cr data. Best model is selected automatically. Alternatively, the user may choose LOESS local regression fits, implemented using
Depends: \tab pheatmap, gplots\cr \code{\link[stats]{loess}} function in the R stats package
License: \tab LGPL-3\cr
Date: \tab 2014-02-10\cr
}
Internally, the data are stored in an array of \linkS4class{well} objects
} }
\author{
Jason Shao\cr
Nate DiPiazza\cr
Yury Bukhman\cr
Minh Bui\cr
Maintainer: Yury Bukhman
}

@ -1,18 +1,20 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/GCAT.main.R
\name{gcat.analysis.main} \name{gcat.analysis.main}
\alias{gcat.analysis.main} \alias{gcat.analysis.main}
\title{Analyze screening growth data from the given .csv files.} \title{Analyze screening growth data from the given .csv files.}
\usage{ \usage{
gcat.analysis.main(file.list, single.plate, layout.file = NULL, gcat.analysis.main(file.list, single.plate, layout.file = NULL,
out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""), out.dir = getwd(), graphic.dir = paste(out.dir, "/pics", sep = ""),
add.constant = 0.1, blank.value = NULL, start.index = 2, add.constant = 0, blank.value = NULL, start.index = 2,
growth.cutoff = 0.05, use.linear.param = F, use.loess = F, growth.cutoff = 0.05, use.linear.param = F, use.loess = F,
smooth.param = 0.1, points.to.remove = 0, remove.jumps = F, smooth.param = 0.1, lagRange = NA, totalRange = NA, specRange = NA,
time.input = NA, plate.nrow = 8, plate.ncol = 12, points.to.remove = 0, remove.jumps = F, time.input = NA,
input.skip.lines = 0, multi.column.headers = c("Plate.ID", "Well", "OD", plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0,
"Time"), single.column.headers = c("", "A1"), multi.column.headers = c("Plate.ID", "Well", "OD", "Time"),
layout.sheet.headers = c("Strain", "Media Definition"), silent = T, single.column.headers = c("", "A1"), layout.sheet.headers = c("Strain",
verbose = F, return.fit = F, overview.jpgs = T) "Media Definition"), silent = T, verbose = F, return.fit = F,
overview.jpgs = T)
} }
\arguments{ \arguments{
\item{file.list}{A list of full paths to .csv files. all files must be in the same format (see <single.plate>)} \item{file.list}{A list of full paths to .csv files. all files must be in the same format (see <single.plate>)}
@ -39,6 +41,12 @@ gcat.analysis.main(file.list, single.plate, layout.file = NULL,
\item{smooth.param}{Smoothing parameter for LOESS model.} \item{smooth.param}{Smoothing parameter for LOESS model.}
\item{lagRange}{The heatmap specific range for lag time.}
\item{totalRange}{The heatmap specific range for the achieved growth.}
\item{specRange}{The heatmap specific range for spec growth rate.}
\item{points.to.remove}{A list of numbers referring to troublesome points that should be removed across all wells.} \item{points.to.remove}{A list of numbers referring to troublesome points that should be removed across all wells.}
\item{remove.jumps}{Should the slope checking function be on the lookout for large jumps in OD?} \item{remove.jumps}{Should the slope checking function be on the lookout for large jumps in OD?}
@ -61,10 +69,12 @@ gcat.analysis.main(file.list, single.plate, layout.file = NULL,
\item{verbose}{Should sub-functions return messages to console? (when I say verbose, I mean it!)} \item{verbose}{Should sub-functions return messages to console? (when I say verbose, I mean it!)}
\item{return.fit}{Whether should a fit well object is returned or not.}
\item{overview.jpgs}{Should GCAT enable an overview image?} \item{overview.jpgs}{Should GCAT enable an overview image?}
} }
\value{ \value{
A list of the output files. Depending on return.fit setting, an array of fitted well objects or a list of output files
} }
\description{ \description{
Top-level GCAT function Top-level GCAT function

@ -0,0 +1,15 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/table2well.R
\name{gcat.append.arrays}
\alias{gcat.append.arrays}
\title{Function to combine two well array datasets by plate}
\usage{
gcat.append.arrays(...)
}
\arguments{
\item{...}{any number of array objects as long as they are all output straight from <load.data>}
}
\description{
This function can append together arrays created using <load.data>
}

@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/GCAT.main.R
\name{gcat.fit.main} \name{gcat.fit.main}
\alias{gcat.fit.main} \alias{gcat.fit.main}
\title{Main analysis function for GCAT} \title{Main analysis function for GCAT}
@ -68,6 +69,8 @@ By default(0) none are marked for removal.}
\item{single.column.headers}{The headers of the column when analyzing a single plate.} \item{single.column.headers}{The headers of the column when analyzing a single plate.}
\item{layout.sheet.headers}{The headers of the layout file.}
\item{growth.model}{What growth model should be used?} \item{growth.model}{What growth model should be used?}
\item{backup.growth.model}{If the main growth model fails, the back up model will be used.} \item{backup.growth.model}{If the main growth model fails, the back up model will be used.}
@ -75,8 +78,6 @@ By default(0) none are marked for removal.}
\item{silent}{Surpress all messages.} \item{silent}{Surpress all messages.}
\item{verbose}{Display all messages when analyzing each well.} \item{verbose}{Display all messages when analyzing each well.}
\item{layour.sheet.headers}{The headers of the layout file.}
} }
\value{ \value{
An array of well objects An array of well objects

@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/table2well.R
\name{gcat.load.data} \name{gcat.load.data}
\alias{gcat.load.data} \alias{gcat.load.data}
\title{Load tabular data} \title{Load tabular data}
@ -22,6 +23,8 @@ of running multiple analyses on the same dataset. If used, the function will ign
\item{single.plate.ID}{specifies a plate name for a single-plate read. If NULL, this is derived from the file name.} \item{single.plate.ID}{specifies a plate name for a single-plate read. If NULL, this is derived from the file name.}
\item{plate.layout}{Specifies the layout of the given plate.}
\item{plate.nrow}{The number of rows in the input files.} \item{plate.nrow}{The number of rows in the input files.}
\item{plate.ncol}{The number of columns in the input files.} \item{plate.ncol}{The number of columns in the input files.}
@ -37,13 +40,11 @@ of running multiple analyses on the same dataset. If used, the function will ign
\item{blank.value}{Blank OD measurement for uninoculated wells. By default(NULL), the value of the first OD \item{blank.value}{Blank OD measurement for uninoculated wells. By default(NULL), the value of the first OD
measurement in each well is used.} measurement in each well is used.}
\item{silent}{Surpress all messages.} \item{start.index}{Which timepoint should be used as the first one after inoculation?}
\item{plate.laout}{Specifies the layout of the given plate.}
\item{add.constant}{A value for r in the log(OD + r) transformation.} \item{single.plate}{Is the plate single type?}
\item{verbose}{Display all messages when analyzing each well.} \item{silent}{Surpress all messages.}
} }
\value{ \value{
A list of well objects. A list of well objects.

@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/GCAT.main.R
\name{gcat.output.main} \name{gcat.output.main}
\alias{gcat.output.main} \alias{gcat.output.main}
\title{Output function for generating files from fitted data.} \title{Output function for generating files from fitted data.}
@ -7,14 +8,21 @@ gcat.output.main(fitted.well.array, out.prefix = "", source.file.list,
upload.timestamp = NULL, add.constant, blank.value, start.index, upload.timestamp = NULL, add.constant, blank.value, start.index,
growth.cutoff, points.to.remove, remove.jumps, out.dir = getwd(), growth.cutoff, points.to.remove, remove.jumps, out.dir = getwd(),
graphic.dir = paste(out.dir, "/pics", sep = ""), overview.jpgs = T, graphic.dir = paste(out.dir, "/pics", sep = ""), overview.jpgs = T,
use.linear.param = F, use.loess = F, plate.nrow = 8, plate.ncol = 12, use.linear.param = F, use.loess = F, lagRange = NA, totalRange = NA,
unlog = F, silent = T) specRange = NA, plate.nrow = 8, plate.ncol = 12, unlog = F,
silent = T, main.envir)
} }
\arguments{ \arguments{
\item{fitted.well.array}{A list of fitted well objects.} \item{fitted.well.array}{A list of fitted well objects.}
\item{out.prefix}{Prefix that is in the name of output files.} \item{out.prefix}{Prefix that is in the name of output files.}
\item{source.file.list}{A list of the source files' names.}
\item{upload.timestamp}{The time format indicated by the user.}
\item{add.constant}{used to readjust for the constant added during the log transform when plotting ODs.}
\item{blank.value}{User can enter a blank OD measurement for uninoculated wells. \item{blank.value}{User can enter a blank OD measurement for uninoculated wells.
If NULL, defaults to the value of the first OD measurement of each well.} If NULL, defaults to the value of the first OD measurement of each well.}
@ -34,12 +42,25 @@ If NULL, defaults to the value of the first OD measurement of each well.}
\item{overview.jpgs}{should jpgs be generated for each plate with the overview graphic? \item{overview.jpgs}{should jpgs be generated for each plate with the overview graphic?
This is for backwards compatibility with the old web server.} This is for backwards compatibility with the old web server.}
\item{use.linear.param}{linear parameter is used or not?}
\item{use.loess}{Is LOESS model going to be used?}
\item{lagRange}{The heatmap specific range for lag time.}
\item{totalRange}{The heatmap specific range for the achieved growth.}
\item{specRange}{The heatmap specific range for spec growth rate.}
\item{plate.nrow}{The number of rows for a plate.}
\item{plate.ncol}{The number of columns for a plate}
\item{unlog}{should exported graphics be transformed back to the OD scale?} \item{unlog}{should exported graphics be transformed back to the OD scale?}
\item{silent}{should messages be returned to the console?} \item{silent}{should messages be returned to the console?}
\item{constant.added}{(should be the same value as add.constant above) - \item{main.envir}{starting environment of gcat.analysis.main(), captured as a list, printed out for debugging}
used to readjust for the constant added during the log transform when plotting ODs.}
} }
\value{ \value{
A list of output files if success. A list of output files if success.

@ -1,53 +0,0 @@
\name{gcat.set.constants}
\alias{gcat.set.constants}
\title{
Set global constants for GCAT analysis package
}
\description{
Sets global constants, mostly regarding issues in input file format, for GCAT analysis.
}
\usage{
gcat.set.constants(plate.nrow = 8, plate.ncol = 12, input.skip.lines = 0, time.format = "\%Y-\%m-\%d \%H:\%M:\%S",
multi.column.headers = c("Plate ID", "Well", "OD", "Time"), single.column.headers = c("", "A1"),
xlsx.data.headers = c("Plate ID", "Well positions"), xlsx.layout.sheet = "Plate layout",
layout.sheet.headers = c("Strain", "Media Definition"))
}
\arguments{
\item{plate.nrow}{
Number of rows present in each plate of input data. Default 8 (A-H)
}
\item{plate.ncol}{
Number of columns present in each plate of input data. Default 12 (1-12)
}
\item{input.skip.lines}{
Number of lines to skip at the top when reading input data files.
}
\item{time.format}{
Either a character describing the format used to convert timestamps
in the input to numbers representing number of seconds (see \code{\link{strptime}}), or a
factor to divide entries in the \code{Time} column by to get the number of hours.
}
\item{multi.column.headers}{
A character vector describing the names of the columns for
Plate ID, Well ID, Cellular density measurements and Time, respectively, in the multi-plate (long) format.
}
\item{single.column.headers}{
A character vector describing the name of the Time column and the first well data in the single plate (wide) format.
}
\item{xlsx.data.headers}{
For .xlsx data only, a vector describing possible entries in the upper left cell marking worksheets in each
workbook as containing data. .csv files don't have multiple worksheets and are assumed to contain useable data.
}
\item{xlsx.layout.sheet}{
For .xlsx data only, the name of the worksheet containing plate layout information. .csv files use a separate layout file.
}
\item{layout.sheet.headers}{
A character vector describing the name of the Strain and Media definiton columns, respectively, in the plate layout file.
}
}
\value{
NULL
}
\author{
Jason Shao
}

@ -0,0 +1,25 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/table2well.R
\name{gcat.start.times}
\alias{gcat.start.times}
\title{Convert timestamps to hours from start and sort timepoints
This function acts on a single well and modifies the raw data stored in slot "screen.data"}
\usage{
gcat.start.times(input.well, time.input, start.index = 2)
}
\arguments{
\item{input.well}{an object of class well}
\item{time.input}{specifies time format in the input. allowed values are "%S", for seconds, "%d", for days, or anything complying with
ISO C / POSIX standards; see <strptime>.}
\item{start.index}{which timepoint should be used as the starting time at inoculation?}
}
\description{
Convert timestamps to hours from start and sort timepoints
This function acts on a single well and modifies the raw data stored in slot "screen.data"
}
\details{
note: reading directly from excel to R results in timestamps being converted to days.
}

@ -0,0 +1,16 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/class.well.R
\docType{methods}
\name{length,well-method}
\alias{length,well-method}
\title{Get the number of data points in a well}
\usage{
\S4method{length}{well}(x)
}
\arguments{
\item{x}{object of class \code{well}}
}
\description{
Get the number of data points in a well
}

@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/class.model.R
\name{model} \name{model}
\alias{model} \alias{model}
\title{Model} \title{Model}

@ -0,0 +1,43 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/normalize.and.transform.R
\name{normalize.ODs}
\alias{normalize.ODs}
\title{Normalize OD readings for an entire array of well objects}
\usage{
normalize.ODs(well.array, normalize.method = "default", blank.value = NULL,
start.index = 2, add.constant = 1)
}
\arguments{
\item{well.array}{an array of well objects.}
\item{normalize.method}{see Details}
\item{blank.value}{user can enter a blank OD measurement for uninoculated wells. if NULL, defaults to the value of the first OD measurement of each well.}
\item{start.index}{which timepoint should be used as the first one after inoculation (defaults to the 2th one)}
\item{add.constant}{add a numeric constant to all timepoints in all wells.}
}
\description{
Normalize OD readings for an entire array of well objects
}
\details{
Note: This function does not write any new OD values to the well objects in the array - it only
fills the "norm" slot of each well object in the array with a value that will be subtracted
from all OD measurements when returning data from the wells using the function <data.from> (see well.class.R)
These functions make use of <raw.data> which simply returns the raw time and OD of a well (also see well.class.R)
note this is the only normalization function that acts on an entire array instead of an individual well.
normalize.method settings:
\describe{
\item{default}{subtracts the blank OD (either specified by <blank.value> or taken from the first timepoint as default)
of each well from all timepoints in that well}
\item{average.blank}{subtracts the mean of all first OD timepoints on a plate from all timepoints in all wells on that plate}
\item{average.first}{takes the mean of the difference between the OD of the specified <start> timepoint and the first timepoint of all wells on a plate
and subtracts this value from all timepoints in all wells on that plate}
\item{anything else}{do nothing}
}
}

@ -0,0 +1,43 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/class.well.R
\docType{methods}
\name{plot,well,missing-method}
\alias{plot,well,missing-method}
\title{A plot method for well}
\usage{
\S4method{plot}{well,missing}(x, y, constant.added = 1, xlim = NULL,
ylim = NULL, well.number = NULL, scale = 1, number.points = T,
draw.symbols = F, show.text = T, show.calc = T, draw.guess = NULL,
...)
}
\arguments{
\item{x}{object of class well}
\item{y}{not used}
\item{constant.added}{used to readjust for the constant added during the log transform: log.OD = log(OD - blank + constant.added)}
\item{xlim}{x axis limits, vector of length 2}
\item{ylim}{y axis limits, vector of length 2}
\item{well.number}{the number of the well in an array of wells}
\item{scale}{determines the font scale for the entire graph. all cex values are calculated from this}
\item{number.points}{should points be labeled with numeric indices?}
\item{draw.symbols}{should <check.slopes> be called on the well and markings drawn on the graph?}
\item{show.text}{show R^2 and growth curve parameters as text on the plot}
\item{show.calc}{draw lines that illustrate growth curve parameters}
\item{draw.guess}{initial guess model. Drawn if specified}
\item{...}{additional arguments passed to the generic plot function}
}
\description{
A plot method for well
}

@ -1,9 +1,10 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
\name{plot.data} % Please edit documentation in R/plot.fit.R
\alias{plot.data} \name{plot_data}
\title{plot.data} \alias{plot_data}
\title{plot_data}
\usage{ \usage{
\method{plot}{data}(input.well, view.raw.data = F, unlog = F, scale = 1, plot_data(input.well, view.raw.data = F, unlog = F, scale = 1,
main = paste(plate.name(input.well), well.name(input.well)), main = paste(plate.name(input.well), well.name(input.well)),
number.points = T, draw.symbols = F, constant.added, ylim, ...) number.points = T, draw.symbols = F, constant.added, ylim, ...)
} }
@ -16,10 +17,16 @@
\item{scale}{determines the font scale for the entire graph. all cex values are calculated from this.} \item{scale}{determines the font scale for the entire graph. all cex values are calculated from this.}
\item{main}{...}
\item{number.points}{should points be labeled with numeric indices?} \item{number.points}{should points be labeled with numeric indices?}
\item{draw.symbols}{- should <check.slopes> be called on the well and markings drawn on the graph?} \item{draw.symbols}{- should <check.slopes> be called on the well and markings drawn on the graph?}
\item{constant.added}{Similar to added.constant.}
\item{ylim}{...}
\item{...}{additional arguments passed to plot()} \item{...}{additional arguments passed to plot()}
} }
\description{ \description{

@ -0,0 +1,29 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/table.output.R
\name{table.out}
\alias{table.out}
\title{Populate an output table with parameters and other useful info for each well in a fitted dataset.}
\usage{
table.out(fitted.data.set, unlog = F, constant.added, reach.cutoff = 0.9,
filename.timestamp = NULL, use.linear.param = F, use.loess = F)
}
\arguments{
\item{fitted.data.set}{array of fitted well objects}
\item{unlog}{- Should OD values be returned on the linear scale instead of log-transformed scale?}
\item{constant.added}{- For returning values on linear scale, what constant was added to ODs before the log transform?}
\item{reach.cutoff}{- what proportion of the plateau OD must tbe reached by the last valid timepoint for the curve to be marked as reaching
its plateau OD?}
\item{filename.timestamp}{timestamp for addition to output file names (for file references in last column of the output)}
\item{use.linear.param}{did the model formula contain a linear parameter? Should normally be FALSE, as the linear parameter is deprecated}
\item{use.loess}{was LOESS used to fit the data (instead of unsing a growth curve model formula)?}
}
\description{
Populate an output table with parameters and other useful info for each well in a fitted dataset.
}

@ -1,7 +1,8 @@
% Generated by roxygen2 (4.0.2): do not edit by hand % Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/normalize.and.transform.R
\name{transform.ODs} \name{transform.ODs}
\alias{transform.ODs} \alias{transform.ODs}
\title{Transform.Ods} \title{Log-transform OD readings for a single well object}
\usage{ \usage{
\method{transform}{ODs}(input.well, use.log = T, blank.value = NULL, \method{transform}{ODs}(input.well, use.log = T, blank.value = NULL,
start.index = 2, negative.OD.cutoff = 10, constant.added = 1, ...) start.index = 2, negative.OD.cutoff = 10, constant.added = 1, ...)
@ -17,6 +18,10 @@ or raw normalized data is returned using the function \code{data.from}.}
\item{start.index}{which timepoint should be used as the first one after inoculation (defaults to the 2th one)} \item{start.index}{which timepoint should be used as the first one after inoculation (defaults to the 2th one)}
\item{negative.OD.cutoff}{if any ODs below the specified blank value are detected before this index timepoint, the entire well is discarded.} \item{negative.OD.cutoff}{if any ODs below the specified blank value are detected before this index timepoint, the entire well is discarded.}
\item{constant.added}{similar to added.constant.}
\item{...}{Additional arguments for this function.}
} }
\description{ \description{
This function adds a "log.OD" column to the "screen.data" slot of a well object with log-transformed data. This function adds a "log.OD" column to the "screen.data" slot of a well object with log-transformed data.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save