diff options
author | Christoph Helma <helma@in-silico.ch> | 2013-04-08 17:58:45 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2013-04-08 17:58:45 +0200 |
commit | 2cfe47dbadeb9b013c875500e4f14e9d287f1a1f (patch) | |
tree | 222ec5f39864c1bb2bcd818f3e759d9131ecb88c | |
parent | 669137532e30d0601e0f47fa903b2c3cc275abba (diff) |
debug messsages partially removed, gem depencies updated. tested with ruby 2.0.0p0
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | algorithm.gemspec | 12 | ||||
-rw-r--r-- | lib/algorithm/feature_values.rb | 1 | ||||
-rw-r--r-- | lib/algorithm/similarity.rb | 2 | ||||
-rw-r--r-- | lib/algorithm/transform.rb | 5 | ||||
-rw-r--r-- | lib/lazar.rb | 10 | ||||
-rw-r--r-- | webapp/fminer.rb | 40 | ||||
-rw-r--r-- | webapp/lazar.rb | 3 |
9 files changed, 9 insertions, 67 deletions
@@ -4,3 +4,4 @@ public/*.owl java/docs/* *.*~ Gemfile.lock +fminer_debug.txt @@ -1,4 +1,4 @@ -source :gemcutter +source "https://rubygems.org" gemspec gem 'opentox-server', :path => "../opentox-server" gem "opentox-client", :path => "../opentox-client" diff --git a/algorithm.gemspec b/algorithm.gemspec index dc334b9..b9d3241 100644 --- a/algorithm.gemspec +++ b/algorithm.gemspec @@ -19,11 +19,11 @@ Gem::Specification.new do |s| # specify any dependencies here; for example: s.add_runtime_dependency "opentox-server" s.add_runtime_dependency "opentox-client" - s.add_runtime_dependency 'rinruby', "~>2.0.2" - s.add_runtime_dependency 'nokogiri', "~>1.4.4" - s.add_runtime_dependency 'statsample', "~>1.1" - s.add_runtime_dependency 'gsl', "~>1.14" - s.add_runtime_dependency "openbabel", "~>2.3.1.5" - s.add_runtime_dependency "rjb" ,"1.4.3" # error in 1.4.5 + s.add_runtime_dependency 'rinruby'#, "~>2.0.2" + s.add_runtime_dependency 'nokogiri'#, "~>1.4.4" + s.add_runtime_dependency 'statsample'#, "~>1.1" + s.add_runtime_dependency 'gsl'#, "~>1.14" + s.add_runtime_dependency "openbabel"#, "~>2.3.1.5" + s.add_runtime_dependency "rjb" ,"1.4.6" # error in 1.4.5#,"1.4.3" s.post_install_message = "Please configure your service in ~/.opentox/config/algorithm.rb" end diff --git a/lib/algorithm/feature_values.rb b/lib/algorithm/feature_values.rb index 62373e7..9a575a3 100644 --- a/lib/algorithm/feature_values.rb +++ b/lib/algorithm/feature_values.rb @@ -14,7 +14,6 @@ module OpenTox # @return [Array] Array with matching Smarts def self.match(params, subjectid) features = params[:feature_dataset].features.collect{ |f| f[RDF::DC.title] } - puts features.inspect params[:compound].match(features) end diff --git a/lib/algorithm/similarity.rb b/lib/algorithm/similarity.rb index 88eed35..22b4c28 100644 --- a/lib/algorithm/similarity.rb +++ b/lib/algorithm/similarity.rb @@ -15,8 +15,6 @@ module OpenTox # @param [Array] b fingerprints of second compound # @return [Float] Tanimoto similarity def self.tanimoto(a,b) - puts a.inspect - puts b.inspect common_p_sum = 0.0 all_p_sum = 0.0 size = [ a.size, b.size ].min diff --git a/lib/algorithm/transform.rb b/lib/algorithm/transform.rb index c851f73..b2f7e7e 100644 --- a/lib/algorithm/transform.rb +++ b/lib/algorithm/transform.rb @@ -334,13 +334,8 @@ module OpenTox # @param[Array] training_props Propositionalized data for this neighbor # @param[Integer] Index of neighbor def add_neighbor(training_props, idx) - puts idx - #puts training_props.inspect - #puts @q_prop.inspect - #puts @model.acts[idx].to_s unless @model.acts[idx].nil? sim = similarity(training_props) - puts sim if sim > @model.min_sim.to_f @model.neighbors << { :compound => @cmpds[idx], diff --git a/lib/lazar.rb b/lib/lazar.rb index b85c13b..3b8621c 100644 --- a/lib/lazar.rb +++ b/lib/lazar.rb @@ -17,7 +17,6 @@ module OpenTox params.each {|k,v| self.class.class_eval { attr_accessor k.to_sym } instance_variable_set "@#{k}", v - puts "#{k} => #{v}" @prediction_dataset.parameters << {RDF::DC.title => k, RDF::OT.paramValue => v} } ["cmpds", "fps", "acts", "n_prop", "q_prop", "neighbors"].each {|k| @@ -25,13 +24,9 @@ module OpenTox instance_variable_set("@#{k}", []) } - puts "Loading #{@prediction_feature_uri}" @prediction_feature = OpenTox::Feature.new(@prediction_feature_uri,@subjectid) @predicted_variable = OpenTox::Feature.new @predicted_variable_uri, @subjectid @predicted_confidence = OpenTox::Feature.new @predicted_confidence_uri, @subjectid - puts @predicted_variable.inspect - puts @predicted_confidence.inspect - puts "Setting metadata" #@prediction_dataset.metadata = { @prediction_dataset.metadata = { RDF::DC.title => "Lazar prediction for #{@prediction_feature.title}", @@ -41,10 +36,8 @@ module OpenTox RDF::OT.predictedVariables => [@predicted_variable_uri,@predicted_confidence_uri] } - puts "Loading #{@training_dataset_uri}" @training_dataset = OpenTox::Dataset.new(@training_dataset_uri,@subjectid) - puts "Loading #{@feature_dataset_uri}" @feature_dataset = OpenTox::Dataset.new(@feature_dataset_uri, @subjectid) bad_request_error "No features found in feature dataset #{@feature_dataset.uri}." if @feature_dataset.features.empty? @@ -55,14 +48,12 @@ module OpenTox prediction_feature_pos = @training_dataset.features.collect{|f| f.uri}.index @prediction_feature.uri if @dataset_uri - puts "Loading #{@dataset_uri}" compounds = OpenTox::Dataset.new(@dataset_uri,@subjectid).compounds else compounds = [ OpenTox::Compound.new(@compound_uri,@subjectid) ] end compounds.each do |compound| - puts compound.smiles database_activity = @training_dataset.database_activity(params) if database_activity @prediction_dataset.add_data_entry compound, @prediction_feature, database_activity @@ -108,7 +99,6 @@ module OpenTox :min_train_performance => @min_train_performance } ) - puts prediction.inspect predicted_value = prediction[:prediction].to_f confidence_value = prediction[:confidence].to_f diff --git a/webapp/fminer.rb b/webapp/fminer.rb index 2d11dcb..4f9abfe 100644 --- a/webapp/fminer.rb +++ b/webapp/fminer.rb @@ -244,60 +244,22 @@ module OpenTox fminer_noact_compounds = fminer_compounds - @@fminer.compounds feature_dataset.features = features - if (params[:get_target] == "true") - puts "get_target TRUE" - feature_dataset.features = [ @@fminer.prediction_feature ] + feature_dataset.features - else - puts "get_target FALSE" - end + feature_dataset.features = [ @@fminer.prediction_feature ] + feature_dataset.features if params[:get_target] == "true" feature_dataset.compounds = fminer_compounds fminer_compounds.each_with_index { |c,idx| - #puts c.smiles - # TODO: fix here, insert with add_data_entry - #row = [ c ] # TODO: reenable option #if (params[:get_target] == "true") #row = row + [ prediction_feature_all_acts[idx] ] #end features.each { |f| - #m = c.match([f.title])[f.title] - #m = 0 unless m v = fminer_results[c][f.uri] if fminer_results[c] unless fminer_noact_compounds.include? c v = 0 if v.nil? end - #unless m == v - #puts f.title - #puts m - #puts v - #end feature_dataset.add_data_entry c, f, v.to_i - #row << (fminer_results[c] ? fminer_results[c][f.uri] : nil) } - #row.collect! { |v| v ? v : 0 } unless fminer_noact_compounds.include? c - #feature_dataset << row } -=begin -CH: Ordering seems to be ok here - feature_dataset.compounds.each_with_index do |c,i| - feature_dataset.features.each_with_index do |f,j| - m = c.match([f.title])[f.title] - #puts c.smiles - #puts f.title - #puts m.inspect - v = feature_dataset.data_entries[i][j] - #puts v.inspect - unless m.to_i == v.to_i - puts f.title - puts m.to_i - puts v.to_i - end - end - end -=end - - #puts feature_dataset.to_csv feature_dataset.put feature_dataset.uri diff --git a/webapp/lazar.rb b/webapp/lazar.rb index 3700cd8..921b08e 100644 --- a/webapp/lazar.rb +++ b/webapp/lazar.rb @@ -28,7 +28,6 @@ module OpenTox # @param [optional,String] - further parameters for the feature generation service # @return [text/uri-list] Task URI post '/lazar/?' do - puts params.inspect resource_not_found_error "Please provide a dataset_uri parameter." unless params[:dataset_uri] resource_not_found_error "Dataset '#{params[:dataset_uri]}' not found." unless URI.accessible? params[:dataset_uri] bad_request_error "Please provide a feature_generation_uri parameter." unless params[:feature_generation_uri] @@ -62,8 +61,6 @@ module OpenTox task = OpenTox::Task.run("Apply lazar model",uri('/lazar/predict'), @subjectid) do |task| lazar = OpenTox::LazarPrediction.new params - puts "RESULT" - puts lazar.prediction_dataset.uri lazar.prediction_dataset.uri end |