sequenceserver 2.0.0.beta3 → 2.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/.eslintrc.json +36 -0
  3. data/.rubocop.yml +1 -1
  4. data/.travis.yml +53 -20
  5. data/AppImage/recipe.yml +15 -0
  6. data/AppImage/sequenceserver.desktop +8 -0
  7. data/AppImage/sequenceserver.png +0 -0
  8. data/AppImage/sequenceserver.sh +11 -0
  9. data/README.md +79 -46
  10. data/bin/sequenceserver +4 -4
  11. data/lib/sequenceserver/version.rb +1 -1
  12. data/package.json +2 -0
  13. data/public/css/grapher.css +3 -0
  14. data/public/css/sequenceserver.css +17 -6
  15. data/public/css/sequenceserver.min.css +3 -3
  16. data/public/js/circos.js +515 -491
  17. data/public/js/grapher.js +12 -6
  18. data/public/js/hits_overview.js +321 -308
  19. data/public/js/hsp.js +12 -7
  20. data/public/js/length_distribution.js +241 -234
  21. data/public/js/report.js +196 -174
  22. data/public/js/search.js +3 -3
  23. data/public/js/sequenceserver.js +9 -9
  24. data/public/js/utils.js +17 -10
  25. data/public/js/visualisation_helpers.js +77 -77
  26. data/public/sequenceserver-report.min.js +17 -17
  27. data/public/sequenceserver-search.min.js +1 -1
  28. data/public/vendor/github/nicgirault/circosJs@1.7.0/dist/circosJS.js +1 -5
  29. data/sequenceserver.gemspec +1 -2
  30. data/spec/blast_versions/blast_2.2.30/blast_2.2.30_spec.rb +13 -13
  31. data/spec/blast_versions/blast_2.2.30/import_spec_capybara_local_2.2.30.rb +555 -25
  32. data/spec/blast_versions/blast_2.2.31/blast_2.2.31_spec.rb +13 -13
  33. data/spec/blast_versions/blast_2.2.31/import_spec_capybara_local_2.2.31.rb +558 -24
  34. data/spec/blast_versions/blast_2.3.0/blast_2.3.0_spec.rb +13 -13
  35. data/spec/blast_versions/blast_2.3.0/import_spec_capybara_local_2.3.0.rb +561 -26
  36. data/spec/blast_versions/blast_2.4.0/blast_2.4.0_spec.rb +13 -13
  37. data/spec/blast_versions/blast_2.4.0/import_spec_capybara_local_2.4.0.rb +561 -25
  38. data/spec/blast_versions/blast_2.5.0/blast_2.5.0_spec.rb +13 -13
  39. data/spec/blast_versions/blast_2.5.0/import_spec_capybara_local_2.5.0.rb +558 -24
  40. data/spec/blast_versions/blast_2.6.0/blast_2.6.0_spec.rb +13 -13
  41. data/spec/blast_versions/blast_2.6.0/import_spec_capybara_local_2.6.0.rb +559 -24
  42. data/spec/blast_versions/blast_2.7.1/blast_2.7.1_spec.rb +13 -13
  43. data/spec/blast_versions/blast_2.7.1/import_spec_capybara_local_2.7.1.rb +559 -28
  44. data/spec/blast_versions/blast_2.8.1/blast_2.8.1_spec.rb +13 -13
  45. data/spec/blast_versions/blast_2.8.1/import_spec_capybara_local_2.8.1.rb +559 -27
  46. data/spec/blast_versions/blast_2.9.0/blast_2.9.0_spec.rb +13 -13
  47. data/spec/blast_versions/blast_2.9.0/import_spec_capybara_local_2.9.0.rb +557 -25
  48. data/spec/blast_versions/diamond_0.9.24/diamond_0.9.24_spec.rb +13 -13
  49. data/spec/blast_versions/diamond_0.9.24/import_spec_capybara_local_0.9.24.rb +219 -21
  50. data/spec/capybara_spec.rb +25 -28
  51. data/spec/download_helper.rb +6 -3
  52. data/spec/sequences/MH011443_1_gi_1486783306_gb_MH011443_1.txt +6 -0
  53. data/spec/sequences/MH011443_1_gi_1486783307_gb_AYF55702_1.txt +6 -0
  54. data/spec/sequences/MH011443_1_gi_1528997474_gb_MH447967_1.txt +30 -0
  55. data/spec/sequences/MH011443_1_sp_P04637_P53_HUMAN.txt +6 -0
  56. data/spec/sequences/alignment-35_hits_diamond_blastp.txt +210 -0
  57. data/spec/sequences/alignment-35_hits_diamond_blastx.txt +210 -0
  58. data/spec/sequences/alignment-3_hits.txt +18 -0
  59. data/spec/sequences/alignment-40_hits_blastn.txt +246 -0
  60. data/spec/sequences/alignment-40_hits_blastp.txt +240 -0
  61. data/spec/sequences/alignment-40_hits_blastp_2.2.30.txt +240 -0
  62. data/spec/sequences/alignment-40_hits_blastx.txt +240 -0
  63. data/spec/sequences/alignment-40_hits_tblastn.txt +240 -0
  64. data/spec/sequences/alignment-40_hits_tblastn_2.2.30.txt +240 -0
  65. data/spec/sequences/alignment-40_hits_tblastx.txt +2664 -0
  66. data/spec/sequences/alignment-4_hits.txt +24 -0
  67. data/spec/sequences/alignment-4_hits_blastn.txt +24 -0
  68. data/spec/sequences/alignment-4_hits_blastp.txt +24 -0
  69. data/spec/sequences/alignment-4_hits_blastp_2.2.30.txt +24 -0
  70. data/spec/sequences/alignment-4_hits_blastx.txt +24 -0
  71. data/spec/sequences/alignment-4_hits_diamond_blastp.txt +24 -0
  72. data/spec/sequences/alignment-4_hits_diamond_blastx.txt +24 -0
  73. data/spec/sequences/alignment-4_hits_tblastn.txt +24 -0
  74. data/spec/sequences/alignment-4_hits_tblastn_2.2.30.txt +24 -0
  75. data/spec/sequences/alignment-4_hits_tblastx.txt +318 -0
  76. data/spec/sequences/sp_P04637_P53_HUMAN_gi_1099170394_ref_XP_018868681_1.txt +6 -0
  77. data/spec/sequences/sp_P04637_P53_HUMAN_gi_120407068_ref_NP_000537_3.txt +6 -0
  78. data/spec/sequences/sp_P04637_P53_HUMAN_gi_1484127324_gb_MG595988_1.txt +6 -0
  79. data/spec/sequences/sp_P04637_P53_HUMAN_gi_395440626_gb_JQ694049_1.txt +6 -0
  80. data/spec/sequences/sp_P04637_P53_HUMAN_sp_P04637_P53_HUMAN.txt +6 -0
  81. data/spec/spec_helper.rb +3 -3
  82. metadata +67 -57
  83. data/.eslintrc +0 -213
  84. data/Rakefile +0 -8
  85. data/spec/dotdir/blast_2.4.0/blastn/TBLASTN_XML_2.4.0.xml +0 -1181
  86. data/spec/dotdir/blast_2.5.0/blastn/BLASTN_LONG_XML_2.5.0.xml +0 -18813
  87. data/spec/import_spec_capybara_local.rb +0 -61
