quorum 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,386 @@
|
|
1
|
+
//
|
2
|
+
// Mustache style Underscore.js templating.
|
3
|
+
//
|
4
|
+
_.templateSettings = {
|
5
|
+
evaluate: /\{\{(.+?)\}\}/g,
|
6
|
+
interpolate: /\{\{\=(.+?)\}\}/g
|
7
|
+
};
|
8
|
+
|
9
|
+
//
|
10
|
+
// jQuery
|
11
|
+
//---------------------------------------------------------------------------//
|
12
|
+
|
13
|
+
$(function() {
|
14
|
+
|
15
|
+
// jQuery Functions //
|
16
|
+
|
17
|
+
$.fn.extend({
|
18
|
+
// Add hints to the form elements.
|
19
|
+
addHints: function() {
|
20
|
+
$(this).each(function() {
|
21
|
+
if ($(this).attr('title') === '') {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
if ($(this).val() === '') {
|
26
|
+
$(this).val($(this).attr('title'));
|
27
|
+
|
28
|
+
if (!$(this).hasClass('auto-hint')) {
|
29
|
+
$(this).addClass('auto-hint');
|
30
|
+
}
|
31
|
+
} else {
|
32
|
+
$(this).removeClass('auto-hint');
|
33
|
+
}
|
34
|
+
});
|
35
|
+
},
|
36
|
+
|
37
|
+
// Remove hints on submit.
|
38
|
+
removeHintsOnSubmit: function() {
|
39
|
+
$(this).each(function() {
|
40
|
+
if ($(this).val() === $(this).attr('title')) {
|
41
|
+
$(this).val('');
|
42
|
+
}
|
43
|
+
});
|
44
|
+
},
|
45
|
+
|
46
|
+
// Remove hint and class on focus.
|
47
|
+
focusHint: function() {
|
48
|
+
$(this).focus(function() {
|
49
|
+
if ($(this).val() === $(this).attr('title')) {
|
50
|
+
$(this).val('');
|
51
|
+
$(this).removeClass('auto-hint');
|
52
|
+
}
|
53
|
+
});
|
54
|
+
},
|
55
|
+
|
56
|
+
// Retain value or add hint.
|
57
|
+
blurHint: function() {
|
58
|
+
$(this).blur(function() {
|
59
|
+
if ($(this).val() === '' && $(this).attr('title') !== '') {
|
60
|
+
$(this).val($(this).attr('title'));
|
61
|
+
$(this).addClass('auto-hint');
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
// End jQuery Functions //
|
68
|
+
|
69
|
+
|
70
|
+
// Hide Elements //
|
71
|
+
|
72
|
+
if (!$('#job_blastn_job_attributes_queue').is(':checked')) {
|
73
|
+
$('#blastn').hide();
|
74
|
+
}
|
75
|
+
|
76
|
+
if (!$('#job_blastx_job_attributes_queue').is(':checked')) {
|
77
|
+
$('#blastx').hide();
|
78
|
+
}
|
79
|
+
|
80
|
+
if (!$('#job_tblastn_job_attributes_queue').is(':checked')) {
|
81
|
+
$('#tblastn').hide();
|
82
|
+
}
|
83
|
+
|
84
|
+
if (!$('#job_blastp_job_attributes_queue').is(':checked')) {
|
85
|
+
$('#blastp').hide();
|
86
|
+
}
|
87
|
+
|
88
|
+
// End Elements //
|
89
|
+
|
90
|
+
|
91
|
+
// Form //
|
92
|
+
|
93
|
+
var form = $('form :input.auto-hint');
|
94
|
+
form.focusHint();
|
95
|
+
form.blurHint();
|
96
|
+
form.addHints();
|
97
|
+
|
98
|
+
// Toggle Algorithms //
|
99
|
+
|
100
|
+
$('#job_blastn_job_attributes_queue').change(function() {
|
101
|
+
$('#blastn').slideToggle();
|
102
|
+
});
|
103
|
+
|
104
|
+
$('#job_blastx_job_attributes_queue').change(function() {
|
105
|
+
$('#blastx').slideToggle();
|
106
|
+
});
|
107
|
+
|
108
|
+
$('#job_tblastn_job_attributes_queue').change(function() {
|
109
|
+
$('#tblastn').slideToggle();
|
110
|
+
});
|
111
|
+
|
112
|
+
$('#job_blastp_job_attributes_queue').change(function() {
|
113
|
+
$('#blastp').slideToggle();
|
114
|
+
});
|
115
|
+
|
116
|
+
// End Algorithms //
|
117
|
+
|
118
|
+
// Disable submit button and remove input values equal to attr title.
|
119
|
+
$('form').submit(function() {
|
120
|
+
$('input[type=submit]', this).val('Processing...').attr(
|
121
|
+
'disabled', 'disabled'
|
122
|
+
);
|
123
|
+
|
124
|
+
form.removeHintsOnSubmit();
|
125
|
+
});
|
126
|
+
|
127
|
+
// Reset form.
|
128
|
+
$('#quorum_job_reset').click(function() {
|
129
|
+
$('input:text').val('');
|
130
|
+
$('input:file').val('');
|
131
|
+
$('input:checkbox').attr('checked', false);
|
132
|
+
$('select').val('');
|
133
|
+
|
134
|
+
$('.toggle').each(function() {
|
135
|
+
$(this).hide();
|
136
|
+
});
|
137
|
+
|
138
|
+
form.addHints();
|
139
|
+
});
|
140
|
+
|
141
|
+
// End Form //
|
142
|
+
|
143
|
+
|
144
|
+
// Views //
|
145
|
+
|
146
|
+
// Tabs
|
147
|
+
$('#tabs').tabs();
|
148
|
+
|
149
|
+
// End Views //
|
150
|
+
|
151
|
+
});
|
152
|
+
|
153
|
+
|
154
|
+
//
|
155
|
+
// JavaScript Functions
|
156
|
+
//---------------------------------------------------------------------------//
|
157
|
+
|
158
|
+
//
|
159
|
+
// Poll quorum search results asynchronously and insert them into
|
160
|
+
// the DOM via #blast_template.
|
161
|
+
//
|
162
|
+
var pollResults = function(id, interval, algos) {
|
163
|
+
|
164
|
+
// Set the default poll interval to 5 seconds.
|
165
|
+
interval = interval || 5000;
|
166
|
+
|
167
|
+
// Algorithms
|
168
|
+
algos = algos || ["blastn", "blastx", "tblastn", "blastp"];
|
169
|
+
|
170
|
+
_.each(algos, function(a) {
|
171
|
+
$.getJSON(
|
172
|
+
'/quorum/jobs/' + id + '/get_quorum_search_results.json?algo=' + a,
|
173
|
+
function(data) {
|
174
|
+
if (data.length === 0) {
|
175
|
+
setTimeout(function() { pollResults(id, interval, [a]); }, interval);
|
176
|
+
} else {
|
177
|
+
$('#' + a + '-results').empty();
|
178
|
+
var temp = _.template(
|
179
|
+
$('#blast_template').html(), {
|
180
|
+
data: data,
|
181
|
+
algo: a
|
182
|
+
}
|
183
|
+
);
|
184
|
+
$('#' + a + '-results').html(temp);
|
185
|
+
return;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
);
|
189
|
+
});
|
190
|
+
}
|
191
|
+
|
192
|
+
//
|
193
|
+
// Display jQuery UI modal box containing detailed report of all hits
|
194
|
+
// to the same query. After the modal box is inserted into the DOM,
|
195
|
+
// automatically scroll to the highlighted hit.
|
196
|
+
//
|
197
|
+
var viewDetailedReport = function(id, focus_id, query, algo) {
|
198
|
+
// Create the modal box.
|
199
|
+
$('#detailed_report_dialog').html(
|
200
|
+
"<p class='center'>" +
|
201
|
+
"Loading... <img src='/assets/quorum/knight_rider.gif' alt='Loading'>" +
|
202
|
+
"</p>"
|
203
|
+
).dialog({
|
204
|
+
modal: true,
|
205
|
+
width: 850,
|
206
|
+
position: 'top'
|
207
|
+
});
|
208
|
+
|
209
|
+
$.getJSON(
|
210
|
+
'/quorum/jobs/' + id + '/get_quorum_search_results.json?algo=' + algo +
|
211
|
+
'&query=' + query,
|
212
|
+
function(data) {
|
213
|
+
var temp = _.template(
|
214
|
+
$('#detailed_report_template').html(), {
|
215
|
+
data: data,
|
216
|
+
query: query,
|
217
|
+
algo: algo
|
218
|
+
}
|
219
|
+
);
|
220
|
+
|
221
|
+
// Insert the detailed report data.
|
222
|
+
$('#detailed_report_dialog').empty().html(temp);
|
223
|
+
|
224
|
+
// Add tipsy to the sequence data.
|
225
|
+
$('a[rel=quorum-tipsy]').tipsy({ gravity: 's' });
|
226
|
+
|
227
|
+
// Highlight the selected id.
|
228
|
+
$('#' + focus_id).addClass("ui-state-highlight");
|
229
|
+
|
230
|
+
// Automatically scroll to the selected id.
|
231
|
+
autoScroll(focus_id, false);
|
232
|
+
}
|
233
|
+
);
|
234
|
+
}
|
235
|
+
|
236
|
+
//
|
237
|
+
// Helper to add title sequence position attribute for tipsy.
|
238
|
+
//
|
239
|
+
// If from > to decrement index; otherwise increment.
|
240
|
+
// If the algo is tblastn and type is hit OR algo is blastx and type is query,
|
241
|
+
// increment / decrement by 3; otherwise increment / decrement by 1.
|
242
|
+
//
|
243
|
+
var addBaseTitleIndex = function(bases, from, to, algo, type) {
|
244
|
+
var forward = true;
|
245
|
+
var value = 1;
|
246
|
+
var index = from;
|
247
|
+
|
248
|
+
if (from > to) {
|
249
|
+
forward = false;
|
250
|
+
}
|
251
|
+
|
252
|
+
// Only set value to 3 if hseq is true and algo is tblastn.
|
253
|
+
if ((type === "hit" && algo === "tblastn") ||
|
254
|
+
(type === "query" && algo === "blastx")) {
|
255
|
+
value = 3;
|
256
|
+
}
|
257
|
+
|
258
|
+
// Add tipsy to each base.
|
259
|
+
return _.map(bases.split(''), function(c) {
|
260
|
+
var str = "<a rel='quorum-tipsy' title=" + index + ">" + c + "</a>";
|
261
|
+
forward ? index += value : index -= value;
|
262
|
+
return str;
|
263
|
+
}).join('');
|
264
|
+
}
|
265
|
+
|
266
|
+
//
|
267
|
+
// Format sequence data for detailed report.
|
268
|
+
//
|
269
|
+
// If q_from > q_to or h_from > h_to, subtract by increment; otherwise add
|
270
|
+
// by increment.
|
271
|
+
//
|
272
|
+
// If algo is tblastn or blastx, multiple increment by 3.
|
273
|
+
//
|
274
|
+
var formatSequenceReport = function(qseq, midline, hseq, q_from, q_to, h_from, h_to, algo) {
|
275
|
+
var max = qseq.length; // max length
|
276
|
+
var increment = 60; // increment value
|
277
|
+
var s = 0; // start position
|
278
|
+
var e = increment; // end position
|
279
|
+
var seq = "\n"; // seq string to return
|
280
|
+
|
281
|
+
while(true) {
|
282
|
+
seq += "qseq " + addBaseTitleIndex(qseq.slice(s, e), q_from, q_to, algo, 'query') + "\n";
|
283
|
+
seq += " " + midline.slice(s, e) + "\n";
|
284
|
+
seq += "hseq " + addBaseTitleIndex(hseq.slice(s, e), h_from, h_to, algo, 'hit') + "\n\n";
|
285
|
+
|
286
|
+
if (e >= max) {
|
287
|
+
break;
|
288
|
+
}
|
289
|
+
|
290
|
+
s += increment;
|
291
|
+
e += increment;
|
292
|
+
|
293
|
+
// If the algorithm is blastx, increment * 3 only for qseq.
|
294
|
+
if (algo === "blastx") {
|
295
|
+
q_from < q_to ? q_from += (increment * 3) : q_from -= (increment * 3);
|
296
|
+
} else {
|
297
|
+
q_from < q_to ? q_from += increment : q_from -= increment;
|
298
|
+
}
|
299
|
+
|
300
|
+
// If the algorithm is tblastn, increment * 3 only for hseq.
|
301
|
+
if (algo === "tblastn") {
|
302
|
+
h_from < h_to ? h_from += (increment * 3) : h_from -= (increment * 3);
|
303
|
+
} else {
|
304
|
+
h_from < h_to ? h_from += increment : h_from -= increment;
|
305
|
+
}
|
306
|
+
}
|
307
|
+
return "<p class='small'>Alignment (Mouse over for positions):</p>" +
|
308
|
+
"<span class='small'><pre>" + seq + "</pre></span>";
|
309
|
+
}
|
310
|
+
|
311
|
+
//
|
312
|
+
// Format Query and Hit Strand.
|
313
|
+
//
|
314
|
+
// If query_frame or hit_frame < 0, print 'reverse'; print 'forward' otherwise.
|
315
|
+
//
|
316
|
+
var formatStrand = function(qstrand, hstrand) {
|
317
|
+
var q = "";
|
318
|
+
var h = "";
|
319
|
+
|
320
|
+
qstrand < 0 ? q = "reverse" : q = "forward";
|
321
|
+
hstrand < 0 ? h = "reverse" : h = "forward";
|
322
|
+
|
323
|
+
return q + " / " + h;
|
324
|
+
}
|
325
|
+
|
326
|
+
//
|
327
|
+
// Display links to Hsps in the same group.
|
328
|
+
//
|
329
|
+
var displayHspLinks = function(focus, group, data) {
|
330
|
+
if (group !== null) {
|
331
|
+
var str = "Related <a onclick=\"(openWindow(" +
|
332
|
+
"'http://www.ncbi.nlm.nih.gov/books/NBK62051/def-item/blast_glossary.HSP'," +
|
333
|
+
"'HSP', 800, 300))\">HSPs</a>: ";
|
334
|
+
|
335
|
+
var ids = _.map(group.split(","), function(i) { return parseInt(i); });
|
336
|
+
|
337
|
+
var selected = _(data).chain()
|
338
|
+
.reject(function(d) { return !_.include(ids, d.id); })
|
339
|
+
.sortBy(function(d) { return d.id; })
|
340
|
+
.value();
|
341
|
+
|
342
|
+
_.each(selected, function(e) {
|
343
|
+
if (e.id !== focus) {
|
344
|
+
str += "<a onclick='(autoScroll(" + e.id + ", true))'>" + e.hsp_num + "</a> ";
|
345
|
+
} else {
|
346
|
+
str += e.hsp_num + " ";
|
347
|
+
}
|
348
|
+
});
|
349
|
+
return str;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
//
|
354
|
+
// Autoscroll to given div id.
|
355
|
+
//
|
356
|
+
var autoScroll = function(id, highlight) {
|
357
|
+
$('html, body').animate({
|
358
|
+
scrollTop: $('#' + id).offset().top
|
359
|
+
}, 1000);
|
360
|
+
|
361
|
+
if (highlight) {
|
362
|
+
$('#' + id).effect("highlight", {}, 4000);
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
//
|
367
|
+
// Truncate string to length n using word boundary.
|
368
|
+
//
|
369
|
+
String.prototype.trunc = function(n) {
|
370
|
+
var longStr = this.length > n;
|
371
|
+
var str = longStr ? this.substr(0, n-1) : this;
|
372
|
+
|
373
|
+
longStr ? str.substr(0, str.lastIndexOf(' ')) : str;
|
374
|
+
return longStr ? str + '...' : str;
|
375
|
+
}
|
376
|
+
|
377
|
+
//
|
378
|
+
// Open URL in new window.
|
379
|
+
//
|
380
|
+
var openWindow = function(url, name, width, height) {
|
381
|
+
|
382
|
+
var windowSize = "width=" + width + ",height=" + height + ",scrollbars=yes";
|
383
|
+
|
384
|
+
window.open(url, name, windowSize);
|
385
|
+
}
|
386
|
+
|
@@ -0,0 +1,224 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*** Content Styles ***/
|
10
|
+
|
11
|
+
html {
|
12
|
+
color: #222222;
|
13
|
+
font-family: Lucida Grande, Helvetica, Arial, sans-serif;
|
14
|
+
background: #b8b8b8 url("bg.png") repeat-x top;
|
15
|
+
}
|
16
|
+
|
17
|
+
a {
|
18
|
+
color: #783C3C;
|
19
|
+
text-decoration: none;
|
20
|
+
}
|
21
|
+
|
22
|
+
a:hover {
|
23
|
+
color: #783C3C;
|
24
|
+
text-decoration: underline;
|
25
|
+
cursor: pointer;
|
26
|
+
}
|
27
|
+
|
28
|
+
img {
|
29
|
+
border: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
hr.big {
|
33
|
+
height: 3px;
|
34
|
+
border: 0;
|
35
|
+
background-color: #8C8C8C;
|
36
|
+
margin: 5px 0 5px 0;
|
37
|
+
width: 100%;
|
38
|
+
overflow: hidden;
|
39
|
+
}
|
40
|
+
|
41
|
+
hr {
|
42
|
+
height: 1px;
|
43
|
+
border: 0;
|
44
|
+
background-color: #8C8C8C;
|
45
|
+
margin: 5px 0 5px 0;
|
46
|
+
width: 100%;
|
47
|
+
}
|
48
|
+
|
49
|
+
.underline {
|
50
|
+
text-decoration: underline;
|
51
|
+
}
|
52
|
+
|
53
|
+
.title {
|
54
|
+
font-size: 16px;
|
55
|
+
font-weight: bold;
|
56
|
+
}
|
57
|
+
|
58
|
+
.text {
|
59
|
+
font-size: 14px;
|
60
|
+
}
|
61
|
+
|
62
|
+
.medium {
|
63
|
+
font-size: 14px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.small {
|
67
|
+
font-size: 12px;
|
68
|
+
}
|
69
|
+
|
70
|
+
.italic {
|
71
|
+
font-style: italic;
|
72
|
+
}
|
73
|
+
|
74
|
+
.small-italic {
|
75
|
+
font-size: 11px;
|
76
|
+
font-style: italic;
|
77
|
+
}
|
78
|
+
|
79
|
+
.right {
|
80
|
+
text-align: right;
|
81
|
+
font-style: italic;
|
82
|
+
}
|
83
|
+
|
84
|
+
.left {
|
85
|
+
text-align: left;
|
86
|
+
}
|
87
|
+
|
88
|
+
.center {
|
89
|
+
margin-left: auto;
|
90
|
+
margin-right: auto;
|
91
|
+
text-align: center;
|
92
|
+
}
|
93
|
+
|
94
|
+
.indent {
|
95
|
+
margin: 0 0 0 5px;
|
96
|
+
padding: 0;
|
97
|
+
}
|
98
|
+
|
99
|
+
.block {
|
100
|
+
margin: 0;
|
101
|
+
padding: 5px;
|
102
|
+
font-size: 11px;
|
103
|
+
text-align: justify;
|
104
|
+
}
|
105
|
+
|
106
|
+
div.center {
|
107
|
+
margin-left: auto;
|
108
|
+
margin-right: auto;
|
109
|
+
text-align: center;
|
110
|
+
}
|
111
|
+
|
112
|
+
img.right {
|
113
|
+
float: right;
|
114
|
+
}
|
115
|
+
|
116
|
+
img.center {
|
117
|
+
text-align: center;
|
118
|
+
}
|
119
|
+
|
120
|
+
img.left {
|
121
|
+
float: left;
|
122
|
+
}
|
123
|
+
|
124
|
+
/*** Error Styles ***/
|
125
|
+
|
126
|
+
#error_explanation {
|
127
|
+
width: 80%;
|
128
|
+
border: 2px solid #0065de;
|
129
|
+
padding: 7px;
|
130
|
+
padding-bottom: 0;
|
131
|
+
margin-bottom: 20px;
|
132
|
+
background-color: #ffffff;
|
133
|
+
}
|
134
|
+
|
135
|
+
#error_explanation h2 {
|
136
|
+
text-align: left;
|
137
|
+
font-weight: bold;
|
138
|
+
padding: 5px 5px 5px 15px;
|
139
|
+
font-size: 18px;
|
140
|
+
margin: -7px;
|
141
|
+
margin-bottom: 0px;
|
142
|
+
background-color: #0065de;
|
143
|
+
color: #fff;
|
144
|
+
}
|
145
|
+
|
146
|
+
#error_explanation ul {
|
147
|
+
margin: 15px 20px 15px 40px;
|
148
|
+
padding: 0;
|
149
|
+
}
|
150
|
+
|
151
|
+
#error_explanation ul li {
|
152
|
+
margin: 0;
|
153
|
+
padding: 0 0 0 5px;
|
154
|
+
font-size: 14px;
|
155
|
+
line-height: 18px;
|
156
|
+
}
|
157
|
+
|
158
|
+
#notice, #alert, #error {
|
159
|
+
margin: 10px 0 15px 0;
|
160
|
+
padding: 0;
|
161
|
+
|
162
|
+
color: #0065de;
|
163
|
+
font-size: 18px;
|
164
|
+
font-weight: bold;
|
165
|
+
clear: both;
|
166
|
+
}
|
167
|
+
|
168
|
+
.field_with_errors {
|
169
|
+
padding: 2px;
|
170
|
+
background-color: #0065de;
|
171
|
+
display: table;
|
172
|
+
color: #fff;
|
173
|
+
}
|
174
|
+
|
175
|
+
/*** End Error ***/
|
176
|
+
|
177
|
+
/*** Form Styles ***/
|
178
|
+
|
179
|
+
form {
|
180
|
+
margin: 5px;
|
181
|
+
padding: 0;
|
182
|
+
}
|
183
|
+
|
184
|
+
form textarea {
|
185
|
+
width: 70%;
|
186
|
+
height: 120px;
|
187
|
+
}
|
188
|
+
|
189
|
+
form label {
|
190
|
+
font-size: 14px;
|
191
|
+
}
|
192
|
+
|
193
|
+
.radio-form {
|
194
|
+
font-size: 12px;
|
195
|
+
}
|
196
|
+
|
197
|
+
.auto-hint {
|
198
|
+
color: #aaa;
|
199
|
+
}
|
200
|
+
|
201
|
+
#loading {
|
202
|
+
padding: 5px;
|
203
|
+
}
|
204
|
+
|
205
|
+
/*** End Form Styles ***/
|
206
|
+
|
207
|
+
#quorum {
|
208
|
+
padding: 0;
|
209
|
+
margin: 20px 0 20px 0;
|
210
|
+
text-align: left;
|
211
|
+
font-size: 12px;
|
212
|
+
}
|
213
|
+
|
214
|
+
#quorum p, #quorum p a {
|
215
|
+
text-decoration: none;
|
216
|
+
color: #f8f8ff;
|
217
|
+
}
|
218
|
+
|
219
|
+
#quorum p a:hover {
|
220
|
+
text-decoration: underline;
|
221
|
+
color: #f8f8ff;
|
222
|
+
}
|
223
|
+
|
224
|
+
/*** End ***/
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/*
|
2
|
+
Place all the styles related to the matching controller here.
|
3
|
+
They will automatically be included in application.css.
|
4
|
+
*/
|
5
|
+
|
6
|
+
#new {
|
7
|
+
width: 60%;
|
8
|
+
}
|
9
|
+
|
10
|
+
#show {
|
11
|
+
width: 90%;
|
12
|
+
}
|
13
|
+
|
14
|
+
/*** Table Styles ***/
|
15
|
+
table.options {
|
16
|
+
margin: 0 0 15px 10px;
|
17
|
+
border: 0;
|
18
|
+
width: 100%;
|
19
|
+
border-collapse: collapse;
|
20
|
+
}
|
21
|
+
|
22
|
+
table.results {
|
23
|
+
margin: 0;
|
24
|
+
border: 0;
|
25
|
+
width: 100%;
|
26
|
+
border-collapse: collapse;
|
27
|
+
}
|
28
|
+
|
29
|
+
table.report_details {
|
30
|
+
margin: 0;
|
31
|
+
border: 0;
|
32
|
+
width: 70%;
|
33
|
+
border-collapse: collapse;
|
34
|
+
}
|
35
|
+
|
36
|
+
th {
|
37
|
+
white-space: normal;
|
38
|
+
font-size: 14px;
|
39
|
+
}
|
40
|
+
|
41
|
+
th, td {
|
42
|
+
padding: 3px 5px 3px 5px;
|
43
|
+
text-align: left;
|
44
|
+
}
|
45
|
+
|
46
|
+
th a, a:hover {
|
47
|
+
text-decoration: underline;
|
48
|
+
border: none;
|
49
|
+
}
|
50
|
+
|
51
|
+
td {
|
52
|
+
white-space: normal;
|
53
|
+
font-size: 12px;
|
54
|
+
}
|
55
|
+
|
56
|
+
td a.detailed_report, td a.detailed_report a:hover {
|
57
|
+
color: #783C3C;
|
58
|
+
text-decoration: none;
|
59
|
+
border: none;
|
60
|
+
}
|
61
|
+
|
62
|
+
tr.odd {
|
63
|
+
background-color: #ffffff;
|
64
|
+
}
|
65
|
+
|
66
|
+
tr.even {
|
67
|
+
background-color: #dcdcdc;
|
68
|
+
}
|
69
|
+
|
70
|
+
/*** End ***/
|
71
|
+
|
72
|
+
|