quorum 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +170 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.rdoc +318 -0
  7. data/Rakefile +31 -0
  8. data/app/assets/images/quorum/.gitkeep +0 -0
  9. data/app/assets/images/quorum/bg.png +0 -0
  10. data/app/assets/images/quorum/knight_rider.gif +0 -0
  11. data/app/assets/images/quorum/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  12. data/app/assets/images/quorum/ui-bg_flat_75_ffffff_40x100.png +0 -0
  13. data/app/assets/images/quorum/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  14. data/app/assets/images/quorum/ui-bg_glass_65_ffffff_1x400.png +0 -0
  15. data/app/assets/images/quorum/ui-bg_glass_75_dadada_1x400.png +0 -0
  16. data/app/assets/images/quorum/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  17. data/app/assets/images/quorum/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  18. data/app/assets/images/quorum/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  19. data/app/assets/images/quorum/ui-icons_222222_256x240.png +0 -0
  20. data/app/assets/images/quorum/ui-icons_2e83ff_256x240.png +0 -0
  21. data/app/assets/images/quorum/ui-icons_454545_256x240.png +0 -0
  22. data/app/assets/images/quorum/ui-icons_888888_256x240.png +0 -0
  23. data/app/assets/images/quorum/ui-icons_cd0a0a_256x240.png +0 -0
  24. data/app/assets/javascripts/quorum/application.js +13 -0
  25. data/app/assets/javascripts/quorum/jobs.js +386 -0
  26. data/app/assets/stylesheets/quorum/application.css +224 -0
  27. data/app/assets/stylesheets/quorum/jobs.css +72 -0
  28. data/app/assets/stylesheets/quorum/jquery-ui-1.8.16.custom.css +568 -0
  29. data/app/assets/stylesheets/quorum/tipsy.css +25 -0
  30. data/app/controllers/quorum/application_controller.rb +5 -0
  31. data/app/controllers/quorum/jobs_controller.rb +102 -0
  32. data/app/helpers/quorum/application_helper.rb +4 -0
  33. data/app/models/quorum/blastn_job.rb +111 -0
  34. data/app/models/quorum/blastn_job_report.rb +7 -0
  35. data/app/models/quorum/blastp_job.rb +111 -0
  36. data/app/models/quorum/blastp_job_report.rb +7 -0
  37. data/app/models/quorum/blastx_job.rb +111 -0
  38. data/app/models/quorum/blastx_job_report.rb +7 -0
  39. data/app/models/quorum/job.rb +164 -0
  40. data/app/models/quorum/tblastn_job.rb +111 -0
  41. data/app/models/quorum/tblastn_job_report.rb +7 -0
  42. data/app/views/layouts/quorum/application.html.erb +15 -0
  43. data/app/views/quorum/jobs/_blastn_form.html.erb +71 -0
  44. data/app/views/quorum/jobs/_blastp_form.html.erb +71 -0
  45. data/app/views/quorum/jobs/_blastx_form.html.erb +71 -0
  46. data/app/views/quorum/jobs/_tblastn_form.html.erb +71 -0
  47. data/app/views/quorum/jobs/new.html.erb +45 -0
  48. data/app/views/quorum/jobs/show.html.erb +183 -0
  49. data/app/views/shared/_error_messages.html.erb +10 -0
  50. data/config/locales/en.yml +8 -0
  51. data/config/routes.rb +9 -0
  52. data/db/migrate/20111031204518_create_jobs.rb +12 -0
  53. data/db/migrate/20111031204701_create_blastn_jobs.rb +19 -0
  54. data/db/migrate/20111031204719_create_blastx_jobs.rb +19 -0
  55. data/db/migrate/20111031204733_create_blastp_jobs.rb +19 -0
  56. data/db/migrate/20111031204754_create_tblastn_jobs.rb +19 -0
  57. data/db/migrate/20111031204846_create_blastn_job_reports.rb +34 -0
  58. data/db/migrate/20111031204903_create_blastx_job_reports.rb +34 -0
  59. data/db/migrate/20111031204922_create_blastp_job_reports.rb +34 -0
  60. data/db/migrate/20111031204941_create_tblastn_job_reports.rb +34 -0
  61. data/lib/generators/quorum/install_generator.rb +68 -0
  62. data/lib/generators/quorum/styles_generator.rb +18 -0
  63. data/lib/generators/quorum/views_generator.rb +18 -0
  64. data/lib/generators/templates/README +25 -0
  65. data/lib/generators/templates/blast.rb +412 -0
  66. data/lib/generators/templates/logger.rb +43 -0
  67. data/lib/generators/templates/quorum_initializer.rb +36 -0
  68. data/lib/generators/templates/quorum_settings.yml +157 -0
  69. data/lib/generators/templates/search +141 -0
  70. data/lib/generators/templates/trollop.rb +781 -0
  71. data/lib/quorum/engine.rb +5 -0
  72. data/lib/quorum/helpers.rb +17 -0
  73. data/lib/quorum/sequence.rb +89 -0
  74. data/lib/quorum/version.rb +3 -0
  75. data/lib/quorum.rb +89 -0
  76. data/lib/tasks/blastdb/README +17 -0
  77. data/lib/tasks/blastdb/build_blast_db.rb +222 -0
  78. data/lib/tasks/quorum_resque.rake +3 -0
  79. data/lib/tasks/quorum_tasks.rake +50 -0
  80. data/lib/workers/quorum.rb +45 -0
  81. data/quorum.gemspec +29 -0
  82. data/script/rails +6 -0
  83. data/spec/data/nucl_prot_seqs.txt +36 -0
  84. data/spec/data/nucl_seqs.txt +32 -0
  85. data/spec/data/prot_seqs.txt +4 -0
  86. data/spec/data/seqs.docx +0 -0
  87. data/spec/data/seqs_not_fa.txt +16 -0
  88. data/spec/data/tmp/test.tgz +0 -0
  89. data/spec/dummy/Rakefile +7 -0
  90. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  91. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  92. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  93. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  94. data/spec/dummy/app/mailers/.gitkeep +0 -0
  95. data/spec/dummy/app/models/.gitkeep +0 -0
  96. data/spec/dummy/app/models/blast.rb +2 -0
  97. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  98. data/spec/dummy/config/application.rb +46 -0
  99. data/spec/dummy/config/boot.rb +10 -0
  100. data/spec/dummy/config/environment.rb +20 -0
  101. data/spec/dummy/config/environments/development.rb +30 -0
  102. data/spec/dummy/config/environments/production.rb +60 -0
  103. data/spec/dummy/config/environments/test.rb +42 -0
  104. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  105. data/spec/dummy/config/initializers/inflections.rb +10 -0
  106. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  107. data/spec/dummy/config/initializers/quorum_initializer.rb +36 -0
  108. data/spec/dummy/config/initializers/resque.rb +1 -0
  109. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  110. data/spec/dummy/config/initializers/session_store.rb +8 -0
  111. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  112. data/spec/dummy/config/locales/en.yml +5 -0
  113. data/spec/dummy/config/locales/quorum.en.yml +8 -0
  114. data/spec/dummy/config/quorum_settings.yml +145 -0
  115. data/spec/dummy/config/routes.rb +9 -0
  116. data/spec/dummy/config.ru +4 -0
  117. data/spec/dummy/db/schema.rb +214 -0
  118. data/spec/dummy/lib/assets/.gitkeep +0 -0
  119. data/spec/dummy/log/.gitkeep +0 -0
  120. data/spec/dummy/public/404.html +26 -0
  121. data/spec/dummy/public/422.html +26 -0
  122. data/spec/dummy/public/500.html +26 -0
  123. data/spec/dummy/public/favicon.ico +0 -0
  124. data/spec/dummy/quorum/bin/search +141 -0
  125. data/spec/dummy/quorum/blastdb/test/contigs.fa +2 -0
  126. data/spec/dummy/quorum/blastdb/test/peptides.fa +2 -0
  127. data/spec/dummy/quorum/blastdb/test.nhd +1 -0
  128. data/spec/dummy/quorum/blastdb/test.nhi +0 -0
  129. data/spec/dummy/quorum/blastdb/test.nhr +0 -0
  130. data/spec/dummy/quorum/blastdb/test.nin +0 -0
  131. data/spec/dummy/quorum/blastdb/test.nog +0 -0
  132. data/spec/dummy/quorum/blastdb/test.nsd +1 -0
  133. data/spec/dummy/quorum/blastdb/test.nsi +0 -0
  134. data/spec/dummy/quorum/blastdb/test.nsq +0 -0
  135. data/spec/dummy/quorum/blastdb/test.phd +1 -0
  136. data/spec/dummy/quorum/blastdb/test.phi +0 -0
  137. data/spec/dummy/quorum/blastdb/test.phr +0 -0
  138. data/spec/dummy/quorum/blastdb/test.pin +0 -0
  139. data/spec/dummy/quorum/blastdb/test.pog +0 -0
  140. data/spec/dummy/quorum/blastdb/test.psd +1 -0
  141. data/spec/dummy/quorum/blastdb/test.psi +0 -0
  142. data/spec/dummy/quorum/blastdb/test.psq +0 -0
  143. data/spec/dummy/quorum/lib/logger.rb +43 -0
  144. data/spec/dummy/quorum/lib/search_tools/blast.rb +412 -0
  145. data/spec/dummy/quorum/lib/trollop.rb +781 -0
  146. data/spec/dummy/script/rails +6 -0
  147. data/spec/models/blastn_job_report_spec.rb +13 -0
  148. data/spec/models/blastn_job_spec.rb +103 -0
  149. data/spec/models/blastp_job_report_spec.rb +13 -0
  150. data/spec/models/blastp_job_spec.rb +103 -0
  151. data/spec/models/blastx_job_report_spec.rb +13 -0
  152. data/spec/models/blastx_job_spec.rb +103 -0
  153. data/spec/models/job_spec.rb +40 -0
  154. data/spec/models/tblastn_job_report_spec.rb +13 -0
  155. data/spec/models/tblastn_job_spec.rb +103 -0
  156. data/spec/quorum/quorum_sequence_spec.rb +64 -0
  157. data/spec/quorum_installed_spec.rb +64 -0
  158. data/spec/requests/jobs_spec.rb +138 -0
  159. data/spec/spec_helper.rb +45 -0
  160. data/spec/tasks/blastdb_rake_spec.rb +119 -0
  161. data/spec/templates/blast_spec.rb +8 -0
  162. data/spec/templates/logger_spec.rb +35 -0
  163. data/vendor/assets/javascripts/jquery.tipsy.js +241 -0
  164. data/vendor/assets/javascripts/underscore-min.js +30 -0
  165. metadata +325 -0