@@ -32,9 +32,9 @@ module SequenceServer
32
32
  no_hits_report = BLAST::Report.new(no_hits)
33
33
 
34
34
  it 'will return queries with valid length' do
35
- hits_report.queries.first.length.should be_a Fixnum
35
+ hits_report.queries.first.length.should be_a Integer
36
36
  hits_report.queries.first.length.should satisfy { |n| n > 0 }
37
- no_hits_report.queries.first.length.should be_a Fixnum
37
+ no_hits_report.queries.first.length.should be_a Integer
38
38
  no_hits_report.queries.first.length.should satisfy { |n| n > 0 }
39
39
  end
40
40
 
@@ -79,45 +79,45 @@ module SequenceServer
79
79
  # Test Random HSPs to ensure that all the values from HSP struct are valid.
80
80
  it 'have correct alignment values' do
81
81
  hits_report.queries.last.hits.first.hsps.last.bit_score.should be_a Float
82
- hits_report.queries.last.hits.first.hsps.last.score.should be_a Fixnum
82
+ hits_report.queries.last.hits.first.hsps.last.score.should be_a Integer
83
83
 
84
84
  hits_report.queries.first.hits.first.hsps.first.evalue.should be_a Float
85
85
  hits_report.queries.first.hits.first.hsps.first.evalue
