summaryrefslogtreecommitdiff
path: root/views/prediction.haml
blob: 29cba4044c31c0e1841af5488bf221fdb3e11bf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
%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(){
      $("table#neighbors").tablesorter({
        debug: false,
        theme: "bootstrap",
        headerTemplate: '{content} {icon}',
        widgets: ['uitheme', 'staticRow'],
        widgetOptions: {
        },
        sortList: [[1,1]],
        widthFixed: false,
      });
    });

  #results.table-responsive
    %table.tablesorter{:id=>"neighbors"}
      %thead
        %tr
          %th
            ID  
          %th
            Similarity
          %th
            Composition  
          %th
            Tox
          - @input.each do |key|
            %th.physchem
              = key[0].gsub(/\sMean/, '')
      %tbody
        / query and match combined
        %tr.static
          / id
          %td
            - if @prediction[:match]
              %h5= @prediction[:match].keys[0]
            - else
              %h5 Query
          / similarity
          %td
            - if @prediction[:match]
              %h5 1
            - else
              %h5 x
          / composition
          %td
            - if @prediction[:match]
              - @prediction[:match].values[0]["composition"].each do |k,v|
                %h5= k
                %p= v
            - else
              %h5 x
          / tox
          %td.tox
            - if @prediction[:prediction]
              - @prediction[:prediction].each do |k,v|
                %h5 Prediction
                %p= k
                - if v == nil
                  %p 0
                - else
                  %p= v.round(5)
            - if @prediction[:match]
              - @prediction[:match].values[0]["tox"].each do |k,v|
                %h5 Measurement
                %p= k
                %p= v.round(3)
            - if !@prediction[:prediction] && !@prediction[:match]
              %h5 x
          / physchem
          - if @prediction[:match]
            - sorted = {}
            - @input.each{|i| sorted[i[0]]=@prediction[:match].values[0]["physchem"][i[0]]}
            - sorted.each do |k,v|
              %td.physchem
                %div{:style=>"display:inline-block;padding-right:20px;"}
                  /= k.gsub(/\sMean/, '')
                  %p= v.round(3)
          - else
            - @input.each do |v|
              %td.physchem
                %div{:style=>"display:inline-block;padding-right:20px;"}
                  //= v[0].gsub(/\sMean/, '')
                  - if v[1].nil?
                    %p x
                  - else
                    %p= v[1].round(3)

        / neighbors
        - if @prediction[:neighbors]
          - @prediction[:neighbors].each_with_index do |neighbor,idx|
            %tr
              / ID
              %td
                %h5= neighbor["id"]
              / Similarity
              %td
                %h5= neighbor["similarity"].round(3)
              / Composition
              %td
                - neighbor["composition"].each do |k,v|
                  %h5= k
                  %p= v
              / Tox
              %td
                - neighbor["tox"].each do |k,v|
                  %h5 Measurement
                  %p= k
                  %p= v.round(3)
              / Physchem
              - sorted = {}
              - @input.each{|i| sorted[i[0]]=neighbor["physchem"][i[0]]}
              - sorted.each do |k,v|
                %td.physchem
                  %div
                    %div{:style=>"display:inline-block;padding-right:20px;"}
                      /= k.gsub(/\sMean/, '')
                      %p= v.round(3)