summaryrefslogtreecommitdiff
path: root/fminer.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-02-04 19:41:23 +0100
committerChristoph Helma <helma@in-silico.de>2010-02-04 19:41:23 +0100
commite6c289e2d7ff2695a5018f09a4cce3867c0a7e7a (patch)
treebbeea475c638f3ecfe8b5514991e67e043b3d8e9 /fminer.rb
parent7ead2a8025487cde52718a9e09034e8cb6858168 (diff)
tasks as trees, prediction of database structures, improved error checking
Diffstat (limited to 'fminer.rb')
-rw-r--r--fminer.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/fminer.rb b/fminer.rb
index 63391ac..e3f47fc 100644
--- a/fminer.rb
+++ b/fminer.rb
@@ -42,7 +42,12 @@ post '/fminer/?' do
@@fminer.Reset
LOGGER.debug "Fminer: initialising ..."
training_dataset.data.each do |c,features|
- smiles = OpenTox::Compound.new(:uri => c.to_s).smiles
+ begin
+ smiles = OpenTox::Compound.new(:uri => c.to_s).smiles
+ rescue
+ LOGGER.warn "No resource for #{c.to_s}"
+ next
+ end
if smiles == '' or smiles.nil?
LOGGER.warn "Cannot find smiles for #{c.to_s}."
else
@@ -54,15 +59,19 @@ post '/fminer/?' do
else
case act.to_s
when "true"
- LOGGER.debug '"' + smiles +'"' + "\t" + true.to_s
+ LOGGER.debug id.to_s + ' "' + smiles +'"' + "\t" + true.to_s
activity = 1
when "false"
- LOGGER.debug '"' + smiles +'"' + "\t" + false.to_s
+ LOGGER.debug id.to_s + ' "' + smiles +'"' + "\t" + false.to_s
activity = 0
end
compounds[id] = compound
- @@fminer.AddCompound(smiles,id)
- @@fminer.AddActivity(activity, id)
+ begin
+ @@fminer.AddCompound(smiles,id)
+ @@fminer.AddActivity(activity, id)
+ rescue
+ LOGGER.warn "Could not add " + smiles + "\t" + activity + " to fminer"
+ end
end
end
id += 1