diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-06-06 12:39:37 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-06-06 12:39:37 +0200 |
commit | f6a55a7121a61865d85ad7195371bd8fd784fb29 (patch) | |
tree | 9bf23b0d79c7e0e6ad4679e6d722d98a451caf62 | |
parent | b435b145aea744ba951c12b4f6bf90ce62a5b0a3 (diff) |
removing several halt, adding debug message, getting smiles directly
-rw-r--r-- | fminer.rb | 2 | ||||
-rw-r--r-- | lazar.rb | 7 | ||||
-rw-r--r-- | openbabel.rb | 4 | ||||
-rw-r--r-- | similarity.rb | 20 |
4 files changed, 17 insertions, 16 deletions
@@ -334,7 +334,7 @@ post '/fminer/last/?' do training_dataset.data_entries.each do |compound,entry| begin - smiles = OpenTox::Compound.new(compound.to_s).to_smiles + smiles = OpenTox::Compound.smiles(compound.to_s) rescue LOGGER.warn "No resource for #{compound.to_s}" next @@ -37,8 +37,9 @@ end # @return [text/uri-list] Task URI post '/lazar/?' do + LOGGER.debug "building lazar model with params: "+params.inspect params[:subjectid] = @subjectid - halt 404, "No dataset_uri parameter." unless params[:dataset_uri] + raise OpenTox::NotFoundError.new "No dataset_uri parameter." unless params[:dataset_uri] dataset_uri = params[:dataset_uri] task = OpenTox::Task.create("Create lazar model",url_for('/lazar',:full)) do |task| @@ -75,7 +76,7 @@ post '/lazar/?' do if feature_generation_uri.match(/fminer/) lazar.feature_calculation_algorithm = "Substructure.match" else - halt 404, "External feature generation services not yet supported" + raise OpenTox::NotFoundError.new "External feature generation services not yet supported" end params[:subjectid] = @subjectid prediction_feature = OpenTox::Feature.find params[:prediction_feature], @subjectid @@ -87,7 +88,7 @@ post '/lazar/?' do end training_features.load_all(@subjectid) - halt 404, "Dataset #{feature_dataset_uri} not found." if training_features.nil? + raise OpenTox::NotFoundError.new "Dataset #{feature_dataset_uri} not found." if training_features.nil? # sorted features for index lookups diff --git a/openbabel.rb b/openbabel.rb index 1644455..fedcb8a 100644 --- a/openbabel.rb +++ b/openbabel.rb @@ -49,7 +49,7 @@ get '/openbabel/:property' do response['Content-Type'] = 'application/rdf+xml' algorithm.to_rdfxml else - halt 404, "Unknown OpenBabel descriptor #{params[:property]}." + raise OpenTox::NotFoundError.new "Unknown OpenBabel descriptor #{params[:property]}." end end @@ -89,7 +89,7 @@ post '/openbabel/:property' do descriptor = OpenBabel::OBDescriptor.find_type(params[:property]) descriptor.predict(obmol).to_s else - halt 404, "Cannot calculate property #{params[:property]} with OpenBabel" + raise OpenTox::NotFoundError.new "Cannot calculate property #{params[:property]} with OpenBabel" end end diff --git a/similarity.rb b/similarity.rb index 060bd2b..faf43f9 100644 --- a/similarity.rb +++ b/similarity.rb @@ -2,25 +2,25 @@ require File.join(File.dirname(__FILE__),'dataset.rb') helpers do def find -# + charges are dropped -uri = uri(params[:splat].first.gsub(/(InChI.*) (.*)/,'\1+\2')) # reinsert dropped '+' signs in InChIs -halt 404, "Dataset \"#{uri}\" not found." unless @set = Dataset.find(uri) + # + charges are dropped + uri = uri(params[:splat].first.gsub(/(InChI.*) (.*)/,'\1+\2')) # reinsert dropped '+' signs in InChIs + raise OpenTox::NotFoundError.new "Dataset \"#{uri}\" not found." unless @set = Dataset.find(uri) end def uri(name) -name = URI.encode(name) -uri = File.join Dataset.base_uri, name -end + name = URI.encode(name) + uri = File.join Dataset.base_uri, name + end end get '/tanimoto/dataset/*/dataset/*/?' do -find -@set.tanimoto(uri(params[:splat][1])) + find + @set.tanimoto(uri(params[:splat][1])) end get '/weighted_tanimoto/dataset/*/dataset/*/?' do -find -@set.weighted_tanimoto(uri(params[:splat][1])) + find + @set.weighted_tanimoto(uri(params[:splat][1])) end |