86
86
  .should_not satisfy { |n| n < 0 }
87
87
 
88
- hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Fixnum
88
+ hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Integer
89
89
  hits_report.queries.first.hits.last.hsps.first.qstart
90
90
  .should_not satisfy { |n| n < 0 }
91
91
 
92
- hits_report.queries.first.hits.last.hsps.first.qend.should be_a Fixnum
92
+ hits_report.queries.first.hits.last.hsps.first.qend.should be_a Integer
93
93
  hits_report.queries.first.hits.last.hsps.first.qend
94
94
  .should_not satisfy { |n| n < 0 }
95
95
 
96
- hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Fixnum
96
+ hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Integer
97
97
  hits_report.queries.last.hits.last.hsps.last.sstart
98
98
  .should_not satisfy { |n| n < 0 }
99
99
 
100
- hits_report.queries.first.hits.first.hsps.last.send.should be_a Fixnum
100
+ hits_report.queries.first.hits.first.hsps.last.send.should be_a Integer
101
101
  hits_report.queries.first.hits.first.hsps.last.send
102
102
  .should_not satisfy { |n| n < 0 }
103
103
 
104
- hits_report.queries.first.hits.first.hsps.last.qframe.should be_a Fixnum
105
- hits_report.queries.first.hits.first.hsps.last.sframe.should be_a Fixnum
104
+ hits_report.queries.first.hits.first.hsps.last.qframe.should be_a Integer
105
+ hits_report.queries.first.hits.first.hsps.last.sframe.should be_a Integer
106
106
 
107
- hits_report.queries.first.hits.first.hsps.last.identity.should be_a Fixnum
107
+ hits_report.queries.first.hits.first.hsps.last.identity.should be_a Integer
108
108
  hits_report.queries.first.hits.first.hsps.last.identity
109
109
  .should_not satisfy { |n| n < 0 }
110
110
 
111
- hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Fixnum
111
+ hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Integer
112
112
  hits_report.queries.first.hits.first.hsps.last.gaps
113
113
  .should_not satisfy { |n| n < 0 }
114
114
 
115
115
  hits_report.queries.first.hits.first.hsps.last.positives
116
- .should be_a Fixnum
116
+ .should be_a Integer
117
117
  hits_report.queries.first.hits.first.hsps.last.positives
118
118
  .should_not satisfy { |n| n < 0 }
119
119
 
120
- hits_report.queries.first.hits.first.hsps.last.length.should be_a Fixnum
120
+ hits_report.queries.first.hits.first.hsps.last.length.should be_a Integer
121
121
  hits_report.queries.first.hits.first.hsps.last.length
122
122
  .should satisfy { |n| n > 0 }
123
123
 
@@ -1,53 +1,585 @@
1
- require 'spec_helper'
2
- require 'sauce_whisk'
3
- require 'capybara/rspec'
4
- require 'selenium-webdriver'
1
+ describe 'report generated from imported XML',type: :feature, js: true do
5
2
 
