diff options
author | gebele <gebele@in-silico.ch> | 2016-12-07 12:07:13 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2016-12-07 12:07:13 +0000 |
commit | 55bf06381a42c9bb1e1e991e990f5d6e90c8e33e (patch) | |
tree | 44044577e36e00485aa5d73531d9d56747e5b742 /application.rb | |
parent | b65956f3b250b4f10fe93b7d35924d21538cd6f5 (diff) |
rebuild code for public release;prepared to work with lazar v1.0.0;reintroduced compound details
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/application.rb b/application.rb index eefd833..4eb4a36 100644 --- a/application.rb +++ b/application.rb @@ -24,19 +24,33 @@ get '/?' do end get '/predict/?' do - @models = OpenTox::Model::Prediction.all + @models = OpenTox::Model::Validation.all @models = @models.delete_if{|m| m.model.name =~ /\b(Net cell association)\b/} @endpoints = @models.collect{|m| m.endpoint}.sort.uniq @models.count <= 0 ? (haml :info) : (haml :predict) end get '/predict/modeldetails/:model' do - model = OpenTox::Model::Prediction.find params[:model] + model = OpenTox::Model::Validation.find params[:model] crossvalidations = OpenTox::Validation::RepeatedCrossValidation.find(model.repeated_crossvalidation_id).crossvalidations return haml :model_details, :layout=> false, :locals => {:model => model, :crossvalidations => crossvalidations} end +# get individual compound details +get '/prediction/:neighbor/details/?' do + @compound = OpenTox::Compound.find params[:neighbor] + @smiles = @compound.smiles + begin + @names = @compound.names.nil? ? "No names for this compound available." : @compound.names + rescue + @names = "No names for this compound available." + end + @inchi = @compound.inchi.gsub("InChI=", "") + + haml :details, :layout => false +end + get '/jme_help/?' do File.read(File.join('views','jme_help.html')) end @@ -121,7 +135,7 @@ post '/predict/?' do @compounds.each do |compound| @batch[compound] = [] params[:selection].keys.each do |model_id| - model = Model::Prediction.find model_id + model = OpenTox::Model::Validation.find model_id prediction = model.predict(compound) @batch[compound] << [model, prediction] end @@ -148,7 +162,7 @@ post '/predict/?' do @models = [] @predictions = [] params[:selection].keys.each do |model_id| - model = Model::Prediction.find model_id + model = OpenTox::Model::Validation.find model_id @models << model @predictions << model.predict(@compound) end @@ -156,6 +170,11 @@ post '/predict/?' do end end +get '/license' do + @license = RDiscount.new(File.read("LICENSE.md")).to_html + haml :license, :layout => false +end + get '/style.css' do headers 'Content-Type' => 'text/css; charset=utf-8' scss :style |