summaryrefslogtreecommitdiff
path: root/fminer.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-01-22 13:15:27 +0100
committerChristoph Helma <helma@in-silico.de>2010-01-22 13:15:27 +0100
commitcd77b6880a7b0d34536e645dd057ceff40705456 (patch)
treef7fb26a77433f87e989d17e9d1f2ed251ef77eb4 /fminer.rb
parent180a017b54bb7858cccb6235e2966162612e7085 (diff)
central config.ru, logger instead of puts
Diffstat (limited to 'fminer.rb')
-rw-r--r--fminer.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/fminer.rb b/fminer.rb
index a42f3d6..36cc87e 100644
--- a/fminer.rb
+++ b/fminer.rb
@@ -17,7 +17,7 @@ post '/fminer/?' do
Spork.spork(:logger => LOGGER) do
- LOGGER.info "Task #{task.uri} created"
+ LOGGER.debug "Task #{task.uri} created"
task.started
feature_dataset = OpenTox::Dataset.new
@@ -31,19 +31,21 @@ post '/fminer/?' do
compounds = []
@@fminer.Reset
training_dataset.feature_values(feature_uri).each do |c,f|
+ LOGGER.debug c.to_s
smiles = OpenTox::Compound.new(:uri => c.to_s).smiles
+ LOGGER.debug smiles.to_s
compound = feature_dataset.find_or_create_compound(c.to_s)
- puts "No #{feature_uri} for #{c.to_s}." if f.size == 0
+ LOGGER.debug "No #{feature_uri} for #{c.to_s}." if f.size == 0
f.each do |act|
- #puts act
+ LOGGER.debug act.to_s
case act.to_s
- when "true"
- #puts smiles + "\t" + true.to_s
+ when /^true|active|1$/
+ LOGGER.debug smiles + "\t" + true.to_s
compounds[id] = compound
@@fminer.AddCompound(smiles,id)
@@fminer.AddActivity(true, id)
- when "false"
- #puts smiles + "\t" + false.to_s
+ when /^false|inactive|0$/
+ LOGGER.debug smiles + "\t" + false.to_s
compounds[id] = compound
@@fminer.AddCompound(smiles,id)
@@fminer.AddActivity(false, id)
@@ -69,7 +71,7 @@ post '/fminer/?' do
effect = 'deactivating'
end
tuple = feature_dataset.create_tuple(bbrc_feature,{ url_for('/fminer#smarts',:full) => smarts, url_for('/fminer#p_value',:full) => p_value, url_for('/fminer#effect',:full) => effect })
- #puts "#{f[0]}\t#{f[1]}\t#{effect}"
+ LOGGER.debug "#{f[0]}\t#{f[1]}\t#{effect}"
ids.each do |id|
feature_dataset.add_tuple compounds[id], tuple
end
@@ -77,7 +79,7 @@ post '/fminer/?' do
end
uri = feature_dataset.save # does not return
- LOGGER.info "Dataset #{uri} created."
+ LOGGER.debug "Dataset #{uri} created."
task.completed(uri)
end
task.uri