6
- RSpec.configure do |config|
7
- config.include Capybara::DSL
8
- end
3
+ # Test suite to test features of imported XML report. Fasta files used for
4
+ # testing consist of TP53 and COX41 protein/nucleotide sequences for
5
+ # reproducibility. Each query was limited to 20 hits to not to overload the
6
+ # test suite.
7
+
8
+ # BLASTP test scenarios
9
+ it 'loads BLASTP XML and tests hit alignment and sidebar Alignment download' do
10
+ access_by_uuid('blast_2.9.0/blastp')
11
+
12
+ # Click on the first hit Alignment download button on the page and wait for
13
+ # the download to finish.
14
+
15
+ page.execute_script("$('.download-aln:eq(0)').click()")
16
+ wait_for_download
17
+ expect(File.basename(downloaded_file)).to eq('sp_P04637_P53_HUMAN_gi_1099170394_ref_XP_018868681_1.txt')
18
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/sp_P04637_P53_HUMAN_gi_1099170394_ref_XP_018868681_1.txt"))
19
+
20
+ clear_downloads
21
+
22
+ # Click on the Alignment of all hits download and compare the downloaded
23
+ # content
24
+
25
+ page.click_link('Alignment of all hits')
26
+ wait_for_download
27
+ expect(File.basename(downloaded_file)).to eq('alignment-40_hits.txt')
28
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-40_hits_blastp.txt"))
29
+
30
+ clear_downloads
31
+
32
+ # Check the cheboxes of indicted hits and click on the download of Alignment
33
+ # of selected hits and compare the downloaded content
34
+
35
+ page.check('Query_1_hit_1_checkbox')
36
+ page.check('Query_1_hit_2_checkbox')
37
+ page.check('Query_2_hit_1_checkbox')
38
+ page.check('Query_2_hit_2_checkbox')
39
+ page.click_link('Alignment of 4 selected hit(s)')
40
+ wait_for_download
41
+
42
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
43
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-4_hits_blastp.txt"))
44
+ end
45
+
46
+ it 'loads BLASTP XML and tests alignment overview and hit PNG/SVG download' do
47
+ access_by_uuid('blast_2.9.0/blastp')
48
+
49
+ # Click on the PNG/SVG download button of the alignment overview and compare
50
+ # the downloaded content.
51
+
52
+ page.execute_script("$('.export-to-png:eq(0)').click()")
53
+ wait_for_download
54
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-sp_P04637_P53_HUMAN.png')
55
+
56
+ clear_downloads
57
+
58
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
59
+ wait_for_download
60
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-sp_P04637_P53_HUMAN.svg')
61
+
62
+ clear_downloads
63
+
64
+ # Click on the PNG/SVG download button of the first hit available and
65
+ # compare the downloaded content.
9
66
 
10
- describe 'report generated from imported XML', :js => true do
11
- before do |scenario|
12
- Capybara.app = SequenceServer.init
13
- Capybara.server = :webrick
14
- Capybara.javascript_driver = :selenium
15
- Capybara.default_max_wait_time = 10
67
+ page.execute_script("$('.export-to-png:eq(1)').click()")
68
+ wait_for_download
69
+ expect(File.basename(downloaded_file)).to eq('Kablammo-sp_P04637_P53_HUMAN-gi_1099170394_ref_XP_018868681_1.png')
16
70
 
17
- Capybara.register_driver :selenium do |app|
18
- options = ::Selenium::WebDriver::Firefox::Options.new
19
- options.args << '--headless'
20
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
21
- end
71
+ clear_downloads
72
+
73
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
74
+ wait_for_download
75
+ expect(File.basename(downloaded_file)).to eq('Kablammo-sp_P04637_P53_HUMAN-gi_1099170394_ref_XP_018868681_1.svg')
76
+ page.should have_content('BLASTP')
22
77
  end
23
78
 
24
- # Fasta files used for testing consist of TP53 and COX41 protein/nucleotide sequences for reproducibility.
25
- it 'loads BLASTP xml output' do
79
+ it 'loads BLASTP XML and tests Circos download' do
26
80
  access_by_uuid('blast_2.9.0/blastp')
