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
@@ -33,9 +33,9 @@ module SequenceServer
33
33
  no_hits_report = BLAST::Report.new(no_hits)
34
34
 
35
35
  it 'will return queries with valid length' do
36
- hits_report.queries.first.length.should be_a Fixnum
36
+ hits_report.queries.first.length.should be_a Integer
37
37
  hits_report.queries.first.length.should satisfy { |n| n > 0 }
38
- no_hits_report.queries.first.length.should be_a Fixnum
38
+ no_hits_report.queries.first.length.should be_a Integer
39
39
  no_hits_report.queries.first.length.should satisfy { |n| n > 0 }
40
40
  end
41
41
 
@@ -80,45 +80,45 @@ module SequenceServer
80
80
  # Test Random HSPs to ensure that all the values from HSP struct are valid.
81
81
  it 'have correct alignment values' do
82
82
  hits_report.queries.last.hits.first.hsps.last.bit_score.should be_a Float
83
- hits_report.queries.last.hits.first.hsps.last.score.should be_a Fixnum
83
+ hits_report.queries.last.hits.first.hsps.last.score.should be_a Integer
84
84
 
85
85
  hits_report.queries.first.hits.first.hsps.first.evalue.should be_a Float
86
86
  hits_report.queries.first.hits.first.hsps.first.evalue
87
87
  .should_not satisfy { |n| n < 0 }
88
88
 
89
- hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Fixnum
89
+ hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Integer
90
90
  hits_report.queries.first.hits.last.hsps.first.qstart
91
91
  .should_not satisfy { |n| n < 0 }
92
92
 
93
- hits_report.queries.first.hits.last.hsps.first.qend.should be_a Fixnum
93
+ hits_report.queries.first.hits.last.hsps.first.qend.should be_a Integer
94
94
  hits_report.queries.first.hits.last.hsps.first.qend
95
95
  .should_not satisfy { |n| n < 0 }
96
96
 
97
- hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Fixnum
97
+ hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Integer
98
98
  hits_report.queries.last.hits.last.hsps.last.sstart
99
99
  .should_not satisfy { |n| n < 0 }
100
100
 
101
- hits_report.queries.first.hits.first.hsps.last.send.should be_a Fixnum
101
+ hits_report.queries.first.hits.first.hsps.last.send.should be_a Integer
102
102
  hits_report.queries.first.hits.first.hsps.last.send
103
103
  .should_not satisfy { |n| n < 0 }
104
104
 
105
- hits_report.queries.first.hits.first.hsps.last.qframe.should be_a Fixnum
106
- hits_report.queries.first.hits.first.hsps.last.sframe.should be_a Fixnum
105
+ hits_report.queries.first.hits.first.hsps.last.qframe.should be_a Integer
106
+ hits_report.queries.first.hits.first.hsps.last.sframe.should be_a Integer
107
107
 
108
- hits_report.queries.first.hits.first.hsps.last.identity.should be_a Fixnum
108
+ hits_report.queries.first.hits.first.hsps.last.identity.should be_a Integer
109
109
  hits_report.queries.first.hits.first.hsps.last.identity
110
110
  .should_not satisfy { |n| n < 0 }
111
111
 
112
- hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Fixnum
112
+ hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Integer
113
113
  hits_report.queries.first.hits.first.hsps.last.gaps
114
114
  .should_not satisfy { |n| n < 0 }
115
115
 
116
116
  hits_report.queries.first.hits.first.hsps.last.positives
117
- .should be_a Fixnum
117
+ .should be_a Integer
118
118
  hits_report.queries.first.hits.first.hsps.last.positives
119
119
  .should_not satisfy { |n| n < 0 }
120
120
 
121
- hits_report.queries.first.hits.first.hsps.last.length.should be_a Fixnum
121
+ hits_report.queries.first.hits.first.hsps.last.length.should be_a Integer
122
122
  hits_report.queries.first.hits.first.hsps.last.length
123
123
  .should satisfy { |n| n > 0 }
124
124
 
@@ -1,34 +1,232 @@
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
+ # Fasta files used for testing consist of TP53 and COX41 protein/nucleotide
3
+ # sequences for reproducibility.
4
+ it 'loads diamond BLASTP xml and tests hit alignment and sidebar Alignment download' do
5
+ access_by_uuid('diamond_0.9.24/blastp')
6
+ # Click on the first Alignment download button on the page and wait for the
7
+ # download to finish.
8
+ page.execute_script("$('.download-aln:eq(0)').click()")
9
+ wait_for_download
10
+ expect(File.basename(downloaded_file)).to eq('sp_P04637_P53_HUMAN_sp_P04637_P53_HUMAN.txt')
11
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/sp_P04637_P53_HUMAN_sp_P04637_P53_HUMAN.txt'))
5
12
 
