summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-07-12 11:43:53 +0200
committermr <mr@mrautenberg.de>2011-07-12 11:43:53 +0200
commitda05e77d831aa174adfa8d487345f2c6f3a80ec3 (patch)
treee965c5ae8964d78731df6cb476546024f7e9e3c6
parent2e79dc191027651acdda0e63c32da78a9c33148b (diff)
fix broken prediction details https://github.com/opentox/toxcreate/issues/49
-rw-r--r--application.rb1
-rw-r--r--helper.rb8
2 files changed, 8 insertions, 1 deletions
diff --git a/application.rb b/application.rb
index a2ead03..54aeb3d 100644
--- a/application.rb
+++ b/application.rb
@@ -359,6 +359,7 @@ post '/predict/?' do # post chemical name to model
db_activities = []
lazar = OpenTox::Model::Lazar.new model.uri
prediction_dataset_uri = lazar.run({:compound_uri => @compound.uri, :subjectid => subjectid})
+ LOGGER.debug "Prediction dataset_uri: #{prediction_dataset_uri}"
prediction_dataset = OpenTox::LazarPrediction.find(prediction_dataset_uri, subjectid)
if prediction_dataset.metadata[OT.hasSource].match(/dataset/)
@predictions << {
diff --git a/helper.rb b/helper.rb
index 2bbab30..0acb90e 100644
--- a/helper.rb
+++ b/helper.rb
@@ -53,7 +53,13 @@ helpers do
def sort(descriptors)
features = {:activating => [], :deactivating => []}
- descriptors.each { |d| features[d[OT.effect].to_sym] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} }
+ descriptors.each do |d|
+ if d[OT.effect] =~ TRUE_REGEXP
+ features[:activating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]}
+ elsif d[OT.effect] =~ FALSE_REGEXP
+ features[:deactivating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]}
+ end
+ end
features
end