81
+
82
+ # Click on the Circos expanding button, wait for animation, click on the
83
+ # download of PNG/SVG file and test that it initiated a file download in a
84
+ # right format.
85
+
86
+ page.should have_content('Chord diagram: queries and their top hits')
87
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
88
+ sleep 1
89
+
90
+ page.execute_script("$('.export-to-png:eq(0)').click()")
91
+ wait_for_download
92
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
93
+
94
+ clear_downloads
95
+
96
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
97
+ wait_for_download
98
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
99
+ end
100
+
101
+ it 'loads BLASTP XML and tests Length distribution download' do
102
+ access_by_uuid('blast_2.9.0/blastp')
103
+
104
+ # Click on the Length distribution expanding button, wait for animation,
105
+ # click on the download of PNG/SVG file and test that it initiated a file
106
+ # download in a right format.
107
+
108
+ page.should have_content('Length distribution of hits')
109
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
110
+ sleep 1
111
+
112
+ page.execute_script("$('.export-to-png:eq(1)').click()")
113
+ wait_for_download
114
+ expect(File.basename(downloaded_file)).to eq('length-distribution-sp_P04637_P53_HUMAN.png')
115
+
116
+ clear_downloads
117
+
118
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
119
+ wait_for_download
120
+ expect(File.basename(downloaded_file)).to eq('length-distribution-sp_P04637_P53_HUMAN.svg')
121
+ end
122
+
123
+ # BLASTX test scenarios
124
+
125
+ it 'loads BLASTX XML and tests hit alignment and sidebar Alignment download' do
126
+ access_by_uuid('blast_2.9.0/blastx')
127
+
128
+ # Click on the first Alignment download button on the page and wait for the
129
+ # download to finish.
130
+
131
+ page.execute_script("$('.download-aln:eq(0)').click()")
132
+ wait_for_download
133
+
134
+ expect(File.basename(downloaded_file)).to eq('MH011443_1_gi_1486783307_gb_AYF55702_1.txt')
135
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/MH011443_1_gi_1486783307_gb_AYF55702_1.txt"))
136
+
137
+ clear_downloads
138
+
139
+ # Click on the Alignment of all hits download and compare the downloaded
140
+ # content
141
+
142
+ page.click_link('Alignment of all hits')
143
+ wait_for_download
144
+ expect(File.basename(downloaded_file)).to eq('alignment-40_hits.txt')
145
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-40_hits_blastx.txt"))
146
+
147
+ clear_downloads
148
+
149
+ # Select four hit checkboxes and click on the Alignment of selected hits.
150
+ # Compare the downloaded content.
151
+
152
+ page.check('Query_1_hit_3_checkbox')
153
+ page.check('Query_1_hit_4_checkbox')
154
+ page.check('Query_2_hit_3_checkbox')
155
+ page.check('Query_2_hit_4_checkbox')
156
+ page.click_link('Alignment of 4 selected hit(s)')
157
+ wait_for_download
158
+
159
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
160
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-4_hits_blastx.txt"))
161
+
162
+ page.should have_content('BLASTX')
163
+ end
164
+
165
+ it 'loads BLASTX XML and tests hit PNG/SVG download' do
166
+ access_by_uuid('blast_2.9.0/blastx')
167
+
168
+ # Click on the PNG/SVG download button of the alignment overview and compare
169
+ # the downloaded content.
170
+ page.execute_script("$('.export-to-png:eq(0)').click()")
171
+ wait_for_download
172
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.png')
173
+
174
+ clear_downloads
175
+
176
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
177
+ wait_for_download
178
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.svg')
179
+
180
+ clear_downloads
181
+
182
+ # Click on the PNG/SVG download button of the first hit available and
183
+ # compare the downloaded content.
184
+ page.execute_script("$('.export-to-png:eq(1)').click()")
185
+ wait_for_download
186
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-gi_1486783307_gb_AYF55702_1.png')
187
+
188
+ clear_downloads
189
+
190
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
191
+ wait_for_download
192
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-gi_1486783307_gb_AYF55702_1.svg')
193
+ page.should have_content('BLASTX')
194
+ end
195
+
196
+ it 'loads BLASTX XML and tests Circos download' do
197
+ access_by_uuid('blast_2.9.0/blastx')
198
+ # Click on the Circos expanding button, wait for animation, click on the
199
+ # download of PNG/SVG file and test that it initiated a file download in a
200
+ # right format.
201
+
202
+ page.should have_content('Chord diagram: queries and their top hits')
203
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
204
+ sleep 1
205
+
206
+ page.execute_script("$('.export-to-png:eq(0)').click()")
207
+ wait_for_download
208
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
209
+ clear_downloads
210
+
211
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
212
+ wait_for_download
213
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
27
214
  end
28
215
 
29
- it 'loads BLASTX xml output' do
216
+ it 'loads BLASTX XML and tests Length distribution download' do
30
217
  access_by_uuid('blast_2.9.0/blastx')
218
+ # Click on the Length distribution expanding button, wait for animation,
219
+ # click on the download of PNG/SVG file and test that it initiated a file
220
+ # download in a right format.
221
+
222
+ page.should have_content('Length distribution of hits')
223
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
224
+ sleep 1
225
+
226
+ page.execute_script("$('.export-to-png:eq(1)').click()")
227
+ wait_for_download
228
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.png')
229
+
230
+ clear_downloads
231
+
232
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
233
+ wait_for_download
234
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.svg')
31
235
  end
32
236
 
33
- it 'loads BLASTN xml output' do
237
+ # BLASTN Test scenarios
238
+
239
+ it 'loads BLASTN XML and tests hit alignment and sidebar Alignment download' do
34
240
  access_by_uuid('blast_2.9.0/blastn')
