diff options
author | mr <mr@mrautenberg.de> | 2011-07-12 11:43:53 +0200 |
---|---|---|
committer | mr <mr@mrautenberg.de> | 2011-07-12 11:43:53 +0200 |
commit | da05e77d831aa174adfa8d487345f2c6f3a80ec3 (patch) | |
tree | e965c5ae8964d78731df6cb476546024f7e9e3c6 | |
parent | 2e79dc191027651acdda0e63c32da78a9c33148b (diff) |
fix broken prediction details https://github.com/opentox/toxcreate/issues/49
-rw-r--r-- | application.rb | 1 | ||||
-rw-r--r-- | helper.rb | 8 |
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 << { @@ -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 |