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.
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,9 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount Quorum::Engine => "/quorum"
4
+
5
+ mount Resque::Server.new, :at => "/quorum/resque"
6
+
7
+ match "/" => redirect("/quorum")
8
+
9
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,214 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20111227224920) do
15
+
16
+ create_table "quorum_blastn_job_reports", :force => true do |t|
17
+ t.string "query"
18
+ t.integer "query_len"
19
+ t.string "hit_id"
20
+ t.string "hit_def"
21
+ t.string "hit_accession"
22
+ t.integer "hit_len"
23
+ t.integer "hsp_num"
24
+ t.string "hsp_group"
25
+ t.integer "bit_score"
26
+ t.integer "score"
27
+ t.string "evalue"
28
+ t.integer "query_from"
29
+ t.integer "query_to"
30
+ t.integer "hit_from"
31
+ t.integer "hit_to"
32
+ t.string "query_frame"
33
+ t.string "hit_frame"
34
+ t.integer "identity"
35
+ t.integer "positive"
36
+ t.integer "align_len"
37
+ t.text "qseq"
38
+ t.text "hseq"
39
+ t.text "midline"
40
+ t.boolean "results"
41
+ t.integer "blastn_job_id"
42
+ t.datetime "created_at"
43
+ t.datetime "updated_at"
44
+ end
45
+
46
+ create_table "quorum_blastn_jobs", :force => true do |t|
47
+ t.string "expectation"
48
+ t.integer "max_score"
49
+ t.integer "min_bit_score"
50
+ t.boolean "filter"
51
+ t.boolean "gapped_alignments"
52
+ t.integer "gap_opening_penalty"
53
+ t.integer "gap_extension_penalty"
54
+ t.text "blast_dbs"
55
+ t.boolean "queue"
56
+ t.integer "job_id"
57
+ t.datetime "created_at"
58
+ t.datetime "updated_at"
59
+ end
60
+
61
+ create_table "quorum_blastp_job_reports", :force => true do |t|
62
+ t.string "query"
63
+ t.integer "query_len"
64
+ t.string "hit_id"
65
+ t.string "hit_def"
66
+ t.string "hit_accession"
67
+ t.integer "hit_len"
68
+ t.integer "hsp_num"
69
+ t.string "hsp_group"
70
+ t.integer "bit_score"
71
+ t.integer "score"
72
+ t.string "evalue"
73
+ t.integer "query_from"
74
+ t.integer "query_to"
75
+ t.integer "hit_from"
76
+ t.integer "hit_to"
77
+ t.string "query_frame"
78
+ t.string "hit_frame"
79
+ t.integer "identity"
80
+ t.integer "positive"
81
+ t.integer "align_len"
82
+ t.text "qseq"
83
+ t.text "hseq"
84
+ t.text "midline"
85
+ t.boolean "results"
86
+ t.integer "blastp_job_id"
87
+ t.datetime "created_at"
88
+ t.datetime "updated_at"
89
+ end
90
+
91
+ create_table "quorum_blastp_jobs", :force => true do |t|
92
+ t.string "expectation"
93
+ t.integer "max_score"
94
+ t.integer "min_bit_score"
95
+ t.boolean "filter"
96
+ t.boolean "gapped_alignments"
97
+ t.integer "gap_opening_penalty"
98
+ t.integer "gap_extension_penalty"
99
+ t.text "blast_dbs"
100
+ t.boolean "queue"
101
+ t.integer "job_id"
102
+ t.datetime "created_at"
103
+ t.datetime "updated_at"
104
+ end
105
+
106
+ create_table "quorum_blastx_job_reports", :force => true do |t|
107
+ t.string "query"
108
+ t.integer "query_len"
109
+ t.string "hit_id"
110
+ t.string "hit_def"
111
+ t.string "hit_accession"
112
+ t.integer "hit_len"
113
+ t.integer "hsp_num"
114
+ t.string "hsp_group"
115
+ t.integer "bit_score"
116
+ t.integer "score"
117
+ t.string "evalue"
118
+ t.integer "query_from"
119
+ t.integer "query_to"
120
+ t.integer "hit_from"
121
+ t.integer "hit_to"
122
+ t.string "query_frame"
123
+ t.string "hit_frame"
124
+ t.integer "identity"
125
+ t.integer "positive"
126
+ t.integer "align_len"
127
+ t.text "qseq"
128
+ t.text "hseq"
129
+ t.text "midline"
130
+ t.boolean "results"
131
+ t.integer "blastx_job_id"
132
+ t.datetime "created_at"
133
+ t.datetime "updated_at"
134
+ end
135
+
136
+ create_table "quorum_blastx_jobs", :force => true do |t|
137
+ t.string "expectation"
138
+ t.integer "max_score"
139
+ t.integer "min_bit_score"
140
+ t.boolean "filter"
141
+ t.boolean "gapped_alignments"
142
+ t.integer "gap_opening_penalty"
143
+ t.integer "gap_extension_penalty"
144
+ t.text "blast_dbs"
145
+ t.boolean "queue"
146
+ t.integer "job_id"
147
+ t.datetime "created_at"
148
+ t.datetime "updated_at"
149
+ end
150
+
151
+ create_table "quorum_hmmer_jobs", :force => true do |t|
152
+ t.string "expectation"
153
+ t.integer "min_score"
154
+ t.boolean "queue"
155
+ t.integer "job_id"
156
+ t.datetime "created_at"
157
+ t.datetime "updated_at"
158
+ end
159
+
160
+ create_table "quorum_jobs", :force => true do |t|
161
+ t.text "sequence", :null => false
162
+ t.text "na_sequence"
163
+ t.text "aa_sequence"
164
+ t.string "sequence_hash"
165
+ t.datetime "created_at"
166
+ t.datetime "updated_at"
167
+ end
168
+
169
+ create_table "quorum_tblastn_job_reports", :force => true do |t|
170
+ t.string "query"
171
+ t.integer "query_len"
172
+ t.string "hit_id"
173
+ t.string "hit_def"
174
+ t.string "hit_accession"
175
+ t.integer "hit_len"
176
+ t.integer "hsp_num"
177
+ t.string "hsp_group"
178
+ t.integer "bit_score"
179
+ t.integer "score"
180
+ t.string "evalue"
181
+ t.integer "query_from"
182
+ t.integer "query_to"
183
+ t.integer "hit_from"
184
+ t.integer "hit_to"
185
+ t.string "query_frame"
186
+ t.string "hit_frame"
187
+ t.integer "identity"
188
+ t.integer "positive"
189
+ t.integer "align_len"
190
+ t.text "qseq"
191
+ t.text "hseq"
192
+ t.text "midline"
193
+ t.boolean "results"
194
+ t.integer "tblastn_job_id"
195
+ t.datetime "created_at"
196
+ t.datetime "updated_at"
197
+ end
198
+
199
+ create_table "quorum_tblastn_jobs", :force => true do |t|
200
+ t.string "expectation"
201
+ t.integer "max_score"
202
+ t.integer "min_bit_score"
203
+ t.boolean "filter"
204
+ t.boolean "gapped_alignments"
205
+ t.integer "gap_opening_penalty"
206
+ t.integer "gap_extension_penalty"
207
+ t.text "blast_dbs"
208
+ t.boolean "queue"
209
+ t.integer "job_id"
210
+ t.datetime "created_at"
211
+ t.datetime "updated_at"
212
+ end
213
+
214
+ end
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
4
+
5
+ require 'trollop'
6
+ require 'active_record'
7
+ require 'search_tools/blast'
8
+
9
+ # Quorum search tools and dependencies.
10
+ SEARCH_TOOLS = {
11
+ "blastn" => ["blastn"],
12
+ "blastx" => ["blastx"],
13
+ "tblastn" => ["tblastn"],
14
+ "blastp" => ["blastp"]
15
+ }
16
+
17
+ module Quorum
18
+ #
19
+ # Parse Options for Quorum Search Tools
20
+ #
21
+ class Search
22
+
23
+ def initialize
24
+ opts = Trollop::options do
25
+ text <<-HEAD
26
+
27
+ Quorum
28
+
29
+ A flexible bioinformatics search tool.
30
+
31
+ Options:
32
+
33
+ HEAD
34
+
35
+ # Search tool
36
+ opt :search_tool, "Search tool to execute. Available tools: " <<
37
+ "#{SEARCH_TOOLS.keys.join(', ')}", :type => :string,
38
+ :required => true, :short => "-s"
39
+
40
+ # General settings
41
+ opt :log_directory, "Path to log directory", :type => :string,
42
+ :required => true, :short => "-l"
43
+ opt :tmp_directory, "Path to tmp directory", :type => :string,
44
+ :required => true, :short => "-m"
45
+
46
+ # ActiveRecord database settings
47
+ opt :id, "Database record ID", :type => :int, :required => true,
48
+ :short => "-i"
49
+ opt :database, "Database name", :type => :string, :required => true,
50
+ :short => "-d"
51
+ opt :database_adapter, "ActiveRecord database adapter",
52
+ :type => :string, :required => true, :short => "-a"
53
+ opt :database_host, "Database host", :type => :string,
54
+ :required => true, :short => "-k"
55
+ opt :database_user, "Database username", :type => :string,
56
+ :required => true, :short => "-u"
57
+ opt :database_password, "Database password", :type => :string,
58
+ :required => true, :short => "-p"
59
+
60
+ # Global settings
61
+ opt :search_database, "Path to search tool database", :type => :string,
62
+ :short => "-b"
63
+ opt :threads, "Number of threads to spawn for search tool",
64
+ :type => :int, :short => "-t"
65
+ end
66
+
67
+ @args = {} # Contains valid opts.
68
+
69
+ ## Additional opt validation. ##
70
+
71
+ unless SEARCH_TOOLS.keys.include?(opts[:search_tool].downcase)
72
+ Trollop::die :search_tool, "search_tool not found\n" <<
73
+ "Available search tools: " + SEARCH_TOOLS.keys.join(", ")
74
+ end
75
+
76
+ @args[:search_tool] = opts[:search_tool].downcase
77
+
78
+ unless opts[:search_database] && Dir.exists?(opts[:search_database])
79
+ Trollop::die :search_database, "search tool database not found\n" <<
80
+ "Supplied directory: " + opts[:search_database]
81
+ end
82
+
83
+ @args[:search_database] = opts[:search_database]
84
+
85
+ @args[:id] = opts[:id]
86
+ @args[:threads] = opts[:threads]
87
+
88
+ unless Dir.exists?(opts[:log_directory])
89
+ Trollop::die :log_directory, "log directory not found\n" <<
90
+ "Supplied directory: " + opts[:log_directory]
91
+ end
92
+
93
+ @args[:log_directory] = opts[:log_directory]
94
+ @args[:tmp_directory] = opts[:tmp_directory]
95
+
96
+ ## Check System Dependancies ##
97
+
98
+ check_dependencies
99
+
100
+ ## Establish ActiveRecord Connection ##
101
+
102
+ begin
103
+ ActiveRecord::Base.establish_connection(
104
+ :adapter => opts[:database_adapter],
105
+ :host => opts[:database_host],
106
+ :username => opts[:database_user],
107
+ :password => opts[:database_password],
108
+ :database => opts[:database]
109
+ )
110
+ rescue Exception => e
111
+ Trollop::die puts e.message
112
+ end
113
+
114
+ ## Execute search tool ##
115
+
116
+ if @args[:search_tool].include? "blast"
117
+ blast = Quorum::SearchTools::Blast.new(@args)
118
+ blast.execute_blast
119
+ end
120
+ end
121
+
122
+ #
123
+ # Check system dependencies.
124
+ #
125
+ def check_dependencies
126
+ SEARCH_TOOLS[@args[:search_tool]].each do |b|
127
+ system("which #{b} > /dev/null 2>&1")
128
+ if $?.exitstatus > 0
129
+ Trollop::die "Quorum dependency not found for tool " <<
130
+ "#{@args[:search_tool].to_s}. Please add `#{b}` to your PATH."
131
+ end
132
+ end
133
+ end
134
+
135
+ end
136
+ end
137
+
138
+ if __FILE__ == $0
139
+ Quorum::Search.new
140
+ end
141
+
@@ -0,0 +1,2 @@
1
+ >TOG900080
2
+ TGATAGGATAATTCTAGACAAAACATTAGCCGATCAAGTGTCATCATGGAAAAGCAGCAGGGGCCTTAGTGATACAGTGGTGACTGATCATGCTTGTTCTGGGGAAACATGCTCGTACTACGCAATTGGAGATGTATTTATTTGTGAAAAGACTGGACAAGTTCATGTTTGTGACGAAACATGTAGGGAAGTAGTAATGGATCCCACCAACGAGCTTTTGGTCTGTACAATATCTGGCCACTGTTTTGACAGATTGCTATCACCTGCTGAAATGGAGCCTGATGCTGAGCAGCAGCAAGGTGGTGCGGCAGATGAGGCAGAACCGTTTATGGGATCTGGCCGTTTTGCACGGGCTTATTTGCTGGGATACAATTGTGCTGATGAAAAGGAGCTTGAAGCTACTTTGAGGTTTTGCTGATCCCTATTGGCCCTTCTGGAGTGGATGATCTCATGTCTCAGCATTTACCTATTTAAGATCAAATAAATCGGGTTTCCTTTTCGTGTTTCTCTTGGCATAAGAATGTTTGATTAGATCTAGATTATGAAACTCTAATCGTCTTCTATATTAATAATTGTATGCTTAAATTTATAGTTGAAATTCCATTGATGAATTTTTCTT
@@ -0,0 +1,2 @@
1
+ >ADA84676.1 protein L-isoaspartyl methyltransferase 1 [Cicer arietinum]
2
+ MEQYWSGSAINENKGMVENLQRYGIIKSSKVAETMEKIDRGLFVPNGVQPYIDSPMSIGYNATISAPHMHATCLQLLENYLQPGMHALDVGSGTGYLTACFAMMVGPNGRAVGVEHIPELVSFSINNIEKSAAAPQLKDGSLSVHEGDGRQGWPEFATYDAIHVGAAAPEIPQPLIDQLKTGGRMIIPVGNVFQDLKVVDKNSDGSISIRTETSVRYVPLTSKEAQLKE
@@ -0,0 +1 @@
1
+ 8824380950
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ gnl|bl_ord_id|00
Binary file
Binary file
@@ -0,0 +1 @@
1
+ 28413460680
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ gnl|bl_ord_id|00
Binary file
Binary file
@@ -0,0 +1,43 @@
1
+ module Quorum
2
+ class Logger
3
+
4
+ def initialize(dir)
5
+ @log_directory = dir
6
+ @log_file = "quorum.log"
7
+ end
8
+
9
+ #
10
+ # Write to log file and exit if exit_status is present.
11
+ #
12
+ def log(program, message, exit_status = nil, files = nil)
13
+ File.open(File.join(@log_directory, @log_file), "a") do |log|
14
+ log.puts ""
15
+ log.puts Time.now.to_s + " " + program
16
+ log.puts message
17
+ log.puts ""
18
+ end
19
+
20
+ if exit_status
21
+ remove_files(files) unless files.nil?
22
+ exit exit_status.to_i
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ #
29
+ # Removes instance files.
30
+ #
31
+ def remove_files(files)
32
+ unless Dir.glob(files).empty?
33
+ `rm #{files}`
34
+ else
35
+ log(
36
+ "remove_files",
37
+ "Unable to remove #{files}"
38
+ )
39
+ end
40
+ end
41
+
42
+ end
43
+ end