241
+ # Click on the first Alignment download button on the page and wait for the
242
+ # download to finish.
243
+
244
+ page.execute_script("$('.download-aln:eq(0)').click()")
245
+ wait_for_download
246
+ expect(File.basename(downloaded_file)).to eq('MH011443_1_gi_1486783306_gb_MH011443_1.txt')
247
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/MH011443_1_gi_1486783306_gb_MH011443_1.txt"))
248
+
249
+ clear_downloads
250
+
251
+ # Click on the Alignment of all hits download and compare the downloaded
252
+ # content
253
+
254
+ page.click_link('Alignment of all hits')
255
+ wait_for_download
256
+ expect(File.basename(downloaded_file)).to eq('alignment-40_hits.txt')
257
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-40_hits_blastn.txt"))
258
+
259
+ clear_downloads
260
+
261
+ # Select four hit checkboxes and click on the Alignment of selected hits.
262
+ # Compare the downloaded content.
263
+ page.check('Query_1_hit_5_checkbox')
264
+ page.check('Query_1_hit_6_checkbox')
265
+ page.check('Query_2_hit_5_checkbox')
266
+ page.check('Query_2_hit_6_checkbox')
267
+ page.click_link('Alignment of 4 selected hit(s)')
268
+ wait_for_download
269
+
270
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
271
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-4_hits_blastn.txt"))
272
+ page.should have_content('BLASTN')
35
273
  end
36
274
 
37
- it 'loads TBLASTN xml output' do
275
+ it 'loads BLASTN XML and tests hit PNG/SVG download' do
276
+ access_by_uuid('blast_2.9.0/blastn')
277
+
278
+ # Click on the PNG/SVG download button of the alignment overview and compare
279
+ # the downloaded content.
280
+ page.execute_script("$('.export-to-png:eq(0)').click()")
281
+ wait_for_download
282
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.png')
283
+
284
+ clear_downloads
285
+
286
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
287
+ wait_for_download
288
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.svg')
289
+
290
+ clear_downloads
291
+ # Click on the PNG download button of the first hit available and compare
292
+ # the downloaded content.
293
+
294
+ page.execute_script("$('.export-to-png:eq(2)').click()")
295
+ wait_for_download
296
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-gi_1528997474_gb_MH447967_1.png')
297
+
298
+ clear_downloads
299
+
300
+ # Click on the SVG download button of the first hit available and compare
301
+ # the downloaded content.
302
+
303
+ page.execute_script("$('.export-to-svg:eq(2)').click()")
304
+ wait_for_download
305
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-gi_1528997474_gb_MH447967_1.svg')
306
+ page.should have_content('BLASTN')
307
+ end
308
+
309
+ it 'loads BLASTN XML and tests Circos download' do
310
+ access_by_uuid('blast_2.9.0/blastn')
311
+
312
+ # Click on the Circos expanding button, wait for animation, click on the
313
+ # download of PNG/SVG file and test that it initiated a file download in a
314
+ # right format.
315
+
316
+ page.should have_content('Chord diagram: queries and their top hits')
317
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
318
+ sleep 1
319
+
320
+ page.execute_script("$('.export-to-png:eq(0)').click()")
321
+ wait_for_download
322
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
323
+ clear_downloads
324
+
325
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
326
+ wait_for_download
327
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
328
+ end
329
+
330
+ it 'loads BLASTN XML and tests Length distribution download' do
331
+ access_by_uuid('blast_2.9.0/blastn')
332
+ # Click on the Length distribution expanding button, wait for animation,
333
+ # click on the download of PNG/SVG file and test that it initiated a file
334
+ # download in a right format.
335
+
336
+ page.should have_content('Length distribution of hits')
337
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
338
+ sleep 1
339
+
340
+ page.execute_script("$('.export-to-png:eq(1)').click()")
341
+ wait_for_download
342
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.png')
343
+ clear_downloads
344
+
345
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
346
+ wait_for_download
347
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.svg')
348
+ end
349
+
350
+ #TBLASTN Test scenarios
351
+
352
+ it 'loads TBLASTN XML and tests hit alignment and sidebar Alignment download' do
353
+ access_by_uuid('blast_2.9.0/tblastn')
354
+ # Click on the first Alignment download button on the page and wait for the
355
+ # download to finish.
356
+
357
+ page.execute_script("$('.download-aln:eq(0)').click()")
358
+ wait_for_download
359
+ expect(File.basename(downloaded_file)).to eq('sp_P04637_P53_HUMAN_gi_395440626_gb_JQ694049_1.txt')
360
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/sp_P04637_P53_HUMAN_gi_395440626_gb_JQ694049_1.txt"))
361
+
362
+ clear_downloads
363
+
364
+ # Click on the Alignment of all hits download and compare the downloaded
365
+ # content
366
+
367
+ page.click_link('Alignment of all hits')
368
+ wait_for_download
369
+ expect(File.basename(downloaded_file)).to eq('alignment-40_hits.txt')
370
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-40_hits_tblastn.txt"))
371
+
372
+ clear_downloads
373
+
374
+ # Select four hit checkboxes and click on the Alignment of selected hits.
375
+ # Compare the downloaded content.
376
+ page.check('Query_1_hit_7_checkbox')
377
+ page.check('Query_1_hit_8_checkbox')
378
+ page.check('Query_2_hit_7_checkbox')
379
+ page.check('Query_2_hit_8_checkbox')
380
+ page.click_link('Alignment of 4 selected hit(s)')
381
+ wait_for_download
382
+
383
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
384
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-4_hits_tblastn.txt"))
385
+ page.should have_content('TBLASTN')
386
+ end
387
+
388
+ it 'loads TBLASTN XML and tests hit PNG/SVG download' do
38
389
  access_by_uuid('blast_2.9.0/tblastn')
