Fixed #11: validation of heat map ranges
This commit is contained in:
Binary file not shown.
@@ -141,6 +141,17 @@ gcat.analysis.main = function(file.list, single.plate, layout.file = NULL,
|
||||
exception("", "time.input is NA.")
|
||||
}
|
||||
|
||||
# Check heatmap ranges
|
||||
for (range1 in list(lagRange, totalRange, totalODRange, specRange)) {
|
||||
if (!identical(range1,NA)) {
|
||||
range1.string = paste(range1,collapse="-")
|
||||
if (length(range1) != 2) exception("",paste("Heat map range must contain 2 values. Bad range:", range1.string))
|
||||
if (!all(is.finite(range1))) exception("",paste("Heat map range must be numeric and finite. Bad range:", range1.string))
|
||||
if (!all(range1 >= 0)) exception("",paste("Heat map range must be positive. Bad range:", range1.string))
|
||||
if (range1[1] >= range1[2]) exception("",paste("Heat map range max must be > min. Bad range:", range1.string))
|
||||
}
|
||||
}
|
||||
|
||||
# MB: Now add.constant will always be 0.
|
||||
# No need to check.
|
||||
#if (add.constant < 0)
|
||||
|
||||
+8
-7
@@ -11,13 +11,6 @@ INPUT.FILE = "YPDAFEXglucoseTests_2-25-10.csv"
|
||||
library(GCAT)
|
||||
setwd(INPUT.DIR)
|
||||
time.input=1/3600
|
||||
# - do not specify parameter ranges
|
||||
out1 = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||
out.dir = OUTPUT.DIR.1, graphic.dir = OUTPUT.DIR.1,
|
||||
add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
|
||||
use.linear.param=F, use.loess=F, smooth.param=0.1,
|
||||
points.to.remove = integer(), remove.jumps = F, time.input=time.input,
|
||||
silent = F, verbose = T, return.fit = T, overview.jpgs = T)
|
||||
|
||||
# - do specify parameter ranges
|
||||
out2 = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||
@@ -28,5 +21,13 @@ out2 = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file
|
||||
silent = F, verbose = T, return.fit = T, overview.jpgs = T,
|
||||
lagRange = c(0,3), totalRange = c(0.2,0.82), totalODRange = c(0.06,1), specRange = c(0.04,0.13))
|
||||
|
||||
# - do not specify parameter ranges
|
||||
out1 = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||
out.dir = OUTPUT.DIR.1, graphic.dir = OUTPUT.DIR.1,
|
||||
add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
|
||||
use.linear.param=F, use.loess=F, smooth.param=0.1,
|
||||
points.to.remove = integer(), remove.jumps = F, time.input=time.input,
|
||||
silent = F, verbose = T, return.fit = T, overview.jpgs = T)
|
||||
|
||||
# Verify that specifying parameter ranges did not affect any computations except for how the heat maps are drawn
|
||||
all.equal(out1,out2)
|
||||
@@ -97,10 +97,21 @@ class Assay
|
||||
#validates :plate_dimensions_column, :numericality => { :only_integer => true, :greater_than => 0}
|
||||
#validates :plate_dimensions_row, :numericality => { :only_integer => true, :greater_than => 0 }
|
||||
|
||||
#validate inoculation timepoint
|
||||
# (7) validate inoculation timepoint
|
||||
validates :start_index, :numericality => { :only_integer => true, :greater_than => 0}
|
||||
|
||||
|
||||
# (8) validate heatmap ranges
|
||||
#validates_numericality_of :blank_value_input,:if => :user_input?, :message => '- Invalid OD blank value. Please Enter A Real Number.'
|
||||
validates_numericality_of :totg_min, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :totg_max, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :totg_OD_min, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :totg_OD_max, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :specg_min, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :specg_max, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :lagT_min, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
validates_numericality_of :lagT_max, :if => :user_input?, :allow_blank => true, :greater_than_or_equal_to => 0, :message => '- Please Enter a positive real number.'
|
||||
|
||||
|
||||
def initialize(attributes = {})
|
||||
attributes.each do |name, value|
|
||||
send("#{name}=", value)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user