6
- RSpec.configure do |config|
7
- config.include Capybara::DSL
8
- end
13
+ clear_downloads
14
+
15
+ # Click on the Alignment of all hits download and compare the downloaded
16
+ # content
17
+
18
+ page.click_link('Alignment of all hits')
19
+ wait_for_download
20
+
21
+ expect(File.basename(downloaded_file)).to eq('alignment-35_hits.txt')
22
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-35_hits_diamond_blastp.txt'))
23
+ clear_downloads
24
+
25
+ # Check the cheboxes of indicted hits and click on the download of Alignment
26
+ # of selected hits and compare the downloaded content
27
+
28
+ page.check('Query_1_hit_1_checkbox')
29
+ page.check('Query_1_hit_2_checkbox')
30
+ page.check('Query_2_hit_1_checkbox')
31
+ page.check('Query_2_hit_2_checkbox')
32
+ page.click_link('Alignment of 4 selected hit(s)')
33
+ wait_for_download
34
+
35
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
36
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-4_hits_diamond_blastp.txt'))
37
+ page.should have_content('BLASTP')
38
+ end
39
+
40
+ it 'loads diamond BLASTP XML and tests alignment overview and hit PNG/SVG download' do
41
+ access_by_uuid('diamond_0.9.24/blastp')
42
+
43
+ # Click on the PNG/SVG download button of the alignment overview and compare
44
+ # the downloaded content.
45
+
46
+ page.execute_script("$('.export-to-png:eq(0)').click()")
47
+ wait_for_download
48
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-sp_P04637_P53_HUMAN.png')
49
+
50
+ clear_downloads
51
+
52
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
53
+ wait_for_download
54
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-sp_P04637_P53_HUMAN.svg')
55
+
56
+ clear_downloads
57
+
58
+ # Click on the PNG/SVG download button of the first hit available and
59
+ # compare the downloaded content.
60
+ page.execute_script("$('.export-to-png:eq(1)').click()")
61
+ wait_for_download
62
+ expect(File.basename(downloaded_file)).to eq('Kablammo-sp_P04637_P53_HUMAN-sp_P04637_P53_HUMAN.png')
9
63
 
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 = 60
64
+ clear_downloads
16
65
 
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
66
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
67
+ wait_for_download
68
+ expect(File.basename(downloaded_file)).to eq('Kablammo-sp_P04637_P53_HUMAN-sp_P04637_P53_HUMAN.svg')
69
+ page.should have_content('BLASTP')
22
70
  end
23
71
 
24
- # Fasta files used for testing consist of TP53 and COX41 protein/nucleotide sequences for reproducibility.
25
- it 'loads Diamond blastp xml report' do
72
+ it 'loads diamond BLASTP XML and tests Circos download' do
26
73
  access_by_uuid('diamond_0.9.24/blastp')
