summaryrefslogtreecommitdiff
path: root/views/predict.haml
blob: 4272a3839ba7db8fd4b259a8026cb6d6d7191cef (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
:javascript
  function checksmiles () {
    if (document.form.identifier.value == "") {
      alert("Please draw or insert a chemical structure.");
      $("img.circle").hide();
      document.form.identifier.focus();
      return false;
    };
    return true;
  };
  function checkboxes () {
    var checked = false;
    $('input[type="checkbox"]').each(function() {
      if ($(this).is(":checked")) {
        checked = true;
      };
    });
    if (checked == false){
      alert("Please select an endpoint.");
      $("img.circle").hide();
      return false;
    };
    return true;
  };
  function jsmeOnLoad() {
    jsmeApplet = new JSApplet.JSME("appletContainer", "380px", "340px", {
      //optional parameters
      "options" : "polarnitro"
    });
  document.JME = jsmeApplet;
  };
  function getsmiles() {
    if (document.JME.smiles() != '') {
      document.form.identifier.value = document.JME.smiles() ;
    };
  };
  function showcircle(){
    $("img.circle").show();
  };

// whole site content needs to be in one form. Input and checkboxes are proofed by js functions. 
%form{:name => "form", :action => to('/predict'), :method => "post", :enctype => "multipart/form-data", :onsubmit => "return  !!(checksmiles() & checkboxes())" }
  %fieldset#top
    %a{:href => "#", :id => "linkInsert"}
      %h1 1. Draw a chemical structure
    :javascript
      $("a#linkInsert").click(function () {
        $("#insert").toggle();
        document.location = document.location + "#" + "insert";
      });
    #insert
      %p
      %label  
      #appletContainer
      %br
      %label{:for => 'identifier'}
        or enter the
        %a{:href => "http://en.wikipedia.org/wiki/Simplified_molecular_input_line_entry_specification", :rel => "external"} SMILES
        string:
      %input{:type => 'text', :name => 'identifier', :id => 'identifier', :size => '60'}
    
  .arrow
    %img{:src=>"/images/arrow_down_float.png", :alt=>"v", :class=> "arrow"}
   
  %fieldset#middle
    %a{:href => "#models", :id => "linkModels"}
      %h1 2. Select one or more endpoints
    
    :javascript
      $("a#linkModels").click(function () {
        $("#models").toggle();
        document.location = document.location + "#" + "models";
      });
      
    #models
      - @detail_count = 0
      - @models.each do |model|
        - model_endpoint = model.type.select{|endpoint| endpoint =~ /Endpoint/}.to_s
        - model_title = model.title.split("_").last(2)[0]
        - model_t = model.title.gsub("_", " ")
        - case model_endpoint
        - when /fish/i
          %br
          %b Acute toxicity to fish (lethality):
          - @detail_count +=1
          %div{:id => model_title}
            %input{:type => "checkbox", :name => "selection[#{model_title}]", :id => "selection[#{model_title}]", :value => true, :disabled => false}
            %label{:for => "selection[#{model_title}]"}
              = model_t
            %a{:href=>"#details", :id => "linkDetails#{model_title}", :title=>"#{model_title} details", :style=>"font-size:small;"}
              [Details]
        
            :javascript
              $("a#linkDetails#{model_title}").click(function () {
                $("#details_#{@detail_count}").toggle();
                //document.location = document.location + "#" + "details";
              });

          #details{:id => "#{@detail_count}", :style=> "display:none;"}
            %h3 Model Details:
            //%p= "Training Dataset:\t#{model[RDF::OT.trainingDataset]}"
            %p{:style=>"display:inline;"} Algorithm:
            %code{:style=>"font-size:x-large;"} lazar
            %p Type: regression
            %p Training compounds: 580
            %p{:style=>"display:inline;"} Descriptors:
            %a{:href=>"https://services.in-silico.ch/algorithm/descriptor/physchem/list", :title=>"link opens in new window.", :target=>"_blank"} Physico-chemical (PC) properties
            //%p= "Training Dataset:\t#{model[RDF::OT.trainingDataset]}"
            //%p= "Feature Dataset:\t#{model[RDF::OT.featureDataset]}"
            /%h3 Validation: 
            -#%a{:href => "#"} 
              Detailed report link
            /%p Number of predictions: integer
            /%p Correct predictions: %
        - when /Carcinogenicity/i
          %br
          %b Carcinogenicity:
          - @detail_count +=1
          %div{:id => model_title}
            %input{:type => "checkbox", :name => "selection[#{model_title}]", :id => "selection[#{model_title}]", :value => true, :disabled => false}
            %label{:for => "selection[#{model_title}]"}
              = model.title.gsub("_", " ")
            %a{:href=>"#details", :id => "linkDetails#{model_title}", :title=>"#{model_title} details", :style=>"font-size:small;"}
              [Details]

            :javascript
              $("a#linkDetails#{model_title}").click(function () {
                $("#details_#{@detail_count}").toggle();
                //document.location = document.location + "#" + "details";
              });

          #details{:id=>"#{@detail_count}", :style=> "display:none;"}
            %h3 Model Details:
            //%p= "Training Dataset:\t#{model[RDF::OT.trainingDataset]}"
            %p{:style=>"display:inline;"} Algorithm:
            %code{:style=>"font-size:x-large;"} lazar
            %p Type: classification
            %p Training compounds: 86
            %p{:style=>"display:inline;"} Descriptors:
            %a{:href=>"http://www.maunz.de/libfminer2-bbrc-doc/", :title=>"link opens in new window.", :target=>"_blank"} Fminer backbone refinement classes
            //%p= "Training Dataset:\t#{model[RDF::OT.trainingDataset]}"
            //%p= "Feature Dataset:\t#{model[RDF::OT.featureDataset]}"
            %h3 Validation: 
            %a{:href => "http://lazar-services.in-silico.ch/validation/report/crossvalidation/22", :title=>"Link opens in new window.", :target=>"_blank"} 
              Detailed report link
            /%p Number of predictions: integer
            /%p Correct predictions: %
            %br
        - when /Mutagenicity/i
          %br
          %b Mutagenicity:
          - @detail_count +=1
          %div{:id => model_title}
            %input{:type => "checkbox", :name => "selection[#{model_title}]", :id => "selection[#{model_title}]", :value => true, :disabled => false}
            %label{:for => "selection[#{model_title}]"}
              = model.title.gsub("_", " ")
            %a{:href=>"#details", :id => "linkDetails#{model_title}", :title=>"#{model_title} details", :style=>"font-size:small;"}
              [Details]
        
            :javascript
              $("a#linkDetails#{model_title}").click(function () {
                $("#details_#{@detail_count}").toggle();
                //document.location = document.location + "#" + "details";
              });

          #details{:id => "#{@detail_count}", :style=> "display:none;"}
            %h3 Model Details:
            //%p= "Training Dataset:\t#{model[RDF::OT.trainingDataset]}"
            %p{:style=>"display:inline;"} Algorithm:
            %code{:style=>"font-size:x-large;"} lazar
            %p Type: classification
            %p Training compounds: 828
            %p{:style=>"display:inline;"} Descriptors:
            %a{:href=>"http://www.maunz.de/libfminer2-bbrc-doc/", :title=>"link opens in new window.", :target=>"_blank"} Fminer backbone refinement classes
            //%p= "Training Dataset:\t#{model[RDF::OT.trainingDataset]}"
            //%p= "Feature Dataset:\t#{model[RDF::OT.featureDataset]}"
            %h3 Validation: 
            %a{:href => "http://lazar-services.in-silico.ch/validation/report/crossvalidation/25", :title=>"Link opens in new window.", :target=>"_blank"} 
              Detailed report link
            /%p Number of predictions: integer
            /%p Correct predictions: %


      %br

  .arrow
    %img{:src=>"/images/arrow_down_float.png", :alt=>"v", :class=> "arrow"}

  %fieldset#bottom
    %h1
      3. Predict
    %input{ :type => "submit", :id => "submit", :value=>">>", :onclick => "(getsmiles() & showcircle())", :style=>"height:30px;width:30px;"}
    %img{:src=>"/images/wait30trans.gif", :alt=>"processing", :class=>"circle", :style=>"display:none;background-color:white;margin-left:10%;border:solid 1px;vertical-align:middle;"}