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.

Potentially problematic release.


This version of sequenceserver might be problematic. Click here for more details.

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