74
+
75
+ # Click on the Circos expanding button, wait for animation, click on the
76
+ # download of PNG/SVG file and test that it initiated a file download in a
77
+ # right format.
78
+
79
+ page.should have_content('Chord diagram: queries and their top hits')
80
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
81
+ sleep 1
82
+
83
+ page.execute_script("$('.export-to-png:eq(0)').click()")
84
+ wait_for_download
85
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
86
+
87
+ clear_downloads
88
+
89
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
90
+ wait_for_download
91
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
92
+ end
93
+
94
+ it 'loads BLASTP XML and tests Length distribution download' do
95
+ access_by_uuid('diamond_0.9.24/blastp')
96
+
97
+ # Click on the Length distribution expanding button, wait for animation,
98
+ # click on the download of PNG/SVG file and test that it initiated a file
99
+ # download in a right format.
100
+
101
+ page.should have_content('Length distribution of hits')
102
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
103
+ sleep 1
104
+
105
+ page.execute_script("$('.export-to-png:eq(1)').click()")
106
+ wait_for_download
107
+ expect(File.basename(downloaded_file)).to eq('length-distribution-sp_P04637_P53_HUMAN.png')
108
+
109
+ clear_downloads
110
+
111
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
112
+ wait_for_download
113
+ expect(File.basename(downloaded_file)).to eq('length-distribution-sp_P04637_P53_HUMAN.svg')
114
+ end
115
+
116
+ # BLASTX test scenarios
117
+
118
+ it 'loads diamond BLASTX XML and tests hit alignment and sidebar Alignment download' do
119
+ access_by_uuid('diamond_0.9.24/blastx')
120
+
121
+ # Click on the first Alignment download button on the page and wait for the
122
+ # download to finish.
123
+ page.execute_script("$('.download-aln:eq(0)').click()")
124
+ wait_for_download
125
+
126
+ expect(File.basename(downloaded_file)).to eq('MH011443_1_sp_P04637_P53_HUMAN.txt')
127
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/MH011443_1_sp_P04637_P53_HUMAN.txt'))
128
+
129
+ clear_downloads
130
+
131
+ # Click on the Alignment of all hits download and compare the downloaded
132
+ # content
133
+
134
+ page.click_link('Alignment of all hits')
135
+ wait_for_download
136
+
137
+ expect(File.basename(downloaded_file)).to eq('alignment-35_hits.txt')
138
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-35_hits_diamond_blastx.txt'))
139
+ clear_downloads
140
+
141
+ # Select four hit checkboxes and click on the Alignment of selected hits.
142
+ # Compare the downloaded content.
143
+ page.check('Query_1_hit_3_checkbox')
144
+ page.check('Query_1_hit_4_checkbox')
145
+ page.check('Query_2_hit_3_checkbox')
146
+ page.check('Query_2_hit_4_checkbox')
147
+ page.click_link('Alignment of 4 selected hit(s)')
148
+ wait_for_download
149
+
150
+ expect(File.basename(downloaded_file)).to eq('alignment-4_hits.txt')
151
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-4_hits_diamond_blastx.txt'))
152
+
153
+ page.should have_content('BLASTX')
27
154
  end
28
155
 
29
- it 'loads Diamond blastx xml report' do
156
+ it 'loads diamond BLASTX XML and tests alignment overview and hit PNG/SVG download' do
30
157
  access_by_uuid('diamond_0.9.24/blastx')
158
+
159
+ # Click on the PNG/SVG download button of the alignment overview and compare
160
+ # the downloaded content.
161
+ page.execute_script("$('.export-to-png:eq(0)').click()")
162
+ wait_for_download
163
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.png')
164
+
165
+ clear_downloads
166
+
167
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
168
+ wait_for_download
169
+ expect(File.basename(downloaded_file)).to eq('Alignment-Overview-MH011443_1.svg')
170
+
171
+ clear_downloads
172
+ # Click on the PNG/SVG download button of the first hit available and
173
+ # compare the downloaded content.
174
+ page.execute_script("$('.export-to-png:eq(1)').click()")
175
+
176
+ wait_for_download
177
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-sp_P04637_P53_HUMAN.png')
178
+
179
+ clear_downloads
180
+
181
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
182
+ wait_for_download
183
+ expect(File.basename(downloaded_file)).to eq('Kablammo-MH011443_1-sp_P04637_P53_HUMAN.svg')
184
+ page.should have_content('BLASTX')
31
185
  end
186
+
187
+ it 'loads diamond BLASTX XML and tests Circos download' do
188
+ access_by_uuid('diamond_0.9.24/blastx')
189
+ # Click on the Circos expanding button, wait for animation, click on the
190
+ # download of PNG/SVG file and test that it initiated a file download in a
191
+ # right format.
192
+
193
+ page.should have_content('Chord diagram: queries and their top hits')
194
+ page.execute_script("$('.circos > .grapher-header > h5').click()")
195
+ sleep 1
196
+
197
+ page.execute_script("$('.export-to-png:eq(0)').click()")
198
+ wait_for_download
199
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
200
+
201
+ clear_downloads
202
+
203
+ page.execute_script("$('.export-to-svg:eq(0)').click()")
204
+ wait_for_download
205
+ expect(File.basename(downloaded_file)).to eq('Circos-visualisation.svg')
206
+ end
207
+
208
+ it 'loads diamond BLASTX XML and tests Length distribution download' do
209
+ access_by_uuid('diamond_0.9.24/blastx')
210
+
211
+ # Click on the Length distribution expanding button, wait for animation,
212
+ # click on the download of PNG/SVG file and test that it initiated a file
213
+ # download in a right format.
214
+
215
+ page.should have_content('Length distribution of hits')
216
+ page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
217
+ sleep 1
218
+
219
+ page.execute_script("$('.export-to-png:eq(1)').click()")
220
+ wait_for_download
221
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.png')
222
+
223
+ clear_downloads
224
+
225
+ page.execute_script("$('.export-to-svg:eq(1)').click()")
226
+ wait_for_download
227
+ expect(File.basename(downloaded_file)).to eq('length-distribution-MH011443_1.svg')
228
+ end
229
+
32
230
  ## Helpers ##
