summaryrefslogtreecommitdiff
path: root/views/prediction.haml
diff options
context:
space:
mode:
Diffstat (limited to 'views/prediction.haml')
-rw-r--r--views/prediction.haml152
1 files changed, 152 insertions, 0 deletions
diff --git a/views/prediction.haml b/views/prediction.haml
new file mode 100644
index 0000000..e05285a
--- /dev/null
+++ b/views/prediction.haml
@@ -0,0 +1,152 @@
+%div
+ %a.btn.btn-xs.btn-default{:href => to('/predict'), :style=>"margin-bottom:1em;"}
+ %span.glyphicon.glyphicon-chevron-left
+ New Prediction
+
+ %h3.help-block
+ Similar particles
+
+ %hr
+ :javascript
+ $(document).ready(function(){
+ $(".tablesorter").tablesorter({
+ debug: false,
+ theme: "bootstrap",
+ //headerTemplate: '{content} {icon}',
+ widgets: ['uitheme', 'staticRow', 'stickyHeaders'],
+ widgetOptions: {
+ stickyHeaders_attachTo: 'neighbors',
+ stickyHeaders_offset: 0,
+ stickyHeaders_xScroll : null
+ },
+ sortList: [[1,1]],
+ widthFixed: false,
+ });
+ $('#neighbors').doubleScroll();
+ });
+
+
+ #neighbors.table-responsive
+ /%table.tablesorter{:style => "max-width:100%;white-space:nowrap;"}
+ %table.tablesorter
+ %thead
+ %tr
+ %th
+ ID
+ %th
+ Similarity
+ %th
+ Composition
+ %th.tox{:style => "max-width:100%;white-space:nowrap;"}
+ Toxicity
+ %br
+ Net cell association
+ %br
+ [mL/ug(Mg)]
+ - if @type =~ /physchem|proteomics/
+ - @input.each{|d| Feature.find(d[0]).category}.each do |key|
+ - feature = Feature.find_by(:id=>key[0])
+ - name = feature.name
+ - if (feature[:conditions] && !feature[:conditions]["MEDIUM"].blank?)
+ - name = feature.name + " / " + feature[:conditions]["MEDIUM"]
+ - else
+ - name = feature.name
+ %th.physchem.sorter-false
+ %a.descriptor{:href=>$npo[feature.name], :rel=>"external"}= name + (feature.unit.blank? ? "" : " (#{feature.unit})")
+ %tbody
+ / query and match combined
+ %tr.static
+ / id
+ %td
+ - if @match
+ %a{:href=> $ambit_search+@name, :rel=>"external"}
+ %h5.th5= @name
+ - else
+ %h5.th5 Query
+ / similarity
+ %td
+ %h5.th5 1.0
+ / composition
+ %td
+ - core = Substance.find @nanoparticle[:core_id]
+ %h5.th5 Core:
+ %a{:href=>core.source, :rel=>"external"}= "["+core.name+"]"
+ %br
+ - if @type == "fingerprint"
+ - coating = []
+ - @nanoparticle[:coating_ids].each{|id| coating << Substance.find(id) }
+ %h5.th5 Coating:
+ - coating.each do |co|
+ %a{:href=>co.source, :rel=>"external"}= co.name
+ %br
+ / tox
+ %td.tox
+ - if @prediction[:value]
+ %h5.th5 Prediction:
+ = @prediction[:value].round(3)
+ %br
+ - if @prediction[:value].blank?
+ %h5.th5 Prediction:
+ = "not available"
+ %br
+ - if @prediction[:prediction_interval]
+ %h5
+ %a{:href=>"https://en.wikipedia.org/wiki/Prediction_interval", :rel=>"external"} 95% Prediction interval:
+ - interval = @prediction[:prediction_interval].nil? ? " - - " : @prediction[:prediction_interval].collect{|i| i.round(2)}
+ = "#{interval[0]} - #{interval[1]}"
+ - if @prediction[:measurements]
+ %br
+ %h5.th5 Measurement:
+ - @prediction[:measurements].each do |m|
+ = m
+ - if !@prediction[:value] && !@prediction[:measurements]
+ %h5.th5 not available
+ / physchem
+ - if @type =~ /physchem|proteomics/
+ - @input.each do |v|
+ %td.physchem
+ %div{:style=>"display:inline-block;padding-right:20px;"}
+ - if v[1].nil?
+ %p x
+ - else
+ %p= v[1][0].round(3)
+
+ / neighbors
+ - if @prediction[:neighbors]
+ - @prediction[:neighbors].each_with_index do |neighbor,idx|
+ - nano = Nanoparticle.find(neighbor[:id])
+ - core = Substance.find nano.core_id
+ - coating = []
+ - nano.coating_ids.each{|id| coating << Substance.find(id)}
+ %tr
+ / ID
+ %td
+ %a{:href=> $ambit_search+nano.name, :rel=>"external"}
+ %h5.th5= nano.name
+ / Similarity
+ %td
+ %h5.th5= neighbor[:similarity].round(3)
+ / Composition
+ %td
+ %h5.th5 Core:
+ %a{:href=>core.source, :rel=> "external"}= "["+core.name+"]"
+ %br
+ %h5.th5 Coating:
+ - coating.each do |co|
+ %a{:href=>co.source, :rel=>"external"}= co.name
+ %br
+ / Tox
+ %td.tox
+ %h5.th5 Measurement:
+ = neighbor[:measurement]
+ / Physchem
+ - case @type
+ - when "physchem"
+ - nano.properties.delete_if{|id,v| !@physchem_relevant_features.include?(Feature.find(id))}.sort_by{|id,v| @physchem_relevant_features.index Feature.find(id)}.each do |k,v|
+ %td.physchem
+ = v[0].round(3) unless v.nil?
+ - when "proteomics"
+ - nano.properties.delete_if{|id,v| !@proteomics_relevant_features.include?(Feature.find(id))}.sort_by{|id,v| @proteomics_relevant_features.index Feature.find(id)}.each do |k,v|
+ %td.physchem
+ = v[0].round(3) unless v.nil?
+