diff options
-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 |