@@ -0,0 +1,12 @@
1
+ class CreateJobs < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_jobs do |t|
4
+ t.text :sequence, :null => false
5
+ t.text :na_sequence, :null => true
6
+ t.text :aa_sequence, :null => true
7
+ t.string :sequence_hash, :nul => true
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ class CreateBlastnJobs < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_blastn_jobs do |t|
4
+ t.string :expectation
5
+ t.integer :max_score
6
+ t.integer :min_bit_score
7
+ t.boolean :filter
8
+ t.boolean :gapped_alignments
9
+ t.integer :gap_opening_penalty
10
+ t.integer :gap_extension_penalty
11
+ t.text :blast_dbs
12
+ t.boolean :queue
13
+
14
+ t.references :job
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class CreateBlastxJobs < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_blastx_jobs do |t|
4
+ t.string :expectation
5
+ t.integer :max_score
6
+ t.integer :min_bit_score
7
+ t.boolean :filter
8
+ t.boolean :gapped_alignments
9
+ t.integer :gap_opening_penalty
10
+ t.integer :gap_extension_penalty
11
+ t.text :blast_dbs
12
+ t.boolean :queue
13
+
14
+ t.references :job
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class CreateBlastpJobs < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_blastp_jobs do |t|
4
+ t.string :expectation
5
+ t.integer :max_score
6
+ t.integer :min_bit_score
7
+ t.boolean :filter
8
+ t.boolean :gapped_alignments
9
+ t.integer :gap_opening_penalty
10
+ t.integer :gap_extension_penalty
11
+ t.text :blast_dbs
12
+ t.boolean :queue
13
+
14
+ t.references :job
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class CreateTblastnJobs < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_tblastn_jobs do |t|
4
+ t.string :expectation
5
+ t.integer :max_score
6
+ t.integer :min_bit_score
7
+ t.boolean :filter
8
+ t.boolean :gapped_alignments
9
+ t.integer :gap_opening_penalty
10
+ t.integer :gap_extension_penalty
11
+ t.text :blast_dbs
12
+ t.boolean :queue
13
+
14
+ t.references :job
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ class CreateBlastnJobReports < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_blastn_job_reports do |t|
4
+ t.string :query
5
+ t.integer :query_len
6
+ t.string :hit_id
7
+ t.string :hit_def
8
+ t.string :hit_accession
9
+ t.integer :hit_len
10
+ t.integer :hsp_num
11
+ t.string :hsp_group
12
+ t.integer :bit_score
13
+ t.integer :score
14
+ t.string :evalue
15
+ t.integer :query_from
16
+ t.integer :query_to
17
+ t.integer :hit_from
18
+ t.integer :hit_to
19
+ t.string :query_frame
20
+ t.string :hit_frame
21
+ t.integer :identity
22
+ t.integer :positive
23
+ t.integer :align_len
24
+ t.text :qseq
25
+ t.text :hseq
26
+ t.text :midline
27
+ t.boolean :results
28
+
29
+ t.references :blastn_job
30
+
31
+ t.timestamps
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ class CreateBlastxJobReports < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_blastx_job_reports do |t|
4
+ t.string :query
5
+ t.integer :query_len
6
+ t.string :hit_id
7
+ t.string :hit_def
8
+ t.string :hit_accession
9
+ t.integer :hit_len
10
+ t.integer :hsp_num
11
+ t.string :hsp_group
12
+ t.integer :bit_score
13
+ t.integer :score
14
+ t.string :evalue
15
+ t.integer :query_from
16
+ t.integer :query_to
17
+ t.integer :hit_from
18
+ t.integer :hit_to
19
+ t.string :query_frame
20
+ t.string :hit_frame
21
+ t.integer :identity
22
+ t.integer :positive
23
+ t.integer :align_len
24
+ t.text :qseq
25
+ t.text :hseq
26
+ t.text :midline
27
+ t.boolean :results
28
+
29
+ t.references :blastx_job
30
+
31
+ t.timestamps
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ class CreateBlastpJobReports < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_blastp_job_reports do |t|
4
+ t.string :query
5
+ t.integer :query_len
6
+ t.string :hit_id
7
+ t.string :hit_def
8
+ t.string :hit_accession
9
+ t.integer :hit_len
10
+ t.integer :hsp_num
11
+ t.string :hsp_group
12
+ t.integer :bit_score
13
+ t.integer :score
14
+ t.string :evalue
15
+ t.integer :query_from
16
+ t.integer :query_to
17
+ t.integer :hit_from
18
+ t.integer :hit_to
19
+ t.string :query_frame
20
+ t.string :hit_frame
21
+ t.integer :identity
22
+ t.integer :positive
23
+ t.integer :align_len
24
+ t.text :qseq
25
+ t.text :hseq
26
+ t.text :midline
27
+ t.boolean :results
28
+
29
+ t.references :blastp_job
30
+
31
+ t.timestamps
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ class CreateTblastnJobReports < ActiveRecord::Migration
2
+ def change
3
+ create_table :quorum_tblastn_job_reports do |t|
4
+ t.string :query
5
+ t.integer :query_len
6
+ t.string :hit_id
7
+ t.string :hit_def
8
+ t.string :hit_accession
9
+ t.integer :hit_len
10
+ t.integer :hsp_num
11
+ t.string :hsp_group
12
+ t.integer :bit_score
13
+ t.integer :score
14
+ t.string :evalue
15
+ t.integer :query_from
16
+ t.integer :query_to
17
+ t.integer :hit_from
18
+ t.integer :hit_to
19
+ t.string :query_frame
20
+ t.string :hit_frame
21
+ t.integer :identity
22
+ t.integer :positive
23
+ t.integer :align_len
24
+ t.text :qseq
25
+ t.text :hseq
26
+ t.text :midline
27
+ t.boolean :results
28
+
29
+ t.references :tblastn_job
30
+
31
+ t.timestamps
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,68 @@
1
+ module Quorum
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Creates Quorum initializer, settings and " <<
7
+ "search tool files."
8
+
9
+ DEPENDENCIES = ["makeblastdb", "seqret"]
10
+
11
+ def copy_initializer
12
+ template "quorum_initializer.rb",
13
+ "config/initializers/quorum_initializer.rb"
14
+ template "quorum_settings.yml", "config/quorum_settings.yml"
15
+ template "search", "quorum/bin/search"
16
+ template "trollop.rb", "quorum/lib/trollop.rb"
17
+ template "logger.rb", "quorum/lib/logger.rb"
18
+ template "blast.rb", "quorum/lib/search_tools/blast.rb"
19
+ end
20
+
21
+ def copy_locale
22
+ copy_file "../../../config/locales/en.yml", "config/locales/quorum.en.yml"
23
+ end
24
+
25
+ def change_file_permissions
26
+ f = File.new("quorum/bin/search", "r")
27
+ f.chmod(0755)
28
+ end
29
+
30
+ def create_quorum_tmp_dir
31
+ Dir.mkdir("quorum/tmp") unless File.directory?("quorum/tmp")
32
+ end
33
+
34
+ def create_quorum_log_dir
35
+ Dir.mkdir("quorum/log") unless File.directory?("quorum/log")
36
+ end
37
+
38
+ def add_mount_engine
39
+ route %Q(mount Quorum::Engine => "/quorum")
40
+ end
41
+
42
+ def add_resque_mount_engine
43
+ route %Q(mount Resque::Server.new, :at => "/quorum/resque")
44
+ end
45
+
46
+ def check_dependencies
47
+ puts ""
48
+ puts "Checking Quorum system dependencies..."
49
+ messages = []
50
+ DEPENDENCIES.each do |b|
51
+ system("which #{b} > /dev/null 2>&1")
52
+ if $?.exitstatus > 0
53
+ messages << "Please add `#{b}` to your PATH."
54
+ end
55
+ end
56
+ unless messages.empty?
57
+ puts "*** Warning: Quorum system dependencies not found ***"
58
+ messages.each { |m| puts m }
59
+ puts ""
60
+ end
61
+ end
62
+
63
+ def show_readme
64
+ readme "README"
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,18 @@
1
+ module Quorum
2
+ module Generators
3
+ class StylesGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../../../app/assets/stylesheets", __FILE__)
5
+ desc "Copy quorum stylesheets to your application."
6
+
7
+ STYLE_DIRECTORIES = [
8
+ "quorum"
9
+ ]
10
+
11
+ def copy_styles
12
+ STYLE_DIRECTORIES.each do |d|
13
+ directory d.to_s, "app/assets/stylesheets/#{d.to_s}"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Quorum
2
+ module Generators
3
+ class ViewsGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../../../app/views/quorum", __FILE__)
5
+ desc "Copy quorum views to your application."
6
+
7
+ VIEW_DIRECTORIES = [
8
+ "jobs"
9
+ ]
10
+
11
+ def copy_views
12
+ VIEW_DIRECTORIES.each do |d|
13
+ directory d.to_s, "app/views/quorum/#{d.to_s}"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+
2
+ ZOMG!! Thanks for installing Quorum!!
3
+
4
+ ==============================================================================
5
+
6
+ Quorum Manual Setup:
7
+
8
+ 1. Ensure you have defined root_url in your config/routes.rb.
9
+ If you are deploying Quorum as a standalone application,
10
+ add the below after the engine is mounted.
11
+
12
+ mount Quorum::Engine => "/quorum"
13
+
14
+ match "/" => redirect("/quorum")
15
+
16
+ 2. Build your Blast databases.
17
+
18
+ rake quorum:blastdb:build
19
+
20
+ For all available quorum:blastdb:build options
21
+
22
+ rake -D
23
+
24
+ ==============================================================================
25
+