quorum 0.3.0 → 0.3.1

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 (56) hide show
  1. data/Gemfile.lock +58 -58
  2. data/HISTORY.md +4 -0
  3. data/README.rdoc +31 -31
  4. data/app/assets/javascripts/quorum/jobs.js +2 -2
  5. data/app/assets/javascripts/quorum/quorum.js +55 -55
  6. data/app/assets/stylesheets/quorum/application.css +23 -23
  7. data/app/assets/stylesheets/quorum/jquery-ui-1.8.16.custom.css +5 -5
  8. data/app/controllers/quorum/jobs_controller.rb +7 -7
  9. data/app/models/quorum/blastn_job.rb +1 -1
  10. data/app/models/quorum/blastp_job.rb +1 -1
  11. data/app/models/quorum/blastx_job.rb +1 -1
  12. data/app/models/quorum/job.rb +19 -19
  13. data/app/models/quorum/tblastn_job.rb +1 -1
  14. data/app/views/quorum/jobs/form/_blastn_form.html.erb +7 -7
  15. data/app/views/quorum/jobs/form/_blastp_form.html.erb +7 -7
  16. data/app/views/quorum/jobs/form/_blastx_form.html.erb +7 -7
  17. data/app/views/quorum/jobs/form/_tblastn_form.html.erb +7 -7
  18. data/app/views/quorum/jobs/new.html.erb +9 -9
  19. data/app/views/quorum/jobs/show.html.erb +7 -7
  20. data/app/views/quorum/jobs/templates/_blast_detailed_report_template.html.erb +3 -3
  21. data/app/views/quorum/jobs/templates/_blast_template.html.erb +4 -4
  22. data/lib/generators/quorum/install_generator.rb +3 -3
  23. data/lib/generators/quorum/views_generator.rb +7 -6
  24. data/lib/generators/templates/README +3 -3
  25. data/lib/generators/templates/blast.rb +7 -7
  26. data/lib/generators/templates/blast_db.rb +6 -6
  27. data/lib/generators/templates/fetch +3 -3
  28. data/lib/generators/templates/quorum_initializer.rb +1 -1
  29. data/lib/generators/templates/quorum_settings.yml +1 -1
  30. data/lib/generators/templates/search +8 -8
  31. data/lib/generators/templates/trollop.rb +4 -4
  32. data/lib/quorum/sequence.rb +6 -6
  33. data/lib/quorum/version.rb +1 -1
  34. data/lib/quorum.rb +1 -1
  35. data/lib/tasks/blastdb/build_blast_db.rb +7 -7
  36. data/lib/tasks/quorum_tasks.rake +6 -6
  37. data/lib/workers/quorum.rb +2 -2
  38. data/quorum.gemspec +1 -1
  39. data/spec/dummy/quorum/blastdb/test.nin +0 -0
  40. data/spec/dummy/quorum/blastdb/test.pin +0 -0
  41. data/spec/javascripts/fixtures/quorum_search_form.html +8 -8
  42. data/spec/javascripts/quorum_spec.js +12 -12
  43. data/spec/javascripts/string_spec.js +2 -2
  44. data/spec/models/blastn_job_report_spec.rb +3 -3
  45. data/spec/models/blastp_job_report_spec.rb +3 -3
  46. data/spec/models/blastx_job_report_spec.rb +3 -3
  47. data/spec/models/job_spec.rb +1 -1
  48. data/spec/models/tblastn_job_report_spec.rb +3 -3
  49. data/spec/quorum/quorum_sequence_spec.rb +1 -1
  50. data/spec/requests/jobs_spec.rb +12 -11
  51. data/spec/spec_helper.rb +1 -1
  52. data/spec/tasks/blastdb_rake_spec.rb +5 -5
  53. data/spec/templates/blast_spec.rb +5 -5
  54. data/vendor/assets/javascripts/jquery.autohint.js +16 -16
  55. data/vendor/assets/javascripts/jquery.tipsy.js +33 -33
  56. metadata +96 -31
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // QUORUM
3
- //---------------------------------------------------------------------------//
3
+ //---------------------------------------------------------------------------//
4
4
 
