diff options
author | mguetlein <martin.guetlein@gmail.com> | 2012-12-04 21:08:43 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2012-12-04 21:08:43 +0100 |
commit | a1f436973a6efe86797dc2fb8c53762fec45cc31 (patch) | |
tree | be622ac941c9b7e9dc27e9f462528b75cbb56e6f /lazar.rb | |
parent | c728fd0b098f8a1b46ad10a2de9a484245ecee3b (diff) | |
parent | 3354bb1fa500df3420d659553db0da9e49f02357 (diff) |
Merge branch 'oldarch' of github.com:opentox/algorithm into oldarcholdarch
Diffstat (limited to 'lazar.rb')
-rw-r--r-- | lazar.rb | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -183,13 +183,17 @@ post '/lazar/?' do # Creating InChi/URI Hash from trainig_feature for comparison with training_dataset to avoid missmatches caused by different URI authorities feature_compounds = {} - which_row={} training_features.compounds.each {|f_c_uri| f_compound = OpenTox::Compound.new(f_c_uri) feature_compounds[f_compound.to_inchi] = f_c_uri - which_row[f_compound.to_inchi] = 0 } - + + which_row=training_dataset.compounds.inject({}) { |h,c| + t_compound = OpenTox::Compound.new(c) + h[t_compound.to_inchi]=0 + h + } + training_dataset.compounds.each do |t_c_uri| t_compound = OpenTox::Compound.new(t_c_uri) @@ -201,7 +205,6 @@ post '/lazar/?' do else lazar.fingerprints[t_c_uri] = {} unless lazar.fingerprints[t_c_uri] entry.keys.each do |feature| - # CASE 1: Substructure if (lazar.feature_calculation_algorithm == "Substructure.match") || (lazar.feature_calculation_algorithm == "Substructure.match_hits") if training_features.features[feature] @@ -214,16 +217,15 @@ post '/lazar/?' do lazar.effects[smarts] = training_features.features[feature][OT.effect] end end - # CASE 2: Others elsif entry[feature].flatten.size == 1 lazar.fingerprints[t_c_uri][feature] = [] unless lazar.fingerprints[t_c_uri][feature] lazar.fingerprints[t_c_uri][feature] << entry[feature][row_idx] lazar.features << feature unless lazar.features.include? feature end - end end + which_row[t_compound.to_inchi] += 1 end |