Files
2015-GCAT/R/GCAT/.Rproj.user/7CB73FCA/sdb/per/t/74C1CB00
T

16 lines
11 KiB
Plaintext
Raw Normal View History

2015-04-10 15:12:45 -05:00
{
"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# #\n# Normalize OD readings for an entire array of well objects #\n# #\n########################################################################\n#\n# Note: This function does not write any new OD values to the well objects in the array - it only \n# fills the \"norm\" slot of each well object in the array with a value that will be subtracted \n# from all OD measurements when returning data from the wells using the function <data.from> (see well.class.R) \n#\n# These functions make use of <raw.data> which simply returns the raw time and OD of a well (also see well.class.R)\n#\n# 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.\n# normalize.method: \n# - (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\n# - average.blank: subtracts the mean of all first OD timepoints on a plate from all timepoints in all wells on that plate\n# - 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\n# and subtracts this value from all timepoints in all wells on that plate\n# - anything else: do nothing\n# 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. \n# start.index - which timepoint should be used as the first one after inoculation (defaults to the 2th one)\n# add.constant: add a numeric constant to all timepoints in all wells. \nnormalize.ODs = function(well.array, normalize.method = \"default\", blank.value = NULL, start.index = 2, add.constant = 1){\n \n if (normalize.method == \"default\"){\n well.array = aapply(well.array, function(well, blank.value){\n # Use the blank OD value if specified; otherwise, get it from the first OD timepoint. \n if(is.null(blank.value)) blank.value = raw.data(well)[1,2]\n # Set the blank OD (minus the constant to be added) to the \"norm\" slot of each well.\n \twell@norm = blank.value - add.constant\n \treturn(well)}, blank.value)\n }\n else if (normalize.method == \"average.blank\"){ \n # Use the blank OD value if specified; otherwise, get it from the first OD timepoint.\n\t\tblank.ODs = unlist(aapply(well.array, function(well, blank.value){\n if(is.null(blank.value)) blank.value = raw.data(well)[1,2]\n return(blank.value)}, blank.value))\n\t\tplate.IDs = unlist(aapply(well.array, plate.name))\n\t\tblank.averages = tapply(blank.ODs, plate.IDs, mean)\n\t # Set this value (minus the constant to be added) to the \"norm\" slot of each well. \n\t\twell.array = aapply(well.array, function(well){\n\t\t\twell@norm = blank.averages[plate.name(well)] - add.constant\n\t\t\treturn(well)})\n\t\t}\n\telse if (normaliz
"created" : 1425413265888.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3349576883",
"id" : "74C1CB00",
"lastKnownWriteTime" : 1428436335,
"path" : "~/Documents/GCAT4/trunk/R/GCAT/R/normalize.and.transform.R",
"project_path" : "R/normalize.and.transform.R",
"properties" : {
},
"source_on_save" : false,
"type" : "r_source"
}