quorum 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +170 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +318 -0
- data/Rakefile +31 -0
- data/app/assets/images/quorum/.gitkeep +0 -0
- data/app/assets/images/quorum/bg.png +0 -0
- data/app/assets/images/quorum/knight_rider.gif +0 -0
- data/app/assets/images/quorum/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/quorum/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/quorum/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/quorum/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/quorum/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/quorum/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/quorum/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/quorum/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
- data/app/assets/images/quorum/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/quorum/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/quorum/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/quorum/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/quorum/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/javascripts/quorum/application.js +13 -0
- data/app/assets/javascripts/quorum/jobs.js +386 -0
- data/app/assets/stylesheets/quorum/application.css +224 -0
- data/app/assets/stylesheets/quorum/jobs.css +72 -0
- data/app/assets/stylesheets/quorum/jquery-ui-1.8.16.custom.css +568 -0
- data/app/assets/stylesheets/quorum/tipsy.css +25 -0
- data/app/controllers/quorum/application_controller.rb +5 -0
- data/app/controllers/quorum/jobs_controller.rb +102 -0
- data/app/helpers/quorum/application_helper.rb +4 -0
- data/app/models/quorum/blastn_job.rb +111 -0
- data/app/models/quorum/blastn_job_report.rb +7 -0
- data/app/models/quorum/blastp_job.rb +111 -0
- data/app/models/quorum/blastp_job_report.rb +7 -0
- data/app/models/quorum/blastx_job.rb +111 -0
- data/app/models/quorum/blastx_job_report.rb +7 -0
- data/app/models/quorum/job.rb +164 -0
- data/app/models/quorum/tblastn_job.rb +111 -0
- data/app/models/quorum/tblastn_job_report.rb +7 -0
- data/app/views/layouts/quorum/application.html.erb +15 -0
- data/app/views/quorum/jobs/_blastn_form.html.erb +71 -0
- data/app/views/quorum/jobs/_blastp_form.html.erb +71 -0
- data/app/views/quorum/jobs/_blastx_form.html.erb +71 -0
- data/app/views/quorum/jobs/_tblastn_form.html.erb +71 -0
- data/app/views/quorum/jobs/new.html.erb +45 -0
- data/app/views/quorum/jobs/show.html.erb +183 -0
- data/app/views/shared/_error_messages.html.erb +10 -0
- data/config/locales/en.yml +8 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20111031204518_create_jobs.rb +12 -0
- data/db/migrate/20111031204701_create_blastn_jobs.rb +19 -0
- data/db/migrate/20111031204719_create_blastx_jobs.rb +19 -0
- data/db/migrate/20111031204733_create_blastp_jobs.rb +19 -0
- data/db/migrate/20111031204754_create_tblastn_jobs.rb +19 -0
- data/db/migrate/20111031204846_create_blastn_job_reports.rb +34 -0
- data/db/migrate/20111031204903_create_blastx_job_reports.rb +34 -0
- data/db/migrate/20111031204922_create_blastp_job_reports.rb +34 -0
- data/db/migrate/20111031204941_create_tblastn_job_reports.rb +34 -0
- data/lib/generators/quorum/install_generator.rb +68 -0
- data/lib/generators/quorum/styles_generator.rb +18 -0
- data/lib/generators/quorum/views_generator.rb +18 -0
- data/lib/generators/templates/README +25 -0
- data/lib/generators/templates/blast.rb +412 -0
- data/lib/generators/templates/logger.rb +43 -0
- data/lib/generators/templates/quorum_initializer.rb +36 -0
- data/lib/generators/templates/quorum_settings.yml +157 -0
- data/lib/generators/templates/search +141 -0
- data/lib/generators/templates/trollop.rb +781 -0
- data/lib/quorum/engine.rb +5 -0
- data/lib/quorum/helpers.rb +17 -0
- data/lib/quorum/sequence.rb +89 -0
- data/lib/quorum/version.rb +3 -0
- data/lib/quorum.rb +89 -0
- data/lib/tasks/blastdb/README +17 -0
- data/lib/tasks/blastdb/build_blast_db.rb +222 -0
- data/lib/tasks/quorum_resque.rake +3 -0
- data/lib/tasks/quorum_tasks.rake +50 -0
- data/lib/workers/quorum.rb +45 -0
- data/quorum.gemspec +29 -0
- data/script/rails +6 -0
- data/spec/data/nucl_prot_seqs.txt +36 -0
- data/spec/data/nucl_seqs.txt +32 -0
- data/spec/data/prot_seqs.txt +4 -0
- data/spec/data/seqs.docx +0 -0
- data/spec/data/seqs_not_fa.txt +16 -0
- data/spec/data/tmp/test.tgz +0 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/blast.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +20 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/quorum_initializer.rb +36 -0
- data/spec/dummy/config/initializers/resque.rb +1 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/locales/quorum.en.yml +8 -0
- data/spec/dummy/config/quorum_settings.yml +145 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +214 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/quorum/bin/search +141 -0
- data/spec/dummy/quorum/blastdb/test/contigs.fa +2 -0
- data/spec/dummy/quorum/blastdb/test/peptides.fa +2 -0
- data/spec/dummy/quorum/blastdb/test.nhd +1 -0
- data/spec/dummy/quorum/blastdb/test.nhi +0 -0
- data/spec/dummy/quorum/blastdb/test.nhr +0 -0
- data/spec/dummy/quorum/blastdb/test.nin +0 -0
- data/spec/dummy/quorum/blastdb/test.nog +0 -0
- data/spec/dummy/quorum/blastdb/test.nsd +1 -0
- data/spec/dummy/quorum/blastdb/test.nsi +0 -0
- data/spec/dummy/quorum/blastdb/test.nsq +0 -0
- data/spec/dummy/quorum/blastdb/test.phd +1 -0
- data/spec/dummy/quorum/blastdb/test.phi +0 -0
- data/spec/dummy/quorum/blastdb/test.phr +0 -0
- data/spec/dummy/quorum/blastdb/test.pin +0 -0
- data/spec/dummy/quorum/blastdb/test.pog +0 -0
- data/spec/dummy/quorum/blastdb/test.psd +1 -0
- data/spec/dummy/quorum/blastdb/test.psi +0 -0
- data/spec/dummy/quorum/blastdb/test.psq +0 -0
- data/spec/dummy/quorum/lib/logger.rb +43 -0
- data/spec/dummy/quorum/lib/search_tools/blast.rb +412 -0
- data/spec/dummy/quorum/lib/trollop.rb +781 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/blastn_job_report_spec.rb +13 -0
- data/spec/models/blastn_job_spec.rb +103 -0
- data/spec/models/blastp_job_report_spec.rb +13 -0
- data/spec/models/blastp_job_spec.rb +103 -0
- data/spec/models/blastx_job_report_spec.rb +13 -0
- data/spec/models/blastx_job_spec.rb +103 -0
- data/spec/models/job_spec.rb +40 -0
- data/spec/models/tblastn_job_report_spec.rb +13 -0
- data/spec/models/tblastn_job_spec.rb +103 -0
- data/spec/quorum/quorum_sequence_spec.rb +64 -0
- data/spec/quorum_installed_spec.rb +64 -0
- data/spec/requests/jobs_spec.rb +138 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/tasks/blastdb_rake_spec.rb +119 -0
- data/spec/templates/blast_spec.rb +8 -0
- data/spec/templates/logger_spec.rb +35 -0
- data/vendor/assets/javascripts/jquery.tipsy.js +241 -0
- data/vendor/assets/javascripts/underscore-min.js +30 -0
- metadata +325 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
|
6
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::BlastnJobReport do
|
|
4
|
+
|
|
5
|
+
it "should respond to default_order" do
|
|
6
|
+
Quorum::BlastnJobReport.methods.should include(:default_order)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should respond to by_query" do
|
|
10
|
+
Quorum::BlastnJobReport.methods.should include(:by_query)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::BlastnJob do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@blastn_job = Quorum::BlastnJob.new()
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "fails validation with poorly formatted expectation (using error_on)" do
|
|
10
|
+
@blastn_job.expectation = "this is bad"
|
|
11
|
+
@blastn_job.should have(1).error_on(:expectation)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "passes validation with valid expectation values (using error_on)" do
|
|
15
|
+
@blastn_job.expectation = 12
|
|
16
|
+
@blastn_job.should have(0).errors_on(:expectation)
|
|
17
|
+
@blastn_job.expectation = 12.1201
|
|
18
|
+
@blastn_job.should have(0).errors_on(:expectation)
|
|
19
|
+
@blastn_job.expectation = "12e-10"
|
|
20
|
+
@blastn_job.should have(0).errors_on(:expectation)
|
|
21
|
+
@blastn_job.expectation = "2e+10"
|
|
22
|
+
@blastn_job.should have(0).errors_on(:expectation)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "fails validation with poorly formatted max_score (using error_on)" do
|
|
26
|
+
@blastn_job.max_score = 12.34
|
|
27
|
+
@blastn_job.should have(1).error_on(:max_score)
|
|
28
|
+
@blastn_job.max_score = "not a number"
|
|
29
|
+
@blastn_job.should have(1).error_on(:max_score)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "passed validation with valid max_score (using error_on)" do
|
|
33
|
+
@blastn_job.max_score = 1235
|
|
34
|
+
@blastn_job.should have(0).errors_on(:max_score)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "fails validation with poorly formatted gap_opening_penalty (using error_on)" do
|
|
38
|
+
@blastn_job.gap_opening_penalty = "not a number"
|
|
39
|
+
@blastn_job.should have(1).error_on(:gap_opening_penalty)
|
|
40
|
+
@blastn_job.gap_opening_penalty = 100.10
|
|
41
|
+
@blastn_job.should have(1).error_on(:gap_opening_penalty)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "passed validation with valid gap_opening_penalty (using error_on)" do
|
|
45
|
+
@blastn_job.max_score = 13
|
|
46
|
+
@blastn_job.should have(0).errors_on(:gap_opening_penalty)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "fails validation with poorly formatted gap_extension_penalty (using error_on)" do
|
|
50
|
+
@blastn_job.gap_extension_penalty = "who are you?"
|
|
51
|
+
@blastn_job.should have(1).error_on(:gap_extension_penalty)
|
|
52
|
+
@blastn_job.gap_extension_penalty = 0.3
|
|
53
|
+
@blastn_job.should have(1).error_on(:gap_extension_penalty)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "passed validation with valid gap_extension_penalty (using error_on)" do
|
|
57
|
+
@blastn_job.max_score = 456
|
|
58
|
+
@blastn_job.should have(0).errors_on(:gap_extension_penalty)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
62
|
+
@blastn_job.gapped_alignments = true
|
|
63
|
+
@blastn_job.gap_opening_extension = ""
|
|
64
|
+
@blastn_job.should have(1).error_on(:gap_opening_extension)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
68
|
+
@blastn_job.gapped_alignments = true
|
|
69
|
+
@blastn_job.gap_opening_extension = "11, 2"
|
|
70
|
+
@blastn_job.should have(0).errors_on(:gap_opening_extension)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "gapped_alignment? returns true if gapped_alignments is set" do
|
|
74
|
+
@blastn_job.gapped_alignments = true
|
|
75
|
+
@blastn_job.gapped_alignment?.should be_true
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "gapped_alignment? returns false if gapped_alignments is not set" do
|
|
79
|
+
@blastn_job.gapped_alignments = false
|
|
80
|
+
@blastn_job.gapped_alignment?.should be_false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "gap_opening_extension values should return an Array of Arrays" do
|
|
84
|
+
@blastn_job.gap_opening_extension_values.should eq(
|
|
85
|
+
[
|
|
86
|
+
['--Select--', ''],
|
|
87
|
+
['32767, 32767', '32767,32767'],
|
|
88
|
+
['11, 2', '11,2'],
|
|
89
|
+
['10, 2', '10,2'],
|
|
90
|
+
['9, 2', '9,2'],
|
|
91
|
+
['8, 2', '8,2'],
|
|
92
|
+
['7, 2', '7,2'],
|
|
93
|
+
['6, 2', '6,2'],
|
|
94
|
+
['13, 1', '13,1'],
|
|
95
|
+
['12, 1', '12,1'],
|
|
96
|
+
['11, 1', '11,1'],
|
|
97
|
+
['10, 1', '10,1'],
|
|
98
|
+
['9, 1', '9,1']
|
|
99
|
+
]
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::BlastpJobReport do
|
|
4
|
+
|
|
5
|
+
it "should respond to default_order" do
|
|
6
|
+
Quorum::BlastpJobReport.methods.should include(:default_order)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should respond to by_query" do
|
|
10
|
+
Quorum::BlastpJobReport.methods.should include(:by_query)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::BlastpJob do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@blastp_job = Quorum::BlastpJob.new()
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "fails validation with poorly formatted expectation (using error_on)" do
|
|
10
|
+
@blastp_job.expectation = "this is bad"
|
|
11
|
+
@blastp_job.should have(1).error_on(:expectation)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "passes validation with valid expectation values (using error_on)" do
|
|
15
|
+
@blastp_job.expectation = 12
|
|
16
|
+
@blastp_job.should have(0).errors_on(:expectation)
|
|
17
|
+
@blastp_job.expectation = 12.1201
|
|
18
|
+
@blastp_job.should have(0).errors_on(:expectation)
|
|
19
|
+
@blastp_job.expectation = "12e-10"
|
|
20
|
+
@blastp_job.should have(0).errors_on(:expectation)
|
|
21
|
+
@blastp_job.expectation = "2e+10"
|
|
22
|
+
@blastp_job.should have(0).errors_on(:expectation)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "fails validation with poorly formatted max_score (using error_on)" do
|
|
26
|
+
@blastp_job.max_score = 12.34
|
|
27
|
+
@blastp_job.should have(1).error_on(:max_score)
|
|
28
|
+
@blastp_job.max_score = "not a number"
|
|
29
|
+
@blastp_job.should have(1).error_on(:max_score)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "passed validation with valid max_score (using error_on)" do
|
|
33
|
+
@blastp_job.max_score = 1235
|
|
34
|
+
@blastp_job.should have(0).errors_on(:max_score)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "fails validation with poorly formatted gap_opening_penalty (using error_on)" do
|
|
38
|
+
@blastp_job.gap_opening_penalty = "not a number"
|
|
39
|
+
@blastp_job.should have(1).error_on(:gap_opening_penalty)
|
|
40
|
+
@blastp_job.gap_opening_penalty = 100.10
|
|
41
|
+
@blastp_job.should have(1).error_on(:gap_opening_penalty)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "passed validation with valid gap_opening_penalty (using error_on)" do
|
|
45
|
+
@blastp_job.max_score = 13
|
|
46
|
+
@blastp_job.should have(0).errors_on(:gap_opening_penalty)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "fails validation with poorly formatted gap_extension_penalty (using error_on)" do
|
|
50
|
+
@blastp_job.gap_extension_penalty = "who are you?"
|
|
51
|
+
@blastp_job.should have(1).error_on(:gap_extension_penalty)
|
|
52
|
+
@blastp_job.gap_extension_penalty = 0.3
|
|
53
|
+
@blastp_job.should have(1).error_on(:gap_extension_penalty)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "passed validation with valid gap_extension_penalty (using error_on)" do
|
|
57
|
+
@blastp_job.max_score = 456
|
|
58
|
+
@blastp_job.should have(0).errors_on(:gap_extension_penalty)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
62
|
+
@blastp_job.gapped_alignments = true
|
|
63
|
+
@blastp_job.gap_opening_extension = ""
|
|
64
|
+
@blastp_job.should have(1).error_on(:gap_opening_extension)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
68
|
+
@blastp_job.gapped_alignments = true
|
|
69
|
+
@blastp_job.gap_opening_extension = "11, 2"
|
|
70
|
+
@blastp_job.should have(0).errors_on(:gap_opening_extension)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "gapped_alignment? returns true if gapped_alignments is set" do
|
|
74
|
+
@blastp_job.gapped_alignments = true
|
|
75
|
+
@blastp_job.gapped_alignment?.should be_true
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "gapped_alignment? returns false if gapped_alignments is not set" do
|
|
79
|
+
@blastp_job.gapped_alignments = false
|
|
80
|
+
@blastp_job.gapped_alignment?.should be_false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "gap_opening_extension values should return an Array of Arrays" do
|
|
84
|
+
@blastp_job.gap_opening_extension_values.should eq(
|
|
85
|
+
[
|
|
86
|
+
['--Select--', ''],
|
|
87
|
+
['32767, 32767', '32767,32767'],
|
|
88
|
+
['11, 2', '11,2'],
|
|
89
|
+
['10, 2', '10,2'],
|
|
90
|
+
['9, 2', '9,2'],
|
|
91
|
+
['8, 2', '8,2'],
|
|
92
|
+
['7, 2', '7,2'],
|
|
93
|
+
['6, 2', '6,2'],
|
|
94
|
+
['13, 1', '13,1'],
|
|
95
|
+
['12, 1', '12,1'],
|
|
96
|
+
['11, 1', '11,1'],
|
|
97
|
+
['10, 1', '10,1'],
|
|
98
|
+
['9, 1', '9,1']
|
|
99
|
+
]
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::BlastxJobReport do
|
|
4
|
+
|
|
5
|
+
it "should respond to default_order" do
|
|
6
|
+
Quorum::BlastxJobReport.methods.should include(:default_order)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should respond to default_order" do
|
|
10
|
+
Quorum::BlastxJobReport.methods.should include(:by_query)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::BlastxJob do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@blastx_job = Quorum::BlastxJob.new()
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "fails validation with poorly formatted expectation (using error_on)" do
|
|
10
|
+
@blastx_job.expectation = "this is bad"
|
|
11
|
+
@blastx_job.should have(1).error_on(:expectation)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "passes validation with valid expectation values (using error_on)" do
|
|
15
|
+
@blastx_job.expectation = 12
|
|
16
|
+
@blastx_job.should have(0).errors_on(:expectation)
|
|
17
|
+
@blastx_job.expectation = 12.1201
|
|
18
|
+
@blastx_job.should have(0).errors_on(:expectation)
|
|
19
|
+
@blastx_job.expectation = "12e-10"
|
|
20
|
+
@blastx_job.should have(0).errors_on(:expectation)
|
|
21
|
+
@blastx_job.expectation = "2e+10"
|
|
22
|
+
@blastx_job.should have(0).errors_on(:expectation)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "fails validation with poorly formatted max_score (using error_on)" do
|
|
26
|
+
@blastx_job.max_score = 12.34
|
|
27
|
+
@blastx_job.should have(1).error_on(:max_score)
|
|
28
|
+
@blastx_job.max_score = "not a number"
|
|
29
|
+
@blastx_job.should have(1).error_on(:max_score)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "passed validation with valid max_score (using error_on)" do
|
|
33
|
+
@blastx_job.max_score = 1235
|
|
34
|
+
@blastx_job.should have(0).errors_on(:max_score)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "fails validation with poorly formatted gap_opening_penalty (using error_on)" do
|
|
38
|
+
@blastx_job.gap_opening_penalty = "not a number"
|
|
39
|
+
@blastx_job.should have(1).error_on(:gap_opening_penalty)
|
|
40
|
+
@blastx_job.gap_opening_penalty = 100.10
|
|
41
|
+
@blastx_job.should have(1).error_on(:gap_opening_penalty)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "passed validation with valid gap_opening_penalty (using error_on)" do
|
|
45
|
+
@blastx_job.max_score = 13
|
|
46
|
+
@blastx_job.should have(0).errors_on(:gap_opening_penalty)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "fails validation with poorly formatted gap_extension_penalty (using error_on)" do
|
|
50
|
+
@blastx_job.gap_extension_penalty = "who are you?"
|
|
51
|
+
@blastx_job.should have(1).error_on(:gap_extension_penalty)
|
|
52
|
+
@blastx_job.gap_extension_penalty = 0.3
|
|
53
|
+
@blastx_job.should have(1).error_on(:gap_extension_penalty)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "passed validation with valid gap_extension_penalty (using error_on)" do
|
|
57
|
+
@blastx_job.max_score = 456
|
|
58
|
+
@blastx_job.should have(0).errors_on(:gap_extension_penalty)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
62
|
+
@blastx_job.gapped_alignments = true
|
|
63
|
+
@blastx_job.gap_opening_extension = ""
|
|
64
|
+
@blastx_job.should have(1).error_on(:gap_opening_extension)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
68
|
+
@blastx_job.gapped_alignments = true
|
|
69
|
+
@blastx_job.gap_opening_extension = "11, 2"
|
|
70
|
+
@blastx_job.should have(0).errors_on(:gap_opening_extension)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "gapped_alignment? returns true if gapped_alignments is set" do
|
|
74
|
+
@blastx_job.gapped_alignments = true
|
|
75
|
+
@blastx_job.gapped_alignment?.should be_true
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "gapped_alignment? returns false if gapped_alignments is not set" do
|
|
79
|
+
@blastx_job.gapped_alignments = false
|
|
80
|
+
@blastx_job.gapped_alignment?.should be_false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "gap_opening_extension values should return an Array of Arrays" do
|
|
84
|
+
@blastx_job.gap_opening_extension_values.should eq(
|
|
85
|
+
[
|
|
86
|
+
['--Select--', ''],
|
|
87
|
+
['32767, 32767', '32767,32767'],
|
|
88
|
+
['11, 2', '11,2'],
|
|
89
|
+
['10, 2', '10,2'],
|
|
90
|
+
['9, 2', '9,2'],
|
|
91
|
+
['8, 2', '8,2'],
|
|
92
|
+
['7, 2', '7,2'],
|
|
93
|
+
['6, 2', '6,2'],
|
|
94
|
+
['13, 1', '13,1'],
|
|
95
|
+
['12, 1', '12,1'],
|
|
96
|
+
['11, 1', '11,1'],
|
|
97
|
+
['10, 1', '10,1'],
|
|
98
|
+
['9, 1', '9,1']
|
|
99
|
+
]
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::Job do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@job = Quorum::Job.new()
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "fails validation without params (using error_on)" do
|
|
10
|
+
@job.should have(1).error_on(:sequence)
|
|
11
|
+
@job.should have(1).error_on(:algorithm)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "passes validation with algorithm and valid sequence data" do
|
|
15
|
+
@job.sequence = File.open(
|
|
16
|
+
File.expand_path("../../data/nucl_prot_seqs.txt", __FILE__)
|
|
17
|
+
).read
|
|
18
|
+
@job.build_blastn_job
|
|
19
|
+
@job.blastn_job.queue = true
|
|
20
|
+
@job.should have(0).errors_on(:sequence)
|
|
21
|
+
@job.should have(0).errors_on(:algorithm)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "queues workers after save" do
|
|
25
|
+
resque = double("Resque")
|
|
26
|
+
resque.stub(:enqueue)
|
|
27
|
+
|
|
28
|
+
@job.sequence = File.open(
|
|
29
|
+
File.expand_path("../../data/nucl_prot_seqs.txt", __FILE__)
|
|
30
|
+
).read
|
|
31
|
+
|
|
32
|
+
@job.build_blastn_job
|
|
33
|
+
@job.blastn_job.queue = true
|
|
34
|
+
@job.blastn_job.blast_dbs = ["tmp"]
|
|
35
|
+
|
|
36
|
+
@job.should_receive(:queue_workers)
|
|
37
|
+
@job.save!
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::TblastnJobReport do
|
|
4
|
+
|
|
5
|
+
it "should respond to default_order" do
|
|
6
|
+
Quorum::TblastnJobReport.methods.should include(:default_order)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should respond to default_order" do
|
|
10
|
+
Quorum::TblastnJobReport.methods.should include(:by_query)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Quorum::TblastnJob do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
@tblastn_job = Quorum::TblastnJob.new()
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "fails validation with poorly formatted expectation (using error_on)" do
|
|
10
|
+
@tblastn_job.expectation = "this is bad"
|
|
11
|
+
@tblastn_job.should have(1).error_on(:expectation)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "passes validation with valid expectation values (using error_on)" do
|
|
15
|
+
@tblastn_job.expectation = 12
|
|
16
|
+
@tblastn_job.should have(0).errors_on(:expectation)
|
|
17
|
+
@tblastn_job.expectation = 12.1201
|
|
18
|
+
@tblastn_job.should have(0).errors_on(:expectation)
|
|
19
|
+
@tblastn_job.expectation = "12e-10"
|
|
20
|
+
@tblastn_job.should have(0).errors_on(:expectation)
|
|
21
|
+
@tblastn_job.expectation = "2e+10"
|
|
22
|
+
@tblastn_job.should have(0).errors_on(:expectation)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "fails validation with poorly formatted max_score (using error_on)" do
|
|
26
|
+
@tblastn_job.max_score = 12.34
|
|
27
|
+
@tblastn_job.should have(1).error_on(:max_score)
|
|
28
|
+
@tblastn_job.max_score = "not a number"
|
|
29
|
+
@tblastn_job.should have(1).error_on(:max_score)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "passed validation with valid max_score (using error_on)" do
|
|
33
|
+
@tblastn_job.max_score = 1235
|
|
34
|
+
@tblastn_job.should have(0).errors_on(:max_score)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "fails validation with poorly formatted gap_opening_penalty (using error_on)" do
|
|
38
|
+
@tblastn_job.gap_opening_penalty = "not a number"
|
|
39
|
+
@tblastn_job.should have(1).error_on(:gap_opening_penalty)
|
|
40
|
+
@tblastn_job.gap_opening_penalty = 100.10
|
|
41
|
+
@tblastn_job.should have(1).error_on(:gap_opening_penalty)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "passed validation with valid gap_opening_penalty (using error_on)" do
|
|
45
|
+
@tblastn_job.max_score = 13
|
|
46
|
+
@tblastn_job.should have(0).errors_on(:gap_opening_penalty)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "fails validation with poorly formatted gap_extension_penalty (using error_on)" do
|
|
50
|
+
@tblastn_job.gap_extension_penalty = "who are you?"
|
|
51
|
+
@tblastn_job.should have(1).error_on(:gap_extension_penalty)
|
|
52
|
+
@tblastn_job.gap_extension_penalty = 0.3
|
|
53
|
+
@tblastn_job.should have(1).error_on(:gap_extension_penalty)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "passed validation with valid gap_extension_penalty (using error_on)" do
|
|
57
|
+
@tblastn_job.max_score = 456
|
|
58
|
+
@tblastn_job.should have(0).errors_on(:gap_extension_penalty)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
62
|
+
@tblastn_job.gapped_alignments = true
|
|
63
|
+
@tblastn_job.gap_opening_extension = ""
|
|
64
|
+
@tblastn_job.should have(1).error_on(:gap_opening_extension)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "fails validation without selecting gap_opening_extension with gapped_alignment (using error_on)" do
|
|
68
|
+
@tblastn_job.gapped_alignments = true
|
|
69
|
+
@tblastn_job.gap_opening_extension = "11, 2"
|
|
70
|
+
@tblastn_job.should have(0).errors_on(:gap_opening_extension)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "gapped_alignment? returns true if gapped_alignments is set" do
|
|
74
|
+
@tblastn_job.gapped_alignments = true
|
|
75
|
+
@tblastn_job.gapped_alignment?.should be_true
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "gapped_alignment? returns false if gapped_alignments is not set" do
|
|
79
|
+
@tblastn_job.gapped_alignments = false
|
|
80
|
+
@tblastn_job.gapped_alignment?.should be_false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "gap_opening_extension values should return an Array of Arrays" do
|
|
84
|
+
@tblastn_job.gap_opening_extension_values.should eq(
|
|
85
|
+
[
|
|
86
|
+
['--Select--', ''],
|
|
87
|
+
['32767, 32767', '32767,32767'],
|
|
88
|
+
['11, 2', '11,2'],
|
|
89
|
+
['10, 2', '10,2'],
|
|
90
|
+
['9, 2', '9,2'],
|
|
91
|
+
['8, 2', '8,2'],
|
|
92
|
+
['7, 2', '7,2'],
|
|
93
|
+
['6, 2', '6,2'],
|
|
94
|
+
['13, 1', '13,1'],
|
|
95
|
+
['12, 1', '12,1'],
|
|
96
|
+
['11, 1', '11,1'],
|
|
97
|
+
['10, 1', '10,1'],
|
|
98
|
+
['9, 1', '9,1']
|
|
99
|
+
]
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'quorum/sequence'
|
|
3
|
+
|
|
4
|
+
include Quorum::Sequence
|
|
5
|
+
|
|
6
|
+
describe "Quorum::Sequence" do
|
|
7
|
+
describe "#create_hash" do
|
|
8
|
+
it "creates a MD5.hexdigest of a sequence" do
|
|
9
|
+
sequence = File.open(
|
|
10
|
+
File.expand_path("../../data/nucl_prot_seqs.txt", __FILE__)
|
|
11
|
+
).read
|
|
12
|
+
create_hash(sequence).should_not be_nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe "#write_input_sequence_to_file" do
|
|
17
|
+
it "writes valid FASTA input sequence to file" do
|
|
18
|
+
sequence = File.open(
|
|
19
|
+
File.expand_path("../../data/nucl_prot_seqs.txt", __FILE__)
|
|
20
|
+
).read
|
|
21
|
+
dir = File.join(::Rails.root.to_s, "log")
|
|
22
|
+
hash = create_hash(sequence)
|
|
23
|
+
write_input_sequence_to_file(dir, hash, sequence)
|
|
24
|
+
|
|
25
|
+
File.size(
|
|
26
|
+
File.join(dir, hash + ".seq")
|
|
27
|
+
).should be > 0
|
|
28
|
+
|
|
29
|
+
File.size(
|
|
30
|
+
File.join(dir, hash + ".fa")
|
|
31
|
+
).should be > 0
|
|
32
|
+
|
|
33
|
+
`rm #{File.join(dir, hash + "*")}`
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "raises an exception if seqret's exit status is > 0" do
|
|
37
|
+
sequence = File.open(
|
|
38
|
+
File.expand_path("../../data/seqs_not_fa.txt", __FILE__)
|
|
39
|
+
).read
|
|
40
|
+
dir = File.join(::Rails.root.to_s, "log")
|
|
41
|
+
hash = create_hash(sequence)
|
|
42
|
+
lambda {
|
|
43
|
+
write_input_sequence_to_file(dir, hash, sequence)
|
|
44
|
+
}.should raise_error
|
|
45
|
+
`rm #{File.join(dir, hash + "*")}`
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "#discover_input_sequence_type" do
|
|
50
|
+
it "should return 'nucleic_acid' when fed nucleic acid sequences" do
|
|
51
|
+
sequence = File.open(
|
|
52
|
+
File.expand_path("../../data/nucl_seqs.txt", __FILE__)
|
|
53
|
+
).read
|
|
54
|
+
discover_input_sequence_type(sequence).should eq("nucleic_acid")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should return 'amino_acid' when fed amino acid sequences" do
|
|
58
|
+
sequence = File.open(
|
|
59
|
+
File.expand_path("../../data/prot_seqs.txt", __FILE__)
|
|
60
|
+
).read
|
|
61
|
+
discover_input_sequence_type(sequence).should eq("amino_acid")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Quorum" do
|
|
4
|
+
before(:all) do
|
|
5
|
+
@dummy_path = File.expand_path("../dummy/", __FILE__)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "checks for generated config file" do
|
|
9
|
+
File.exists?(
|
|
10
|
+
File.join(@dummy_path, "config", "quorum_settings.yml")
|
|
11
|
+
).should be_true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "checks for generated initializer" do
|
|
15
|
+
File.exists?(
|
|
16
|
+
File.join(@dummy_path, "config", "initializers", "quorum_initializer.rb")
|
|
17
|
+
).should be_true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "checks for generated locale" do
|
|
21
|
+
File.exists?(
|
|
22
|
+
File.join(@dummy_path, "config", "locales", "quorum.en.yml")
|
|
23
|
+
).should be_true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "checks for quorum directory" do
|
|
27
|
+
File.directory?(File.join(@dummy_path, "quorum")).should be_true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "checks for quorum/lib files" do
|
|
31
|
+
File.exists?(
|
|
32
|
+
File.join(@dummy_path, "quorum", "lib", "search_tools", "blast.rb")
|
|
33
|
+
).should be_true
|
|
34
|
+
|
|
35
|
+
File.exists?(
|
|
36
|
+
File.join(@dummy_path, "quorum", "lib", "logger.rb")
|
|
37
|
+
).should be_true
|
|
38
|
+
|
|
39
|
+
File.exists?(
|
|
40
|
+
File.join(@dummy_path, "quorum", "lib", "trollop.rb")
|
|
41
|
+
).should be_true
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "checks for quorum/bin files and ensures they are executable" do
|
|
45
|
+
File.exists?(
|
|
46
|
+
File.join(@dummy_path, "quorum", "bin", "search")
|
|
47
|
+
).should be_true
|
|
48
|
+
|
|
49
|
+
File.executable?(
|
|
50
|
+
File.join(@dummy_path, "quorum", "bin", "search")
|
|
51
|
+
).should be_true
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "checks for generated directories" do
|
|
55
|
+
File.directory?(File.join(@dummy_path, "quorum", "log")).should be_true
|
|
56
|
+
|
|
57
|
+
File.directory?(File.join(@dummy_path, "quorum", "tmp")).should be_true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "ensures Quorum::Engine is mounted in dummy/config/routes.rb" do
|
|
61
|
+
f = File.open(File.join(@dummy_path, "config", "routes.rb"), "r")
|
|
62
|
+
f.read.include?("mount Quorum::Engine => \"/quorum\"").should be_true
|
|
63
|
+
end
|
|
64
|
+
end
|