390
+
391
+ # Click on the PNG/SVG download button of the alignment overview and compare
392
+ # the downloaded content.
393
+ page.execute_script("$('.export-to-png:eq(0)').click()")
394
+ wait_for_download
395
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-sp_P04637_P53_HUMAN.png')
396
+
397
+ clear_downloads
398
+
399
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
400
+ wait_for_download
401
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-sp_P04637_P53_HUMAN.svg')
402
+ clear_downloads
403
+ # Click on the PNG download button of the first hit available and compare
404
+ # the downloaded content.
405
+
406
+ page.execute_script("$('.export-to-png:eq(1)').click()")
407
+ wait_for_download
408
+ expect(File.basename(downloaded_file)).to eq('Kablammo-sp_P04637_P53_HUMAN-gi_395440626_gb_JQ694049_1.png')
409
+
410
+ clear_downloads
411
+
412
+ # Click on the SVG download button of the first hit available and compare
413
+ # the downloaded content.
414
+
415
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
416
+ wait_for_download
417
+ expect(File.basename(downloaded_file)).to eq('Kablammo-sp_P04637_P53_HUMAN-gi_395440626_gb_JQ694049_1.svg')
418
+ page.should have_content('TBLASTN')
39
419
  end
40
420
 
41
- it 'loads TBLASTX xml output' do
421
+ it 'loads TBLASTN XML and tests Circos download' do
422
+ access_by_uuid('blast_2.9.0/tblastn')
423
+ # Click on the Circos expanding button, wait for animation, click on the
424
+ # download of PNG/SVG file and test that it initiated a file download in a
425
+ # right format.
426
+
427
+ page.should have_content('Chord diagram: queries and their top hits')
428
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
429
+ sleep 1
430
+
431
+ page.execute_script("$('.export-to-png:eq(0)').click()")
432
+ wait_for_download
433
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
434
+
435
+ clear_downloads
436
+
437
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
438
+ wait_for_download
439
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
440
+ end
441
+
442
+ it 'loads TBLASTN XML and tests Length distribution download' do
443
+ access_by_uuid('blast_2.9.0/tblastn')
444
+ # Click on the Length distribution expanding button, wait for animation,
445
+ # click on the download of PNG/SVG file and test that it initiated a file
446
+ # download in a right format.
447
+
448
+ page.should have_content('Length distribution of hits')
449
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
450
+ sleep 1
451
+
452
+ page.execute_script("$('.export-to-png:eq(1)').click()")
453
+ wait_for_download
454
+ expect(File.basename(downloaded_file)).to eq('length-distribution-sp_P04637_P53_HUMAN.png')
455
+
456
+ clear_downloads
457
+
458
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
459
+ wait_for_download
460
+ expect(File.basename(downloaded_file)).to eq('length-distribution-sp_P04637_P53_HUMAN.svg')
461
+ end
462
+
463
+ #TBLASTX Test scenarios
464
+
465
+ it 'loads TBLASTX XML and tests hit alignment and sidebar Alignment download' do
42
466
  access_by_uuid('blast_2.9.0/tblastx')
