quorum 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +11 -11
- data/HISTORY.md +8 -0
- data/README.rdoc +1 -1
- data/app/assets/javascripts/quorum/quorum.js +144 -78
- data/app/views/quorum/jobs/new.html.erb +1 -1
- data/app/views/quorum/jobs/show.html.erb +5 -7
- data/app/views/quorum/jobs/templates/_blast_detailed_report_template.html.erb +1 -1
- data/app/views/quorum/jobs/templates/_blast_template.html.erb +0 -1
- data/db/migrate/20120910175911_change_hsp_group_column_type.rb +15 -0
- data/lib/generators/templates/blast.rb +7 -2
- data/lib/quorum/version.rb +1 -1
- data/spec/dummy/db/schema.rb +5 -5
- data/spec/dummy/quorum/lib/search_tools/blast.rb +7 -2
- data/spec/javascripts/fixtures/quorum_tabs.html +16 -14
- data/spec/javascripts/quorum_spec.js +52 -26
- metadata +5 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
quorum (0.
|
4
|
+
quorum (0.5.0)
|
5
5
|
bio-blastxmlparser (~> 1.1.0)
|
6
6
|
jquery-rails
|
7
7
|
net-ssh (~> 2.3.0)
|
@@ -46,7 +46,7 @@ GEM
|
|
46
46
|
nokogiri (>= 1.5.0)
|
47
47
|
bio-logger (1.0.1)
|
48
48
|
log4r (>= 1.1.9)
|
49
|
-
builder (3.0.
|
49
|
+
builder (3.0.3)
|
50
50
|
capybara (1.1.2)
|
51
51
|
mime-types (>= 1.16)
|
52
52
|
nokogiri (>= 1.3.3)
|
@@ -61,18 +61,18 @@ GEM
|
|
61
61
|
erubis (2.7.0)
|
62
62
|
ffi (1.1.5)
|
63
63
|
hike (1.2.1)
|
64
|
-
i18n (0.6.
|
65
|
-
jasmine (1.2.
|
64
|
+
i18n (0.6.1)
|
65
|
+
jasmine (1.2.1)
|
66
66
|
jasmine-core (>= 1.2.0)
|
67
67
|
rack (~> 1.0)
|
68
68
|
rspec (>= 1.3.1)
|
69
69
|
selenium-webdriver (>= 0.1.3)
|
70
70
|
jasmine-core (1.2.0)
|
71
71
|
journey (1.0.4)
|
72
|
-
jquery-rails (2.
|
73
|
-
railties (>= 3.
|
72
|
+
jquery-rails (2.1.2)
|
73
|
+
railties (>= 3.1.0, < 5.0)
|
74
74
|
thor (~> 0.14)
|
75
|
-
json (1.7.
|
75
|
+
json (1.7.5)
|
76
76
|
libwebsocket (0.1.5)
|
77
77
|
addressable
|
78
78
|
log4r (1.1.10)
|
@@ -134,9 +134,9 @@ GEM
|
|
134
134
|
rspec-expectations (~> 2.11.0)
|
135
135
|
rspec-mocks (~> 2.11.0)
|
136
136
|
rspec-core (2.11.1)
|
137
|
-
rspec-expectations (2.11.
|
137
|
+
rspec-expectations (2.11.3)
|
138
138
|
diff-lcs (~> 1.1.3)
|
139
|
-
rspec-mocks (2.11.
|
139
|
+
rspec-mocks (2.11.2)
|
140
140
|
rspec-rails (2.11.0)
|
141
141
|
actionpack (>= 3.0)
|
142
142
|
activesupport (>= 3.0)
|
@@ -148,7 +148,7 @@ GEM
|
|
148
148
|
libwebsocket (~> 0.1.3)
|
149
149
|
multi_json (~> 1.0)
|
150
150
|
rubyzip
|
151
|
-
sinatra (1.3.
|
151
|
+
sinatra (1.3.3)
|
152
152
|
rack (~> 1.3, >= 1.3.6)
|
153
153
|
rack-protection (~> 1.2)
|
154
154
|
tilt (~> 1.3, >= 1.3.3)
|
@@ -156,7 +156,7 @@ GEM
|
|
156
156
|
hike (~> 1.2)
|
157
157
|
rack (~> 1.0)
|
158
158
|
tilt (~> 1.1, != 1.3.0)
|
159
|
-
thor (0.
|
159
|
+
thor (0.16.0)
|
160
160
|
tilt (1.3.3)
|
161
161
|
treetop (1.4.10)
|
162
162
|
polyglot
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.5.0 (2012-09-14)
|
2
|
+
|
3
|
+
* Fixed partial data load bug. https://github.com/ncgr/quorum/issues/2
|
4
|
+
Requires running quorum:install and quorum:views generators.
|
5
|
+
See the Upgrading? section in the README for more information.
|
6
|
+
* Added better support for jQuery ajax errors in quorum.js.
|
7
|
+
* Added better support for URLs in quorum.js.
|
8
|
+
|
1
9
|
## 0.4.0 (2012-08-10)
|
2
10
|
|
3
11
|
* Added Hsp gaps to Blast Job Reports.
|
data/README.rdoc
CHANGED
@@ -13,13 +13,16 @@ QUORUM.algorithms = ["blastn", "blastx", "tblastn", "blastp"];
|
|
13
13
|
// Poll search results asynchronously.
|
14
14
|
//
|
15
15
|
// Allow user to define callback / callback_obj. If callback is
|
16
|
-
// undefined, render
|
16
|
+
// undefined, render default view.
|
17
17
|
//
|
18
|
-
QUORUM.pollResults = function(
|
18
|
+
QUORUM.pollResults = function(callback, callback_obj, interval, algos) {
|
19
19
|
|
20
20
|
var self = this,
|
21
|
-
|
22
|
-
|
21
|
+
url = document.URL + '/get_quorum_search_results.json',
|
22
|
+
interval = interval || 5000,
|
23
|
+
algos = algos || self.algorithms,
|
24
|
+
error = false,
|
25
|
+
timeoutIds = {};
|
23
26
|
|
24
27
|
// Render default view.
|
25
28
|
function buildTemplate(data, a) {
|
@@ -33,24 +36,56 @@ QUORUM.pollResults = function(id, callback, callback_obj, interval, algos) {
|
|
33
36
|
$('#' + a + '-results').html(temp);
|
34
37
|
}
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
buildTemplate(data, a);
|
50
|
-
}
|
51
|
-
}
|
39
|
+
// Process returned data from ajax call. If data is present, render,
|
40
|
+
// otherwise call function via setTimeout().
|
41
|
+
function processData(data, a) {
|
42
|
+
if (data.length === 0) {
|
43
|
+
timeoutIds[a] = setTimeout(function() {
|
44
|
+
getData(a);
|
45
|
+
}, interval);
|
46
|
+
} else {
|
47
|
+
clearTimeout(timeoutIds[a]);
|
48
|
+
if (_.isFunction(callback)) {
|
49
|
+
callback.call(callback_obj, data, a);
|
50
|
+
} else {
|
51
|
+
buildTemplate(data, a);
|
52
52
|
}
|
53
|
-
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// Render jqXHR error message.
|
57
|
+
function renderError(jqXHR) {
|
58
|
+
var msg = "<div class='ui-state-error ui-corner-all' " +
|
59
|
+
"style='padding: 0 .7em;'><p class='text'>" +
|
60
|
+
"<span class='ui-icon ui-icon-alert' style='float: left; " +
|
61
|
+
"margin-right: .3em;';></span>Something went wrong. " +
|
62
|
+
"Error: " + jqXHR.status + " " + jqXHR.statusText + "</p></div>";
|
63
|
+
if (error === false) {
|
64
|
+
$('#show').append(msg);
|
65
|
+
error = true;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
// Get Quorum results.
|
70
|
+
function getData(a) {
|
71
|
+
$.ajax({
|
72
|
+
url: url,
|
73
|
+
type: 'get',
|
74
|
+
dataType: 'json',
|
75
|
+
data: { 'algo': a },
|
76
|
+
cache: false,
|
77
|
+
timeout: 10000,
|
78
|
+
success: function(data) {
|
79
|
+
processData(data, a);
|
80
|
+
},
|
81
|
+
error: function(jqXHR) {
|
82
|
+
renderError(jqXHR);
|
83
|
+
}
|
84
|
+
});
|
85
|
+
}
|
86
|
+
|
87
|
+
_.each(algos, function(a) {
|
88
|
+
getData(a);
|
54
89
|
});
|
55
90
|
|
56
91
|
};
|
@@ -60,9 +95,10 @@ QUORUM.pollResults = function(id, callback, callback_obj, interval, algos) {
|
|
60
95
|
// to the same query. After the modal box is inserted into the DOM,
|
61
96
|
// automatically scroll to the highlighted hit.
|
62
97
|
//
|
63
|
-
QUORUM.viewDetailedReport = function(
|
98
|
+
QUORUM.viewDetailedReport = function(focus_id, query, algo) {
|
64
99
|
|
65
|
-
var self = this
|
100
|
+
var self = this,
|
101
|
+
url = document.URL + '/get_quorum_search_results.json';
|
66
102
|
|
67
103
|
// Create the modal box.
|
68
104
|
$('#detailed_report_dialog').html(
|
@@ -75,33 +111,50 @@ QUORUM.viewDetailedReport = function(id, focus_id, query, algo) {
|
|
75
111
|
position: 'top'
|
76
112
|
});
|
77
113
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
$(
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
114
|
+
function renderTemplate(data) {
|
115
|
+
var temp = _.template(
|
116
|
+
$('#detailed_report_template').html(), {
|
117
|
+
data: data,
|
118
|
+
query: query,
|
119
|
+
algo: algo
|
120
|
+
}
|
121
|
+
);
|
122
|
+
|
123
|
+
// Insert the detailed report data.
|
124
|
+
$('#detailed_report_dialog').empty().html(temp);
|
125
|
+
// Add tipsy to sequence data on mouse enter.
|
126
|
+
$('#detailed_report_dialog .sequence').mouseenter(function() {
|
127
|
+
$(this).find('a[rel=quorum-tipsy]').tipsy({ gravity: 's' });
|
128
|
+
});
|
129
|
+
// Highlight the selected id.
|
130
|
+
$('#' + focus_id).addClass("ui-state-highlight");
|
131
|
+
// Automatically scroll to the selected id.
|
132
|
+
self.autoScroll(focus_id, false);
|
133
|
+
}
|
134
|
+
|
135
|
+
function renderError(jqXHR) {
|
136
|
+
$('#detailed_report_dialog').empty().html(
|
137
|
+
"<div class='ui-state-error ui-corner-all' " +
|
138
|
+
"style='padding: 0 .7em;'><p class='text'>" +
|
139
|
+
"<span class='ui-icon ui-icon-alert' style='float: left; " +
|
140
|
+
"margin-right: .3em;';></span>Something went wrong. " +
|
141
|
+
"Error: " + jqXHR.status + " " + jqXHR.statusText + "</p></div>"
|
142
|
+
);
|
143
|
+
}
|
144
|
+
|
145
|
+
$.ajax({
|
146
|
+
url: url,
|
147
|
+
type: 'get',
|
148
|
+
dataType: 'json',
|
149
|
+
data: { 'algo': algo, 'query': query },
|
150
|
+
timeout: 10000,
|
151
|
+
success: function(data) {
|
152
|
+
renderTemplate(data);
|
153
|
+
},
|
154
|
+
error: function(jqXHR) {
|
155
|
+
renderError(jqXHR);
|
103
156
|
}
|
104
|
-
);
|
157
|
+
});
|
105
158
|
|
106
159
|
};
|
107
160
|
|
@@ -273,51 +326,64 @@ QUORUM.displayHspLinks = function(focus, group, data) {
|
|
273
326
|
//
|
274
327
|
// Download Blast hit sequence.
|
275
328
|
//
|
276
|
-
QUORUM.downloadSequence = function(
|
329
|
+
QUORUM.downloadSequence = function(algo_id, algo, el) {
|
277
330
|
|
278
|
-
var self = this
|
331
|
+
var self = this,
|
332
|
+
url = document.URL + '/get_quorum_blast_hit_sequence.json';
|
279
333
|
|
280
334
|
$(el).html('Fetching sequence...');
|
281
335
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
336
|
+
function renderError(jqXHR) {
|
337
|
+
$(el).addClass('ui-state-error').html(
|
338
|
+
"Error: " + jqXHR.status + " " + jqXHR.statusText
|
339
|
+
);
|
340
|
+
}
|
341
|
+
|
342
|
+
$.ajax({
|
343
|
+
url: url,
|
344
|
+
dataType: 'json',
|
345
|
+
data: { 'algo_id': algo_id, 'algo': algo },
|
346
|
+
timeout: 10000,
|
347
|
+
success: function(data) {
|
348
|
+
self.getSequenceFile(data[0].meta_id, el);
|
349
|
+
},
|
350
|
+
error: function(jqXHR) {
|
351
|
+
renderError(jqXHR);
|
287
352
|
}
|
288
|
-
);
|
353
|
+
});
|
289
354
|
|
290
355
|
};
|
291
356
|
|
292
357
|
//
|
293
358
|
// Poll application for Blast hit sequence.
|
294
359
|
//
|
295
|
-
QUORUM.getSequenceFile = function(
|
360
|
+
QUORUM.getSequenceFile = function(meta_id, el) {
|
296
361
|
|
297
362
|
var self = this,
|
298
|
-
url
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
363
|
+
url = document.URL + '/send_quorum_blast_hit_sequence?meta_id=' + meta_id,
|
364
|
+
timeoutId = 0;
|
365
|
+
|
366
|
+
function downloadFile(data) {
|
367
|
+
if (data.length === 0) {
|
368
|
+
timeoutId = setTimeout(function() {
|
369
|
+
self.getSequenceFile(meta_id, el)
|
370
|
+
}, 2500);
|
371
|
+
} else {
|
372
|
+
clearTimeout(timeoutId);
|
373
|
+
if (data.indexOf("error") !== -1) {
|
374
|
+
// Print error message.
|
375
|
+
$(el).addClass('ui-state-error').html(data);
|
307
376
|
} else {
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
$(el).addClass('ui-state-highlight').html('Sequence Downloaded Successfully');
|
314
|
-
$('.quorum_sequence_download').remove();
|
315
|
-
$('body').append('<iframe class="quorum_sequence_download"></iframe>');
|
316
|
-
$('.quorum_sequence_download').attr('src', url).hide();
|
317
|
-
}
|
377
|
+
// Force browser to download file via iframe.
|
378
|
+
$(el).addClass('ui-state-highlight').html('Sequence Downloaded Successfully');
|
379
|
+
$('.quorum_sequence_download').remove();
|
380
|
+
$('body').append('<iframe class="quorum_sequence_download"></iframe>');
|
381
|
+
$('.quorum_sequence_download').attr('src', url).hide();
|
318
382
|
}
|
319
383
|
}
|
320
|
-
|
384
|
+
}
|
385
|
+
|
386
|
+
$.get(url, function(data) { downloadFile(data); });
|
321
387
|
|
322
388
|
};
|
323
389
|
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<div id="quorum">
|
51
51
|
<hr class="big" />
|
52
52
|
<p>
|
53
|
-
Powered by <%= link_to "Quorum", "https://github.com/ncgr/quorum" %>
|
53
|
+
Powered by <%= link_to "Quorum v#{Quorum::VERSION}", "https://github.com/ncgr/quorum" %>
|
54
54
|
</p>
|
55
55
|
</div>
|
56
56
|
|
@@ -63,24 +63,22 @@
|
|
63
63
|
//
|
64
64
|
// Asynchronously poll Quorum for search results.
|
65
65
|
//
|
66
|
-
// QUORUM.pollResults(
|
67
|
-
// id: Job.id
|
66
|
+
// QUORUM.pollResults(callback, callback_obj, interval)
|
68
67
|
// callback: Define your own callback function to override the default.
|
69
68
|
// callback should expect the following params.
|
70
|
-
// id: Job.id (Int),
|
71
69
|
// data: JSON data (JSON),
|
72
70
|
// algorithm: Supported algorithm (String).
|
73
71
|
// callback_obj: Callback object.
|
74
72
|
// interval: poll interval in milliseconds. 5000 default.
|
75
73
|
//
|
76
74
|
// Example:
|
77
|
-
// QUORUM.pollResults(
|
75
|
+
// QUORUM.pollResults(MYAPP.myCoolCallback, MYAPP, 5000);
|
78
76
|
//
|
79
77
|
// Example callback:
|
80
|
-
// MYAPP.myCoolCallback = function(
|
78
|
+
// MYAPP.myCoolCallback = function(data, algo) {
|
81
79
|
// // awesome logic
|
82
80
|
// };
|
83
81
|
//
|
84
|
-
QUORUM.pollResults(
|
82
|
+
QUORUM.pollResults();
|
85
83
|
});
|
86
84
|
</script>
|
@@ -41,7 +41,7 @@
|
|
41
41
|
</table>
|
42
42
|
<p class="small">
|
43
43
|
<a id="download_sequence_{{= id }}"
|
44
|
-
onclick="QUORUM.downloadSequence(
|
44
|
+
onclick="QUORUM.downloadSequence({{= id }}, '{{= algo }}', this)">
|
45
45
|
Download Sequence
|
46
46
|
</a>
|
47
47
|
</p>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ChangeHspGroupColumnType < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_column :quorum_blastn_job_reports, :hsp_group, :text
|
4
|
+
change_column :quorum_blastx_job_reports, :hsp_group, :text
|
5
|
+
change_column :quorum_tblastn_job_reports, :hsp_group, :text
|
6
|
+
change_column :quorum_blastp_job_reports, :hsp_group, :text
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
change_column :quorum_blastn_job_reports, :hsp_group, :string
|
11
|
+
change_column :quorum_blastx_job_reports, :hsp_group, :string
|
12
|
+
change_column :quorum_tblastn_job_reports, :hsp_group, :string
|
13
|
+
change_column :quorum_blastp_job_reports, :hsp_group, :string
|
14
|
+
end
|
15
|
+
end
|
@@ -437,8 +437,13 @@ module Quorum
|
|
437
437
|
generate_blast_cmd
|
438
438
|
@logger.log("NCBI Blast", @cmd)
|
439
439
|
system(@cmd)
|
440
|
-
|
441
|
-
|
440
|
+
|
441
|
+
# Wrap these methods in a transaction to prevent premature return.
|
442
|
+
@job.method(@job_report_association).call.transaction do
|
443
|
+
parse_and_save_results
|
444
|
+
add_hps_groups_to_reports
|
445
|
+
end
|
446
|
+
|
442
447
|
remove_tmp_files
|
443
448
|
end
|
444
449
|
|
data/lib/quorum/version.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120910180642) do
|
15
15
|
|
16
16
|
create_table "quorum_blastn_job_reports", :force => true do |t|
|
17
17
|
t.string "query"
|
@@ -21,7 +21,7 @@ ActiveRecord::Schema.define(:version => 20120807211452) do
|
|
21
21
|
t.string "hit_accession"
|
22
22
|
t.integer "hit_len"
|
23
23
|
t.integer "hsp_num"
|
24
|
-
t.
|
24
|
+
t.text "hsp_group"
|
25
25
|
t.integer "bit_score"
|
26
26
|
t.integer "score"
|
27
27
|
t.string "evalue"
|
@@ -68,7 +68,7 @@ ActiveRecord::Schema.define(:version => 20120807211452) do
|
|
68
68
|
t.string "hit_accession"
|
69
69
|
t.integer "hit_len"
|
70
70
|
t.integer "hsp_num"
|
71
|
-
t.
|
71
|
+
t.text "hsp_group"
|
72
72
|
t.integer "bit_score"
|
73
73
|
t.integer "score"
|
74
74
|
t.string "evalue"
|
@@ -115,7 +115,7 @@ ActiveRecord::Schema.define(:version => 20120807211452) do
|
|
115
115
|
t.string "hit_accession"
|
116
116
|
t.integer "hit_len"
|
117
117
|
t.integer "hsp_num"
|
118
|
-
t.
|
118
|
+
t.text "hsp_group"
|
119
119
|
t.integer "bit_score"
|
120
120
|
t.integer "score"
|
121
121
|
t.string "evalue"
|
@@ -171,7 +171,7 @@ ActiveRecord::Schema.define(:version => 20120807211452) do
|
|
171
171
|
t.string "hit_accession"
|
172
172
|
t.integer "hit_len"
|
173
173
|
t.integer "hsp_num"
|
174
|
-
t.
|
174
|
+
t.text "hsp_group"
|
175
175
|
t.integer "bit_score"
|
176
176
|
t.integer "score"
|
177
177
|
t.string "evalue"
|
@@ -437,8 +437,13 @@ module Quorum
|
|
437
437
|
generate_blast_cmd
|
438
438
|
@logger.log("NCBI Blast", @cmd)
|
439
439
|
system(@cmd)
|
440
|
-
|
441
|
-
|
440
|
+
|
441
|
+
# Wrap these methods in a transaction to prevent premature return.
|
442
|
+
@job.method(@job_report_association).call.transaction do
|
443
|
+
parse_and_save_results
|
444
|
+
add_hps_groups_to_reports
|
445
|
+
end
|
446
|
+
|
442
447
|
remove_tmp_files
|
443
448
|
end
|
444
449
|
|
@@ -1,15 +1,17 @@
|
|
1
|
-
<div id="
|
2
|
-
<
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
</div>
|
1
|
+
<div id="show">
|
2
|
+
<div id="tabs">
|
3
|
+
<ul>
|
4
|
+
<li><a href="#tabs-1">Tab 1</a></li>
|
5
|
+
<li><a href="#tabs-2">Tab 2</a></li>
|
6
|
+
<li><a href="#tabs-3">Tab 3</a></li>
|
7
|
+
</ul>
|
8
|
+
<div id="tabs-1">Tab 1</div>
|
9
|
+
<div id="tabs-2">Tab 2</div>
|
10
|
+
<div id="tabs-3">Tab 3</div>
|
11
|
+
</div>
|
11
12
|
|
12
|
-
<div id="detailed_report_dialog" title="Quorum Report Details"></div>
|
13
|
-
<script type="text/template" id="blast_template"></script>
|
14
|
-
<script type="text/template" id="detailed_report_template"></script>
|
15
|
-
<a id="download_sequence">Download Sequence</a>
|
13
|
+
<div id="detailed_report_dialog" title="Quorum Report Details"></div>
|
14
|
+
<script type="text/template" id="blast_template"></script>
|
15
|
+
<script type="text/template" id="detailed_report_template"></script>
|
16
|
+
<a id="download_sequence">Download Sequence</a>
|
17
|
+
</div>
|
@@ -23,21 +23,32 @@ describe("QUORUM", function() {
|
|
23
23
|
// anonymous function buildTemplate().
|
24
24
|
//
|
25
25
|
it("fetches JSON and calls user defined callback function", function() {
|
26
|
-
|
26
|
+
loadFixtures('quorum_tabs.html');
|
27
|
+
|
28
|
+
spyOn($, 'ajax');
|
27
29
|
spyOn(window, 'setTimeout');
|
28
|
-
var
|
29
|
-
|
30
|
-
|
30
|
+
var callback = jasmine.createSpy(),
|
31
|
+
data = 'foo',
|
32
|
+
error = {
|
33
|
+
status: 400,
|
34
|
+
statusText: 'bad news'
|
35
|
+
};
|
31
36
|
|
32
|
-
QUORUM.pollResults(
|
37
|
+
QUORUM.pollResults(callback, null, 5000, ['a']);
|
33
38
|
|
34
39
|
// setTimeout()
|
35
|
-
$.
|
40
|
+
$.ajax.mostRecentCall.args[0].success([]);
|
36
41
|
expect(window.setTimeout).toHaveBeenCalled();
|
37
42
|
|
43
|
+
// Print jqXHR error message.
|
44
|
+
$.ajax.mostRecentCall.args[0].error(error);
|
45
|
+
expect($(".ui-state-error")).toHaveText(
|
46
|
+
'Something went wrong. Error: 400 bad news'
|
47
|
+
);
|
48
|
+
|
38
49
|
// callback()
|
39
|
-
$.
|
40
|
-
expect(callback).toHaveBeenCalledWith(
|
50
|
+
$.ajax.mostRecentCall.args[0].success(data);
|
51
|
+
expect(callback).toHaveBeenCalledWith(data, 'a');
|
41
52
|
});
|
42
53
|
|
43
54
|
//
|
@@ -48,20 +59,29 @@ describe("QUORUM", function() {
|
|
48
59
|
it("renders modal box containing detailed report", function() {
|
49
60
|
loadFixtures('quorum_tabs.html');
|
50
61
|
|
51
|
-
spyOn($, '
|
62
|
+
spyOn($, 'ajax');
|
52
63
|
spyOn(QUORUM, 'autoScroll');
|
53
|
-
var
|
54
|
-
focus_id = 1,
|
64
|
+
var focus_id = 1,
|
55
65
|
query = 'foo',
|
56
66
|
algo = 'a',
|
57
|
-
data = 'bar'
|
67
|
+
data = 'bar',
|
68
|
+
error = {
|
69
|
+
status: 500,
|
70
|
+
statusText: 'bad news'
|
71
|
+
};
|
58
72
|
|
59
|
-
QUORUM.viewDetailedReport(
|
73
|
+
QUORUM.viewDetailedReport(focus_id, query, algo);
|
60
74
|
|
61
75
|
expect($("#detailed_report_dialog")).toBeVisible();
|
62
76
|
|
77
|
+
// Print jqXHR error message.
|
78
|
+
$.ajax.mostRecentCall.args[0].error(error);
|
79
|
+
expect($("#detailed_report_dialog")).toHaveText(
|
80
|
+
'Something went wrong. Error: 500 bad news'
|
81
|
+
);
|
82
|
+
|
63
83
|
// Fetch JSON to build the template and scroll to focus_id.
|
64
|
-
$.
|
84
|
+
$.ajax.mostRecentCall.args[0].success(data);
|
65
85
|
expect(QUORUM.autoScroll).toHaveBeenCalledWith(focus_id, false);
|
66
86
|
|
67
87
|
// Close the dialog box.
|
@@ -214,20 +234,27 @@ describe("QUORUM", function() {
|
|
214
234
|
it("sends request to server to extract Blast hit sequence", function() {
|
215
235
|
loadFixtures("quorum_tabs.html");
|
216
236
|
|
217
|
-
spyOn($, '
|
237
|
+
spyOn($, 'ajax');
|
218
238
|
spyOn(QUORUM, 'getSequenceFile');
|
219
|
-
var
|
220
|
-
algo_id = 1,
|
239
|
+
var algo_id = 1,
|
221
240
|
algo = 'a',
|
222
241
|
el = $("#download_sequence"),
|
223
|
-
data = [{meta_id:"foo"}]
|
242
|
+
data = [{meta_id:"foo"}],
|
243
|
+
error = {
|
244
|
+
status: 505,
|
245
|
+
statusText: 'wut?'
|
246
|
+
};
|
224
247
|
|
225
|
-
QUORUM.downloadSequence(
|
248
|
+
QUORUM.downloadSequence(algo_id, algo, el);
|
226
249
|
|
227
250
|
expect(el.html()).toEqual('Fetching sequence...');
|
228
251
|
|
229
|
-
|
230
|
-
|
252
|
+
// Print jqXHR error message.
|
253
|
+
$.ajax.mostRecentCall.args[0].error(error);
|
254
|
+
expect(el).toHaveText("Error: 505 wut?");
|
255
|
+
|
256
|
+
$.ajax.mostRecentCall.args[0].success(data);
|
257
|
+
expect(QUORUM.getSequenceFile).toHaveBeenCalledWith(data[0].meta_id, el);
|
231
258
|
});
|
232
259
|
|
233
260
|
//
|
@@ -241,19 +268,18 @@ describe("QUORUM", function() {
|
|
241
268
|
|
242
269
|
spyOn($, 'get');
|
243
270
|
spyOn(window, 'setTimeout');
|
244
|
-
var
|
245
|
-
meta_id = 'foo',
|
271
|
+
var meta_id = 'foo',
|
246
272
|
el = $("#download_sequence"),
|
247
273
|
data = 'bar',
|
248
274
|
error = 'error';
|
249
275
|
|
250
|
-
QUORUM.getSequenceFile(
|
276
|
+
QUORUM.getSequenceFile(meta_id, el);
|
251
277
|
|
252
278
|
// setTimeout()
|
253
|
-
$.get.mostRecentCall.args[1](
|
279
|
+
$.get.mostRecentCall.args[1]([]);
|
254
280
|
expect(window.setTimeout).toHaveBeenCalled();
|
255
281
|
|
256
|
-
// Print error message
|
282
|
+
// Print error message.
|
257
283
|
$.get.mostRecentCall.args[1](error);
|
258
284
|
expect(el.html()).toEqual(error);
|
259
285
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quorum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -280,6 +280,7 @@ files:
|
|
280
280
|
- db/migrate/20111031204941_create_tblastn_job_reports.rb
|
281
281
|
- db/migrate/20120109232446_add_hit_display_id_to_blast_reports.rb
|
282
282
|
- db/migrate/20120807202555_add_gaps_to_blast_reports.rb
|
283
|
+
- db/migrate/20120910175911_change_hsp_group_column_type.rb
|
283
284
|
- lib/generators/quorum/images_generator.rb
|
284
285
|
- lib/generators/quorum/install_generator.rb
|
285
286
|
- lib/generators/quorum/styles_generator.rb
|
@@ -426,7 +427,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
426
427
|
version: '0'
|
427
428
|
segments:
|
428
429
|
- 0
|
429
|
-
hash: -
|
430
|
+
hash: -220393998352510462
|
430
431
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
431
432
|
none: false
|
432
433
|
requirements:
|
@@ -435,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
436
|
version: '0'
|
436
437
|
segments:
|
437
438
|
- 0
|
438
|
-
hash: -
|
439
|
+
hash: -220393998352510462
|
439
440
|
requirements: []
|
440
441
|
rubyforge_project:
|
441
442
|
rubygems_version: 1.8.24
|