summaryrefslogtreecommitdiff
path: root/views/prediction.haml
blob: 99bd2a00c90ae567cc56ba74a88b58b9fea30dfb (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
%div.well
  %a.btn.btn-xs.btn-warning{:href => to('/predict'), :style=>"margin-bottom:1em;"}
    %i.glyphicon.glyphicon-menu-left
    New Prediction
  %ul.nav.nav-tabs
    %li
      %a{:href=>"#query", :data=>{:toggle=>"tab"}} Query
    %li
      %a{:href=>"#match", :data=>{:toggle=>"tab"}} Match
    %li.active
      %a{:href=>"#prediction", :data=>{:toggle=>"tab"}} Prediction
    %li
      %a{:href=>"#neighbors", :data=>{:toggle=>"tab"}} Neighbors

  %div.tab-content
    #query.tab-pane.fade
      %span.help-block
        your query was
      - @input.each_with_index do |v,id|
        - key = v[0]
        - val = v[1]
        %h5= key
        %input.form-control{:id=>id,:type=>"text",:value=>"#{val}", :disabled=>"true"}
    #match.tab-pane.fade
      - if @prediction[:match]  
        %table{:id=>"match"}
          %thead
            %tr
            - @prediction[:match][:id].keys.each do |key|
              %th= key.capitalize
          %tbody
            %tr
              / composition
              %td
                - @prediction[:match][:id]["composition"].each do |k,v|
                  %h5= k
                  %p= v
              / tox
              %td
                - @prediction[:match][:id]["tox"].each do |k,v|
                  %h5= k
                  %p= v
              / physchem
              %td
                - @prediction[:match][:id]["physchem"].each do |k,v|
                  %h5= k
                  %p= v
      - else
        %h5 No match
    #prediction.tab-pane.in.active
      - @prediction[:prediction].each do |k,v|
        %h5= k
        %p= v.round(5)
    #neighbors.tab-pane.fade
      :javascript
        $(document).ready(function(){
          $("table#match").tablesorter({
            debug: false,
            theme: "bootstrap",
            headerTemplate: '{content} {icon}',
            widgets: ['uitheme'],
            headers: {0: {sorter: false}, 1: {sorter: false}, 2: {sorter: false}},
            sortList: [[1,1]],
            widthFixed: false
          });
        });
        $(document).ready(function(){
          $("table#neighbors").tablesorter({
            debug: false,
            theme: "bootstrap",
            headerTemplate: '{content} {icon}',
            widgets: ['uitheme'],
            sortList: [[1,1]],
            widthFixed: false
          });
        });
      %div.table-responsive
        %table.tablesorter{:id=>"neighbors", :style=>"border-style: 1px solid black;margin-top:10px;"}
          %thead
            %tr
              %th{:style =>"vertical-align:middle;"}
                ID  
              %th{:style =>"vertical-align:middle;"}
                Similarity
              %th{:style =>"vertical-align:middle;"}
                Composition  
              %th{:style =>"vertical-align:middle;"}
                Tox
              %th{:style =>"vertical-align:middle;"}
                Physchem
          %tbody
          - @prediction[:neighbors].each do |neighbor|
            %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= k
                  %p= v.round(3)
              / Physchem
              %td
                - neighbor["physchem"].each do |k,v|
                  %h5= k
                  %p= v