sequenceserver 1.1.0.beta12 → 2.0.0.beta1
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.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.travis.yml +5 -5
- data/README.md +86 -43
- data/bin/sequenceserver +29 -32
- data/lib/sequenceserver.rb +86 -123
- data/lib/sequenceserver/api_errors.rb +3 -1
- data/lib/sequenceserver/blast/hit.rb +48 -28
- data/lib/sequenceserver/blast/job.rb +28 -8
- data/lib/sequenceserver/blast/report.rb +52 -15
- data/lib/sequenceserver/database.rb +71 -0
- data/lib/sequenceserver/exceptions.rb +5 -10
- data/lib/sequenceserver/job.rb +8 -1
- data/lib/sequenceserver/links.rb +49 -17
- data/lib/sequenceserver/logger.rb +2 -2
- data/lib/sequenceserver/routes.rb +20 -14
- data/lib/sequenceserver/sys.rb +86 -0
- data/lib/sequenceserver/version.rb +1 -1
- data/public/css/sequenceserver.min.css +3 -3
- data/public/js/alignment_exporter.js +1 -1
- data/public/js/hsp.js +1 -1
- data/public/js/report.js +76 -63
- data/public/js/search.js +29 -6
- data/public/sequenceserver-report.min.js +4 -4
- data/public/sequenceserver-search.min.js +2 -2
- data/sequenceserver.gemspec +3 -2
- data/spec/blast_versions/blast_2.2.30/blast_2.2.30_spec.rb +228 -0
- data/spec/blast_versions/blast_2.2.30/import_spec_capybara_local_2.2.30.rb +53 -0
- data/spec/blast_versions/blast_2.2.31/blast_2.2.31_spec.rb +228 -0
- data/spec/blast_versions/blast_2.2.31/import_spec_capybara_local_2.2.31.rb +53 -0
- data/spec/{blast_spec.rb → blast_versions/blast_2.3.0/blast_2.3.0_spec.rb} +8 -37
- data/spec/blast_versions/blast_2.3.0/import_spec_capybara_local_2.3.0.rb +52 -0
- data/spec/blast_versions/blast_2.4.0/blast_2.4.0_spec.rb +228 -0
- data/spec/blast_versions/blast_2.4.0/import_spec_capybara_local_2.4.0.rb +52 -0
- data/spec/blast_versions/blast_2.5.0/blast_2.5.0_spec.rb +228 -0
- data/spec/blast_versions/blast_2.5.0/import_spec_capybara_local_2.5.0.rb +53 -0
- data/spec/blast_versions/blast_2.6.0/blast_2.6.0_spec.rb +228 -0
- data/spec/blast_versions/blast_2.6.0/import_spec_capybara_local_2.6.0.rb +52 -0
- data/spec/blast_versions/blast_2.7.1/blast_2.7.1_spec.rb +228 -0
- data/spec/blast_versions/blast_2.7.1/import_spec_capybara_local_2.7.1.rb +56 -0
- data/spec/blast_versions/blast_2.8.1/blast_2.8.1_spec.rb +228 -0
- data/spec/blast_versions/blast_2.8.1/import_spec_capybara_local_2.8.1.rb +55 -0
- data/spec/blast_versions/blast_2.9.0/blast_2.9.0_spec.rb +228 -0
- data/spec/blast_versions/blast_2.9.0/import_spec_capybara_local_2.9.0.rb +53 -0
- data/spec/blast_versions/diamond_0.9.24/diamond_0.9.24_spec.rb +176 -0
- data/spec/blast_versions/diamond_0.9.24/import_spec_capybara_local_0.9.24.rb +39 -0
- data/spec/capybara_spec.local.rb +190 -0
- data/spec/capybara_spec.rb +15 -13
- data/spec/config_spec.rb +1 -1
- data/spec/database/funky_ids/funky_ids.fa +2 -0
- data/spec/database/funky_ids/funky_ids.fa.nhd +8 -0
- data/spec/database/funky_ids/funky_ids.fa.nhi +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nhr +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nin +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nog +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nsd +15 -13
- data/spec/database/funky_ids/funky_ids.fa.nsi +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nsq +0 -0
- data/spec/database_spec.rb +2 -2
- data/spec/dotdir/blast_2.2.30/blastn/BLASTN_XML_2.2.30.xml +1201 -0
- data/spec/dotdir/blast_2.2.30/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.30/blastn_nohits/BLASTN_NO_HITS_XML_2.2.30.xml +866 -0
- data/spec/dotdir/blast_2.2.30/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.30/blastp/BLASTP_XML_2.2.30.xml +1181 -0
- data/spec/dotdir/blast_2.2.30/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.30/blastx/BLASTX_XML_2.2.30.xml +1181 -0
- data/spec/dotdir/blast_2.2.30/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.30/tblastn/TBLASTN_XML_2.2.30.xml +1181 -0
- data/spec/dotdir/blast_2.2.30/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.30/tblastx/TBLASTX_XML_2.2.30.xml +8857 -0
- data/spec/dotdir/blast_2.2.30/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.31/blastn/BLASTN_XML_2.2.31.xml +1201 -0
- data/spec/dotdir/blast_2.2.31/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.31/blastn_nohits/BLASTN_NO_HITS_XML_2.2.31.xml +866 -0
- data/spec/dotdir/blast_2.2.31/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.31/blastp/BLASTP_XML_2.2.31.xml +1181 -0
- data/spec/dotdir/blast_2.2.31/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.31/blastx/BLASTX_XML_2.2.31.xml +1181 -0
- data/spec/dotdir/blast_2.2.31/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.31/tblastn/TBLASTN_XML_2.2.31.xml +1181 -0
- data/spec/dotdir/blast_2.2.31/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.2.31/tblastx/TBLASTX_XML_2.2.31.xml +8857 -0
- data/spec/dotdir/blast_2.2.31/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.3.0/blastn/BLASTN_XML_2.3.0.xml +1201 -0
- data/spec/dotdir/blast_2.3.0/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.3.0/blastn_nohits/BLASTN_NO_HITS_XML_2.3.0.xml +866 -0
- data/spec/dotdir/blast_2.3.0/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.3.0/blastp/BLASTP_XML_2.3.0.xml +1181 -0
- data/spec/dotdir/blast_2.3.0/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.3.0/blastx/BLASTX_XML_2.3.0.xml +1181 -0
- data/spec/dotdir/blast_2.3.0/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.3.0/tblastn/TBLASTN_XML_2.3.0.xml +1181 -0
- data/spec/dotdir/blast_2.3.0/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.3.0/tblastx/TBLASTX_XML_2.3.0.xml +8857 -0
- data/spec/dotdir/blast_2.3.0/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.4.0/blastn/BLASTN_XML_2.4.0.xml +1201 -0
- data/spec/dotdir/blast_2.4.0/blastn/TBLASTN_XML_2.4.0.xml +1181 -0
- data/spec/dotdir/blast_2.4.0/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.4.0/blastn_nohits/BLASTN_NO_HITS_XML_2.4.0.xml +866 -0
- data/spec/dotdir/blast_2.4.0/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.4.0/blastp/BLASTP_XML_2.4.0.xml +1181 -0
- data/spec/dotdir/blast_2.4.0/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.4.0/blastx/BLASTX_XML_2.4.0.xml +1181 -0
- data/spec/dotdir/blast_2.4.0/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.4.0/tblastn/TBLASTN_XML_2.4.0.xml +1181 -0
- data/spec/dotdir/blast_2.4.0/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.4.0/tblastx/TBLASTX_XML_2.4.0.xml +8857 -0
- data/spec/dotdir/blast_2.4.0/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.5.0/blastn/BLASTN_LONG_XML_2.5.0.xml +18813 -0
- data/spec/dotdir/blast_2.5.0/blastn/BLASTN_XML_2.5.0.xml +1201 -0
- data/spec/dotdir/blast_2.5.0/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.5.0/blastn_nohits/BLASTN_NO_HITS_XML_2.5.0.xml +866 -0
- data/spec/dotdir/blast_2.5.0/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.5.0/blastp/BLASTP +2161 -0
- data/spec/dotdir/blast_2.5.0/blastp/BLASTP_XML_2.5.0.xml +1181 -0
- data/spec/dotdir/blast_2.5.0/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.5.0/blastx/BLASTX +28080 -0
- data/spec/dotdir/blast_2.5.0/blastx/BLASTX_XML_2.5.0.xml +1181 -0
- data/spec/dotdir/blast_2.5.0/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.5.0/tblastn/TBLASTN +29486 -0
- data/spec/dotdir/blast_2.5.0/tblastn/TBLASTN_XML_2.5.0.xml +1181 -0
- data/spec/dotdir/blast_2.5.0/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.5.0/tblastx/TBLASTX +180859 -0
- data/spec/dotdir/blast_2.5.0/tblastx/TBLASTX_XML_2.5.0.xml +8857 -0
- data/spec/dotdir/blast_2.5.0/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.6.0/blastn/BLASTN_XML_2.6.0.xml +1201 -0
- data/spec/dotdir/blast_2.6.0/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.6.0/blastn_nohits/BLASTN_NO_HITS_XML_2.6.0.xml +866 -0
- data/spec/dotdir/blast_2.6.0/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.6.0/blastp/BLASTP_XML_2.6.0.xml +1181 -0
- data/spec/dotdir/blast_2.6.0/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.6.0/blastx/BLASTX_XML_2.6.0.xml +1181 -0
- data/spec/dotdir/blast_2.6.0/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.6.0/tblastn/TBLASTN_XML_2.6.0.xml +1181 -0
- data/spec/dotdir/blast_2.6.0/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.6.0/tblastx/TBLASTX_XML_2.6.0.xml +8857 -0
- data/spec/dotdir/blast_2.6.0/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.7.1/blastn/BLASTN_XML_2.7.1.xml +1201 -0
- data/spec/dotdir/blast_2.7.1/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.7.1/blastn_nohits/BLASTN_NO_HITS_XML_2.7.1.xml +866 -0
- data/spec/dotdir/blast_2.7.1/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.7.1/blastp/BLASTP_XML_2.7.1.xml +1181 -0
- data/spec/dotdir/blast_2.7.1/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.7.1/blastx/BLASTX_XML_2.7.1.xml +1181 -0
- data/spec/dotdir/blast_2.7.1/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.7.1/tblastn/TBLASTN_XML_2.7.1.xml +1181 -0
- data/spec/dotdir/blast_2.7.1/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.7.1/tblastx/TBLASTX_XML_2.7.1.xml +8857 -0
- data/spec/dotdir/blast_2.7.1/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.8.1/blastn/BLASTN_XML_2.8.1.xml +1201 -0
- data/spec/dotdir/blast_2.8.1/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.8.1/blastn_nohits/BLASTN_NO_HITS_XML_2.8.1.xml +866 -0
- data/spec/dotdir/blast_2.8.1/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.8.1/blastp/BLASTP_XML_2.8.1.xml +1181 -0
- data/spec/dotdir/blast_2.8.1/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.8.1/blastx/BLASTX_XML_2.8.1.xml +1181 -0
- data/spec/dotdir/blast_2.8.1/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.8.1/tblastn/TBLASTN_XML_2.8.1.xml +1181 -0
- data/spec/dotdir/blast_2.8.1/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.8.1/tblastx/TBLASTX_XML_2.8.1.xml +8857 -0
- data/spec/dotdir/blast_2.8.1/tblastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.9.0/blastn/BLASTN_XML_2.9.0.xml +1201 -0
- data/spec/dotdir/blast_2.9.0/blastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.9.0/blastn_nohits/BLASTN_NO_HITS_XML_2.9.0.xml +866 -0
- data/spec/dotdir/blast_2.9.0/blastn_nohits/job.yaml +8 -0
- data/spec/dotdir/blast_2.9.0/blastp/BLASTP_XML_2.9.0.xml +1181 -0
- data/spec/dotdir/blast_2.9.0/blastp/job.yaml +8 -0
- data/spec/dotdir/blast_2.9.0/blastx/BLASTX_XML_2.9.0.xml +1181 -0
- data/spec/dotdir/blast_2.9.0/blastx/job.yaml +8 -0
- data/spec/dotdir/blast_2.9.0/tblastn/TBLASTN_XML_2.9.0.xml +1181 -0
- data/spec/dotdir/blast_2.9.0/tblastn/job.yaml +8 -0
- data/spec/dotdir/blast_2.9.0/tblastx/TBLASTX_XML_2.9.0.xml +8857 -0
- data/spec/dotdir/blast_2.9.0/tblastx/job.yaml +8 -0
- data/spec/dotdir/diamond_0.9.24/blastp/DIAMOND_BLASTP_0.9.24.xml +1040 -0
- data/spec/dotdir/diamond_0.9.24/blastp/job.yaml +8 -0
- data/spec/dotdir/diamond_0.9.24/blastx/DIAMOND_BLASTX_0.9.24.xml +1040 -0
- data/spec/dotdir/diamond_0.9.24/blastx/job.yaml +8 -0
- data/spec/dotdir/diamond_0.9.24/blastx_nohits/DIAMOND_BLASTX_NOHITS_0.9.24.xml +41 -0
- data/spec/dotdir/diamond_0.9.24/blastx_nohits/job.yaml +8 -0
- data/spec/download_helper.rb +32 -0
- data/spec/import_spec_capybara_local.rb +61 -0
- data/spec/sequence_spec.rb +1 -2
- data/spec/sequences/Nucleotide_TP53_COX41.fasta +15 -0
- data/spec/sequences/Protein_TP53_COX41.fasta +12 -0
- data/spec/sequences/Query_1_SI2_2_0_06267.txt +6 -0
- data/spec/{nucleotide_query.fa → sequences/nucleotide_query.fa} +0 -0
- data/spec/sequences/problematic_query.fa +5 -0
- data/spec/sequences/protein_query.fa +9 -0
- data/spec/sequences/sample_query_fire_ant_obps.fa +44 -0
- data/spec/sequences/sequenceserver-SI2.2.0_06267.fa +5 -0
- data/spec/sequenceserver_spec.rb +3 -3
- data/spec/spec_helper.rb +59 -0
- metadata +185 -28
- data/spec/protein_query.fa +0 -21
- data/spec/sample_reports/blastn_sample/job.yaml +0 -10
- data/spec/sample_reports/blastn_sample/stdout +0 -144
- data/spec/sample_reports/blastp_sample/job.yaml +0 -10
- data/spec/sample_reports/blastp_sample/stdout +0 -1187
- data/spec/sample_reports/blastx_sample/job.yaml +0 -10
- data/spec/sample_reports/blastx_sample/stdout +0 -1191
- data/spec/sample_reports/no_hits_sample/job.yaml +0 -10
- data/spec/sample_reports/no_hits_sample/stdout +0 -130
- data/spec/sample_reports/tblastn_sample/job.yaml +0 -10
- data/spec/sample_reports/tblastn_sample/stdout +0 -1107
- data/spec/sample_reports/tblastx_sample/job.yaml +0 -10
- data/spec/sample_reports/tblastx_sample/stdout +0 -2422
- data/spec/sample_reports/with_hits_sample/job.yaml +0 -10
- data/spec/sample_reports/with_hits_sample/stdout +0 -1489
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sauce_whisk'
|
3
|
+
require 'capybara/rspec'
|
4
|
+
require 'selenium-webdriver'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.include Capybara::DSL
|
8
|
+
end
|
9
|
+
|
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 = 220
|
16
|
+
|
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
|
22
|
+
end
|
23
|
+
|
24
|
+
# Fasta files used for testing consist of TP53 and COX41 protein/nucleotide sequences for reproducibility.
|
25
|
+
it 'loads BLASTP xml output' do
|
26
|
+
access_by_uuid('blast_2.4.0/blastp')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'loads BLASTX xml output' do
|
30
|
+
access_by_uuid('blast_2.4.0/blastx')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'loads BLASTN xml output' do
|
34
|
+
access_by_uuid('blast_2.4.0/blastn')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'loads TBLASTN xml output' do
|
38
|
+
access_by_uuid('blast_2.4.0/tblastn')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'loads TBLASTX xml output' do
|
42
|
+
access_by_uuid('blast_2.4.0/tblastx')
|
43
|
+
end
|
44
|
+
|
45
|
+
## Helpers ##
|
46
|
+
|
47
|
+
def access_by_uuid(id)
|
48
|
+
url= url_encode(id)
|
49
|
+
visit "/#{url}"
|
50
|
+
page.should have_content('Query')
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Test BLAST module.
|
4
|
+
module SequenceServer
|
5
|
+
with_hits = Job.fetch('blast_2.5.0/blastn')
|
6
|
+
no_hits = Job.fetch('blast_2.5.0/blastn_nohits')
|
7
|
+
|
8
|
+
init
|
9
|
+
|
10
|
+
describe 'Report' do
|
11
|
+
hits_report = BLAST::Report.new(with_hits)
|
12
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
13
|
+
|
14
|
+
it 'will return an Array of queries' do
|
15
|
+
hits_report.queries.should be_a Array
|
16
|
+
no_hits_report.queries.should be_a Array
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'will return a Hash of stats' do
|
20
|
+
hits_report.stats.should be_a Hash
|
21
|
+
no_hits_report.stats.should be_a Hash
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'contains all the necessary stats' do
|
25
|
+
hits_report.stats.length.should eql(7)
|
26
|
+
no_hits_report.stats.length.should eql(7)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'Query' do
|
31
|
+
hits_report = BLAST::Report.new(with_hits)
|
32
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
33
|
+
|
34
|
+
it 'will return queries with valid length' do
|
35
|
+
hits_report.queries.first.length.should be_a Fixnum
|
36
|
+
hits_report.queries.first.length.should satisfy { |n| n > 0 }
|
37
|
+
no_hits_report.queries.first.length.should be_a Fixnum
|
38
|
+
no_hits_report.queries.first.length.should satisfy { |n| n > 0 }
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'will return an Array of hits' do
|
42
|
+
hits_report.queries.first.hits.should be_a Array
|
43
|
+
no_hits_report.queries.first.hits.should be_a Array
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'Hits' do
|
48
|
+
hits_report = BLAST::Report.new(with_hits)
|
49
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
50
|
+
|
51
|
+
it 'will have non zero length' do
|
52
|
+
hits_report.queries.last.hits.first.length.should satisfy { |n| n > 0 }
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'will return an Array of HSPs' do
|
56
|
+
hits_report.queries.first.hits.first.hsps.should be_a Array
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'will return an Array with atleast one HSP' do
|
60
|
+
hits_report.queries.first.hits.first.hsps.length.should be >= 1
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'will contain no element if no hits were obtained' do
|
64
|
+
no_hits_report.queries.first.hits.length.should eql(0)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Test general features of HSPs. Algorithm specific customizations are
|
69
|
+
# tested separetly.
|
70
|
+
describe 'HSPs' do
|
71
|
+
hits_report = BLAST::Report.new(with_hits)
|
72
|
+
|
73
|
+
# Currently using all 17 HSP parameters in BLAST Report + 1 to refer to the
|
74
|
+
# hit object it belongs to.
|
75
|
+
it 'have all the necessary values' do
|
76
|
+
hits_report.queries.last.hits.first.hsps.last.count.should eql(19)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Test Random HSPs to ensure that all the values from HSP struct are valid.
|
80
|
+
it 'have correct alignment values' do
|
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
|
83
|
+
|
84
|
+
hits_report.queries.first.hits.first.hsps.first.evalue.should be_a Float
|
85
|
+
hits_report.queries.first.hits.first.hsps.first.evalue
|
86
|
+
.should_not satisfy { |n| n < 0 }
|
87
|
+
|
88
|
+
hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Fixnum
|
89
|
+
hits_report.queries.first.hits.last.hsps.first.qstart
|
90
|
+
.should_not satisfy { |n| n < 0 }
|
91
|
+
|
92
|
+
hits_report.queries.first.hits.last.hsps.first.qend.should be_a Fixnum
|
93
|
+
hits_report.queries.first.hits.last.hsps.first.qend
|
94
|
+
.should_not satisfy { |n| n < 0 }
|
95
|
+
|
96
|
+
hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Fixnum
|
97
|
+
hits_report.queries.last.hits.last.hsps.last.sstart
|
98
|
+
.should_not satisfy { |n| n < 0 }
|
99
|
+
|
100
|
+
hits_report.queries.first.hits.first.hsps.last.send.should be_a Fixnum
|
101
|
+
hits_report.queries.first.hits.first.hsps.last.send
|
102
|
+
.should_not satisfy { |n| n < 0 }
|
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
|
106
|
+
|
107
|
+
hits_report.queries.first.hits.first.hsps.last.identity.should be_a Fixnum
|
108
|
+
hits_report.queries.first.hits.first.hsps.last.identity
|
109
|
+
.should_not satisfy { |n| n < 0 }
|
110
|
+
|
111
|
+
hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Fixnum
|
112
|
+
hits_report.queries.first.hits.first.hsps.last.gaps
|
113
|
+
.should_not satisfy { |n| n < 0 }
|
114
|
+
|
115
|
+
hits_report.queries.first.hits.first.hsps.last.positives
|
116
|
+
.should be_a Fixnum
|
117
|
+
hits_report.queries.first.hits.first.hsps.last.positives
|
118
|
+
.should_not satisfy { |n| n < 0 }
|
119
|
+
|
120
|
+
hits_report.queries.first.hits.first.hsps.last.length.should be_a Fixnum
|
121
|
+
hits_report.queries.first.hits.first.hsps.last.length
|
122
|
+
.should satisfy { |n| n > 0 }
|
123
|
+
|
124
|
+
hits_report.queries.last.hits.last.hsps.first.qseq.should be_a String
|
125
|
+
hits_report.queries.last.hits.last.hsps.first.sseq.should be_a String
|
126
|
+
hits_report.queries.last.hits.last.hsps.first.midline.should be_a String
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'have correctly matched query, hit and midline alignments' do
|
130
|
+
hsp = hits_report.queries.last.hits.last.hsps.first
|
131
|
+
hsp.qseq.length.should eql(hsp.sseq.length)
|
132
|
+
hsp.sseq.length.should eql(hsp.midline.length)
|
133
|
+
hsp.midline.length.should eql(hsp.qseq.length)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Individually test different BLAST+ algorithms
|
138
|
+
#
|
139
|
+
describe 'BLASTN' do
|
140
|
+
let 'hsp' do
|
141
|
+
report = BLAST::Report.new(Job.fetch('blast_2.5.0/blastn'))
|
142
|
+
report.queries.first.hits.last.hsps.first
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'have correct query and subject frame' do
|
146
|
+
[1, -1].should include(hsp.qframe)
|
147
|
+
[1, -1].should include(hsp.sframe)
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'have correct qstart, qend, sstart, send' do
|
151
|
+
if hsp.sframe > 0
|
152
|
+
hsp.sstart.should be <= hsp.send
|
153
|
+
else
|
154
|
+
hsp.sstart.should be >= hsp.send
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe 'BLASTP' do
|
160
|
+
let 'hsp' do
|
161
|
+
report = BLAST::Report.new(Job.fetch('blast_2.5.0/blastp'))
|
162
|
+
report.queries.first.hits.last.hsps.first
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'have correct query and subject frame' do
|
166
|
+
hsp.qframe.should eql(0)
|
167
|
+
hsp.sframe.should eql(0)
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'have correct qstart, qend, sstart, send values' do
|
171
|
+
hsp.qstart.should be <= hsp.qend
|
172
|
+
hsp.sstart.should be <= hsp.send
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
describe 'BLASTX' do
|
178
|
+
let 'hsp' do
|
179
|
+
report = BLAST::Report.new(Job.fetch('blast_2.5.0/blastx'))
|
180
|
+
|
181
|
+
report.queries.first.hits.last.hsps.first
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'have correct query and subject frame' do
|
185
|
+
hsp.qframe.should_not eql(0)
|
186
|
+
hsp.sframe.should eql(0)
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'have correct qstart, qend, sstart, send' do
|
190
|
+
hsp.qstart.should be <= hsp.qend
|
191
|
+
hsp.sstart.should be <= hsp.send
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe 'TBLASTX' do
|
196
|
+
let 'hsp' do
|
197
|
+
report = BLAST::Report.new(Job.fetch('blast_2.5.0/tblastx'))
|
198
|
+
report.queries.first.hits.last.hsps.first
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'have correct query and subject frame' do
|
202
|
+
hsp.qframe.should_not eql(0)
|
203
|
+
hsp.sframe.should_not eql(0)
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'have correct qstart, qend, sstart, send' do
|
207
|
+
hsp.qstart.should be <= hsp.qend
|
208
|
+
hsp.sstart.should be <= hsp.send
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe 'TBLASTN' do
|
213
|
+
let 'hsp' do
|
214
|
+
report = BLAST::Report.new(Job.fetch('blast_2.5.0/tblastn'))
|
215
|
+
report.queries.first.hits.last.hsps.first
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'have correct query and subject frame' do
|
219
|
+
hsp.qframe.should eql(0)
|
220
|
+
hsp.sframe.should_not eql(0)
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'have correct qstart, qend, sstart, send' do
|
224
|
+
hsp.qstart.should be <= hsp.qend
|
225
|
+
hsp.sstart.should be <= hsp.send
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sauce_whisk'
|
3
|
+
require 'capybara/rspec'
|
4
|
+
require 'selenium-webdriver'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.include Capybara::DSL
|
8
|
+
end
|
9
|
+
|
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
|
16
|
+
|
17
|
+
options = ::Selenium::WebDriver::Firefox::Options.new
|
18
|
+
options.args << '--headless'
|
19
|
+
Capybara.register_driver :selenium do |app|
|
20
|
+
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Fasta files used for testing consist of TP53 and COX41 protein/nucleotide sequences for reproducibility.
|
25
|
+
it 'loads BLASTP xml output' do
|
26
|
+
access_by_uuid('blast_2.5.0/blastp')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'loads BLASTX xml output' do
|
30
|
+
access_by_uuid('blast_2.5.0/blastx')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'loads BLASTN xml output' do
|
34
|
+
access_by_uuid('blast_2.5.0/blastn')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'loads TBLASTN xml output' do
|
38
|
+
access_by_uuid('blast_2.5.0/tblastn')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'loads TBLASTX xml output' do
|
42
|
+
access_by_uuid('blast_2.5.0/tblastx')
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
## Helpers ##
|
47
|
+
|
48
|
+
def access_by_uuid(id)
|
49
|
+
url = url_encode(id)
|
50
|
+
visit "/#{url}"
|
51
|
+
page.should have_content('Query')
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Test BLAST module.
|
4
|
+
module SequenceServer
|
5
|
+
with_hits = Job.fetch('blast_2.6.0/blastn')
|
6
|
+
no_hits = Job.fetch('blast_2.6.0/blastn_nohits')
|
7
|
+
|
8
|
+
init
|
9
|
+
|
10
|
+
describe 'Report' do
|
11
|
+
hits_report = BLAST::Report.new(with_hits)
|
12
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
13
|
+
|
14
|
+
it 'will return an Array of queries' do
|
15
|
+
hits_report.queries.should be_a Array
|
16
|
+
no_hits_report.queries.should be_a Array
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'will return a Hash of stats' do
|
20
|
+
hits_report.stats.should be_a Hash
|
21
|
+
no_hits_report.stats.should be_a Hash
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'contains all the necessary stats' do
|
25
|
+
hits_report.stats.length.should eql(7)
|
26
|
+
no_hits_report.stats.length.should eql(7)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'Query' do
|
31
|
+
hits_report = BLAST::Report.new(with_hits)
|
32
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
33
|
+
|
34
|
+
it 'will return queries with valid length' do
|
35
|
+
hits_report.queries.first.length.should be_a Fixnum
|
36
|
+
hits_report.queries.first.length.should satisfy { |n| n > 0 }
|
37
|
+
no_hits_report.queries.first.length.should be_a Fixnum
|
38
|
+
no_hits_report.queries.first.length.should satisfy { |n| n > 0 }
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'will return an Array of hits' do
|
42
|
+
hits_report.queries.first.hits.should be_a Array
|
43
|
+
no_hits_report.queries.first.hits.should be_a Array
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'Hits' do
|
48
|
+
hits_report = BLAST::Report.new(with_hits)
|
49
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
50
|
+
|
51
|
+
it 'will have non zero length' do
|
52
|
+
hits_report.queries.last.hits.first.length.should satisfy { |n| n > 0 }
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'will return an Array of HSPs' do
|
56
|
+
hits_report.queries.first.hits.first.hsps.should be_a Array
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'will return an Array with atleast one HSP' do
|
60
|
+
hits_report.queries.first.hits.first.hsps.length.should be >= 1
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'will contain no element if no hits were obtained' do
|
64
|
+
no_hits_report.queries.first.hits.length.should eql(0)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Test general features of HSPs. Algorithm specific customizations are
|
69
|
+
# tested separetly.
|
70
|
+
describe 'HSPs' do
|
71
|
+
hits_report = BLAST::Report.new(with_hits)
|
72
|
+
|
73
|
+
# Currently using all 17 HSP parameters in BLAST Report + 1 to refer to the
|
74
|
+
# hit object it belongs to.
|
75
|
+
it 'have all the necessary values' do
|
76
|
+
hits_report.queries.last.hits.first.hsps.last.count.should eql(19)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Test Random HSPs to ensure that all the values from HSP struct are valid.
|
80
|
+
it 'have correct alignment values' do
|
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
|
83
|
+
|
84
|
+
hits_report.queries.first.hits.first.hsps.first.evalue.should be_a Float
|
85
|
+
hits_report.queries.first.hits.first.hsps.first.evalue
|
86
|
+
.should_not satisfy { |n| n < 0 }
|
87
|
+
|
88
|
+
hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Fixnum
|
89
|
+
hits_report.queries.first.hits.last.hsps.first.qstart
|
90
|
+
.should_not satisfy { |n| n < 0 }
|
91
|
+
|
92
|
+
hits_report.queries.first.hits.last.hsps.first.qend.should be_a Fixnum
|
93
|
+
hits_report.queries.first.hits.last.hsps.first.qend
|
94
|
+
.should_not satisfy { |n| n < 0 }
|
95
|
+
|
96
|
+
hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Fixnum
|
97
|
+
hits_report.queries.last.hits.last.hsps.last.sstart
|
98
|
+
.should_not satisfy { |n| n < 0 }
|
99
|
+
|
100
|
+
hits_report.queries.first.hits.first.hsps.last.send.should be_a Fixnum
|
101
|
+
hits_report.queries.first.hits.first.hsps.last.send
|
102
|
+
.should_not satisfy { |n| n < 0 }
|
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
|
106
|
+
|
107
|
+
hits_report.queries.first.hits.first.hsps.last.identity.should be_a Fixnum
|
108
|
+
hits_report.queries.first.hits.first.hsps.last.identity
|
109
|
+
.should_not satisfy { |n| n < 0 }
|
110
|
+
|
111
|
+
hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Fixnum
|
112
|
+
hits_report.queries.first.hits.first.hsps.last.gaps
|
113
|
+
.should_not satisfy { |n| n < 0 }
|
114
|
+
|
115
|
+
hits_report.queries.first.hits.first.hsps.last.positives
|
116
|
+
.should be_a Fixnum
|
117
|
+
hits_report.queries.first.hits.first.hsps.last.positives
|
118
|
+
.should_not satisfy { |n| n < 0 }
|
119
|
+
|
120
|
+
hits_report.queries.first.hits.first.hsps.last.length.should be_a Fixnum
|
121
|
+
hits_report.queries.first.hits.first.hsps.last.length
|
122
|
+
.should satisfy { |n| n > 0 }
|
123
|
+
|
124
|
+
hits_report.queries.last.hits.last.hsps.first.qseq.should be_a String
|
125
|
+
hits_report.queries.last.hits.last.hsps.first.sseq.should be_a String
|
126
|
+
hits_report.queries.last.hits.last.hsps.first.midline.should be_a String
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'have correctly matched query, hit and midline alignments' do
|
130
|
+
hsp = hits_report.queries.last.hits.last.hsps.first
|
131
|
+
hsp.qseq.length.should eql(hsp.sseq.length)
|
132
|
+
hsp.sseq.length.should eql(hsp.midline.length)
|
133
|
+
hsp.midline.length.should eql(hsp.qseq.length)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Individually test different BLAST+ algorithms
|
138
|
+
#
|
139
|
+
describe 'BLASTN' do
|
140
|
+
let 'hsp' do
|
141
|
+
report = BLAST::Report.new(Job.fetch('blast_2.6.0/blastn'))
|
142
|
+
report.queries.first.hits.last.hsps.first
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'have correct query and subject frame' do
|
146
|
+
[1, -1].should include(hsp.qframe)
|
147
|
+
[1, -1].should include(hsp.sframe)
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'have correct qstart, qend, sstart, send' do
|
151
|
+
if hsp.sframe > 0
|
152
|
+
hsp.sstart.should be <= hsp.send
|
153
|
+
else
|
154
|
+
hsp.sstart.should be >= hsp.send
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe 'BLASTP' do
|
160
|
+
let 'hsp' do
|
161
|
+
report = BLAST::Report.new(Job.fetch('blast_2.6.0/blastp'))
|
162
|
+
report.queries.first.hits.last.hsps.first
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'have correct query and subject frame' do
|
166
|
+
hsp.qframe.should eql(0)
|
167
|
+
hsp.sframe.should eql(0)
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'have correct qstart, qend, sstart, send values' do
|
171
|
+
hsp.qstart.should be <= hsp.qend
|
172
|
+
hsp.sstart.should be <= hsp.send
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
describe 'BLASTX' do
|
178
|
+
let 'hsp' do
|
179
|
+
report = BLAST::Report.new(Job.fetch('blast_2.6.0/blastx'))
|
180
|
+
|
181
|
+
report.queries.first.hits.last.hsps.first
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'have correct query and subject frame' do
|
185
|
+
hsp.qframe.should_not eql(0)
|
186
|
+
hsp.sframe.should eql(0)
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'have correct qstart, qend, sstart, send' do
|
190
|
+
hsp.qstart.should be <= hsp.qend
|
191
|
+
hsp.sstart.should be <= hsp.send
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe 'TBLASTX' do
|
196
|
+
let 'hsp' do
|
197
|
+
report = BLAST::Report.new(Job.fetch('blast_2.6.0/tblastx'))
|
198
|
+
report.queries.first.hits.last.hsps.first
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'have correct query and subject frame' do
|
202
|
+
hsp.qframe.should_not eql(0)
|
203
|
+
hsp.sframe.should_not eql(0)
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'have correct qstart, qend, sstart, send' do
|
207
|
+
hsp.qstart.should be <= hsp.qend
|
208
|
+
hsp.sstart.should be <= hsp.send
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe 'TBLASTN' do
|
213
|
+
let 'hsp' do
|
214
|
+
report = BLAST::Report.new(Job.fetch('blast_2.6.0/tblastn'))
|
215
|
+
report.queries.first.hits.last.hsps.first
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'have correct query and subject frame' do
|
219
|
+
hsp.qframe.should eql(0)
|
220
|
+
hsp.sframe.should_not eql(0)
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'have correct qstart, qend, sstart, send' do
|
224
|
+
hsp.qstart.should be <= hsp.qend
|
225
|
+
hsp.sstart.should be <= hsp.send
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|