summaryrefslogtreecommitdiff
path: root/views/prediction.haml
blob: 7f94a2ef806a782b736f6598b4786663985740ac (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
.predictions
  .back
    %h1
      %img{:src=>"/images/arrow_left_float.png", :alt=>"<"}
        %a{:href => to('/predict')} New Prediction

  / displays all prediction results
  .overview
    %table{:width=>"100%", :cellspacing=>"1", :id=>"overview"}
      %thead
        %tr
          %caption
            %h2 Prediction Results:

      %tbody
        %tr
          %td{:id=>"compound"}
            %a{:href => to("/prediction/#{CGI.escape(@compound.uri)}/details"), :id=>"linkCompound", :target=>"details_overview"}
              %img{:src=>"#{@compound.uri}/image", :alt=>"Compound image not available", :width=>"150", :height=>"150"}
            %br
            %br
            %img{:src=>"/images/arrow_up_float.png", :alt=>"^"}
            :javascript
              $(function() {
                $("a#linkCompound").on('click', function(e) {
                  $('#iframe_overview').bPopup();
                });
              });
          - count=0
          / var for rule to load neighbors page.
          - @@neighbors_available = 1
          - @@predictions.each do |pa|
            / prediction of one model
            - pa.each do |p|
              - $logger.debug "inspect p: #{p.inspect}\n"
              - $logger.debug "inspect data_entries: #{p.data_entries}\n"
              / p.data_entries > 1 = neighbors available
              - p.data_entries.length > 1 ? @@neighbors_available = p.data_entries.length : @@neighbors_available
              / prevent conversion of nil
              - c = p.data_entries[0][0] != nil ? p.data_entries[0][0] : ''
              - $logger.debug "inspect c: #{c.inspect}\n"
              - case c
              - when /(0|false)/
                - c = "non-carcinogen"
              - when /(1|true)/
                - c = "carcinogen"
              - else
                - c = Array.new
                - c[0] = p.data_entries[0][0].round(3)
              %td
                %b{:class => "title"}
                  = @@prediction_models[count].title.split(" ").first
                %br
                %br
                  / classification, regression
                  %b Type:
                %br
                  %b Result:
                  %b{:class => c[0]}
                    - if c.class == String
                      = (c != '' ? c : "No prediction result.")
                    - else
                      = (c[0] != '' ? c[0] : "No prediction result.")
                  / title must be empty for tooltip
                  %a{:href=>"#result", :title=>"", :id=>"result"}
                    %img{:src=>"/images/info_white.png"}
                  .tooltip{:style=>"font-weight: normal; font-size: 1em; width: 50%; text-align: left;"}
                    %dt
                      Result
                    %dd
                      %code lazar 
                      calculates searches the training dataset for similar compounds (neighbors) 
                      and calculates the prediction from their measured activities. lazar 
                      calculates predictions using
                      %ul
                        %li a majority vote (weighted by compound similarity) for 
                        %em classification 
                        (
                        %a{:href=>"http://www.in-silico.de/articles/modi020905.pdf"} original publication
                        )
                        %li a local QSAR model based on neighbors for
                        %em regression
                        (
                        %a{:href=>"http://www.in-silico.de/articles/mh_tf.pdf"} original publication
                        )
                      Please keep in mind that predictions are based on the measured activities of neighbors.
                %br
                  .confidence
                    %b Confidence:
                    = p.data_entries[0][1] != nil ? p.data_entries[0][1].round(3) : ""
                    / title must be empty for tooltip
                    %a{:href=>"#confidence", :title=>"", :id=>"confidence"}
                      %img{:src=>"/images/info_white.png"}
                    .tooltip{:style=>"font-weight: normal; font-size: 1em; width: 50%; text-align: left;"}
                      %dt
                        Confidence
                      %dd
                        Indicates the applicability domain of a model.
                        Predictions with a high confidence can be expected to be more reliable than predictions 
                        with low confidence.
                        Confidence values may take any value between 0 and 1.
                        For most models confidence > 0.025 is a sensible (hard) cutoff to distiguish between 
                        reliable and unreliable predictions.
                  %br
                %a{:href=> "#tabs", :id=>"link#{count}"}
                  %img{:src=>"/images/arrow_down_float.png", :alt=>"v"}
                  :javascript
                    $("a#link#{count}").click(function () {
                      $(".results").show();
                      document.getElementById('tabs').focus();
                      $("#tabs").tabs({ active: "#{count}" });
                    });
              - count+=1
  
  - if @@neighbors_available > 1
    = haml :neighbors, :layout => false
  - else
    %h2
      no neighbors available
%iframe{:id=>"iframe_overview", :name=>"details_overview", :height=>"90%", :width=>"90%", :style=>"display:none;border:0px"}