lazar-gui 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/FAQ.md +29 -0
  4. data/Gemfile +7 -0
  5. data/README.md +15 -0
  6. data/VERSION +1 -0
  7. data/application.rb +317 -0
  8. data/bin/lazar-start +5 -0
  9. data/bin/lazar-start.sh +8 -0
  10. data/bin/lazar-stop +6 -0
  11. data/bin/lazar-stop.sh +52 -0
  12. data/config.ru +5 -0
  13. data/helper.rb +218 -0
  14. data/lazar-gui.gemspec +29 -0
  15. data/public/css/bootstrap-theme.min.css +5 -0
  16. data/public/css/bootstrap.min.css +5 -0
  17. data/public/css/images/black-asc.gif +0 -0
  18. data/public/css/images/black-desc.gif +0 -0
  19. data/public/css/images/black-unsorted.gif +0 -0
  20. data/public/css/images/bootstrap-black-unsorted.png +0 -0
  21. data/public/css/images/bootstrap-white-unsorted.png +0 -0
  22. data/public/css/images/dragtable-handle.png +0 -0
  23. data/public/css/images/dragtable-handle.svg +7 -0
  24. data/public/css/images/dropbox-asc-hovered.png +0 -0
  25. data/public/css/images/dropbox-asc.png +0 -0
  26. data/public/css/images/dropbox-desc-hovered.png +0 -0
  27. data/public/css/images/dropbox-desc.png +0 -0
  28. data/public/css/images/first.png +0 -0
  29. data/public/css/images/green-asc.gif +0 -0
  30. data/public/css/images/green-desc.gif +0 -0
  31. data/public/css/images/green-header.gif +0 -0
  32. data/public/css/images/green-unsorted.gif +0 -0
  33. data/public/css/images/ice-asc.gif +0 -0
  34. data/public/css/images/ice-desc.gif +0 -0
  35. data/public/css/images/ice-unsorted.gif +0 -0
  36. data/public/css/images/last.png +0 -0
  37. data/public/css/images/loading.gif +0 -0
  38. data/public/css/images/metro-black-asc.png +0 -0
  39. data/public/css/images/metro-black-desc.png +0 -0
  40. data/public/css/images/metro-loading.gif +0 -0
  41. data/public/css/images/metro-unsorted.png +0 -0
  42. data/public/css/images/metro-white-asc.png +0 -0
  43. data/public/css/images/metro-white-desc.png +0 -0
  44. data/public/css/images/next.png +0 -0
  45. data/public/css/images/prev.png +0 -0
  46. data/public/css/images/white-asc.gif +0 -0
  47. data/public/css/images/white-desc.gif +0 -0
  48. data/public/css/images/white-unsorted.gif +0 -0
  49. data/public/css/jquery-ui.css +1225 -0
  50. data/public/css/jquery-ui.theme.min.css +5 -0
  51. data/public/css/theme.bootstrap.css +158 -0
  52. data/public/css/theme.bootstrap.min.css +1 -0
  53. data/public/css/theme.default.min.css +1 -0
  54. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  55. data/public/fonts/glyphicons-halflings-regular.svg +288 -0
  56. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  57. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  58. data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
  59. data/public/images/Email.png +0 -0
  60. data/public/images/Facebook.png +0 -0
  61. data/public/images/Google+.png +0 -0
  62. data/public/images/IST_logo_s.png +0 -0
  63. data/public/images/LinkedIn.png +0 -0
  64. data/public/images/OpenToxEuro2013_small.png +0 -0
  65. data/public/images/Twitter.png +0 -0
  66. data/public/images/arrow_down_float.png +0 -0
  67. data/public/images/arrow_left_float.png +0 -0
  68. data/public/images/arrow_right_float.png +0 -0
  69. data/public/images/arrow_up_float.png +0 -0
  70. data/public/images/asc.gif +0 -0
  71. data/public/images/bfr_logo.gif +0 -0
  72. data/public/images/bg.gif +0 -0
  73. data/public/images/blind.png +0 -0
  74. data/public/images/desc.gif +0 -0
  75. data/public/images/enm_logo.png +0 -0
  76. data/public/images/favicon.ico +0 -0
  77. data/public/images/gray_jean.png +0 -0
  78. data/public/images/info_white.png +0 -0
  79. data/public/images/ist_logo.png +0 -0
  80. data/public/images/nestec.jpg +0 -0
  81. data/public/images/ot_logo.png +0 -0
  82. data/public/images/wait30trans.gif +0 -0
  83. data/public/javascripts/bootstrap.min.js +7 -0
  84. data/public/javascripts/jquery-1.11.2.min.js +4 -0
  85. data/public/javascripts/jquery-1.8.3.min.js +2 -0
  86. data/public/javascripts/jquery-ui-1.10.3.custom.min.js +6 -0
  87. data/public/javascripts/jquery.bpopup.min.js +7 -0
  88. data/public/javascripts/jquery.tablesorter.min.js +2 -0
  89. data/public/javascripts/jquery.tablesorter.widgets.js +2678 -0
  90. data/public/javascripts/jquery.tools.min.js +5 -0
  91. data/public/javascripts/lazar-gui.js +11 -0
  92. data/public/jsme/057C029061D565E59B91BCF8D80FA08E.cache.html +651 -0
  93. data/public/jsme/05B63F17C4ECC632F0004998FE93F0D9.cache.png +0 -0
  94. data/public/jsme/0D71BA88E8DB59E613D3BD042277F3CA.cache.html +636 -0
  95. data/public/jsme/143B86F220A77EA4A06DF2CE62EF455A.cache.html +636 -0
  96. data/public/jsme/1AFB129BECD672F835F8C27B14A9D8F2.cache.html +619 -0
  97. data/public/jsme/20865588BA1E58170CC8C13CEAD50C3C.cache.html +615 -0
  98. data/public/jsme/20B12D7884BFE17E1879B157A966B4D0.cache.html +631 -0
  99. data/public/jsme/222DCE3CD01E8F29C3D81A37CE3EC2B8.cache.html +626 -0
  100. data/public/jsme/230043C4988F4EECEF225437640D792F.cache.html +625 -0
  101. data/public/jsme/3014E46F5C6FB35E6CF0D7870071174B.cache.html +615 -0
  102. data/public/jsme/396F806CD63ABD414BFBB9D57429F05B.cache.png +0 -0
  103. data/public/jsme/3F57AECC67986E796A3148265F038FF1.cache.html +639 -0
  104. data/public/jsme/40BAF81124143A595056A9CCA0E9DBBA.cache.png +0 -0
  105. data/public/jsme/469A5B5AE16905A2CD712E25B9517A14.cache.html +644 -0
  106. data/public/jsme/4722AB194B521805C997130865A7EE3D.cache.html +638 -0
  107. data/public/jsme/4841BDE9DC293BA35F7762B4D8EFD236.cache.png +0 -0
  108. data/public/jsme/497588C27DED1A6E8FE1E0AB8417B414.cache.html +626 -0
  109. data/public/jsme/571D27D70DEF8240841DA5CAFC363CFF.cache.html +619 -0
  110. data/public/jsme/5F7FD5A5750634DF9F5480F2778D9CD7.cache.html +651 -0
  111. data/public/jsme/6187B195CC6073B1DB0A30F6CD64ACA3.cache.html +620 -0
  112. data/public/jsme/6DED0C7A48F0BB72DDB1FDE5C05E60B5.cache.html +642 -0
  113. data/public/jsme/73F66F1A578E65144682885B3DC28556.cache.html +620 -0
  114. data/public/jsme/76252DEA9FB0A670947525C4C89E2530.cache.html +657 -0
  115. data/public/jsme/84DE2DAB8AD49C4E122A548C4B072500.cache.html +625 -0
  116. data/public/jsme/98150D1CD230B36339E35812F0BD3D0E.cache.html +629 -0
  117. data/public/jsme/9BA3A5A02DFF97BADFD3F9FE3817341B.cache.html +636 -0
  118. data/public/jsme/9D58CD61900096C805154C0AC693DCE7.cache.html +639 -0
  119. data/public/jsme/A3D2B7C95C4FC47DB0996CBDF930EA17.cache.html +657 -0
  120. data/public/jsme/A6DF9CFFF55769DE62DA6868C558B3F2.cache.html +629 -0
  121. data/public/jsme/B70D7DA2E93A6B0FB7E5BC15540F7B15.cache.html +645 -0
  122. data/public/jsme/DF7764EEC1903CD03C9545B354D8D8E4.cache.png +0 -0
  123. data/public/jsme/E07214401017B41AF0BDAB1EB811CC83.cache.html +645 -0
  124. data/public/jsme/E45DF2A61DB551567FA3454B1A00412D.cache.html +631 -0
  125. data/public/jsme/E97CDFD075EEB4D0578A219C5564A988.cache.html +642 -0
  126. data/public/jsme/EBCDA5C12B4318C17A4741474FB9D7CA.cache.html +643 -0
  127. data/public/jsme/clear.cache.gif +0 -0
  128. data/public/jsme/gwt/chrome/chrome.css +1155 -0
  129. data/public/jsme/gwt/chrome/chrome_rtl.css +1155 -0
  130. data/public/jsme/gwt/chrome/images/button/menu-button-arrow-disabled.png +0 -0
  131. data/public/jsme/gwt/chrome/images/button/menu-button-arrow.png +0 -0
  132. data/public/jsme/gwt/chrome/images/button/split-button-arrow-active.png +0 -0
  133. data/public/jsme/gwt/chrome/images/button/split-button-arrow-disabled.png +0 -0
  134. data/public/jsme/gwt/chrome/images/button/split-button-arrow-focus.png +0 -0
  135. data/public/jsme/gwt/chrome/images/button/split-button-arrow-hover.png +0 -0
  136. data/public/jsme/gwt/chrome/images/button/split-button-arrow.png +0 -0
  137. data/public/jsme/gwt/chrome/images/combobox/arrow-down-disabled.png +0 -0
  138. data/public/jsme/gwt/chrome/images/combobox/arrow-down.png +0 -0
  139. data/public/jsme/gwt/chrome/images/combobox/ellipsis-disabled.png +0 -0
  140. data/public/jsme/gwt/chrome/images/combobox/ellipsis.png +0 -0
  141. data/public/jsme/gwt/chrome/images/corner.png +0 -0
  142. data/public/jsme/gwt/chrome/images/corner_ie6.png +0 -0
  143. data/public/jsme/gwt/chrome/images/fastree/selectionBar.gif +0 -0
  144. data/public/jsme/gwt/chrome/images/fastree/treeClosed.gif +0 -0
  145. data/public/jsme/gwt/chrome/images/fastree/treeLoading.gif +0 -0
  146. data/public/jsme/gwt/chrome/images/fastree/treeOpen.gif +0 -0
  147. data/public/jsme/gwt/chrome/images/glasspanel/blue_ridge.png +0 -0
  148. data/public/jsme/gwt/chrome/images/hborder.png +0 -0
  149. data/public/jsme/gwt/chrome/images/hborder_ie6.png +0 -0
  150. data/public/jsme/gwt/chrome/images/ie6/corner_dialog_topleft.png +0 -0
  151. data/public/jsme/gwt/chrome/images/ie6/corner_dialog_topright.png +0 -0
  152. data/public/jsme/gwt/chrome/images/ie6/hborder_blue_shadow.png +0 -0
  153. data/public/jsme/gwt/chrome/images/ie6/hborder_gray_shadow.png +0 -0
  154. data/public/jsme/gwt/chrome/images/ie6/vborder_blue_shadow.png +0 -0
  155. data/public/jsme/gwt/chrome/images/ie6/vborder_gray_shadow.png +0 -0
  156. data/public/jsme/gwt/chrome/images/scrolltable/bg_header_gradient.gif +0 -0
  157. data/public/jsme/gwt/chrome/images/splitPanelThumb.png +0 -0
  158. data/public/jsme/gwt/chrome/images/valuespinner/bg_textbox.png +0 -0
  159. data/public/jsme/gwt/chrome/images/vborder.png +0 -0
  160. data/public/jsme/gwt/chrome/images/vborder_ie6.png +0 -0
  161. data/public/jsme/gwt/chrome/mosaic.css +1252 -0
  162. data/public/jsme/gwt/chrome/mosaic_rtl.css +1252 -0
  163. data/public/jsme/hosted.html +365 -0
  164. data/public/jsme/jsa.css +175 -0
  165. data/public/jsme/jsme.nocache.js +18 -0
  166. data/public/rect.png +0 -0
  167. data/public/stylesheets/jquery-ui.css +1186 -0
  168. data/test/lazarweb.rb +193 -0
  169. data/test/setup.rb +7 -0
  170. data/unicorn.rb +7 -0
  171. data/views/batch.haml +58 -0
  172. data/views/details.haml +24 -0
  173. data/views/error.haml +8 -0
  174. data/views/faq.haml +2 -0
  175. data/views/faq_layout.haml +67 -0
  176. data/views/info.haml +2 -0
  177. data/views/jme_help.html +197 -0
  178. data/views/js_link.haml +5 -0
  179. data/views/layout.haml +113 -0
  180. data/views/model_details.haml +117 -0
  181. data/views/neighbors.haml +104 -0
  182. data/views/predict.haml +175 -0
  183. data/views/prediction.haml +84 -0
  184. data/views/significant_fragments.haml +66 -0
  185. data/views/style.scss +70 -0
  186. data/views/validation.haml +16 -0
  187. metadata +373 -0
