summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-07-01 10:05:36 +0200
committerChristoph Helma <helma@in-silico.ch>2010-07-01 10:05:36 +0200
commitc024c22038eb2eb16d946132eca908412515c656 (patch)
tree003012a6fa5d851aeb43aee2ebf6414da4e50965 /lib
parent1b7aa1e22b972f8d297b479319bc586033ee7385 (diff)
log level moved to config, model type detection updated
Diffstat (limited to 'lib')
-rw-r--r--lib/dataset.rb10
-rw-r--r--lib/environment.rb11
-rw-r--r--lib/model.rb2
3 files changed, 11 insertions, 12 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb
index 1254992..fc4502a 100644
--- a/lib/dataset.rb
+++ b/lib/dataset.rb
@@ -86,8 +86,10 @@ module OpenTox
def get_predicted_class(compound, feature)
v = get_value(compound, feature)
if v.is_a?(Hash)
- if v.has_key?(:classification)
- return v[:classification]
+ k = v.keys.grep("classification")
+ unless k.empty?
+ #if v.has_key?(:classification)
+ return v[k]
else
return "no classification key"
end
@@ -107,7 +109,9 @@ module OpenTox
def get_prediction_confidence(compound, feature)
v = get_value(compound, feature)
if v.is_a?(Hash)
- if v.has_key?(:confidence)
+ k = v.keys.grep("confidence")
+ unless k.empty?
+ #if v.has_key?(:confidence)
return v[:confidence].abs
else
# PENDING: return nil isntead of raising an exception
diff --git a/lib/environment.rb b/lib/environment.rb
index ceb3ef8..e37463b 100644
--- a/lib/environment.rb
+++ b/lib/environment.rb
@@ -107,17 +107,12 @@ end
logfile = "#{LOG_DIR}/#{ENV["RACK_ENV"]}.log"
LOGGER = MyLogger.new(logfile,'daily') # daily rotation
-case `hostname`
-when /ot-dev/
+if @@config[:logger] and @@config[:logger] == "debug"
LOGGER.level = Logger::DEBUG
else
LOGGER.level = Logger::WARN
end
-#LOGGER = MyLogger.new(STDOUT)
-#LOGGER.datetime_format = "%Y-%m-%d %H:%M:%S "
-
-
if File.exist?(user_file)
@@users = YAML.load_file(user_file)
else
@@ -141,8 +136,8 @@ OT = Redland::Namespace.new 'http://www.opentox.org/api/1.1#'
XML = Redland::Namespace.new 'http://www.w3.org/2001/XMLSchema#'
# Regular expressions for parsing classification data
-TRUE_REGEXP = /^(true|active|$1^)/
-FALSE_REGEXP = /^(false|inactive|$0^)/
+TRUE_REGEXP = /^(true|active|1|1.0)$/i
+FALSE_REGEXP = /^(false|inactive|0|0.0)$/i
# Task durations
DEFAULT_TASK_MAX_DURATION = @@config[:default_task_max_duration]
diff --git a/lib/model.rb b/lib/model.rb
index e3ddeb0..f2d7ba5 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -61,7 +61,7 @@ module OpenTox
def classification?
#HACK replace with request to ontology server
- if @title =~ /lazar classification/
+ if @title =~ /classification/
return true
elsif @uri =~/ntua/ and @title =~ /mlr/
return false