467
+ # Click on the first Alignment download button on the page and wait for the
468
+ # download to finish.
469
+
470
+ page.execute_script("$('.download-aln:eq(1)').click()")
471
+ wait_for_download
472
+ expect(File.basename(downloaded_file)).to eq('MH011443_1_gi_1528997474_gb_MH447967_1.txt')
473
+ expect(File.read(downloaded_file)). to eq(File.read("spec/sequences/MH011443_1_gi_1528997474_gb_MH447967_1.txt"))
474
+
475
+ clear_downloads
476
+
477
+ # Click on the Alignment of all hits download and compare the downloaded
478
+ # content
479
+
480
+ page.click_link('Alignment of all hits')
481
+ wait_for_download
482
+ expect(File.basename(downloaded_file)).to eq('alignment-40_hits.txt')
483
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-40_hits_tblastx.txt"))
484
+
485
+ clear_downloads
486
+
487
+ # Select four hit checkboxes and click on the Alignment of selected hits.
488
+ # Compare the downloaded content.
489
+ page.check('Query_1_hit_9_checkbox')
490
+ page.check('Query_1_hit_10_checkbox')
491
+ page.check('Query_2_hit_9_checkbox')
492
+ page.check('Query_2_hit_10_checkbox')
493
+ page.click_link('Alignment of 4 selected hit(s)')
494
+ wait_for_download
495
+
496
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
497
+ expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-4_hits_tblastx.txt"))
498
+ page.should have_content('TBLASTX')
499
+ end
500
+
501
+ it 'loads TBLASTX XML and tests hit PNG/SVG download' do
502
+ access_by_uuid('blast_2.9.0/tblastx')
503
+
504
+ # Click on the PNG/SVG download button of the alignment overview and compare
505
+ # the downloaded content.
506
+ page.execute_script("$('.export-to-png:eq(0)').click()")
507
+ wait_for_download
508
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.png')
509
+
510
+ clear_downloads
511
+
512
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
513
+ wait_for_download
514
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.svg')
515
+
516
+ clear_downloads
517
+ # Click on the PNG download button of the first hit available and compare
518
+ # the downloaded content.
519
+
520
+ page.execute_script("$('.export-to-png:eq(1)').click()")
521
+ wait_for_download
522
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-gi_1486783306_gb_MH011443_1.png')
523
+
524
+ clear_downloads
525
+
526
+ # Click on the SVG download button of the first hit available and compare
527
+ # the downloaded content.
528
+
529
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
530
+ wait_for_download
531
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-gi_1486783306_gb_MH011443_1.svg')
532
+ page.should have_content('TBLASTX')
533
+ end
534
+
535
+ it 'loads TBLASTX XML and tests Circos download' do
536
+ access_by_uuid('blast_2.9.0/tblastx')
537
+ # Click on the Circos expanding button, wait for animation, click on the
538
+ # download of PNG/SVG file and test that it initiated a file download in a
539
+ # right format.
540
+
541
+ page.should have_content('Chord diagram: queries and their top hits')
542
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
543
+ sleep 1
544
+
545
+ page.execute_script("$('.export-to-png:eq(0)').click()")
546
+ wait_for_download
547
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
548
+
549
+ clear_downloads
550
+
551
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
552
+ wait_for_download
553
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
554
+ end
555
+
556
+ it 'loads TBLASTX XML and tests Length distribution download' do
557
+ access_by_uuid('blast_2.9.0/tblastx')
558
+ # Click on the Length distribution expanding button, wait for animation,
559
+ # click on the download of PNG/SVG file and test that it initiated a file
560
+ # download in a right format.
561
+
562
+ page.should have_content('Length distribution of hits')
563
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
564
+ sleep 1
565
+
566
+ page.execute_script("$('.export-to-png:eq(1)').click()")
567
+ wait_for_download
568
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.png')
569
+
570
+ clear_downloads
571
+
572
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
573
+ wait_for_download
574
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.svg')
43
575
  end
44
576
 
45
577
  ## Helpers ##
46
578
 
47
579
  def access_by_uuid(id)
580
+ # Method to access the XML report in the browser
48
581
  url = url_encode(id)
49
582
  visit "/#{url}"
50
583
  page.should have_content('Query')
51
- page.execute_script("return $('.view-sequence').is(':disabled')").should eq(false)
52
584
  end
53
585
  end