5
5
  var QUORUM = {
6
6
 
@@ -8,31 +8,31 @@ var QUORUM = {
8
8
  // Supported algorithms.
9
9
  //
10
10
  algorithms: ["blastn", "blastx", "tblastn", "blastp"],
11
-
12
- //
11
+
12
+ //
13
13
  // Poll quorum search results asynchronously and insert them into
14
14
  // the DOM via #blast_template.
15
15
  //
16
16
  pollResults: function(id, interval, algos) {
17
-
17
+
18
18
  // Set the default poll interval to 5 seconds.
19
19
  interval = interval || 5000;
20
-
20
+
21
21
  // Algorithms
22
22
  algos = algos || QUORUM.algorithms;
23
-
23
+
24
24
  _.each(algos, function(a) {
25
25
  $.getJSON(
26
26
  '/quorum/jobs/' + id + '/get_quorum_search_results.json?algo=' + a,
27
27
  function(data) {
28
28
  if (data.length === 0) {
29
- setTimeout(function() {
30
- QUORUM.pollResults(id, interval, [a]);
29
+ setTimeout(function() {
30
+ QUORUM.pollResults(id, interval, [a]);
31
31
  }, interval);
32
32
  } else {
33
33
  $('#' + a + '-results').empty();
34
34
  var temp = _.template(
35
- $('#blast_template').html(), {
35
+ $('#blast_template').html(), {
36
36
  data: data,
37
37
  algo: a
38
38
  }
@@ -40,20 +40,20 @@ var QUORUM = {
40
40
  $('#' + a + '-results').html(temp);
41
41
  return;
42
42
  }
43
- }
43
+ }
44
44
  );
45
45
  });
46
46
  },
47
-
47
+
48
48
  //
49
- // Display jQuery UI modal box containing detailed report of all hits
49
+ // Display jQuery UI modal box containing detailed report of all hits
50
50
  // to the same query. After the modal box is inserted into the DOM,
51
51
  // automatically scroll to the highlighted hit.
52
52
  //
53
53
  viewDetailedReport: function(id, focus_id, query, algo) {
54
54
  // Create the modal box.
55
55
  $('#detailed_report_dialog').html(
56
- "<p class='center'>" +
56
+ "<p class='center'>" +
57
57
  "Loading... <img src='/assets/quorum/loading.gif' alt='Loading'>" +
58
58
  "</p>"
59
59
  ).dialog({
@@ -61,9 +61,9 @@ var QUORUM = {
61
61
  width: 850,
62
62
  position: 'top'
63
63
  });
64
-
64
+
65
65
  $.getJSON(
66
- '/quorum/jobs/' + id + '/get_quorum_search_results.json?algo=' + algo +
66
+ '/quorum/jobs/' + id + '/get_quorum_search_results.json?algo=' + algo +
67
67
  '&query=' + query,
68
68
  function(data) {
69
69
  var temp = _.template(
@@ -73,54 +73,54 @@ var QUORUM = {
73
73
  algo: algo
74
74
  }
75
75
  );
76
-
76
+
77
77
  // Insert the detailed report data.
78
78
  $('#detailed_report_dialog').empty().html(temp);
79
-
79
+
80
80
  // Add tipsy to the sequence data.
81
81
  $('a[rel=quorum-tipsy]').tipsy({ gravity: 's' });
82
-
82
+
83
83
  // Highlight the selected id.
84
84
  $('#' + focus_id).addClass("ui-state-highlight");
85
-
85
+
86
86
  // Automatically scroll to the selected id.
87
87
  QUORUM.autoScroll(focus_id, false);
88
88
  }
89
- );
89
+ );
90
90
  },
91
-
91
+
92
92
  //
93
93
  // Helper to add title sequence position attribute for tipsy.
94
94
  //
95
95
  // If from > to decrement index; otherwise increment.
96
- // If the algo is tblastn and type is hit OR algo is blastx and type is query,
96
+ // If the algo is tblastn and type is hit OR algo is blastx and type is query,
97
97
  // increment / decrement by 3; otherwise increment / decrement by 1.
98
98
  //
99
99
  addBaseTitleIndex: function(bases, from, to, algo, type) {
100
100
  var forward = true;
101
101
  var value = 1;
102
102
  var index = from;
103
-
103
+
104
104
  if (from > to) {
105
105
  forward = false;
106
106
  }
107
-
107
+
108
108
  // Set value to 3 for the below.
109
109
  if ((type === "hit" && algo === "tblastn") ||
110
110
  (type === "query" && algo === "blastx")) {
111
111
  value = 3;
112
112
  }
113
-
113
+
114
114
  // Add tipsy to each base.
115
115
  return _.map(bases.split(''), function(c) {
116
116
  var str = "<a rel='quorum-tipsy' title=" + index + ">" + c + "</a>";
117
117
  forward ? index += value : index -= value;
118
118
  return str;
119
- }).join('');
119
+ }).join('');
120
120
  },
121
-
121
+
122
122
  //
123
- // Format sequence data for detailed report.
123
+ // Format sequence data for detailed report.
124
124
  //
125
125
  // If q_from > q_to or h_from > h_to, subtract by increment; otherwise add
126
126
  // by increment.
@@ -133,26 +133,26 @@ var QUORUM = {
133
133
  var s = 0; // start position
134
134
  var e = increment; // end position
135
135
  var seq = "\n"; // seq string to return
136
-
136
+
137
137
  while(true) {
138
138
  seq += "qseq " + QUORUM.addBaseTitleIndex(qseq.slice(s, e), q_from, q_to, algo, 'query') + "\n";
139
139
  seq += " " + midline.slice(s, e) + "\n";
140
140
  seq += "hseq " + QUORUM.addBaseTitleIndex(hseq.slice(s, e), h_from, h_to, algo, 'hit') + "\n\n";
141
-
141
+
142
142
  if (e >= max) {
143
143
  break;
144
144
  }
145
-
145
+
146
146
  s += increment;
147
147
  e += increment;
148
-
148
+
149
149
  // If the algorithm is blastx, increment * 3 only for qseq.
150
150
  if (algo === "blastx") {
151
151
  q_from < q_to ? q_from += (increment * 3) : q_from -= (increment * 3);
152
152
  } else {
153
153
  q_from < q_to ? q_from += increment : q_from -= increment;
154
154
  }
155
-
155
+
156
156
  // If the algorithm is tblastn, increment * 3 only for hseq.
157
157
  if (algo === "tblastn") {
158
158
  h_from < h_to ? h_from += (increment * 3) : h_from -= (increment * 3);
@@ -160,10 +160,10 @@ var QUORUM = {
160
160
  h_from < h_to ? h_from += increment : h_from -= increment;
161
161
  }
162
162
  }
163
- return "<p class='small'>Alignment (Mouse over for positions):</p>" +
163
+ return "<p class='small'>Alignment (Mouse over for positions):</p>" +
164
164
  "<span class='small'><pre>" + seq + "</pre></span>";
165
165
  },
166
-
166
+
167
167
  //
168
168
  // Format Query and Hit Strand.
169
169
  //
@@ -172,29 +172,29 @@ var QUORUM = {
172
172
  formatStrand: function(qstrand, hstrand) {
173
173
  var q = "";
174
174
  var h = "";
175
-
175
+
176
176
  qstrand < 0 ? q = "reverse" : q = "forward";
177
177
  hstrand < 0 ? h = "reverse" : h = "forward";
178
-
178
+
179
179
  return q + " / " + h;
180
180
  },
181
-
181
+
182
182
  //
183
183
  // Display links to Hsps in the same group.
184
184
  //
185
185
  displayHspLinks: function(focus, group, data) {
186
186
  if (group !== null) {
187
- var str = "Related <a onclick=\"(QUORUM.openWindow(" +
188
- "'http://www.ncbi.nlm.nih.gov/books/NBK62051/def-item/blast_glossary.HSP'," +
187
+ var str = "Related <a onclick=\"(QUORUM.openWindow(" +
188
+ "'http://www.ncbi.nlm.nih.gov/books/NBK62051/def-item/blast_glossary.HSP'," +
189
189
  "'HSP', 800, 300))\">HSPs</a>: ";
190
-
190
+
191
191
  var ids = _.map(group.split(","), function(i) { return parseInt(i, 10); });
192
-
192
+
193
193
  var selected = _(data).chain()
194
194
  .reject(function(d) { return !_.include(ids, d.id); })
195
195
  .sortBy(function(d) { return d.id; })
196
196
  .value();
197
-
197
+
198
198
  _.each(selected, function(e) {
199
199
  if (e.id !== focus) {
200
200
  str += "<a onclick='(QUORUM.autoScroll(" + e.id + ", true))'>" + e.hsp_num + "</a> ";
@@ -205,13 +205,13 @@ var QUORUM = {
205
205
  return str;
206
206
  }
207
207
  },
208
-
208
+
209
209
  //
210
210
  // Download Blast hit sequence.
211
211
  //
212
212
  downloadSequence: function(id, algo_id, algo, el) {
213
213
  $(el).html('Fetching sequence...');
214
-
214
+
215
215
  $.getJSON(
216
216
  "/quorum/jobs/" + id + "/get_quorum_blast_hit_sequence.json?algo_id=" +
217
217
  algo_id + "&algo=" + algo,
@@ -220,12 +220,12 @@ var QUORUM = {
220
220
  }
221
221
  );
222
222
  },
223
-
223
+
224
224
  //
225
225
  // Poll application for Blast hit sequence.
226
226
  //
227
227
  getSequenceFile: function(id, meta_id, el) {
228
- var url = "/quorum/jobs/" + id +
228
+ var url = "/quorum/jobs/" + id +
229
229
  "/send_quorum_blast_hit_sequence?meta_id=" + meta_id;
230
230
  $.get(
231
231
  url,
@@ -235,19 +235,19 @@ var QUORUM = {
235
235
  } else {
236
236
  if (data.indexOf("error") !== -1) {
237
237
  // Print error message.
238
- $(el).addClass('ui-state-error').html(data);
238
+ $(el).addClass('ui-state-error').html(data);
239
239
  } else {
240
240
  // Force browser to download file via iframe.
241
- $(el).addClass('ui-state-highlight').html('Sequence Downloaded Successfully');
241
+ $(el).addClass('ui-state-highlight').html('Sequence Downloaded Successfully');
242
242
  $('.quorum_sequence_download').remove();
243
243
  $('body').append('<iframe class="quorum_sequence_download"></iframe>');
244
244
  $('.quorum_sequence_download').attr('src', url).hide();
245
245
  }
246
246
  }
247
- }
247
+ }
248
248
  );
249
249
  },
250
-
250
+
251
251
  //
252
252
  // Autoscroll to given div id.
253
253
  //
@@ -255,19 +255,19 @@ var QUORUM = {
255
255
  $('html, body').animate({
256
256
  scrollTop: $('#' + id).offset().top
257
257
  }, 1000);
258
-
258
+
259
259
  if (highlight) {
260
260
  $('#' + id).effect("highlight", {}, 4000);
261
261
  }
262
262
  },
263
-
263
+
264
264
  //
265
265
  // Open URL in new window.
266
266
  //
267
267
  openWindow: function(url, name, width, height) {
268
-
268
+
269
269
  var windowSize = "width=" + width + ",height=" + height + ",scrollbars=yes";
270
-
270
+
271
271
  window.open(url, name, windowSize);
272
272
  }
273
273
 
@@ -3,14 +3,14 @@
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *= require_self
6
- *= require_tree .
6
+ *= require_tree .
7
7
  */
8
8
 
9
9
  /*** Content Styles ***/
10
10
 
11
11
  html {
12
12
  color: #222222;
13
- font-family: Lucida Grande, Helvetica, Arial, sans-serif;
13
+ font-family: Lucida Grande, Helvetica, Arial, sans-serif;
14
14
  background: #b8b8b8 url("bg.png") repeat-x top;
15
15
  }
16
16
 
@@ -30,18 +30,18 @@ img {
30
30
  }
31
31
 
32
32
  hr.big {
33
- height: 3px;
34
- border: 0;
35
- background-color: #8C8C8C;
36
- margin: 5px 0 5px 0;
33
+ height: 3px;
34
+ border: 0;
35
+ background-color: #8C8C8C;
36
+ margin: 5px 0 5px 0;
37
37
  width: 100%;
38
38
  overflow: hidden;
39
39
  }
40
40
 
41
41
  hr {
42
- height: 1px;
43
- border: 0;
44
- background-color: #8C8C8C;
42
+ height: 1px;
43
+ border: 0;
44
+ background-color: #8C8C8C;
45
45
  margin: 5px 0 5px 0;
46
46
  width: 100%;
47
47
  }
@@ -77,22 +77,22 @@ hr {
77
77
  }
78
78
 
79
79
  .right {
80
- text-align: right;
80
+ text-align: right;
81
81
  font-style: italic;
82
82
  }
83
83
 
84
84
  .left {
85
- text-align: left;
85
+ text-align: left;
86
86
  }
87
87
 
88
88
  .center {
89
- margin-left: auto;
90
- margin-right: auto;
91
- text-align: center;
89
+ margin-left: auto;
90
+ margin-right: auto;
91
+ text-align: center;
92
92
  }
93
93
 
94
94
  .indent {
95
- margin: 0 0 0 5px;
95
+ margin: 0 0 0 5px;
96
96
  padding: 0;
97
97
  }
98
98
 
@@ -104,17 +104,17 @@ hr {
104
104
  }
105
105
 
106
106
  div.center {
107
- margin-left: auto;
108
- margin-right: auto;
109
- text-align: center;
107
+ margin-left: auto;
108
+ margin-right: auto;
109
+ text-align: center;
110
110
  }
111
111
 
112
112
  img.right {
113
113
  float: right;
114
114
  }
115
115
 
116
- img.center {
117
- text-align: center;
116
+ img.center {
117
+ text-align: center;
118
118
  }
119
119
 
120
120
  img.left {
@@ -151,14 +151,14 @@ img.left {
151
151
  #error_explanation ul li {
152
152
  margin: 0;
153
153
  padding: 0 0 0 5px;
154
- font-size: 14px;
154
+ font-size: 14px;
155
155
  line-height: 18px;
156
156
  }
157
157
 
158
158
  #notice, #alert, #error {
159
159
  margin: 10px 0 15px 0;
160
160
  padding: 0;
161
-
161
+
162
162
  color: #0065de;
163
163
  font-size: 18px;
164
164
  font-weight: bold;
@@ -207,7 +207,7 @@ form label {
207
207
  font-size: 12px;
208
208
  }
209
209
 
210
- #quorum p, #quorum p a {
210
+ #quorum p, #quorum p a {
211
211
  text-decoration: none;
212
212
  color: #f8f8ff;
213
213
  }
@@ -344,7 +344,7 @@
344
344
  *
345
345
  * http://docs.jquery.com/UI/Autocomplete#theming
346
346
  */
347
- .ui-autocomplete { position: absolute; cursor: default; }
347
+ .ui-autocomplete { position: absolute; cursor: default; }
348
348
 
349
349
  /* workarounds */
350
350
  * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
@@ -400,8 +400,8 @@
400
400
  .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
401
401
  .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
402
402
  button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
403
- .ui-button-icons-only { width: 3.4em; }
404
- button.ui-button-icons-only { width: 3.7em; }
403
+ .ui-button-icons-only { width: 3.4em; }
404
+ button.ui-button-icons-only { width: 3.7em; }
405
405
 
406
406
  /*button text element */
407
407
  .ui-button .ui-button-text { display: block; line-height: 1.4; }
@@ -437,7 +437,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
437
437
  */
438
438
  .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
439
439
  .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
440
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
440
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
441
441
  .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
442
442
  .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
443
443
  .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
@@ -509,7 +509,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
509
509
  .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
510
510
  .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
511
511
  .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
512
- .ui-datepicker select.ui-datepicker-month,
512
+ .ui-datepicker select.ui-datepicker-month,
513
513
  .ui-datepicker select.ui-datepicker-year { width: 49%;}
514
514
  .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
515
515
  .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
@@ -35,7 +35,7 @@ module Quorum
35
35
  @job.build_tblastn_job if @job.tblastn_job.nil?
36
36
  @job.build_blastp_job if @job.blastp_job.nil?
37
37
  render :action => "new"
38
- return
38
+ return
39
39
  end
40
40
  redirect_to job_path(@job.id)
41
41
  end
@@ -46,7 +46,7 @@ module Quorum
46
46
  rescue ActiveRecord::RecordNotFound => e
47
47
  set_flash_message(:notice, :data_not_found)
48
48
  redirect_to :action => "new"
49
- end
49
+ end
50
50
  end
51
51
 
52
52
  #
@@ -101,7 +101,7 @@ module Quorum
101
101
  )
102
102
  json = [{ :meta_id => data.meta_id }]
103
103
  end
104
- end
104
+ end
105
105
 
106
106
  respond_with json
107
107
  end
@@ -116,8 +116,8 @@ module Quorum
116
116
  data = Workers::System.get_meta(params[:meta_id])
117
117
  if data.succeeded?
118
118
  unless data.result.downcase.include?("error")
119
- send_data data.result,
120
- :filename => "#{params[:meta_id]}.fa",
119
+ send_data data.result,
120
+ :filename => "#{params[:meta_id]}.fa",
121
121
  :type => "text/plain",
122
122
  :disposition => "attachment"
123
123
  return
@@ -137,8 +137,8 @@ module Quorum
137
137
  def set_blast_dbs
138
138
  @blast_dbs = {
139
139
  :blastn => Quorum.blastn,
140
- :blastx => Quorum.blastx,
141
- :tblastn => Quorum.tblastn,
140
+ :blastx => Quorum.blastx,
141
+ :tblastn => Quorum.tblastn,
142
142
  :blastp => Quorum.blastp
143
143
  }
144
144
  end
@@ -4,7 +4,7 @@ module Quorum
4
4
  before_save :set_optional_params, :set_blast_dbs
5
5
 
6
6
  belongs_to :job
7
- has_many :blastn_job_reports,
7
+ has_many :blastn_job_reports,
8
8
  :dependent => :destroy,
9
9
  :foreign_key => :blastn_job_id,
10
10
  :primary_key => :job_id
@@ -4,7 +4,7 @@ module Quorum
4
4
  before_save :set_optional_params, :set_blast_dbs
5
5
 
6
6
  belongs_to :job
7
- has_many :blastp_job_reports,
7
+ has_many :blastp_job_reports,
8
8
  :dependent => :destroy,
9
9
  :foreign_key => :blastp_job_id,
10
10
  :primary_key => :job_id
@@ -4,7 +4,7 @@ module Quorum
4
4
  before_save :set_optional_params, :set_blast_dbs
5
5
 
6
6
  belongs_to :job
7
- has_many :blastx_job_reports,
7
+ has_many :blastx_job_reports,
8
8
  :dependent => :destroy,
9
9
  :foreign_key => :blastx_job_id,
10
10
  :primary_key => :job_id
@@ -1,31 +1,31 @@
1
1
  module Quorum
2
2
  class Job < ActiveRecord::Base
3
-
3
+
4
4
  include Quorum::Sequence
5
5
 
6
6
  after_save :queue_workers
7
7
 
8
8
  has_one :blastn_job, :dependent => :destroy
9
- has_many :blastn_job_reports, :through => :blastn_job,
9
+ has_many :blastn_job_reports, :through => :blastn_job,
10
10
  :dependent => :destroy
11
11
 
12
12
  has_one :blastx_job, :dependent => :destroy
13
- has_many :blastx_job_reports, :through => :blastx_job,
13
+ has_many :blastx_job_reports, :through => :blastx_job,
14
14
  :dependent => :destroy
15
15
 
16
16
  has_one :tblastn_job, :dependent => :destroy
17
- has_many :tblastn_job_reports, :through => :tblastn_job,
17
+ has_many :tblastn_job_reports, :through => :tblastn_job,
18
18
  :dependent => :destroy
19
19
 
20
20
  has_one :blastp_job, :dependent => :destroy
21
- has_many :blastp_job_reports, :through => :blastp_job,
21
+ has_many :blastp_job_reports, :through => :blastp_job,
22
22
  :dependent => :destroy
23
23
 
24
24
  accepts_nested_attributes_for :blastn_job, :blastx_job, :tblastn_job,
25
25
  :blastp_job,
26
26
  :reject_if => proc { |attributes| attributes['queue'] == '0' }
27
27
 
28
- attr_accessible :sequence, :na_sequence, :aa_sequence,
28
+ attr_accessible :sequence, :na_sequence, :aa_sequence,
29
29
  :blastn_job_attributes, :blastx_job_attributes, :tblastn_job_attributes,
30
30
  :blastp_job_attributes
31
31
 
@@ -34,7 +34,7 @@ module Quorum
34
34
  validate :filter_input_sequences, :algorithm_selected
35
35
 
36
36
  #
37
- # Fetch Blast hit_id, hit_display_id, queue Resque worker and
37
+ # Fetch Blast hit_id, hit_display_id, queue Resque worker and
38
38
  # return worker's meta_id.
39
39
  #
40
40
  def fetch_quorum_blast_sequence(algo, algo_id)
@@ -53,8 +53,8 @@ module Quorum
53
53
  cmd = create_blast_fetch_command(blast_dbs, hit_id, hit_display_id, algo)
54
54
 
55
55
  data = Workers::System.enqueue(
56
- cmd, Quorum.blast_remote,
57
- Quorum.blast_ssh_host, Quorum.blast_ssh_user,
56
+ cmd, Quorum.blast_remote,
57
+ Quorum.blast_ssh_host, Quorum.blast_ssh_user,
58
58
  Quorum.blast_ssh_options, true
59
59
  )
60
60
 
@@ -74,7 +74,7 @@ module Quorum
74
74
  rescue ActiveSupport::Multibyte::EncodingError => e
75
75
  logger.error e.message
76
76
  errors.add(
77
- :sequence,
77
+ :sequence,
78
78
  "Please enter your sequence(s) in Plain Text as FASTA."
79
79
  )
80
80
  self.sequence = ""
@@ -100,7 +100,7 @@ module Quorum
100
100
  self.na_sequence = ""
101
101
  self.aa_sequence = ""
102
102
 
103
- # Split the sequences on >, check the type (AA or NA) and separate.
103
+ # Split the sequences on >, check the type (AA or NA) and separate.
104
104
  seqs = fasta.split('>')
105
105
  seqs.delete_if { |s| s.empty? }
106
106
  seqs.each do |s|
@@ -110,8 +110,8 @@ module Quorum
110
110
  end
111
111
  if type == "amino_acid"
112
112
  self.aa_sequence << ">" << s
113
- end
114
- end
113
+ end
114
+ end
115
115
 
116
116
  self.na_sequence = nil if self.na_sequence.empty?
117
117
  self.aa_sequence = nil if self.aa_sequence.empty?
@@ -122,15 +122,15 @@ module Quorum
122
122
  #
123
123
  def algorithm_selected
124
124
  in_queue = false
125
- if (self.blastn_job && self.blastn_job.queue) ||
125
+ if (self.blastn_job && self.blastn_job.queue) ||
126
126
  (self.blastx_job && self.blastx_job.queue) ||
127
- (self.tblastn_job && self.tblastn_job.queue) ||
127
+ (self.tblastn_job && self.tblastn_job.queue) ||
128
128
  (self.blastp_job && self.blastp_job.queue)
129
129
  in_queue = true
130
130
  end
131
131
  unless in_queue
132
132
  errors.add(
133
- :algorithm,
133
+ :algorithm,
134
134
  " - Please select at least one algorithm to continue."
135
135
  )
136
136
  end
@@ -153,12 +153,12 @@ module Quorum
153
153
  if self.blastp_job && self.blastp_job.queue
154
154
  jobs << create_search_command("blastp")
155
155
  end
156
-
156
+
157
157
  unless jobs.blank?
158
158
  jobs.each do |j|
159
159
  Workers::System.enqueue(
160
- j, Quorum.blast_remote,
161
- Quorum.blast_ssh_host, Quorum.blast_ssh_user,
160
+ j, Quorum.blast_remote,
161
+ Quorum.blast_ssh_host, Quorum.blast_ssh_user,
162
162
  Quorum.blast_ssh_options
163
163
  )
164
164
  end
@@ -4,7 +4,7 @@ module Quorum
4
4
  before_save :set_optional_params, :set_blast_dbs
5
5
 
6
6
  belongs_to :job
7
- has_many :tblastn_job_reports,
7
+ has_many :tblastn_job_reports,
8
8
  :dependent => :destroy,
9
9
  :foreign_key => :tblastn_job_id,
10
10
  :primary_key => :job_id