From 1cf0938be3cc81e426030df9b1a1e3f534fa5fc2 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 4 May 2017 11:33:54 +0000 Subject: bumped version;adjustments for updated lazar library --- VERSION | 2 +- application.rb | 4 ++++ public/css/bootstrap.vertical-tabs.min.css | 1 + views/batch.haml | 2 +- views/neighbors.haml | 29 +++------------------------ views/prediction.haml | 32 ++++++++++++++++++++++-------- views/style.scss | 7 +++++-- 7 files changed, 39 insertions(+), 38 deletions(-) create mode 100644 public/css/bootstrap.vertical-tabs.min.css diff --git a/VERSION b/VERSION index 45a1b3f..26aaba0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.2 +1.2.0 diff --git a/application.rb b/application.rb index fa5df0a..911965f 100644 --- a/application.rb +++ b/application.rb @@ -19,6 +19,10 @@ before do @version = File.read("VERSION").chomp end +not_found do + redirect to('/predict') +end + get '/?' do redirect to('/predict') end diff --git a/public/css/bootstrap.vertical-tabs.min.css b/public/css/bootstrap.vertical-tabs.min.css new file mode 100644 index 0000000..d711daa --- /dev/null +++ b/public/css/bootstrap.vertical-tabs.min.css @@ -0,0 +1 @@ +.tabs-left,.tabs-right{border-bottom:none;padding-top:2px}.tabs-left{border-right:1px solid #ddd}.tabs-right{border-left:1px solid #ddd}.tabs-left>li,.tabs-right>li{float:none;margin-bottom:2px}.tabs-left>li{margin-right:-1px}.tabs-right>li{margin-left:-1px}.tabs-left>li.active>a,.tabs-left>li.active>a:focus,.tabs-left>li.active>a:hover{border-bottom-color:#ddd;border-right-color:transparent}.tabs-right>li.active>a,.tabs-right>li.active>a:focus,.tabs-right>li.active>a:hover{border-bottom:1px solid #ddd;border-left-color:transparent}.tabs-left>li>a{border-radius:4px 0 0 4px;margin-right:0;display:block}.tabs-right>li>a{border-radius:0 4px 4px 0;margin-right:0}.sideways{margin-top:50px;border:none;position:relative}.sideways>li{height:20px;width:120px;margin-bottom:100px}.sideways>li>a{border-bottom:1px solid #ddd;border-right-color:transparent;text-align:center;border-radius:4px 4px 0 0}.sideways>li.active>a,.sideways>li.active>a:focus,.sideways>li.active>a:hover{border-bottom-color:transparent;border-right-color:#ddd;border-left-color:#ddd}.sideways.tabs-left{left:-50px}.sideways.tabs-right{right:-50px}.sideways.tabs-right>li{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.sideways.tabs-left>li{-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)} diff --git a/views/batch.haml b/views/batch.haml index 6c37a2b..c1b45f6 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -53,7 +53,7 @@ = type %p / check for database hit - - if prediction[:warning] =~ /\b(identical)\b/i + - if prediction[:info] =~ /\b(identical)\b/i / show message about dbhit and measurements %p diff --git a/views/neighbors.haml b/views/neighbors.haml index 2d7c4a5..7c814dc 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -1,38 +1,17 @@ -/ unpacks multi prediction array ; -/ prepare it for neighbors ; -/ align single prediction to endpoint ; -/ display preordered in table view ; - %div.results %h3 Neighbors: / tabs div #tabs %ul.nav.nav-tabs.nav-justified{:id=>"neighborTabs", :role=>"tablist"} - / each model a tab head ; - / hash for predictionFeature - - predictionFeature = {} - @models.each_with_index do |model,i| / get predictionFeature type - m = Model::Lazar.find model.model_id.to_s - - predFeature = Feature.find m.prediction_feature_id.to_s - / define feature type (numeric : nominal) - - predFeatureType = (predFeature.numeric? ? "numeric" : "nominal") - / use prediction feature id for neighbor compound features - - predFeatureId = m.prediction_feature_id.to_s - - predictionFeature[i] = {"id" => predFeatureId, "type" => predFeatureType} %li{:class => ("active" if i == 0)} %a{:href => "#results_#{i+1}", :id => "linkTab#{i+1}", data: {toggle:"tab"}} = "#{model.endpoint} (#{model.species})" %div.tab-content - / unpack to single arrays - @predictions.each_with_index do |prediction,j| - / pass model type for significant fragments view #results.tab-pane{:id=>"#{j+1}", :class => ("active" if j == 0)} - / prepare dataset for neighbors table ; - / delete first array which contains prediction ; - / following arrays are the neighbor predictions ; - / call the tablesorter plugin ; - / presort by similarity ; :javascript $(document).ready(function(){ $("table##{j+1}").tablesorter({ @@ -58,7 +37,7 @@ widthFixed: false }); }); - - if prediction[:neighbors].size > 0 + - if prediction[:neighbors] %div.table-responsive %table{:id=>"#{j+1}", :style=>"border-style: solid;"} %thead @@ -71,8 +50,6 @@ %th.sorter-false{:style =>"vertical-align:middle;"} Similarity %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} - / %th{:style =>"vertical-align:middle;"} - / Supporting Information %tbody - type = @model_types[j] - unit = @models[j].unit @@ -90,8 +67,8 @@ - if neighbor[:measurement].is_a?(Array) = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") - else - = (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] - + - if !neighbor[:measurement].nil? + = (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] / Similarity = tanimoto %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} = neighbor[:similarity].round(3) diff --git a/views/prediction.haml b/views/prediction.haml index 77d7524..12a1fde 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -23,14 +23,15 @@ = "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})" / check for prediction - - if prediction[:neighbors].size > 0 + /- if prediction[:neighbors].size > 0 + - if prediction[:neighbors] and !prediction[:value].nil? %p / show model type (classification|regression) %b Type: = type %p / check for database hit - - if prediction[:warning] =~ /\b(identical)\b/i + - if prediction[:info] =~ /\b(identical)\b/i - @dbhit[i] = true / show message about dbhit and measurements @@ -77,15 +78,30 @@ %br = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1].signif(3)}" - / show warnings + / show warnings and info %p - - if !prediction[:warning].nil? - %b Warnings: - %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Warnings", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"auto", html:"true", content:"#{prediction[:warning]}"}} + - if !prediction[:info].blank? + %b info: + %br + %p=prediction[:info].sub(/excluded/, "excluded
") + - if !prediction[:warnings].blank? + %b warnings: + - prediction[:warnings].each do |warning| + %br + %p=warning + %p=warning.sub(/substances/, "substances
").sub(/prediction\:/, "prediction\:
") - else + %br - @dbhit[i] = false - %p - = "Not enough similar compounds
in training dataset." + - if !prediction[:info].blank? + %b info: + %br + %p=prediction[:info].sub(/excluded/, "excluded
") + - if !prediction[:warnings].blank? + %b warnings: + - prediction[:warnings].each do |warning| + %br + %p=warning.sub(/substances/, "substances
").sub(/prediction\:/, "prediction\:
") / always show the neighbors table, message is given there = haml :neighbors, :layout => false, :model_type => @model_types, :dbhit => @dbhit diff --git a/views/style.scss b/views/style.scss index 2c84781..5c56d14 100644 --- a/views/style.scss +++ b/views/style.scss @@ -9,14 +9,14 @@ h4.head-back, h5.head-back{ } .nav-tabs { background-color: #E7E7E7; - margin-bottom: 0; + //margin-bottom: 0; li.active a:hover { background-color: #f5f5f5; } li a { - height: 5em; + height: 7em; } } img { @@ -40,6 +40,9 @@ img { .tablesorter-bootstrap thead .sorter-false { cursor: default; } +.tablesorter-bootstrap thead { + background-color: #E7E7E7; +} ul.share-buttons{ list-style: none; } -- cgit v1.2.3