From 35448f7bd136b7f3ce82a784e2c433bdea2b9880 Mon Sep 17 00:00:00 2001 From: ot5 Date: Fri, 13 Apr 2012 14:56:37 +0200 Subject: Fix: verbose prediction ds for Substructure.lookup --- lib/model.rb | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/model.rb b/lib/model.rb index 8d7e4f6..88023eb 100644 --- a/lib/model.rb +++ b/lib/model.rb @@ -319,6 +319,16 @@ module OpenTox @prediction_dataset.add @compound.uri, feature_uri, true f+=1 end + elsif @feature_calculation_algorithm == "Substructure.lookup" + f = 0 + @compound_features.each do |feature, value| + features[feature] = feature + @prediction_dataset.add_feature(feature, { + RDF.type => [OT.NumericFeature] + }) + @prediction_dataset.add @compound.uri, feature, value + f+=1 + end else @compound_features.each do |feature| features[feature] = feature @@ -342,15 +352,26 @@ module OpenTox else feature_uri = feature end - @prediction_dataset.add neighbor[:compound], feature_uri, true + if @feature_calculation_algorithm == "Substructure.lookup" + @prediction_dataset.add neighbor[:compound], feature_uri, @fingerprints[neighbor[:compound]][feature_uri] + else + @prediction_dataset.add neighbor[:compound], feature_uri, true + end + unless features.has_key? feature features[feature] = feature_uri - @prediction_dataset.add_feature(feature_uri, { - RDF.type => [OT.Substructure], - OT.smarts => feature, - OT.pValue => @p_values[feature], - OT.effect => @effects[feature] - }) + if @feature_calculation_algorithm == "Substructure.lookup" + @prediction_dataset.add_feature(feature_uri, { + RDF.type => [OT.NumericFeature] + }) + else + @prediction_dataset.add_feature(feature_uri, { + RDF.type => [OT.Substructure], + OT.smarts => feature, + OT.pValue => @p_values[feature], + OT.effect => @effects[feature] + }) + end f+=1 end end -- cgit v1.2.3