sequenceserver 3.1.3 → 3.2.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.
- checksums.yaml +4 -4
- data/lib/sequenceserver/api_errors.rb +18 -0
- data/lib/sequenceserver/blast/hit.rb +1 -2
- data/lib/sequenceserver/blast/job.rb +15 -5
- data/lib/sequenceserver/blast/report.rb +5 -1
- data/lib/sequenceserver/database.rb +5 -1
- data/lib/sequenceserver/job.rb +26 -10
- data/lib/sequenceserver/makeblastdb.rb +2 -1
- data/lib/sequenceserver/routes.rb +37 -12
- data/lib/sequenceserver/version.rb +1 -1
- data/lib/sequenceserver/zip_file_generator.rb +1 -1
- data/public/404.html +8 -16
- data/public/css/app.css +794 -111
- data/public/css/app.min.css +1 -1
- data/public/css/sequenceserver.min.css +1 -8
- data/public/js/circos.js +103 -96
- data/public/{packages/circosJS@1.7.0.js → js/circosjs.js} +156 -778
- data/public/js/cloud_share_modal.js +55 -58
- data/public/js/collapse_preferences.js +13 -15
- data/public/js/databases.js +4 -3
- data/public/js/databases_tree.js +51 -30
- data/public/js/error_modal.js +35 -22
- data/public/js/exporter.js +2 -0
- data/public/js/form.js +43 -7
- data/public/js/grapher.js +94 -92
- data/public/js/hit.js +21 -19
- data/public/js/hits.js +45 -38
- data/public/js/hits_overview.js +8 -27
- data/public/js/hsp.js +140 -144
- data/public/js/jquery_world.js +24 -15
- data/public/js/kablammo.js +14 -10
- data/public/js/length_distribution.js +23 -37
- data/public/js/null_plugins/report_plugins.js +3 -5
- data/public/js/options.js +17 -19
- data/public/js/query.js +36 -35
- data/public/js/report/alignment_results.js +18 -0
- data/public/js/report/graphical_overview.js +38 -0
- data/public/js/report/report_header.js +28 -0
- data/public/js/report/run_summary.js +43 -0
- data/public/js/report.js +62 -102
- data/public/js/report_root.js +3 -3
- data/public/js/search.js +5 -2
- data/public/js/search_button.js +85 -78
- data/public/js/sequence.js +11 -22
- data/public/js/sequence_modal.js +38 -37
- data/public/js/share_url.js +5 -5
- data/public/js/sidebar.js +148 -86
- data/public/js/svgExporter.js +8 -3
- data/public/js/tests/form.spec.js +1 -1
- data/public/js/tests/visualisation_helpers.spec.js +28 -0
- data/public/js/visualisation_helpers.js +24 -27
- data/public/sequenceserver-report.min.js +1 -1
- data/public/sequenceserver-report.min.js.LICENSE.txt +1 -88
- data/public/sequenceserver-report.min.js.map +1 -1
- data/public/sequenceserver-search.min.js +1 -1
- data/public/sequenceserver-search.min.js.LICENSE.txt +0 -30
- data/public/sequenceserver-search.min.js.map +1 -1
- data/views/error.erb +1 -1
- data/views/layout.erb +123 -130
- data/views/report.erb +3 -2
- data/views/search.erb +10 -14
- metadata +13 -26
- data/public/css/fonts.css +0 -31
- data/public/css/grapher.css +0 -670
- data/public/css/sequenceserver.css +0 -509
- data/public/vendor/github/mbostock/d3@3.5.6/d3.js +0 -9506
- data/public/vendor/github/mbostock/d3@3.5.6.js +0 -1
- data/views/search_layout.erb +0 -153
|
@@ -1,3 +1,91 @@
|
|
|
1
|
+
const d3 = require('d3');
|
|
2
|
+
|
|
3
|
+
// ribbon function from d3 version 3
|
|
4
|
+
var π = Math.PI, halfπ = π / 2;
|
|
5
|
+
function d3_functor(v) {
|
|
6
|
+
return typeof v === "function" ? v : function() {
|
|
7
|
+
return v;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function d3_source(d) {
|
|
12
|
+
return d.source;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function d3_target(d) {
|
|
16
|
+
return d.target;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function d3_svg_chordRadius(d) {
|
|
20
|
+
return d.radius;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function d3_svg_arcStartAngle(d) {
|
|
24
|
+
return d.startAngle;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function d3_svg_arcEndAngle(d) {
|
|
28
|
+
return d.endAngle;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var ribbonV3 = function() {
|
|
32
|
+
var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
|
|
33
|
+
function chord(d, i) {
|
|
34
|
+
var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
|
|
35
|
+
result = "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.p0) : curve(t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(s.p0)) + "Z";
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
function subgroup(self, f, d, i) {
|
|
39
|
+
var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ;
|
|
40
|
+
return {
|
|
41
|
+
r: r,
|
|
42
|
+
a0: a0,
|
|
43
|
+
a1: a1,
|
|
44
|
+
p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
|
|
45
|
+
p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function equals(a, b) {
|
|
49
|
+
return a.a0 == b.a0 && a.a1 == b.a1;
|
|
50
|
+
}
|
|
51
|
+
function arc(r, p, a) {
|
|
52
|
+
return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
|
|
53
|
+
}
|
|
54
|
+
function curve(p1) {
|
|
55
|
+
return "Q 0,0 " + p1;
|
|
56
|
+
}
|
|
57
|
+
chord.radius = function(v) {
|
|
58
|
+
if (!arguments.length) return radius;
|
|
59
|
+
radius = d3_functor(v);
|
|
60
|
+
return chord;
|
|
61
|
+
};
|
|
62
|
+
chord.source = function(v) {
|
|
63
|
+
if (!arguments.length) return source;
|
|
64
|
+
source = d3_functor(v);
|
|
65
|
+
return chord;
|
|
66
|
+
};
|
|
67
|
+
chord.target = function(v) {
|
|
68
|
+
if (!arguments.length) return target;
|
|
69
|
+
target = d3_functor(v);
|
|
70
|
+
return chord;
|
|
71
|
+
};
|
|
72
|
+
chord.startAngle = function(v) {
|
|
73
|
+
if (!arguments.length) return startAngle;
|
|
74
|
+
startAngle = d3_functor(v);
|
|
75
|
+
return chord;
|
|
76
|
+
};
|
|
77
|
+
chord.endAngle = function(v) {
|
|
78
|
+
if (!arguments.length) return endAngle;
|
|
79
|
+
endAngle = d3_functor(v);
|
|
80
|
+
return chord;
|
|
81
|
+
};
|
|
82
|
+
return chord;
|
|
83
|
+
};
|
|
84
|
+
// end of ribbon function from d3 version 3
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// Bellow code extracted from circosjs https://github.com/nicgirault/circosJS and d3 version upgraded to use version 7.9
|
|
88
|
+
|
|
1
89
|
var circosJS,
|
|
2
90
|
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
|
3
91
|
|
|
@@ -197,183 +285,6 @@ circosJS.checkNumber = function(keys, index) {
|
|
|
197
285
|
return true;
|
|
198
286
|
};
|
|
199
287
|
|
|
200
|
-
circosJS.parseSpanValueData = function(data, layoutSummary) {
|
|
201
|
-
var groups, sample;
|
|
202
|
-
if (!(data.length > 0)) {
|
|
203
|
-
return {
|
|
204
|
-
data: [],
|
|
205
|
-
meta: {
|
|
206
|
-
min: null,
|
|
207
|
-
max: null
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
sample = data[0];
|
|
212
|
-
if ('parent_id' in sample && 'start' in sample && 'end' in sample && 'value' in sample) {
|
|
213
|
-
data = data.map(function(datum) {
|
|
214
|
-
return [datum.parent_id, datum.start, datum.end, datum.value];
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
data = data.filter(function(datum, index) {
|
|
218
|
-
return circosJS.checkParent(datum[0], index, layoutSummary, 'parent');
|
|
219
|
-
}).filter(function(datum, index) {
|
|
220
|
-
return circosJS.checkNumber({
|
|
221
|
-
start: datum[1],
|
|
222
|
-
end: datum[2],
|
|
223
|
-
value: datum[3]
|
|
224
|
-
}, index);
|
|
225
|
-
}).map(function(datum) {
|
|
226
|
-
if (datum[1] < 0 || datum[2] > layoutSummary[datum[0]]) {
|
|
227
|
-
circosJS.log(2, 'position', 'position inconsistency', {
|
|
228
|
-
datum: datum,
|
|
229
|
-
layoutSummary: layoutSummary
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return {
|
|
233
|
-
block_id: datum[0],
|
|
234
|
-
start: Math.max(0, parseFloat(datum[1])),
|
|
235
|
-
end: Math.min(layoutSummary[datum[0]], parseFloat(datum[2])),
|
|
236
|
-
value: parseFloat(datum[3]) || 1
|
|
237
|
-
};
|
|
238
|
-
});
|
|
239
|
-
groups = d3.nest().key(function(datum) {
|
|
240
|
-
return datum.block_id;
|
|
241
|
-
}).entries(data);
|
|
242
|
-
return {
|
|
243
|
-
data: groups,
|
|
244
|
-
meta: {
|
|
245
|
-
min: d3.min(data, function(d) {
|
|
246
|
-
return d.value;
|
|
247
|
-
}),
|
|
248
|
-
max: d3.max(data, function(d) {
|
|
249
|
-
return d.value;
|
|
250
|
-
})
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
circosJS.parseSpanStringData = function(data, layoutSummary) {
|
|
256
|
-
var groups, sample;
|
|
257
|
-
sample = data[0];
|
|
258
|
-
if ('parent_id' in sample && 'start' in sample && 'end' in sample && 'value' in sample) {
|
|
259
|
-
data = data.map(function(datum) {
|
|
260
|
-
return [datum.parent_id, datum.start, datum.end, datum.value];
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
data = data.filter(function(datum, index) {
|
|
264
|
-
return circosJS.checkParent(datum[0], index, layoutSummary, 'parent');
|
|
265
|
-
}).filter(function(datum, index) {
|
|
266
|
-
return circosJS.checkNumber({
|
|
267
|
-
start: datum[1],
|
|
268
|
-
end: datum[2]
|
|
269
|
-
}, index);
|
|
270
|
-
}).map(function(datum) {
|
|
271
|
-
var value;
|
|
272
|
-
if (datum[1] < 0 || datum[2] > layoutSummary[datum[0]]) {
|
|
273
|
-
circosJS.log(2, 'position', 'position inconsistency', {
|
|
274
|
-
datum: datum,
|
|
275
|
-
layoutSummary: layoutSummary
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
value = datum[3] != null ? datum[3] : null;
|
|
279
|
-
return {
|
|
280
|
-
block_id: datum[0],
|
|
281
|
-
start: Math.max(0, parseFloat(datum[1])),
|
|
282
|
-
end: Math.min(layoutSummary[datum[0]], parseFloat(datum[2])),
|
|
283
|
-
value: value
|
|
284
|
-
};
|
|
285
|
-
});
|
|
286
|
-
groups = d3.nest().key(function(datum) {
|
|
287
|
-
return datum.block_id;
|
|
288
|
-
}).entries(data);
|
|
289
|
-
return {
|
|
290
|
-
data: groups,
|
|
291
|
-
meta: {
|
|
292
|
-
min: d3.min(data, function(d) {
|
|
293
|
-
return d.value;
|
|
294
|
-
}),
|
|
295
|
-
max: d3.max(data, function(d) {
|
|
296
|
-
return d.value;
|
|
297
|
-
})
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
circosJS.parsePositionValueData = function(data, layoutSummary) {
|
|
303
|
-
var groups, sample;
|
|
304
|
-
sample = data[0];
|
|
305
|
-
if ('parent_id' in sample && 'position' in sample) {
|
|
306
|
-
data = data.map(function(datum) {
|
|
307
|
-
return [datum.parent_id, datum.position, datum.value];
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
data = data.filter(function(datum, index) {
|
|
311
|
-
return circosJS.checkParent(datum[0], index, layoutSummary, 'parent');
|
|
312
|
-
}).filter(function(datum, index) {
|
|
313
|
-
return circosJS.checkNumber({
|
|
314
|
-
position: datum[1],
|
|
315
|
-
value: datum[2]
|
|
316
|
-
}, index);
|
|
317
|
-
}).map(function(datum) {
|
|
318
|
-
return {
|
|
319
|
-
block_id: datum[0],
|
|
320
|
-
position: Math.min(layoutSummary[datum[0]], parseFloat(datum[1])),
|
|
321
|
-
value: parseFloat(datum[2]) || 1
|
|
322
|
-
};
|
|
323
|
-
});
|
|
324
|
-
groups = d3.nest().key(function(datum) {
|
|
325
|
-
return datum.block_id;
|
|
326
|
-
}).entries(data);
|
|
327
|
-
return {
|
|
328
|
-
data: groups,
|
|
329
|
-
meta: {
|
|
330
|
-
min: d3.min(data, function(d) {
|
|
331
|
-
return d.value;
|
|
332
|
-
}),
|
|
333
|
-
max: d3.max(data, function(d) {
|
|
334
|
-
return d.value;
|
|
335
|
-
})
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
circosJS.parsePositionTextData = function(data, layoutSummary) {
|
|
341
|
-
var groups, sample;
|
|
342
|
-
sample = data[0];
|
|
343
|
-
if ('parent_id' in sample && 'position' in sample) {
|
|
344
|
-
data = data.map(function(datum) {
|
|
345
|
-
return [datum.parent_id, datum.position, datum.value];
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
data = data.filter(function(datum, index) {
|
|
349
|
-
return circosJS.checkParent(datum[0], index, layoutSummary, 'parent');
|
|
350
|
-
}).filter(function(datum, index) {
|
|
351
|
-
return circosJS.checkNumber({
|
|
352
|
-
position: datum[1]
|
|
353
|
-
}, index);
|
|
354
|
-
}).map(function(datum) {
|
|
355
|
-
return {
|
|
356
|
-
block_id: datum[0],
|
|
357
|
-
position: Math.min(layoutSummary[datum[0]], parseFloat(datum[1])),
|
|
358
|
-
value: datum[2]
|
|
359
|
-
};
|
|
360
|
-
});
|
|
361
|
-
groups = d3.nest().key(function(datum) {
|
|
362
|
-
return datum.block_id;
|
|
363
|
-
}).entries(data);
|
|
364
|
-
return {
|
|
365
|
-
data: groups,
|
|
366
|
-
meta: {
|
|
367
|
-
min: d3.min(data, function(d) {
|
|
368
|
-
return d.value;
|
|
369
|
-
}),
|
|
370
|
-
max: d3.max(data, function(d) {
|
|
371
|
-
return d.value;
|
|
372
|
-
})
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
};
|
|
376
|
-
|
|
377
288
|
circosJS.parseChordData = function(data, layoutSummary) {
|
|
378
289
|
var sample;
|
|
379
290
|
sample = data[0];
|
|
@@ -486,22 +397,6 @@ circosJS.Layout = function(conf, data) {
|
|
|
486
397
|
return this;
|
|
487
398
|
};
|
|
488
399
|
|
|
489
|
-
circosJS.Core.prototype.heatmap = function(id, conf, data) {
|
|
490
|
-
var track;
|
|
491
|
-
track = new circosJS.Heatmap();
|
|
492
|
-
track.build(this, conf, data);
|
|
493
|
-
this.tracks.heatmaps[id] = track;
|
|
494
|
-
return this;
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
circosJS.Core.prototype.histogram = function(id, conf, data) {
|
|
498
|
-
var track;
|
|
499
|
-
track = new circosJS.Histogram();
|
|
500
|
-
track.build(this, conf, data);
|
|
501
|
-
this.tracks.histograms[id] = track;
|
|
502
|
-
return this;
|
|
503
|
-
};
|
|
504
|
-
|
|
505
400
|
circosJS.Core.prototype.chord = function(id, conf, data) {
|
|
506
401
|
var track;
|
|
507
402
|
track = new circosJS.Chord();
|
|
@@ -510,46 +405,6 @@ circosJS.Core.prototype.chord = function(id, conf, data) {
|
|
|
510
405
|
return this;
|
|
511
406
|
};
|
|
512
407
|
|
|
513
|
-
circosJS.Core.prototype.scatter = function(id, conf, data) {
|
|
514
|
-
var track;
|
|
515
|
-
track = new circosJS.Scatter();
|
|
516
|
-
track.build(this, conf, data);
|
|
517
|
-
this.tracks.scatters[id] = track;
|
|
518
|
-
return this;
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
circosJS.Core.prototype.line = function(id, conf, data) {
|
|
522
|
-
var track;
|
|
523
|
-
track = new circosJS.Line();
|
|
524
|
-
track.build(this, conf, data);
|
|
525
|
-
this.tracks.lines[id] = track;
|
|
526
|
-
return this;
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
circosJS.Core.prototype.stack = function(id, conf, data) {
|
|
530
|
-
var track;
|
|
531
|
-
track = new circosJS.Stack();
|
|
532
|
-
track.build(this, conf, data);
|
|
533
|
-
this.tracks.stacks[id] = track;
|
|
534
|
-
return this;
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
circosJS.Core.prototype.highlight = function(id, conf, data) {
|
|
538
|
-
var track;
|
|
539
|
-
track = new circosJS.Highlight();
|
|
540
|
-
track.build(this, conf, data);
|
|
541
|
-
this.tracks.highlights[id] = track;
|
|
542
|
-
return this;
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
circosJS.Core.prototype.text = function(id, conf, data) {
|
|
546
|
-
var track;
|
|
547
|
-
track = new circosJS.Text();
|
|
548
|
-
track.build(this, conf, data);
|
|
549
|
-
this.tracks.texts[id] = track;
|
|
550
|
-
return this;
|
|
551
|
-
};
|
|
552
|
-
|
|
553
408
|
circosJS.Chord = function() {
|
|
554
409
|
circosJS.Track.call(this);
|
|
555
410
|
this.parseData = circosJS.parseChordData;
|
|
@@ -582,11 +437,12 @@ circosJS.Chord = function() {
|
|
|
582
437
|
block = layout.blocks[d.id];
|
|
583
438
|
startAngle = block.start + d.start / block.len * (block.end - block.start);
|
|
584
439
|
endAngle = block.start + d.end / block.len * (block.end - block.start);
|
|
585
|
-
|
|
440
|
+
result = {
|
|
586
441
|
radius: layout.conf.innerRadius,
|
|
587
442
|
startAngle: startAngle,
|
|
588
443
|
endAngle: endAngle
|
|
589
444
|
};
|
|
445
|
+
return result;
|
|
590
446
|
};
|
|
591
447
|
})(this);
|
|
592
448
|
this.getTarget = (function(_this) {
|
|
@@ -596,16 +452,17 @@ circosJS.Chord = function() {
|
|
|
596
452
|
block = layout.blocks[d.id];
|
|
597
453
|
startAngle = block.start + d.start / block.len * (block.end - block.start);
|
|
598
454
|
endAngle = block.start + d.end / block.len * (block.end - block.start);
|
|
599
|
-
|
|
455
|
+
result = {
|
|
600
456
|
radius: layout.conf.innerRadius,
|
|
601
457
|
startAngle: startAngle,
|
|
602
458
|
endAngle: endAngle
|
|
603
459
|
};
|
|
460
|
+
return result;
|
|
604
461
|
};
|
|
605
462
|
})(this);
|
|
606
463
|
this.dimChords = function (parentElement, d, conf, index) {
|
|
607
464
|
parentElement.selectAll('path').style('opacity', function (p, i) {
|
|
608
|
-
if (
|
|
465
|
+
if (d === p) {
|
|
609
466
|
return 1;
|
|
610
467
|
}
|
|
611
468
|
return 0;
|
|
@@ -617,25 +474,39 @@ circosJS.Chord = function() {
|
|
|
617
474
|
this.renderChords = function(parentElement, name, conf, data, layout, ratio, getSource, getTarget) {
|
|
618
475
|
var link, track;
|
|
619
476
|
track = parentElement.append('g').attr('class', conf.colorPalette);
|
|
620
|
-
link = track
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
477
|
+
link = track
|
|
478
|
+
.selectAll('.chord')
|
|
479
|
+
.data(data)
|
|
480
|
+
.enter()
|
|
481
|
+
.append('path')
|
|
482
|
+
.attr('class', 'chord')
|
|
483
|
+
.attr('d', ribbonV3()
|
|
484
|
+
.source(function(d) {
|
|
485
|
+
return getSource(d, layout);
|
|
486
|
+
})
|
|
487
|
+
.target(function(d) {
|
|
488
|
+
return getTarget(d, layout);
|
|
489
|
+
})
|
|
490
|
+
)
|
|
491
|
+
.attr('opacity', function(_d) {
|
|
492
|
+
return conf.opacity;
|
|
493
|
+
})
|
|
494
|
+
.attr('id', function(d) {
|
|
495
|
+
return d.source.id + '_' + d.target.id;
|
|
496
|
+
})
|
|
497
|
+
.on('mouseover', (function(_this) {
|
|
498
|
+
return function(event, d) {
|
|
499
|
+
_this.dimChords(track, d, conf);
|
|
500
|
+
return _this.dispatch.call('mouseover', event, d);
|
|
501
|
+
};
|
|
502
|
+
})(this))
|
|
503
|
+
.on('mouseout', (function(_this) {
|
|
504
|
+
return function(event, d) {
|
|
505
|
+
_this.resetChords(track, conf);
|
|
506
|
+
return _this.dispatch.call('mouseout', event, d);
|
|
507
|
+
};
|
|
508
|
+
})(this));
|
|
509
|
+
|
|
639
510
|
if (conf.usePalette) {
|
|
640
511
|
link.attr('class', function(d) {
|
|
641
512
|
return 'q' + ratio(d.value, conf.cmin, conf.cmax, conf.colorPaletteSize, conf.colorPaletteReverse, conf.logScale) + '-' + conf.colorPaletteSize;
|
|
@@ -661,380 +532,6 @@ circosJS.Chord = function() {
|
|
|
661
532
|
return this;
|
|
662
533
|
};
|
|
663
534
|
|
|
664
|
-
circosJS.Heatmap = function() {
|
|
665
|
-
circosJS.Track.call(this);
|
|
666
|
-
this.parseData = circosJS.parseSpanValueData;
|
|
667
|
-
this.renderDatumContainer = (function(_this) {
|
|
668
|
-
return function(instance, parentElement, name, data, conf) {
|
|
669
|
-
var group, track;
|
|
670
|
-
track = parentElement.append('g').attr('class', conf.colorPalette);
|
|
671
|
-
return group = _this.renderBlock(track, data, instance._layout, conf);
|
|
672
|
-
};
|
|
673
|
-
})(this);
|
|
674
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
675
|
-
return parentElement.selectAll('tile').data(function(d) {
|
|
676
|
-
return d.values;
|
|
677
|
-
}).enter().append('path').attr('class', 'tile').attr('opacity', function(d) {
|
|
678
|
-
return d.opacity || conf.opacity;
|
|
679
|
-
}).attr('d', d3.svg.arc().innerRadius(conf.innerRadius).outerRadius(conf.outerRadius).startAngle(function(d, i) {
|
|
680
|
-
return utils.theta(d.start, layout.blocks[d.block_id]);
|
|
681
|
-
}).endAngle(function(d, i) {
|
|
682
|
-
return utils.theta(d.end, layout.blocks[d.block_id]);
|
|
683
|
-
})).attr('class', function(d) {
|
|
684
|
-
return 'q' + utils.ratio(d.value, conf.cmin, conf.cmax, conf.colorPaletteSize, conf.colorPaletteReverse, conf.logScale) + '-' + conf.colorPaletteSize;
|
|
685
|
-
});
|
|
686
|
-
};
|
|
687
|
-
return this;
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
circosJS.Highlight = function() {
|
|
691
|
-
circosJS.Track.call(this);
|
|
692
|
-
this.parseData = circosJS.parseSpanStringData;
|
|
693
|
-
this.renderDatumContainer = (function(_this) {
|
|
694
|
-
return function(instance, parentElement, name, data, conf) {
|
|
695
|
-
var group;
|
|
696
|
-
return group = _this.renderBlock(parentElement, data, instance._layout, conf);
|
|
697
|
-
};
|
|
698
|
-
})(this);
|
|
699
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
700
|
-
return parentElement.selectAll('tile').data(function(d) {
|
|
701
|
-
return d.values;
|
|
702
|
-
}).enter().append('path').attr('class', 'tile').attr('d', d3.svg.arc().innerRadius(conf.innerRadius).outerRadius(conf.outerRadius).startAngle(function(d, i) {
|
|
703
|
-
return utils.theta(d.start, layout.blocks[d.block_id]);
|
|
704
|
-
}).endAngle(function(d, i) {
|
|
705
|
-
return utils.theta(d.end, layout.blocks[d.block_id]);
|
|
706
|
-
})).attr('fill', function(d) {
|
|
707
|
-
return d.value || conf.color;
|
|
708
|
-
}).attr('opacity', function(d) {
|
|
709
|
-
return d.opacity || conf.opacity;
|
|
710
|
-
}).attr('stroke-width', function(d) {
|
|
711
|
-
return d.strokeWidth || conf.strokeWidth;
|
|
712
|
-
}).attr('stroke', function(d) {
|
|
713
|
-
return d.strokeColor || conf.strokeColor;
|
|
714
|
-
});
|
|
715
|
-
};
|
|
716
|
-
return this;
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
circosJS.Histogram = function() {
|
|
720
|
-
circosJS.Track.call(this);
|
|
721
|
-
this.parseData = circosJS.parseSpanValueData;
|
|
722
|
-
this.renderDatumContainer = (function(_this) {
|
|
723
|
-
return function(instance, parentElement, name, data, conf) {
|
|
724
|
-
var group, track;
|
|
725
|
-
track = parentElement.append('g').attr('class', _this.conf.colorPalette);
|
|
726
|
-
return group = _this.renderBlock(track, data, instance._layout, conf);
|
|
727
|
-
};
|
|
728
|
-
})(this);
|
|
729
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
730
|
-
var bin;
|
|
731
|
-
bin = parentElement.selectAll('.bin').data(function(d) {
|
|
732
|
-
return d.values;
|
|
733
|
-
}).enter().append('path').attr('class', 'bin').attr('opacity', function(d) {
|
|
734
|
-
return d.opacity || conf.opacity;
|
|
735
|
-
}).attr('d', d3.svg.arc().innerRadius(function(d) {
|
|
736
|
-
var height;
|
|
737
|
-
if (conf.direction === 'in') {
|
|
738
|
-
height = utils.ratio(d.value, conf.cmin, conf.cmax, conf.outerRadius - conf.innerRadius, false, conf.logscale);
|
|
739
|
-
return conf.outerRadius - height;
|
|
740
|
-
} else {
|
|
741
|
-
return conf.innerRadius;
|
|
742
|
-
}
|
|
743
|
-
}).outerRadius(function(d) {
|
|
744
|
-
var height;
|
|
745
|
-
if (conf.direction === 'out') {
|
|
746
|
-
height = utils.ratio(d.value, conf.cmin, conf.cmax, conf.outerRadius - conf.innerRadius, false, conf.logscale);
|
|
747
|
-
return conf.innerRadius + height;
|
|
748
|
-
} else {
|
|
749
|
-
return conf.outerRadius;
|
|
750
|
-
}
|
|
751
|
-
}).startAngle(function(d) {
|
|
752
|
-
return utils.theta(d.start, layout.blocks[d.block_id]);
|
|
753
|
-
}).endAngle(function(d) {
|
|
754
|
-
return utils.theta(d.end, layout.blocks[d.block_id]);
|
|
755
|
-
}));
|
|
756
|
-
if (conf.usePalette) {
|
|
757
|
-
bin.attr('class', function(d) {
|
|
758
|
-
return 'q' + utils.ratio(d.value, conf.cmin, conf.cmax, conf.colorPaletteSize, conf.colorPaletteReverse, conf.logScale) + '-' + conf.colorPaletteSize;
|
|
759
|
-
});
|
|
760
|
-
} else {
|
|
761
|
-
bin.attr('fill', d.color || conf.color);
|
|
762
|
-
}
|
|
763
|
-
return bin;
|
|
764
|
-
};
|
|
765
|
-
return this;
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
circosJS.Line = function() {
|
|
769
|
-
circosJS.Track.call(this);
|
|
770
|
-
this.parseData = circosJS.parsePositionValueData;
|
|
771
|
-
this.renderDatumContainer = (function(_this) {
|
|
772
|
-
return function(instance, parentElement, name, data, conf) {
|
|
773
|
-
var group, track;
|
|
774
|
-
track = parentElement.append('g').attr('class', name);
|
|
775
|
-
return group = _this.renderBlock(track, data, instance._layout, conf);
|
|
776
|
-
};
|
|
777
|
-
})(this);
|
|
778
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
779
|
-
var line;
|
|
780
|
-
line = d3.svg.line().x(function(d) {
|
|
781
|
-
return utils.x(d, layout, conf);
|
|
782
|
-
}).y(function(d) {
|
|
783
|
-
return utils.y(d, layout, conf);
|
|
784
|
-
}).interpolate(conf.interpolation);
|
|
785
|
-
return parentElement.append('path').datum(function(d) {
|
|
786
|
-
return d.values;
|
|
787
|
-
}).attr('class', 'line').attr('d', line).attr('opacity', function(d) {
|
|
788
|
-
return d.opacity || conf.opacity;
|
|
789
|
-
}).attr('stroke-width', function(d) {
|
|
790
|
-
return d.thickness || conf.thickness;
|
|
791
|
-
}).attr('stroke', function(d) {
|
|
792
|
-
return d.color || conf.color;
|
|
793
|
-
}).attr('fill', function(d) {
|
|
794
|
-
var color, fill;
|
|
795
|
-
fill = d.fill || conf.fill;
|
|
796
|
-
color = d.fill_color || conf.fill_color;
|
|
797
|
-
if (fill) {
|
|
798
|
-
return color;
|
|
799
|
-
} else {
|
|
800
|
-
return 'none';
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
};
|
|
804
|
-
return this;
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
circosJS.Scatter = function() {
|
|
808
|
-
circosJS.Track.call(this);
|
|
809
|
-
this.parseData = circosJS.parsePositionValueData;
|
|
810
|
-
this.renderDatumContainer = (function(_this) {
|
|
811
|
-
return function(instance, parentElement, name, data, conf) {
|
|
812
|
-
var group, track;
|
|
813
|
-
track = parentElement.append('g').attr('class', name);
|
|
814
|
-
return group = _this.renderBlock(track, data, instance._layout, conf);
|
|
815
|
-
};
|
|
816
|
-
})(this);
|
|
817
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
818
|
-
var point;
|
|
819
|
-
point = parentElement.selectAll('.point').data(function(d) {
|
|
820
|
-
return d.values;
|
|
821
|
-
}).enter().append('path').attr('class', 'point').attr('opacity', function(d) {
|
|
822
|
-
return d.opacity || conf.opacity;
|
|
823
|
-
}).attr('d', d3.svg.symbol().type(conf.glyph.shape).size(conf.glyph.size)).attr('transform', (function(_this) {
|
|
824
|
-
return function(d) {
|
|
825
|
-
return 'translate(' + utils.x(d, layout, conf) + ',' + utils.y(d, layout, conf) + ') rotate(' + utils.theta(d.position, layout.blocks[d.block_id]) * 360 / (2 * Math.PI) + ')';
|
|
826
|
-
};
|
|
827
|
-
})(this)).attr('stroke', function(d) {
|
|
828
|
-
return d.glyph_strokeColor || conf.glyph.strokeColor;
|
|
829
|
-
}).attr('stroke-width', function(d) {
|
|
830
|
-
return d.glyph_strokeWidth || conf.glyph.strokeWidth;
|
|
831
|
-
}).attr('fill', function(d) {
|
|
832
|
-
var color, fill;
|
|
833
|
-
fill = d.glyph_fill || conf.glyph.fill;
|
|
834
|
-
color = d.glyph_color || conf.glyph.color;
|
|
835
|
-
if (fill) {
|
|
836
|
-
return color;
|
|
837
|
-
} else {
|
|
838
|
-
return 'none';
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
return point;
|
|
842
|
-
};
|
|
843
|
-
return this;
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
circosJS.Stack = function() {
|
|
847
|
-
circosJS.Track.call(this);
|
|
848
|
-
this.parseData = circosJS.parseSpanValueData;
|
|
849
|
-
this.build = function(instance, conf, data, rules, backgrounds) {
|
|
850
|
-
this.loadData(data, instance);
|
|
851
|
-
this.conf = this.processConf(conf, this.defaultConf, this.meta, instance, this);
|
|
852
|
-
this.buildLayers(this.data, this.conf.margin);
|
|
853
|
-
return this.applyRules(conf.rules, this.data);
|
|
854
|
-
};
|
|
855
|
-
this.buildLayers = function(data, margin) {
|
|
856
|
-
var block, datum, i, idx, l, lastDatumInLayer, layer, layers, len, len1, m, placed, ref;
|
|
857
|
-
for (idx in data) {
|
|
858
|
-
block = data[idx];
|
|
859
|
-
block.values = block.values.sort(function(a, b) {
|
|
860
|
-
if (a.start < b.start) {
|
|
861
|
-
return -1;
|
|
862
|
-
}
|
|
863
|
-
if (a.start === b.start && a.end > b.end) {
|
|
864
|
-
return -1;
|
|
865
|
-
}
|
|
866
|
-
if (a.start === b.start && a.end === b.end) {
|
|
867
|
-
return 0;
|
|
868
|
-
}
|
|
869
|
-
return 1;
|
|
870
|
-
});
|
|
871
|
-
layers = [];
|
|
872
|
-
ref = block.values;
|
|
873
|
-
for (l = 0, len = ref.length; l < len; l++) {
|
|
874
|
-
datum = ref[l];
|
|
875
|
-
placed = false;
|
|
876
|
-
for (i = m = 0, len1 = layers.length; m < len1; i = ++m) {
|
|
877
|
-
layer = layers[i];
|
|
878
|
-
lastDatumInLayer = layer.slice(0).pop();
|
|
879
|
-
if (lastDatumInLayer.end + margin < datum.start) {
|
|
880
|
-
layer.push(datum);
|
|
881
|
-
datum.layer = i;
|
|
882
|
-
placed = true;
|
|
883
|
-
break;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
if (!placed) {
|
|
887
|
-
datum.layer = layers.length;
|
|
888
|
-
}
|
|
889
|
-
if (!placed) {
|
|
890
|
-
layers.push([datum]);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
};
|
|
895
|
-
this.applyRules = function(rules, data) {
|
|
896
|
-
var datum, i, k, layer, results, rule, v;
|
|
897
|
-
rules = rules || [];
|
|
898
|
-
results = [];
|
|
899
|
-
for (k in data) {
|
|
900
|
-
v = data[k];
|
|
901
|
-
results.push((function() {
|
|
902
|
-
var ref, results1;
|
|
903
|
-
ref = v.layers;
|
|
904
|
-
results1 = [];
|
|
905
|
-
for (i in ref) {
|
|
906
|
-
layer = ref[i];
|
|
907
|
-
results1.push((function() {
|
|
908
|
-
var l, len, results2;
|
|
909
|
-
results2 = [];
|
|
910
|
-
for (l = 0, len = layer.length; l < len; l++) {
|
|
911
|
-
datum = layer[l];
|
|
912
|
-
results2.push((function() {
|
|
913
|
-
var len1, m, results3;
|
|
914
|
-
results3 = [];
|
|
915
|
-
for (m = 0, len1 = rules.length; m < len1; m++) {
|
|
916
|
-
rule = rules[m];
|
|
917
|
-
if (rule.condition(v.parent, datum, i)) {
|
|
918
|
-
results3.push(datum[rule.parameter] = rule.value);
|
|
919
|
-
} else {
|
|
920
|
-
results3.push(void 0);
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
return results3;
|
|
924
|
-
})());
|
|
925
|
-
}
|
|
926
|
-
return results2;
|
|
927
|
-
})());
|
|
928
|
-
}
|
|
929
|
-
return results1;
|
|
930
|
-
})());
|
|
931
|
-
}
|
|
932
|
-
return results;
|
|
933
|
-
};
|
|
934
|
-
this.datumRadialPosition = (function(_this) {
|
|
935
|
-
return function(d) {
|
|
936
|
-
var origin, radialEnd, radialStart;
|
|
937
|
-
radialStart = (_this.conf.thickness + _this.conf.radialMargin) * d.layer;
|
|
938
|
-
radialEnd = radialStart + _this.conf.thickness;
|
|
939
|
-
if (_this.conf.direction === 'out') {
|
|
940
|
-
return [_this.conf.innerRadius + radialStart, Math.min(_this.conf.innerRadius + radialEnd, _this.conf.outerRadius)];
|
|
941
|
-
}
|
|
942
|
-
if (_this.conf.direction === 'in') {
|
|
943
|
-
return [Math.max(_this.conf.outerRadius - radialEnd, _this.conf.innerRadius), _this.conf.outerRadius - radialStart];
|
|
944
|
-
}
|
|
945
|
-
if (_this.conf.direction === 'center') {
|
|
946
|
-
origin = Math.floor((_this.conf.outerRadius + _this.conf.innerRadius) / 2);
|
|
947
|
-
radialStart = (_this.conf.thickness + _this.conf.radialMargin) * Math.floor(d.layer / 2);
|
|
948
|
-
radialEnd = radialStart + _this.conf.thickness;
|
|
949
|
-
if (d.layer % 2 === 0) {
|
|
950
|
-
return [origin + radialStart, origin + radialEnd];
|
|
951
|
-
} else {
|
|
952
|
-
return [origin - radialStart - _this.conf.radialMargin, origin - radialEnd - _this.conf.radialMargin];
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
})(this);
|
|
957
|
-
this.datumInnerRadius = (function(_this) {
|
|
958
|
-
return function(d, i, j) {
|
|
959
|
-
return _this.datumRadialPosition(d, i, j)[0];
|
|
960
|
-
};
|
|
961
|
-
})(this);
|
|
962
|
-
this.datumOuterRadius = (function(_this) {
|
|
963
|
-
return function(d, i, j) {
|
|
964
|
-
return _this.datumRadialPosition(d, i, j)[1];
|
|
965
|
-
};
|
|
966
|
-
})(this);
|
|
967
|
-
this.renderDatumContainer = (function(_this) {
|
|
968
|
-
return function(instance, parentElement, name, data, conf) {
|
|
969
|
-
var group, track;
|
|
970
|
-
track = parentElement.append('g').attr('class', conf.colorPalette);
|
|
971
|
-
return group = _this.renderBlock(track, data, instance._layout, conf);
|
|
972
|
-
};
|
|
973
|
-
})(this);
|
|
974
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
975
|
-
var tile;
|
|
976
|
-
tile = parentElement.selectAll('.tile').data(function(d) {
|
|
977
|
-
return d.values;
|
|
978
|
-
}).enter().append('path').attr('class', 'tile').attr('d', d3.svg.arc().innerRadius(utils.datumInnerRadius).outerRadius(utils.datumOuterRadius).startAngle(function(d) {
|
|
979
|
-
return utils.theta(d.start, layout.blocks[d.block_id]);
|
|
980
|
-
}).endAngle(function(d) {
|
|
981
|
-
return utils.theta(d.end, layout.blocks[d.block_id]);
|
|
982
|
-
}));
|
|
983
|
-
tile.attr('opacity', function(d) {
|
|
984
|
-
return d.opacity || conf.opacity;
|
|
985
|
-
});
|
|
986
|
-
tile.attr('stroke-width', function(d) {
|
|
987
|
-
return d.strokeWidth || conf.strokeWidth;
|
|
988
|
-
});
|
|
989
|
-
tile.attr('stroke', function(d) {
|
|
990
|
-
return d.strokeColor || conf.strokeColor;
|
|
991
|
-
});
|
|
992
|
-
tile.attr('fill', function(d) {
|
|
993
|
-
return d.color || conf.color;
|
|
994
|
-
});
|
|
995
|
-
tile.attr('class', function(d) {
|
|
996
|
-
var usePalette;
|
|
997
|
-
usePalette = d.usePalette || conf.usePalette;
|
|
998
|
-
if (usePalette) {
|
|
999
|
-
return 'q' + utils.ratio(d.value, conf.cmin, conf.cmax, conf.colorPaletteSize, conf.colorPaletteReverse, conf.logScale) + '-' + conf.colorPaletteSize;
|
|
1000
|
-
}
|
|
1001
|
-
});
|
|
1002
|
-
return tile;
|
|
1003
|
-
};
|
|
1004
|
-
return this;
|
|
1005
|
-
};
|
|
1006
|
-
|
|
1007
|
-
circosJS.Text = function() {
|
|
1008
|
-
circosJS.Track.call(this);
|
|
1009
|
-
this.parseData = circosJS.parsePositionTextData;
|
|
1010
|
-
this.renderDatumContainer = (function(_this) {
|
|
1011
|
-
return function(instance, parentElement, name, data, conf) {
|
|
1012
|
-
var group, track;
|
|
1013
|
-
track = parentElement.append('g').attr('class', name);
|
|
1014
|
-
return group = _this.renderBlock(track, data, instance._layout, conf);
|
|
1015
|
-
};
|
|
1016
|
-
})(this);
|
|
1017
|
-
this.renderDatum = function(parentElement, conf, layout, utils) {
|
|
1018
|
-
var key, ref, text, value;
|
|
1019
|
-
text = parentElement.selectAll('g').data(function(d) {
|
|
1020
|
-
return d.values;
|
|
1021
|
-
}).enter().append('g').append('text').text(function(d) {
|
|
1022
|
-
return d.value;
|
|
1023
|
-
}).attr('transform', function(d) {
|
|
1024
|
-
var angle;
|
|
1025
|
-
angle = utils.theta(d.position, layout.blocks[d.block_id]) * 360 / (2 * Math.PI) - 90;
|
|
1026
|
-
return 'rotate(' + angle + ')' + 'translate(' + conf.innerRadius + ',0)';
|
|
1027
|
-
});
|
|
1028
|
-
ref = conf.style;
|
|
1029
|
-
for (key in ref) {
|
|
1030
|
-
value = ref[key];
|
|
1031
|
-
text.style(key, value);
|
|
1032
|
-
}
|
|
1033
|
-
return text;
|
|
1034
|
-
};
|
|
1035
|
-
return this;
|
|
1036
|
-
};
|
|
1037
|
-
|
|
1038
535
|
circosJS.Track = function() {
|
|
1039
536
|
this.build = function(instance, conf, data) {
|
|
1040
537
|
this.dispatch = d3.dispatch('mouseover', 'mouseout');
|
|
@@ -1149,7 +646,7 @@ circosJS.Track = function() {
|
|
|
1149
646
|
return background.color;
|
|
1150
647
|
}).attr('opacity', function(background) {
|
|
1151
648
|
return background.opacity || 1;
|
|
1152
|
-
}).attr('d', d3.
|
|
649
|
+
}).attr('d', d3.arc().innerRadius(function(background) {
|
|
1153
650
|
if (conf.direction === 'in') {
|
|
1154
651
|
return conf.outerRadius - scope * background.start;
|
|
1155
652
|
} else {
|
|
@@ -1181,7 +678,7 @@ circosJS.Track = function() {
|
|
|
1181
678
|
return results;
|
|
1182
679
|
})();
|
|
1183
680
|
}
|
|
1184
|
-
axis = d3.
|
|
681
|
+
axis = d3.arc().innerRadius(function(d) {
|
|
1185
682
|
return d;
|
|
1186
683
|
}).outerRadius(function(d) {
|
|
1187
684
|
return d;
|
|
@@ -1190,6 +687,7 @@ circosJS.Track = function() {
|
|
|
1190
687
|
block = layout.blocks[data[j].key];
|
|
1191
688
|
return block.end - block.start;
|
|
1192
689
|
});
|
|
690
|
+
console.log('axis', axis);
|
|
1193
691
|
return parentElement.selectAll('.axis').data(axes).enter().append('path').attr('opacity', conf.opacity).attr('class', 'axis').attr('d', axis).attr('stroke-width', function(d, i) {
|
|
1194
692
|
if (i % conf.axes.major.spacing === 0) {
|
|
1195
693
|
return conf.axes.major.thickness;
|
|
@@ -1260,7 +758,7 @@ circosJS.renderLayout = function(d3, parentElement, instance) {
|
|
|
1260
758
|
block = layout.selectAll('g').data(instance._layout.data).enter().append('g').attr('class', function(d) {
|
|
1261
759
|
return d.id;
|
|
1262
760
|
}).attr('opacity', conf.opacity);
|
|
1263
|
-
entry = d3.
|
|
761
|
+
entry = d3.arc().innerRadius(conf.innerRadius).outerRadius(conf.outerRadius).cornerRadius(conf.cornerRadius).startAngle(function(d) {
|
|
1264
762
|
return d.start;
|
|
1265
763
|
}).endAngle(function(d) {
|
|
1266
764
|
return d.end;
|
|
@@ -1281,7 +779,7 @@ circosJS.renderLayout = function(d3, parentElement, instance) {
|
|
|
1281
779
|
circosJS.renderLayoutLabels = function(conf, d3, block) {
|
|
1282
780
|
var label, labelArc, r;
|
|
1283
781
|
r = conf.innerRadius + conf.labels.radialOffset;
|
|
1284
|
-
labelArc = d3.
|
|
782
|
+
labelArc = d3.arc().innerRadius(r).outerRadius(r).startAngle(function(d, i) {
|
|
1285
783
|
return d.start;
|
|
1286
784
|
}).endAngle(function(d, i) {
|
|
1287
785
|
return d.end;
|
|
@@ -1315,7 +813,7 @@ circosJS.renderLayoutTicks = function(conf, layout, d3, instance) {
|
|
|
1315
813
|
var arr = [];
|
|
1316
814
|
var item = {angle: 0 * k + d.start, label: 0};
|
|
1317
815
|
arr.push(item);
|
|
1318
|
-
var temp_scale = d3.
|
|
816
|
+
var temp_scale = d3.scaleLinear()
|
|
1319
817
|
.domain([1, d.len])
|
|
1320
818
|
.range([d.start, d.end]);
|
|
1321
819
|
var len = temp_scale.ticks(space).length;
|
|
@@ -1391,10 +889,14 @@ circosJS.Core.prototype.render = function(ids, removeTracks) {
|
|
|
1391
889
|
}
|
|
1392
890
|
}
|
|
1393
891
|
}
|
|
1394
|
-
svg = d3.select(this.conf.container)
|
|
892
|
+
svg = d3.select(this.conf.container);
|
|
1395
893
|
translated = svg.select('.all');
|
|
1396
894
|
if (translated.empty()) {
|
|
1397
|
-
translated = svg.append('
|
|
895
|
+
translated = svg.append('svg')
|
|
896
|
+
.attr('width', this.conf.width)
|
|
897
|
+
.attr('height', this.conf.height)
|
|
898
|
+
|
|
899
|
+
translated = translated.append('g').attr('class', 'all').attr('transform', 'translate(' + parseInt(this.conf.width / 2) + ',' + parseInt(this.conf.height / 2) + ')');
|
|
1398
900
|
}
|
|
1399
901
|
ref1 = this.tracks;
|
|
1400
902
|
for (trackType in ref1) {
|
|
@@ -1409,20 +911,24 @@ circosJS.Core.prototype.render = function(ids, removeTracks) {
|
|
|
1409
911
|
if (renderAll || indexOf.call(ids, 'layout') >= 0) {
|
|
1410
912
|
circosJS.renderLayout(d3, translated, this);
|
|
1411
913
|
}
|
|
1412
|
-
|
|
1413
|
-
tracks
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
});
|
|
1425
|
-
|
|
914
|
+
|
|
915
|
+
// tracks = svg.selectAll('.all > g').nodes();
|
|
916
|
+
// svg.selectAll('.all > g').remove();
|
|
917
|
+
|
|
918
|
+
// tracks.sort(function(a, b) {
|
|
919
|
+
// if (parseInt(a.getAttribute('z-index')) < parseInt(b.getAttribute('z-index'))) {
|
|
920
|
+
// return -1;
|
|
921
|
+
// } else if (parseInt(a.getAttribute('z-index')) > parseInt(b.getAttribute('z-index'))) {
|
|
922
|
+
// return 1;
|
|
923
|
+
// } else {
|
|
924
|
+
// return 0;
|
|
925
|
+
// }
|
|
926
|
+
// });
|
|
927
|
+
|
|
928
|
+
// svg.select('.all').selectAll('g').data(tracks).enter().append(function(d) {
|
|
929
|
+
// return d;
|
|
930
|
+
// });
|
|
931
|
+
// return this;
|
|
1426
932
|
};
|
|
1427
933
|
|
|
1428
934
|
circosJS.Core.prototype.defaultConf = {
|
|
@@ -1483,42 +989,6 @@ circosJS.axes = {
|
|
|
1483
989
|
}
|
|
1484
990
|
};
|
|
1485
991
|
|
|
1486
|
-
circosJS.Heatmap.prototype.defaultConf = {
|
|
1487
|
-
innerRadius: 0,
|
|
1488
|
-
outerRadius: 0,
|
|
1489
|
-
min: 'smart',
|
|
1490
|
-
max: 'smart',
|
|
1491
|
-
colorPalette: 'YlGnBu',
|
|
1492
|
-
colorPaletteSize: 9,
|
|
1493
|
-
colorPaletteReverse: false,
|
|
1494
|
-
logScale: false,
|
|
1495
|
-
rules: [],
|
|
1496
|
-
backgrounds: [],
|
|
1497
|
-
zIndex: 1,
|
|
1498
|
-
opacity: 1,
|
|
1499
|
-
tooltipContent: null
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
circosJS.Histogram.prototype.defaultConf = {
|
|
1503
|
-
innerRadius: 0,
|
|
1504
|
-
outerRadius: 0,
|
|
1505
|
-
min: 'smart',
|
|
1506
|
-
max: 'smart',
|
|
1507
|
-
direction: 'out',
|
|
1508
|
-
colorPaletteSize: 9,
|
|
1509
|
-
colorPalette: 'YlGnBu',
|
|
1510
|
-
usePalette: true,
|
|
1511
|
-
colorPaletteReverse: false,
|
|
1512
|
-
color: '#fd6a62',
|
|
1513
|
-
logScale: false,
|
|
1514
|
-
axes: circosJS.axes,
|
|
1515
|
-
rules: [],
|
|
1516
|
-
backgrounds: [],
|
|
1517
|
-
zIndex: 1,
|
|
1518
|
-
opacity: 1,
|
|
1519
|
-
tooltipContent: null
|
|
1520
|
-
};
|
|
1521
|
-
|
|
1522
992
|
circosJS.Chord.prototype.defaultConf = {
|
|
1523
993
|
colorPaletteSize: 9,
|
|
1524
994
|
colorPalette: 'PuBuGn',
|
|
@@ -1535,98 +1005,6 @@ circosJS.Chord.prototype.defaultConf = {
|
|
|
1535
1005
|
tooltipContent: null
|
|
1536
1006
|
};
|
|
1537
1007
|
|
|
1538
|
-
circosJS.Scatter.prototype.defaultConf = {
|
|
1539
|
-
innerRadius: 0,
|
|
1540
|
-
outerRadius: 0,
|
|
1541
|
-
min: 'smart',
|
|
1542
|
-
max: 'smart',
|
|
1543
|
-
direction: 'out',
|
|
1544
|
-
logScale: false,
|
|
1545
|
-
glyph: {
|
|
1546
|
-
color: '#fd6a62',
|
|
1547
|
-
fill: true,
|
|
1548
|
-
size: 15,
|
|
1549
|
-
shape: 'circle',
|
|
1550
|
-
strokeColor: '#d3d3d3',
|
|
1551
|
-
strokeWidth: 2
|
|
1552
|
-
},
|
|
1553
|
-
axes: circosJS.axes,
|
|
1554
|
-
rules: [],
|
|
1555
|
-
backgrounds: [],
|
|
1556
|
-
zIndex: 1,
|
|
1557
|
-
opacity: 1,
|
|
1558
|
-
tooltipContent: null
|
|
1559
|
-
};
|
|
1560
|
-
|
|
1561
|
-
circosJS.Line.prototype.defaultConf = {
|
|
1562
|
-
innerRadius: 0,
|
|
1563
|
-
outerRadius: 0,
|
|
1564
|
-
min: 'smart',
|
|
1565
|
-
max: 'smart',
|
|
1566
|
-
direction: 'out',
|
|
1567
|
-
logScale: false,
|
|
1568
|
-
color: '#fd6a62',
|
|
1569
|
-
fill: true,
|
|
1570
|
-
fill_color: '#d3d3d3',
|
|
1571
|
-
thickness: 2,
|
|
1572
|
-
max_gap: 10000000,
|
|
1573
|
-
interpolation: 'linear',
|
|
1574
|
-
axes: circosJS.axes,
|
|
1575
|
-
rules: [],
|
|
1576
|
-
backgrounds: [],
|
|
1577
|
-
zIndex: 1,
|
|
1578
|
-
opacity: 1,
|
|
1579
|
-
tooltipContent: null
|
|
1580
|
-
};
|
|
1581
|
-
|
|
1582
|
-
circosJS.Stack.prototype.defaultConf = {
|
|
1583
|
-
innerRadius: 0,
|
|
1584
|
-
outerRadius: 0,
|
|
1585
|
-
colorPaletteSize: 9,
|
|
1586
|
-
colorPalette: 'PuBuGn',
|
|
1587
|
-
usePalette: true,
|
|
1588
|
-
colorPaletteReverse: false,
|
|
1589
|
-
color: '#fd6a62',
|
|
1590
|
-
min: 'smart',
|
|
1591
|
-
max: 'smart',
|
|
1592
|
-
direction: 'out',
|
|
1593
|
-
logScale: false,
|
|
1594
|
-
color: '#fd6a62',
|
|
1595
|
-
thickness: 10,
|
|
1596
|
-
radialMargin: 2,
|
|
1597
|
-
margin: 2,
|
|
1598
|
-
strokeWidth: 1,
|
|
1599
|
-
strokeColor: '#000000',
|
|
1600
|
-
axes: circosJS.axes,
|
|
1601
|
-
rules: [],
|
|
1602
|
-
backgrounds: [],
|
|
1603
|
-
zIndex: 1,
|
|
1604
|
-
opacity: 1,
|
|
1605
|
-
tooltipContent: null
|
|
1606
|
-
};
|
|
1607
|
-
|
|
1608
|
-
circosJS.Highlight.prototype.defaultConf = {
|
|
1609
|
-
innerRadius: 0,
|
|
1610
|
-
outerRadius: 0,
|
|
1611
|
-
defaultColor: '#fd6a62',
|
|
1612
|
-
opacity: 0.5,
|
|
1613
|
-
rules: [],
|
|
1614
|
-
zIndex: 101,
|
|
1615
|
-
strokeColor: '#d3d3d3',
|
|
1616
|
-
strokeWidth: 0,
|
|
1617
|
-
tooltipContent: null
|
|
1618
|
-
};
|
|
1619
|
-
|
|
1620
|
-
circosJS.Text.prototype.defaultConf = {
|
|
1621
|
-
innerRadius: 0,
|
|
1622
|
-
outerRadius: 0,
|
|
1623
|
-
rules: [],
|
|
1624
|
-
backgrounds: [],
|
|
1625
|
-
zIndex: 1,
|
|
1626
|
-
style: {},
|
|
1627
|
-
tooltipContent: null
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
1008
|
circosJS.registerTooltip = function(instance, track, element, trackParams) {
|
|
1631
1009
|
track.tip = d3.tip().direction('s').offset([20, 0]).html(trackParams.tooltipContent);
|
|
1632
1010
|
element.call(track.tip);
|