33
231
 
34
232
  def access_by_uuid(id)
@@ -14,51 +14,50 @@ describe 'a browser', type: :feature, js: true do
14
14
  fill_in('sequence', with: nucleotide_query)
15
15
  check(nucleotide_databases.first)
16
16
  page.evaluate_script("$('.protein .database').first().hasClass('disabled')")
17
- .should eq(true)
17
+ .should eq(true)
18
18
  end
19
19
 
20
20
  it 'shows a dropdown menu when other blast methods are available' do
21
21
  visit '/'
22
22
  fill_in('sequence', with: nucleotide_query)
23
23
  check(nucleotide_databases.first)
24
- page.save_screenshot('screenshot.png')
25
24
  page.has_css?('button.dropdown-toggle').should eq(true)
26
25
  end
27
26
 
28
27
  it 'can run a simple blastn search' do
29
28
  perform_search query: nucleotide_query,
30
- databases: nucleotide_databases
29
+ databases: nucleotide_databases
31
30
  page.should have_content('BLASTN')
32
31
  end
33
32
 
34
33
  it 'can run a simple blastp search' do
35
34
  perform_search query: protein_query,
36
- databases: protein_databases
35
+ databases: protein_databases
37
36
  page.should have_content('BLASTP')
38
37
  end
39
38
 
40
39
  it 'can run a simple blastx search' do
41
40
  perform_search query: nucleotide_query,
42
- databases: protein_databases
41
+ databases: protein_databases
43
42
  page.should have_content('BLASTX')
44
43
  end
45
44
 
46
45
  it 'can run a simple tblastx search' do
47
46
  perform_search query: nucleotide_query,
48
- databases: nucleotide_databases,
49
- method: 'tblastx'
47
+ databases: nucleotide_databases,
48
+ method: 'tblastx'
50
49
  page.should have_content('TBLASTX')
51
50
  end
52
51
 
53
52
  it 'can run a simple tblastn search' do
54
53
  perform_search query: protein_query,
55
- databases: nucleotide_databases
54
+ databases: nucleotide_databases
56
55
  page.should have_content('TBLASTN')
57
56
  end
58
57
 
59
58
  ### Test aspects of the generated report.
60
59
 
61
- it "can download FASTA of each hit" do
60
+ it 'can download FASTA of each hit' do
62
61
  # Do a BLASTP search. protein_query refers to the first two sequence in
63
62
  # protein_databases[0], so the top hits are the query sequences themselves.
