summaryrefslogtreecommitdiff
path: root/views/neighbors.haml
diff options
context:
space:
mode:
Diffstat (limited to 'views/neighbors.haml')
-rw-r--r--views/neighbors.haml20
1 files changed, 13 insertions, 7 deletions
diff --git a/views/neighbors.haml b/views/neighbors.haml
index 69034b3..70bf4b8 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -10,6 +10,7 @@
%ul.nav.nav-tabs.nav-justified{:id=>"neighborTabs", :role=>"tablist"}
/ each model a tab head ;
- @models.each_with_index do |model,i|
+ - @type = model.model.class.to_s.match("Classification") ? "Classification" : "Regression"
%li{:class => ("active" if i == 0)}
%a{:href => "#results_#{i+1}", :id => "linkTab#{i+1}", data: {toggle:"tab"}}
= "#{model.endpoint} (#{model.species})"
@@ -31,7 +32,8 @@
headerTemplate: '{content} {icon}',
widgets: ['zebra', 'columns', 'uitheme'],
headers: {0: {sorter: false}, 3: {sorter: false}},
- sortList: [[2,1]]
+ sortList: [[2,1]],
+ widthFixed: false
});
});
- if prediction[:neighbors].size > 0
@@ -59,16 +61,20 @@
%tbody
- prediction[:neighbors].each_with_index do |neighbor,count|
%tr
- %td{:style =>"vertical-align:middle;padding-left:1em;"}
+ / Compound
+ %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"}
/%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor[0].to_s)}/details"), :id=>"link#{j+1}#{count}"}}
%p= Compound.find(neighbor[0]).svg
%p= Compound.find(neighbor[0]).smiles
- %td{:style =>"vertical-align:middle;padding-left:1em;"}
- -#= neighbor[2].collect{|n| '%.2e' % n}.join ", "
- = neighbor[2].join ", "
- %td{:style =>"vertical-align:middle;padding-left:1em;"}
+ / Measured Activity
+ %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"}
+ //= neighbor[2].collect{|n| '%.2e' % n}.join ", "
+ //= neighbor[2].join ", "
+ = (@type == "Regression") ? neighbor[2].collect{|n| n.round(2)}.join(", ") : neighbor[2].join(", ")
+ / Similarity
+ %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"}
/ TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset?
- = neighbor[1] != nil ? neighbor[1] : "Not enough similar compounds in training dataset."
+ = neighbor[1] != nil ? neighbor[1].round(2) : "Not enough similar compounds in training dataset."
- else
%span.btn.btn-default.disabled Not enough similar compounds in training dataset