summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2017-05-04 11:33:54 +0000
committergebele <gebele@in-silico.ch>2017-05-04 11:33:54 +0000
commit1cf0938be3cc81e426030df9b1a1e3f534fa5fc2 (patch)
treeaec19bd9dad554080c62c1f6317a4d637d3781b9
parent6e2dacfee8e52175ef3ccc79da3d3dc21380683f (diff)
bumped version;adjustments for updated lazar library
-rw-r--r--VERSION2
-rw-r--r--application.rb4
-rw-r--r--public/css/bootstrap.vertical-tabs.min.css1
-rw-r--r--views/batch.haml2
-rw-r--r--views/neighbors.haml29
-rw-r--r--views/prediction.haml32
-rw-r--r--views/style.scss7
7 files changed, 39 insertions, 38 deletions
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:"<a alt=\"Link opens in new window.\" title=\"Link opens in new window.\" target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Jaccard_index\">Tanimoto/Jaccard</a> similarity based on <a alt=\"Link opens in new window.\" title=\"Link opens in new window.\" target=\"_blank\" href=\"https://openbabel.org/docs/dev/FileFormats/MolPrint2D_format.html\">Molprint2D</a> 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})</br>#{c.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("</br>") : neighbor[:measurement].join(", ")
- else
- = (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})</br>#{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})</br>#{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<br>")
+ - if !prediction[:warnings].blank?
+ %b warnings:
+ - prediction[:warnings].each do |warning|
+ %br
+ %p=warning
+ %p=warning.sub(/substances/, "substances<br>").sub(/prediction\:/, "prediction\:<br>")
- else
+ %br
- @dbhit[i] = false
- %p
- = "Not enough similar compounds </br>in training dataset."
+ - if !prediction[:info].blank?
+ %b info:
+ %br
+ %p=prediction[:info].sub(/excluded/, "excluded<br>")
+ - if !prediction[:warnings].blank?
+ %b warnings:
+ - prediction[:warnings].each do |warning|
+ %br
+ %p=warning.sub(/substances/, "substances<br>").sub(/prediction\:/, "prediction\:<br>")
/ 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;
}