data/test/lazarweb.rb ADDED
@@ -0,0 +1,193 @@
1
+ require 'minitest/autorun'
2
+ require 'capybara'
3
+ require 'capybara-webkit'
4
+
5
+ ENV['DISPLAY'] ="localhost:1.0"
6
+
7
+ Capybara.register_driver :webkit do |app|
8
+ Capybara::Webkit::Driver.new(app).tap{|d| d.browser.ignore_ssl_errors}
9
+ end
10
+ Capybara.default_driver = :webkit
11
+ Capybara.default_max_wait_time = 20
12
+ Capybara.javascript_driver = :webkit
13
+ Capybara.run_server = false
14
+ Capybara.app_host = "http://localhost:8088"
15
+
16
+ begin
17
+ puts "Service URI is: http://localhost:8088"
18
+ rescue
19
+ puts "Unable to start service."
20
+ exit
21
+ end
22
+
23
+ class LazarWebTest < MiniTest::Test
24
+
25
+ def self.test_order
26
+ :sorted
27
+ end
28
+
29
+ include Capybara::DSL
30
+
31
+ def test_00_xsetup
32
+ `Xvfb :1 -screen 0 1024x768x16 2>/dev/null &`
33
+ sleep 2
34
+ end
35
+
36
+ def test_01_visit
37
+ visit('/predict')
38
+ assert page.has_content?('Lazar Toxicity Predictions')
39
+ assert page.has_content?("Draw a chemical structure")
40
+ assert page.has_content?("enter")
41
+ assert page.has_content?("upload")
42
+ assert page.has_content?("Select one or more endpoints")
43
+ assert page.has_content?("Acute toxicity")
44
+ assert page.has_content?("Fathead minnow")
45
+ assert page.has_content?("Carcinogenicity")
46
+ assert page.has_content?("Rat")
47
+ assert page.has_content?("Rodents (multiple species/sites)")
48
+ assert page.has_content?("Mouse")
49
+ assert page.has_content?("Maximum Recommended Daily Dose")
50
+ assert page.has_content?("Human")
51
+ assert page.has_content?("Predict")
52
+ end
53
+
54
+ def test_02_insert_wrong_smiles
55
+ visit('/')
56
+ page.fill_in 'identifier', :with => "blahblah"
57
+ check('selection[Rat]')
58
+ first(:button, '>>').click
59
+ assert page.has_content?('Attention')
60
+ end
61
+
62
+ def test_03_check_all_links_exists
63
+ visit('/')
64
+ links = ["Details | Validation", "SMILES", "toxicology gmbh 2004 - #{Time.now.year.to_s}"]
65
+ links.each{|l| assert page.has_link?(l), "true"}
66
+ end
67
+
68
+ def test_04_model_details
69
+ visit("/")
70
+ details = page.all('a', :text => 'Details | Validation')
71
+ details[0].click
72
+ assert page.has_content?('Model:')
73
+ assert page.has_content?('Source: http://www.epa.gov/comptox/dsstox/sdf_epafhm.html')
74
+ assert page.has_content?('Algorithm: LAZAR')
75
+ assert page.has_content?('Type: regression')
76
+ assert page.has_content?('Training dataset: EPAFHM.csv')
77
+ assert page.has_content?('Training compounds: 617')
78
+ assert page.has_content?('Validation:')
79
+ assert page.has_content?('Num folds: 10')
80
+ details[0].click
81
+ #
82
+ details[1].click
83
+ assert page.has_content?('Model:')
84
+ assert page.has_content?('Source: http://www.epa.gov/ncct/dsstox/sdf_cpdbas.html')
85
+ assert page.has_content?('Algorithm: LAZAR')
86
+ assert page.has_content?('Type: classification')
87
+ assert page.has_content?('Training dataset: DSSTox_Carcinogenic_Potency_DBS_Rat.csv')
88
+ assert page.has_content?('Training compounds: 1195')
89
+ assert page.has_content?('Validation:')
90
+ assert page.has_content?('Num folds: 10')
91
+ details[1].click
92
+ #
93
+ details[2].click
94
+ assert page.has_content?('Model:')
95
+ assert page.has_content?('Source: http://www.epa.gov/ncct/dsstox/sdf_cpdbas.html')
96
+ assert page.has_content?('Algorithm: LAZAR')
97
+ assert page.has_content?('Type: classification')
98
+ assert page.has_content?('Training dataset: DSSTox_Carcinogenic_Potency_DBS_MultiCellCall.csv')
99
+ assert page.has_content?('Training compounds: 1116')
100
+ assert page.has_content?('Validation:')
101
+ assert page.has_content?('Num folds: 10')
102
+ details[2].click
103
+ #
104
+ details[3].click
105
+ assert page.has_content?('Model:')
106
+ assert page.has_content?('Source: http://www.epa.gov/ncct/dsstox/sdf_cpdbas.html')
107
+ assert page.has_content?('Algorithm: LAZAR')
108
+ assert page.has_content?('Type: classification')
109
+ assert page.has_content?('Training dataset: DSSTox_Carcinogenic_Potency_DBS_Mouse.csv')
110
+ assert page.has_content?('Training compounds: 973')
111
+ assert page.has_content?('Validation:')
112
+ assert page.has_content?('Num folds: 10')
113
+ details[3].click
114
+ #
115
+ details[4].click
116
+ assert page.has_content?('Model:')
117
+ assert page.has_content?('Source: http://www.epa.gov/comptox/dsstox/sdf_fdamdd.html')
118
+ assert page.has_content?('Algorithm: LAZAR')
119
+ assert page.has_content?('Type: regression')
120
+ assert page.has_content?('Training dataset: FDA_v3b_Maximum_Recommended_Daily_Dose_mmol.csv')
121
+ assert page.has_content?('Training compounds: 1216')
122
+ assert page.has_content?('Validation:')
123
+ assert page.has_content?('Num folds: 10')
124
+ details[4].click
125
+ end
126
+
127
+ def test_05_predict
128
+ visit('/')
129
+ page.fill_in('identifier', :with => "NNc1ccccc1")
130
+ check('selection[Rat]')
131
+ first(:button, '>>').click
132
+ assert page.has_content?('Carcinogenicity (Rat)'), "true"
133
+ assert page.has_content?('Type: Classification'), "true"
134
+ assert page.has_content?('Prediction: active'), "true"
135
+ assert page.has_content?('Confidence: 0.019'), "true"
136
+ assert page.has_content?('Neighbors'), "true"
137
+ assert page.has_content?('Compound'), "true"
138
+ assert page.has_content?('Measured Activity'), "true"
139
+ assert page.has_content?('Similarity'), "true"
140
+ =begin
141
+ assert page.has_link?('Significant fragments'), "true"
142
+ assert page.has_link?('v'), "true"
143
+ open 'significant fragments' view
144
+ find_link('linkPredictionSf').click
145
+ sleep 5
146
+ within_frame('details_overview') do
147
+ assert page.has_content?('Predominantly in compounds with activity "inactive"'), "true"
148
+ assert page.has_content?('Predominantly in compounds with activity "active"'), "true"
149
+ assert page.has_content?('p value'), "true"
150
+ # inactive
151
+ assert page.has_content?('[#6&a]:[#6&a]:[#6&a]:[#6&a]:[#6&a]-[#7&A]'), "true"
152
+ assert page.has_content?('0.98674'), "true"
153
+ assert page.has_content?('[#6&a]:[#6&a](-[#7&A])(:[#6&a]:[#6&a]:[#6&a])'), "true"
154
+ assert page.has_content?('0.97699'), "true"
155
+ assert page.has_content?('[#6&a]:[#6&a](-[#7&A])(:[#6&a]:[#6&a])'), "true"
156
+ assert page.has_content?('0.97699'), "true"
157
+ assert page.has_content?('[#6&a]:[#6&a](-[#7&A])(:[#6&a])'), "true"
158
+ assert page.has_content?('0.97699'), "true"
159
+ assert page.has_content?('[#6&a]:[#6&a]'), "true"
160
+ assert page.has_content?('0.99605'), "true"
161
+ assert page.has_content?('[#6&a]:[#6&a]:[#6&a]:[#6&a]'), "true"
162
+ assert page.has_content?('0.99791'), "true"
163
+ assert page.has_content?('[#6&a]:[#6&a]:[#6&a]:[#6&a]:[#6&a]'), "true"
164
+ assert page.has_content?('0.99985'), "true"
165
+ # active
166
+ assert page.has_content?('[#7&A]-[#7&A]'), "true"
167
+ assert page.has_content?('0.99993'), "true"
168
+ # close 'significant fragments' view
169
+ find_button('closebutton').click
170
+ end
171
+ find_link('link0').click
172
+ sleep 2
173
+ assert page.has_content?('Supporting information'), "true"
174
+ first(:link, 'linkCompound').click
175
+ sleep 5
176
+ within_frame('details_overview') do
177
+ assert page.has_content?('SMILES:'), "true"
178
+ assert page.has_content?('c1ccc(cc1)NN'), "true"
179
+ assert page.has_content?('InChI:'), "true"
180
+ assert page.has_content?('1S/C6H8N2/c7-8-6-4-2-1-3-5-6/h1-5,8H,7H2'), "true"
181
+ assert page.has_content?('Names:'), "true"
182
+ assert page.has_content?('Phenylhydrazine'), "true"
183
+ assert page.has_link?('PubChem read across'), "true"
184
+ end
185
+ =end
186
+ end
187
+
188
+ def test_99_kill
189
+ `pidof Xvfb|xargs kill`
190
+ end
191
+
192
+ end
193
+
data/test/setup.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'minitest/autorun'
2
+ require_relative '../lib/lazar.rb'
3
+ include OpenTox
4
+ TEST_DIR ||= File.expand_path(File.dirname(__FILE__))
5
+ DATA_DIR ||= File.join(TEST_DIR,"data")
6
+ #$mongo.database.drop
7
+ #$gridfs = $mongo.database.fs # recreate GridFS indexes
data/unicorn.rb ADDED
@@ -0,0 +1,7 @@
1
+ #worker_processes 4
2
+ timeout 6000
3
+ listen 8088
4
+ log_dir = "#{ENV['HOME']}"
5
+ log_file = File.join log_dir, "lazar.log"
6
+ stderr_path log_file
7
+ stdout_path log_file
data/views/batch.haml ADDED
@@ -0,0 +1,58 @@
1
+ %div.well
2
+ %a.btn.btn-warning{:href => to('/predict')}
3
+ %span.glyphicon.glyphicon-menu-left{:aria=>{:hidden=>"true"}}
4
+ New Prediction
5
+ / displays all prediction result in first table
6
+ %div.table-responsive
7
+ %table.table.table-bordered{:id=>"batch", :style=>"background-color:white;"}
8
+ %thead
9
+ %tr
10
+ %h3.col-md-4{:style=>"padding-left:0;"} Batch Prediction Results:
11
+ %h3.col-md-8= @filename
12
+ %tr
13
+ %span.btn.btn-default
14
+ %a{:href=>"#{to("/predict/#{@filename}")}", :title=>"download"}
15
+ %span.glyphicon.glyphicon-download-alt{:aria=>{:hidden=>"true"}}
16
+ CSV
17
+ %tbody
18
+ / key = compound, values = array of arrays with model, prediction
19
+ - @batch.each do |key, values|
20
+ - compound = key
21
+ - mw = compound.molecular_weight
22
+ %tr
23
+ %td{:style=>"vertical-align:top;"}
24
+ %p= compound.svg
25
+ %p= compound.smiles
26
+ / array = single prediction [endpoint, result]
27
+ - values.each_with_index do |array,i|
28
+ %td{:style=>"vertical-align:top;white-space:nowrap;"}
29
+ - model = array[0]
30
+ - prediction = array[1]
31
+ %b{:class => "title"}
32
+ = "#{model.endpoint.gsub('_', ' ')} (#{model.species})"
33
+ %p
34
+ - if prediction[:confidence] == "measured"
35
+ %p
36
+ %b Measured activity:
37
+ - if prediction[:value].is_a?(Array)
38
+ = prediction[:value][0].numeric? ? prediction[:value].collect{|v| weight = compound.mmol_to_mg(v, mw); '%.2e' % v + " (#{model.unit})"+" | #{'%.2e' % weight} (mg/kg_bw/day)"}.join("</br>") : prediction[:value].join(", ")
39
+ - else
40
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
41
+ %p
42
+ %b Compound is part of the training dataset
43
+ - elsif prediction[:neighbors].size > 0
44
+ %p
45
+ / model type (classification|regression)
46
+ %b Type:
47
+ = model.model.class.to_s.match("Classification") ? "Classification" : "Regression"
48
+ %br
49
+ %b Prediction:
50
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
51
+ %br
52
+ / TODO probability
53
+ %b Confidence:
54
+ = prediction[:confidence].round(3)
55
+ %p
56
+ - else
57
+ %p
58
+ = "Not enough similar compounds </br>in training dataset."
@@ -0,0 +1,24 @@
1
+ %div.modal-body{:style=>"padding:10px;"}
2
+ %button.close{ :type=>" button", data: { dismiss:"modal"}} &times;
3
+ %h3
4
+ Names and synonyms:
5
+ %img.img-responsive{:src=>"#{@compound.uri}/image", :alt=>"Compound image not available", :width=>"300px", :heigth=>"300px", :style=>"float:left;"}
6
+ %p
7
+ %b="SMILES:"
8
+ %p= @smiles
9
+ %br
10
+ %b="InChI:"
11
+ %p= @inchi
12
+ %br
13
+ %b="Names:"
14
+ %p{:style=>"padding-left:0.5em;"}
15
+ - if @names !~ /^no names/i
16
+ = @names.join("; ")
17
+ - else
18
+ = @names
19
+ %hr
20
+ %p{:style=>"padding-left:0.5em;"}
21
+ / pubchem link
22
+ %a.btn.btn-primary{:href=>"http://aop.in-silico.ch/", :title=>"Link opens in new window.", :alt=>"pubchem read across", :target=>"_blank"} PubChem read across
23
+ %i (experimental)
24
+ %br
data/views/error.haml ADDED
@@ -0,0 +1,8 @@
1
+ %div.well
2
+ %a.btn.btn-warning{:href => to('/predict')}
3
+ %i.glyphicon.glyphicon-menu-left
4
+ Back
5
+ %hr
6
+ %div.well{:style=>"width:100%;margin-bottom:2em;"}
7
+ = @error_report
8
+
data/views/faq.haml ADDED
@@ -0,0 +1,2 @@
1
+ %div.well.faq
2
+ = @faq
@@ -0,0 +1,67 @@
1
+ !!!
2
+ %html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
3
+ %head
4
+ %meta{'charset'=>"utf-8"}
5
+ %meta{'http-equiv'=>"X-UA-Compatible", :content=>"IE=edge"}
6
+ %meta{'name'=>"viewport", :content=>"width=device-width, initial-scale=1"}
7
+ %title Lazar GUI FAQ
8
+ %link{:rel=>'icon', :type=>'image/x-icon', :href=>'/images/favicon.ico'}
9
+ %link{:rel=>'stylesheet', :href=>"#{'/css/bootstrap.min.css'}"}
10
+ %link{:rel=>'stylesheet', :href=>"#{'/css/theme.default.min.css'}"}
11
+ %link{:rel=>'stylesheet', :href=>"#{'/css/theme.bootstrap.min.css'}"}
12
+ %link{ :href=>"/style.css", :rel=>"stylesheet"}
13
+ %link{ :href=>"/stylesheets/jquery-ui.css", :rel=>"stylesheet"}
14
+ %script{:src=>"/javascripts/jquery-1.11.2.min.js"}
15
+ %script{:src=>"/javascripts/bootstrap.min.js"}
16
+ %script{ :src=>"/javascripts/lazar-gui.js"}
17
+ %body
18
+ %noscript
19
+ %div{ :style=>"width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"}
20
+ Your web browser must have JavaScript enabled in order for this application to display correctly.
21
+ %header.page-header
22
+ %div.row
23
+ %div.col-md-2
24
+ %a{:href=> to("/predict")}
25
+ %img.media-object{:src=>"/images/ist_logo.png", :alt=>"logo", :style=>"margin:0 3em 0 2em;"}
26
+ %div.col-md-10
27
+ %h1.media-heading{:style=>"margin: 0 0 0 1em;display:inline;"} Lazar GUI
28
+ A Graphical User Interface for the <a href="http://github.com/opentox/lazar">Lazar</a> framework
29
+
30
+ %div.container-fluid
31
+ :javascript
32
+ $(document).ready(function(){
33
+ $("#back-top").hide();
34
+ $(".blind").error(function(){
35
+ $(this).attr('src', '/images/blind.png');
36
+ });
37
+ });
38
+
39
+ = yield
40
+
41
+ %footer.footer
42
+ %div.container-fluid
43
+ %p.text-muted
44
+ &copy;
45
+ %a{:href => 'http://www.in-silico.ch', :rel => "external"} <i style="font-family: serife">in silico</i> toxicology gmbh 2004 - #{Time.now.year.to_s}
46
+
47
+ #back-top{:style => "z-index:100;position:fixed;bottom:1%;right:1%;"}
48
+ %a{:href => "", :style=>"text:decoration:none;color:#ccc;"}
49
+ %span.glyphicon.glyphicon-circle-arrow-up{:style => "font-size:3em;color:black;"}
50
+ :javascript
51
+ $("#back-top").hide();
52
+ $(function () {
53
+ $(window).scroll(function () {
54
+ if ($(this).scrollTop() > 600) {
55
+ $('#back-top').fadeIn();
56
+ } else {
57
+ $('#back-top').fadeOut();
58
+ }
59
+ });
60
+ // scroll body to 0px on click
61
+ $('#back-top a').click(function () {
62
+ $('body,html').animate({
63
+ scrollTop: 0
64
+ }, 500);
65
+ return false;
66
+ });
67
+ });
data/views/info.haml ADDED
@@ -0,0 +1,2 @@
1
+ %div.info
2
+ currently no models available
@@ -0,0 +1,197 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+
3
+ <html>
4
+ <head>
5
+ <meta name="generator" content=
6
+ "HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org">
7
+ <meta http-equiv="content-type" content=
8
+ "text/html; charset=us-ascii">
9
+
10
+ <title>JME Help</title>
11
+ <meta name="author" content="Peter Ertl, Novartis Pharma AG">
12
+ <link rel="stylesheet" href="../style.css" type="text/css">
13
+ <style type="text/css">
14
+ body {
15
+ background-color: white;
16
+ }
17
+ h2.c3 {text-align: center}
18
+ p.c2 {font-style: italic; text-align: right}
19
+ p.c1 {text-align: center}
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <h1>JME Molecular Editor</h1>
25
+
26
+ <p class="c2">Written by Peter Ertl, Novartis Pharma
27
+ AG</p>
28
+
29
+ <h2 class="c3">Basic Instructions</h2>
30
+
31
+ <p>This editor is intended to be used without any special
32
+ documentation or training, but there are some tricks which
33
+ can help you to work with it more efficiently.</p>
34
+
35
+ <h3>Menu Buttons</h3>
36
+
37
+ <ul>
38
+ <li><b>D-R</b> deletes functional groups - choose this
39
+ option and then click on the bond connecting the group
40
+ with the main skeleton</li>
41
+
42
+ <li><b>UDO</b> undo last editing step</li>
43
+
44
+ <li><b>QRY</b> (if enabled in the param tag) allows easy
45
+ specification of atomic queries for substructure
46
+ searches</li>
47
+
48
+ <li><b>Stereo bonds</b> - the type of stereo bond (up,
49
+ down) may be changed by clicking on the already created
50
+ stereo bond; this cycles through two / four possible
51
+ stereo bond types</li>
52
+
53
+ <li><b>Atomic charges</b> may be changed by the
54
+ <b>+/-</b> button. Editor enables modification of charges
55
+ only in "reasonable" cases. If you are not satisfied with
56
+ the editor's inteligence (concerning charges and the
57
+ explicit number of hydrogens) you can force your will by
58
+ using the <b>X</b> button</li>
59
+
60
+ <li><b>"Non-organic" atoms</b> or atoms with nonstandard
61
+ valence may be entered with help of <b>X</b> button by
62
+ specifying atomic SMILES (without [ ] brackets, i.e. Si,
63
+ Fe++, NH3+).</li>
64
+ </ul>
65
+
66
+ <h3>Keyboard Shortcuts</h3>
67
+
68
+ <p>Most of the commands may be accessed also by keyboard
69
+ shortcuts. It is possible to:</p>
70
+
71
+ <ul>
72
+ <li>change <b>atom type</b> by pressing <b>C</b>,
73
+ <b>N</b>, <b>O</b>, <b>S</b>, <b>F</b>, <b>L</b> (for Cl)
74
+ <b>B</b> (for Br) <b>I</b>, <b>P</b>, <b>H</b>, <b>X</b>,
75
+ <b>R</b> and clicking the respective atom</li>
76
+
77
+ <li>choose <b>bond order</b>: <b>-</b> for single bond,
78
+ <b>=</b> for double bond, <b>#</b> for triple bond</li>
79
+
80
+ <li>choose <b>ring type</b> by pressing <b>3</b>,
81
+ <b>4</b>, <b>5</b>, <b>6</b>, <b>7</b>, <b>8</b>,
82
+ <b>9</b> or <b>1</b> for phenyl, <b>0</b> for furyl</li>
83
+
84
+ <li>start <b>delete mode</b> by pressing <b>D</b> or
85
+ <b>Del</b> and</li>
86
+
87
+ <li>return to the <b>standard state</b> (carbon, single
88
+ bond) with <b>Esc</b></li>
89
+ </ul>
90
+
91
+ <p><b>common functional groups</b> may also be added by
92
+ keyboard shortcuts. Use <b>t</b> for t-butyl, <b>ft</b> for
93
+ trifluoromethyl, <b>lt</b> for trichloromethyl, <b>a</b>
94
+ for COOH, <b>z</b> for SO2Me and <b>y</b> for nitro, and
95
+ then click the atom where the group should be
96
+ connected.</p>
97
+
98
+ <h3>Moving and Rotation</h3>
99
+
100
+ <p>You can move molecule by "dragging free space" with the
101
+ left mouse button and rotate it by using the left mouse
102
+ button and <b>Shift</b> key (or left and right mouse
103
+ buttons together).</p>
104
+
105
+ <h3>Adding rings</h3>
106
+
107
+ <p>When a ring template is selected and multivalent atom is
108
+ clicked, a new ring will be created connected by single
109
+ bond to this atom. When spiro ring is required, the
110
+ <b>Shift</b> key must be pressed when clicking on the atom.
111
+ Spiro ring may be added only to atom with 2 single
112
+ bonds.</p>
113
+
114
+ <h3>Multivalent nitrogen groups</h3>
115
+
116
+ <p>Multivalent nitrogen groups, such as nitro, azide,
117
+ N-oxide, nitrile etc, should be drawn with a pentavalent
118
+ nitrogen as shown below.</p>
119
+
120
+ <p class="c1"><img src="images/nitro.gif" alt=
121
+ "nitro stuff"></p>
122
+
123
+ <p>The program automatically converts polar form of these
124
+ groups into non-polar one with pentavalent nitrogen. If you
125
+ prefer polar nitro (and similar) groups, use keyword
126
+ "polarnitro" in the applet param tag.</p>
127
+
128
+ <h3>Stereochemistry</h3>
129
+
130
+ <p>Stereochemistry at C4 centers, double bonds and allenes
131
+ is supported. Use the up/down wedge bonds to indicate
132
+ stereochemistry at the C4 centers. Remember, that only
133
+ bonds with a "sharp point" towards the atom are considered.
134
+ When creating SMILES the editor tries to guess missing
135
+ stereo features, in unresolvable cases an error message is
136
+ issued and the SMILES without stereo information is
137
+ created.</p>
138
+
139
+ <p>When the autoez keyword is set, SMILES with E,Z
140
+ stereochemistry on all non-ring double bonds is generated
141
+ automatically. Without this keyword (or for ring double
142
+ bonds) you have to mark a double bond as stereo by clicking
143
+ on it with the stereo bond button selected. The bond color
144
+ will change to violet.</p>
145
+
146
+ <p>Stereochemistry may be completely disabled by the
147
+ "nostereo" option in the param tag.</p>
148
+
149
+ <h3>Input of Multipart Structures</h3>
150
+
151
+ <p>By default only non-disconnected structures are allowed.
152
+ This may be changed by a "multipart" option in the applet
153
+ param tag. A button <b>NEW</b> appears in the JME menu.
154
+ Creation of a new molecule may be started only after
155
+ clicking the <b>NEW</b> button, selecting a proper template
156
+ (atom, ring, bond) and clicking free space in the drawing
157
+ area. Without <b>NEW</b> button the click on the free space
158
+ has the same effect as in the standard mode (i.e moving or
159
+ rotation of the last touched molecule). In the multipart
160
+ mode <b>CLR</b> button deletes the last touched
161
+ molecule.</p>
162
+
163
+ <h3>Atom Numbering</h3>
164
+
165
+ <p>Atom numbering (marking) is enabled with the option
166
+ "number" in the applet param tag (for reaction input this
167
+ is default). Button <b>123</b> appears in the JME menu. To
168
+ mark an atom press the <b>123</b> button and then the atom.
169
+ You can mark more atoms with the same number when pressing
170
+ <b>Shift</b> while clicking the 2nd and further atoms.
171
+ Second click on the marked atom deletes the number.</p>
172
+
173
+ <h3>Reaction Input</h3>
174
+
175
+ <p>Reaction input is enabled with the option "reaction" in
176
+ the applet param tag. Button with an arrow, <b>NEW</b>
177
+ button and <b>123</b> button appear in the JME menu and
178
+ arrow appears also in the drawing area. Now simply draw
179
+ reactant(s), product(s) and modulator(s) (modulators have
180
+ to be above the arrow) as explained in the description of
181
+ input of multipart structures. The arrow button enables
182
+ simplified input of reactions. After clicking it, the
183
+ reactant will be copied to the product (including atom
184
+ numbering, if any). When the <b>Shift</b> is pressed during
185
+ this action all atoms will be automatically numbered.</p>
186
+
187
+ <h3>Query Features</h3>
188
+
189
+ <p>Query button (when enabled in the option tag) launches a
190
+ query window which allows creation of SMARTS atom queries
191
+ by combining various atom attributes. Create a SMARTS query
192
+ and then click the respective atom in the
193
+ molecule.</p>
194
+ </body>
195
+ </html>
196
+
197
+