64
63
  perform_search(query: protein_query,
@@ -70,13 +69,13 @@ describe 'a browser', type: :feature, js: true do
70
69
  wait_for_download
71
70
 
72
71
  # Test name and content of the downloaded file.
73
- expect(File.basename(downloaded_file)).
74
- to eq('sequenceserver-SI2.2.0_06267.fa')
75
- expect(File.read(downloaded_file)).
76
- to eq(File.read("#{__dir__}/sequences/sequenceserver-SI2.2.0_06267.fa"))
72
+ expect(File.basename(downloaded_file))
73
+ .to eq('sequenceserver-SI2.2.0_06267.fa')
74
+ expect(File.read(downloaded_file))
75
+ .to eq(File.read("#{__dir__}/sequences/sequenceserver-SI2.2.0_06267.fa"))
77
76
  end
78
77
 
79
- it "can download FASTA of selected hits" do
78
+ it 'can download FASTA of selected hits' do
80
79
  # Do a BLASTP search. protein_query refers to the first two sequence in
81
80
  # protein_databases[0], so the top hits are the query sequences themselves.
82
81
  perform_search(query: protein_query,
@@ -89,10 +88,10 @@ describe 'a browser', type: :feature, js: true do
89
88
  wait_for_download
90
89
 
91
90
  expect(File.basename(downloaded_file)).to eq('sequenceserver-2_hits.fa')
92
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/sequenceserver-2_hits.fa"))
91
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/sequenceserver-2_hits.fa'))
93
92
  end
94
93
 
95
- it "can download FASTA of all hits" do
94
+ it 'can download FASTA of all hits' do
96
95
  # Do a BLASTP search. protein_query refers to the first two sequence in
97
96
  # protein_databases[0], so the top hits are the query sequences themselves.
98
97
  perform_search(query: protein_query,
@@ -103,10 +102,10 @@ describe 'a browser', type: :feature, js: true do
103
102
  wait_for_download
104
103
 
105
104
  expect(File.basename(downloaded_file)).to eq('sequenceserver-2_hits.fa')
106
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/sequenceserver-2_hits.fa"))
105
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/sequenceserver-2_hits.fa'))
107
106
  end
108
107
 
109
- it "can download alignment for each hit" do
108
+ it 'can download alignment for each hit' do
110
109
  # Do a BLASTP search. protein_query refers to the first two sequence in
111
110
  # protein_databases[0], so the top hits are the query sequences themselves.
112
111
  perform_search(query: protein_query,
@@ -119,11 +118,11 @@ describe 'a browser', type: :feature, js: true do
119
118
 
120
119
  # Test name and content of the downloaded file.
121
120
  expect(File.basename(downloaded_file)).to eq('Query_1_SI2_2_0_06267.txt')
122
- expect(File.read(downloaded_file)).
123
- to eq(File.read("#{__dir__}/sequences/Query_1_SI2_2_0_06267.txt"))
121
+ expect(File.read(downloaded_file))
122
+ .to eq(File.read("#{__dir__}/sequences/Query_1_SI2_2_0_06267.txt"))
124
123
  end
125
124
 
126
- it "can download Alignment of selected hits" do
125
+ it 'can download Alignment of selected hits' do
127
126
  # Do a BLASTP search. protein_query refers to the first two sequence in
128
127
  # protein_databases[0], so the top hits are the query sequences themselves.
129
128
  perform_search(query: protein_query,
@@ -136,10 +135,10 @@ describe 'a browser', type: :feature, js: true do
136
135
  wait_for_download
137
136
 
138
137
  expect(File.basename(downloaded_file)).to eq('alignment-2_hits.txt')
139
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-2_hits.txt"))
138
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-2_hits.txt'))
140
139
  end
141
140
 
142
- it "can download Alignment of all hits" do
141
+ it 'can download Alignment of all hits' do
143
142
  # Do a BLASTP search. protein_query refers to the first two sequence in
144
143
  # protein_databases[0], so the top hits are the query sequences themselves.
145
144
  perform_search(query: protein_query,
@@ -150,7 +149,7 @@ describe 'a browser', type: :feature, js: true do
150
149
  wait_for_download
151
150
 
152
151
  expect(File.basename(downloaded_file)).to eq('alignment-2_hits.txt')
153
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-2_hits.txt"))
152
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-2_hits.txt'))
154
153
  end
155
154
 
156
155
  it 'can download BLAST results in XML and tabular formats' do
@@ -232,7 +231,7 @@ describe 'a browser', type: :feature, js: true do
232
231
  databases: protein_databases.values_at(0))
233
232
 
234
233
  ## Check that there is a circos vis and unfold it.
235
- page.should have_content('Circos')
234
+ page.should have_content('Chord diagram: queries and their top hits')
236
235
  page.execute_script("$('.circos > .grapher-header > h5').click()")
237
236
  sleep 1
238
237
 
@@ -246,7 +245,6 @@ describe 'a browser', type: :feature, js: true do
246
245
  expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
247
246
  clear_downloads
248
247
 
249
-
250
248
  ## Check that there is a graphical overview of hits.
251
249
  page.should have_content('Graphical overview of hits')
252
250
 
@@ -260,7 +258,6 @@ describe 'a browser', type: :feature, js: true do
260
258
  expect(File.basename(downloaded_file)).to eq('Alignment-Overview-Query_1.png')
261
259
  clear_downloads
262
260
 
263
-
264
261
  ## Check that there is a length distribution of hits.
265
262
  page.should have_content('Length distribution of hits')
266
263
  page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
@@ -292,7 +289,7 @@ describe 'a browser', type: :feature, js: true do
292
289
 
293
290
  ## Helpers ##
294
291
 
295
- def perform_search(query: , databases: , method: nil)
292
+ def perform_search(query:, databases:, method: nil)
296
293
  # Load search form.
297
294
  visit '/'
298
295