oncoprintjs 5.0.3 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +14746 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +14760 -0
- package/dist/index.js.map +1 -0
- package/dist/js/CachedProperty.d.ts +10 -10
- package/dist/js/binarysearch.d.ts +1 -1
- package/dist/js/bucketsort.d.ts +16 -16
- package/dist/js/clustering.d.ts +14 -14
- package/dist/js/extractrgba.d.ts +4 -4
- package/dist/js/haselementsininterval.d.ts +1 -1
- package/dist/js/heatmapcolors.d.ts +5 -4
- package/dist/js/makesvgelement.d.ts +1 -1
- package/dist/js/modelutils.d.ts +7 -7
- package/dist/js/oncoprint.d.ts +168 -170
- package/dist/js/oncoprintheaderview.d.ts +23 -22
- package/dist/js/oncoprintlabelview.d.ts +79 -78
- package/dist/js/oncoprintlegendrenderer.d.ts +32 -31
- package/dist/js/oncoprintminimapview.d.ts +69 -68
- package/dist/js/oncoprintmodel.d.ts +403 -398
- package/dist/js/oncoprintruleset.d.ts +176 -177
- package/dist/js/oncoprintshape.d.ts +67 -67
- package/dist/js/oncoprintshapetosvg.d.ts +2 -2
- package/dist/js/oncoprintshapetovertexes.d.ts +5 -5
- package/dist/js/oncoprinttooltip.d.ts +23 -22
- package/dist/js/oncoprinttrackinfoview.d.ts +40 -39
- package/dist/js/oncoprinttrackoptionsview.d.ts +58 -57
- package/dist/js/oncoprintwebglcellview.d.ts +168 -167
- package/dist/js/oncoprintzoomslider.d.ts +28 -27
- package/dist/js/polyfill.d.ts +4 -4
- package/dist/js/precomputedcomparator.d.ts +13 -13
- package/dist/js/shaders.d.ts +2 -2
- package/dist/js/svgfactory.d.ts +24 -23
- package/dist/js/utils.d.ts +16 -16
- package/dist/js/workers/clustering-worker.d.ts +19 -20
- package/dist/test/gradientCategoricalRuleset.spec.d.ts +1 -1
- package/dist/test/monolith.spec.d.ts +1 -1
- package/jest.config.ts +2 -0
- package/package.json +20 -26
- package/rollup.config.ts +14 -0
- package/rules/geneticrules.ts +344 -305
- package/server.js +11 -0
- package/src/img/menudots.svg +9 -9
- package/src/img/zoomtofit.svg +12 -12
- package/src/index.tsx +13 -0
- package/src/js/CachedProperty.ts +6 -7
- package/src/js/binarysearch.ts +8 -3
- package/src/js/bucketsort.ts +89 -47
- package/src/js/clustering.ts +22 -10
- package/src/js/extractrgba.ts +16 -12
- package/src/js/haselementsininterval.ts +8 -4
- package/src/js/heatmapcolors.ts +515 -515
- package/src/js/main.js +1 -1
- package/src/js/makesvgelement.ts +2 -2
- package/src/js/modelutils.ts +11 -8
- package/src/js/oncoprint.ts +706 -385
- package/src/js/oncoprintheaderview.ts +165 -125
- package/src/js/oncoprintlabelview.ts +388 -170
- package/src/js/oncoprintlegendrenderer.ts +203 -72
- package/src/js/oncoprintminimapview.ts +965 -423
- package/src/js/oncoprintmodel.ts +905 -532
- package/src/js/oncoprintruleset.ts +694 -379
- package/src/js/oncoprintshape.ts +240 -97
- package/src/js/oncoprintshapetosvg.ts +77 -26
- package/src/js/oncoprintshapetovertexes.ts +153 -48
- package/src/js/oncoprinttooltip.ts +58 -27
- package/src/js/oncoprinttrackinfoview.ts +115 -59
- package/src/js/oncoprinttrackoptionsview.ts +354 -187
- package/src/js/oncoprintwebglcellview.ts +951 -415
- package/src/js/oncoprintzoomslider.ts +172 -107
- package/src/js/polyfill.ts +7 -3
- package/src/js/precomputedcomparator.ts +133 -50
- package/src/js/shaders.ts +2 -4
- package/src/js/svgfactory.ts +128 -73
- package/src/js/utils.ts +51 -31
- package/src/js/workers/clustering-worker.ts +50 -42
- package/src/test/gradientCategoricalRuleset.spec.ts +55 -38
- package/src/test/monolith.spec.ts +718 -285
- package/test/generate_data.py +108 -0
- package/test/glyphmap-data.js +1041 -0
- package/test/heatmap-data.js +1027 -0
- package/test/index.html +21 -0
- package/test/oncoprint-glyphmap.js +79 -0
- package/test/oncoprint-heatmap.js +123 -0
- package/tsconfig.json +4 -10
- package/tsconfig.test.json +11 -0
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/oncoprintjs.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -105
- package/dist/.gitkeep +0 -0
- package/dist/js/minimaputils.d.ts +0 -0
- package/dist/oncoprint.bundle.js +0 -44313
- package/jest.config.js +0 -12
- package/src/js/minimaputils.ts +0 -0
- package/typings/custom.d.ts +0 -7
- package/typings/missing.d.ts +0 -7
- package/webpack.config.js +0 -43
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import svgfactory from './svgfactory';
|
|
2
2
|
import $ from 'jquery';
|
|
3
|
-
import OncoprintModel from
|
|
4
|
-
import {Rule, RuleWithId} from
|
|
3
|
+
import OncoprintModel from './oncoprintmodel';
|
|
4
|
+
import { Rule, RuleWithId } from './oncoprintruleset';
|
|
5
5
|
|
|
6
|
-
function nodeIsVisible(node:HTMLElement) {
|
|
6
|
+
function nodeIsVisible(node: HTMLElement) {
|
|
7
7
|
let ret = true;
|
|
8
|
-
while (node && node.tagName.toLowerCase() !==
|
|
8
|
+
while (node && node.tagName.toLowerCase() !== 'html') {
|
|
9
9
|
if ($(node).css('display') === 'none') {
|
|
10
10
|
ret = false;
|
|
11
11
|
break;
|
|
@@ -16,52 +16,59 @@ function nodeIsVisible(node:HTMLElement) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default class OncoprintLegendView {
|
|
19
|
-
|
|
20
|
-
private $svg:JQuery<SVGElement>;
|
|
19
|
+
private $svg: JQuery<SVGElement>;
|
|
21
20
|
private rendering_suppressed = false;
|
|
22
|
-
private width:number;
|
|
21
|
+
private width: number;
|
|
23
22
|
|
|
24
23
|
private rule_set_label_config = {
|
|
25
24
|
weight: 'bold',
|
|
26
25
|
size: 12,
|
|
27
|
-
font: 'Arial'
|
|
26
|
+
font: 'Arial',
|
|
28
27
|
};
|
|
29
28
|
private rule_label_config = {
|
|
30
29
|
weight: 'normal',
|
|
31
30
|
size: 12,
|
|
32
|
-
font: 'Arial'
|
|
31
|
+
font: 'Arial',
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
private padding_after_rule_set_label = 10;
|
|
36
35
|
private padding_between_rules = 20;
|
|
37
36
|
private padding_between_rule_set_rows = 10;
|
|
38
37
|
|
|
39
|
-
constructor
|
|
40
|
-
|
|
38
|
+
constructor(
|
|
39
|
+
private $div: JQuery,
|
|
40
|
+
private base_width: number,
|
|
41
|
+
private base_height: number
|
|
42
|
+
) {
|
|
43
|
+
this.$svg = $(svgfactory.svg(200, 200)).appendTo(this.$div);
|
|
41
44
|
this.width = $div.width();
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
private renderLegend(
|
|
47
|
+
private renderLegend(
|
|
48
|
+
model: OncoprintModel,
|
|
49
|
+
target_svg?: SVGElement,
|
|
50
|
+
show_all?: boolean
|
|
51
|
+
) {
|
|
45
52
|
if (this.rendering_suppressed) {
|
|
46
53
|
return;
|
|
47
54
|
}
|
|
48
55
|
if (typeof target_svg === 'undefined') {
|
|
49
56
|
target_svg = this.$svg[0];
|
|
50
57
|
}
|
|
51
|
-
if (!nodeIsVisible(target_svg as any as HTMLElement)) {
|
|
58
|
+
if (!nodeIsVisible((target_svg as any) as HTMLElement)) {
|
|
52
59
|
return;
|
|
53
60
|
}
|
|
54
61
|
$(target_svg).empty();
|
|
55
62
|
const defs = svgfactory.defs();
|
|
56
63
|
target_svg.appendChild(defs);
|
|
57
64
|
|
|
58
|
-
const everything_group = svgfactory.group(0,0);
|
|
65
|
+
const everything_group = svgfactory.group(0, 0);
|
|
59
66
|
target_svg.appendChild(everything_group);
|
|
60
67
|
|
|
61
68
|
const rule_sets = model.getRuleSets();
|
|
62
69
|
let y = 0;
|
|
63
70
|
const rule_start_x = 200;
|
|
64
|
-
for (let i=0; i<rule_sets.length; i++) {
|
|
71
|
+
for (let i = 0; i < rule_sets.length; i++) {
|
|
65
72
|
if (rule_sets[i].exclude_from_legend && !show_all) {
|
|
66
73
|
continue;
|
|
67
74
|
}
|
|
@@ -70,11 +77,21 @@ export default class OncoprintLegendView {
|
|
|
70
77
|
// dont render this ruleset into legend if no active rules
|
|
71
78
|
continue;
|
|
72
79
|
}
|
|
73
|
-
const rule_set_group = svgfactory.group(0,y);
|
|
80
|
+
const rule_set_group = svgfactory.group(0, y);
|
|
74
81
|
everything_group.appendChild(rule_set_group);
|
|
75
82
|
(function addLabel() {
|
|
76
|
-
if (
|
|
77
|
-
|
|
83
|
+
if (
|
|
84
|
+
typeof rule_sets[i].legend_label !== 'undefined' &&
|
|
85
|
+
rule_sets[i].legend_label.length > 0
|
|
86
|
+
) {
|
|
87
|
+
const label = svgfactory.text(
|
|
88
|
+
rule_sets[i].legend_label,
|
|
89
|
+
0,
|
|
90
|
+
0,
|
|
91
|
+
12,
|
|
92
|
+
'Arial',
|
|
93
|
+
'bold'
|
|
94
|
+
);
|
|
78
95
|
rule_set_group.appendChild(label);
|
|
79
96
|
svgfactory.wrapText(label, rule_start_x);
|
|
80
97
|
}
|
|
@@ -83,7 +100,7 @@ export default class OncoprintLegendView {
|
|
|
83
100
|
let x = rule_start_x + this.padding_after_rule_set_label;
|
|
84
101
|
let in_group_y_offset = 0;
|
|
85
102
|
|
|
86
|
-
const labelSort = function(ruleA:RuleWithId, ruleB:RuleWithId) {
|
|
103
|
+
const labelSort = function(ruleA: RuleWithId, ruleB: RuleWithId) {
|
|
87
104
|
const labelA = ruleA.rule.legend_label;
|
|
88
105
|
const labelB = ruleB.rule.legend_label;
|
|
89
106
|
if (labelA && labelB) {
|
|
@@ -95,6 +112,7 @@ export default class OncoprintLegendView {
|
|
|
95
112
|
} else if (!labelB) {
|
|
96
113
|
return 1;
|
|
97
114
|
}
|
|
115
|
+
return 0;
|
|
98
116
|
};
|
|
99
117
|
|
|
100
118
|
rules.sort(function(ruleA, ruleB) {
|
|
@@ -102,10 +120,16 @@ export default class OncoprintLegendView {
|
|
|
102
120
|
const orderA = ruleA.rule.legend_order;
|
|
103
121
|
const orderB = ruleB.rule.legend_order;
|
|
104
122
|
|
|
105
|
-
if (
|
|
123
|
+
if (
|
|
124
|
+
typeof orderA === 'undefined' &&
|
|
125
|
+
typeof orderB === 'undefined'
|
|
126
|
+
) {
|
|
106
127
|
// if neither have defined order, then sort alphabetically
|
|
107
128
|
return labelSort(ruleA, ruleB);
|
|
108
|
-
} else if (
|
|
129
|
+
} else if (
|
|
130
|
+
typeof orderA !== 'undefined' &&
|
|
131
|
+
typeof orderB !== 'undefined'
|
|
132
|
+
) {
|
|
109
133
|
// if both have defined order, sort by order
|
|
110
134
|
if (orderA < orderB) {
|
|
111
135
|
return -1;
|
|
@@ -115,14 +139,14 @@ export default class OncoprintLegendView {
|
|
|
115
139
|
// if order is same, sort alphabetically
|
|
116
140
|
return labelSort(ruleA, ruleB);
|
|
117
141
|
}
|
|
118
|
-
} else if (typeof orderA ===
|
|
142
|
+
} else if (typeof orderA === 'undefined') {
|
|
119
143
|
if (orderB === Number.POSITIVE_INFINITY) {
|
|
120
144
|
return -1; // A comes before B regardless, if B is forced to end
|
|
121
145
|
} else {
|
|
122
146
|
//otherwise, A comes after B if B has defined order and A doesnt
|
|
123
147
|
return 1;
|
|
124
148
|
}
|
|
125
|
-
} else if (typeof orderB ===
|
|
149
|
+
} else if (typeof orderB === 'undefined') {
|
|
126
150
|
if (orderA === Number.POSITIVE_INFINITY) {
|
|
127
151
|
return 1; // A comes after B regardless, if A is forced to end
|
|
128
152
|
} else {
|
|
@@ -130,56 +154,103 @@ export default class OncoprintLegendView {
|
|
|
130
154
|
return -1;
|
|
131
155
|
}
|
|
132
156
|
}
|
|
157
|
+
return 0;
|
|
133
158
|
});
|
|
134
|
-
for (let j=0; j<rules.length; j++) {
|
|
159
|
+
for (let j = 0; j < rules.length; j++) {
|
|
135
160
|
const rule = rules[j].rule;
|
|
136
161
|
if (rule.exclude_from_legend) {
|
|
137
162
|
continue;
|
|
138
163
|
}
|
|
139
|
-
const group = this.ruleToSVGGroup(
|
|
140
|
-
|
|
164
|
+
const group = this.ruleToSVGGroup(
|
|
165
|
+
rule,
|
|
166
|
+
model,
|
|
167
|
+
target_svg,
|
|
168
|
+
defs
|
|
169
|
+
);
|
|
170
|
+
group.setAttribute(
|
|
171
|
+
'transform',
|
|
172
|
+
'translate(' + x + ',' + in_group_y_offset + ')'
|
|
173
|
+
);
|
|
141
174
|
rule_set_group.appendChild(group);
|
|
142
175
|
if (x + group.getBBox().width > this.width) {
|
|
143
176
|
x = rule_start_x + this.padding_after_rule_set_label;
|
|
144
|
-
in_group_y_offset =
|
|
145
|
-
|
|
177
|
+
in_group_y_offset =
|
|
178
|
+
rule_set_group.getBBox().height +
|
|
179
|
+
this.padding_between_rule_set_rows;
|
|
180
|
+
group.setAttribute(
|
|
181
|
+
'transform',
|
|
182
|
+
'translate(' + x + ',' + in_group_y_offset + ')'
|
|
183
|
+
);
|
|
146
184
|
}
|
|
147
185
|
x += group.getBBox().width;
|
|
148
186
|
x += this.padding_between_rules;
|
|
149
187
|
}
|
|
150
188
|
y += rule_set_group.getBBox().height;
|
|
151
|
-
y += 3*this.padding_between_rule_set_rows;
|
|
189
|
+
y += 3 * this.padding_between_rule_set_rows;
|
|
152
190
|
}
|
|
153
191
|
const everything_box = everything_group.getBBox();
|
|
154
192
|
this.$svg[0].setAttribute('width', everything_box.width.toString());
|
|
155
193
|
// add 10px to height to give room for rectangle stroke, which doesn't factor in accurately into the bounding box
|
|
156
194
|
// so that bounding boxes are too small to show the entire stroke (see https://github.com/cBioPortal/cbioportal/issues/3994)
|
|
157
|
-
this.$svg[0].setAttribute(
|
|
195
|
+
this.$svg[0].setAttribute(
|
|
196
|
+
'height',
|
|
197
|
+
(everything_box.height + 10).toString()
|
|
198
|
+
);
|
|
158
199
|
}
|
|
159
200
|
|
|
160
|
-
private ruleToSVGGroup(
|
|
161
|
-
|
|
201
|
+
private ruleToSVGGroup(
|
|
202
|
+
rule: Rule,
|
|
203
|
+
model: OncoprintModel,
|
|
204
|
+
target_svg: SVGElement,
|
|
205
|
+
target_defs: SVGDefsElement
|
|
206
|
+
) {
|
|
207
|
+
const root = svgfactory.group(0, 0);
|
|
162
208
|
const config = rule.getLegendConfig();
|
|
163
209
|
if (config.type === 'rule') {
|
|
164
|
-
const concrete_shapes = rule.apply(
|
|
210
|
+
const concrete_shapes = rule.apply(
|
|
211
|
+
config.target,
|
|
212
|
+
model.getCellWidth(true),
|
|
213
|
+
this.base_height
|
|
214
|
+
);
|
|
165
215
|
if (rule.legend_base_color) {
|
|
166
216
|
// generate backgrounds
|
|
167
|
-
const baseRect = svgfactory.rect(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
217
|
+
const baseRect = svgfactory.rect(
|
|
218
|
+
0,
|
|
219
|
+
0,
|
|
220
|
+
model.getCellWidth(true),
|
|
221
|
+
this.base_height,
|
|
222
|
+
{
|
|
223
|
+
type: 'rgba',
|
|
224
|
+
value: rule.legend_base_color,
|
|
225
|
+
}
|
|
226
|
+
);
|
|
171
227
|
root.appendChild(baseRect);
|
|
172
228
|
}
|
|
173
229
|
// generate shapes
|
|
174
|
-
for (let i=0; i<concrete_shapes.length; i++) {
|
|
175
|
-
root.appendChild(
|
|
230
|
+
for (let i = 0; i < concrete_shapes.length; i++) {
|
|
231
|
+
root.appendChild(
|
|
232
|
+
svgfactory.fromShape(concrete_shapes[i], 0, 0)
|
|
233
|
+
);
|
|
176
234
|
}
|
|
177
235
|
if (typeof rule.legend_label !== 'undefined') {
|
|
178
236
|
const font_size = 12;
|
|
179
|
-
const text_node = svgfactory.text(
|
|
237
|
+
const text_node = svgfactory.text(
|
|
238
|
+
rule.legend_label,
|
|
239
|
+
model.getCellWidth(true) + 5,
|
|
240
|
+
this.base_height / 2,
|
|
241
|
+
font_size,
|
|
242
|
+
'Arial',
|
|
243
|
+
'normal'
|
|
244
|
+
);
|
|
180
245
|
target_svg.appendChild(text_node);
|
|
181
246
|
const height = text_node.getBBox().height;
|
|
182
|
-
text_node.setAttribute(
|
|
247
|
+
text_node.setAttribute(
|
|
248
|
+
'y',
|
|
249
|
+
(
|
|
250
|
+
parseFloat(text_node.getAttribute('y')) -
|
|
251
|
+
height / 2
|
|
252
|
+
).toString()
|
|
253
|
+
);
|
|
183
254
|
target_svg.removeChild(text_node);
|
|
184
255
|
root.appendChild(text_node);
|
|
185
256
|
}
|
|
@@ -187,12 +258,32 @@ export default class OncoprintLegendView {
|
|
|
187
258
|
const num_decimal_digits = 2;
|
|
188
259
|
const display_range = config.range.map(function(x) {
|
|
189
260
|
const num_digit_multiplier = Math.pow(10, num_decimal_digits);
|
|
190
|
-
return
|
|
261
|
+
return (
|
|
262
|
+
Math.round(x * num_digit_multiplier) / num_digit_multiplier
|
|
263
|
+
);
|
|
191
264
|
});
|
|
192
|
-
root.appendChild(
|
|
193
|
-
|
|
265
|
+
root.appendChild(
|
|
266
|
+
svgfactory.text(
|
|
267
|
+
display_range[0].toString(),
|
|
268
|
+
0,
|
|
269
|
+
0,
|
|
270
|
+
12,
|
|
271
|
+
'Arial',
|
|
272
|
+
'normal'
|
|
273
|
+
)
|
|
274
|
+
);
|
|
275
|
+
root.appendChild(
|
|
276
|
+
svgfactory.text(
|
|
277
|
+
display_range[1].toString(),
|
|
278
|
+
50,
|
|
279
|
+
0,
|
|
280
|
+
12,
|
|
281
|
+
'Arial',
|
|
282
|
+
'normal'
|
|
283
|
+
)
|
|
284
|
+
);
|
|
194
285
|
const mesh = 100;
|
|
195
|
-
const points:[number,number][] = [];
|
|
286
|
+
const points: [number, number][] = [];
|
|
196
287
|
let fill = null;
|
|
197
288
|
let linear_gradient = null;
|
|
198
289
|
if (config.range_type === 'NON_POSITIVE') {
|
|
@@ -201,73 +292,109 @@ export default class OncoprintLegendView {
|
|
|
201
292
|
fill = config.positive_color;
|
|
202
293
|
} else if (config.range_type === 'ALL') {
|
|
203
294
|
linear_gradient = svgfactory.linearGradient();
|
|
204
|
-
const offset =
|
|
205
|
-
|
|
206
|
-
|
|
295
|
+
const offset =
|
|
296
|
+
(Math.abs(display_range[0]) /
|
|
297
|
+
(Math.abs(display_range[0]) + display_range[1])) *
|
|
298
|
+
100;
|
|
299
|
+
linear_gradient.appendChild(
|
|
300
|
+
svgfactory.stop(offset, config.negative_color)
|
|
301
|
+
);
|
|
302
|
+
linear_gradient.appendChild(
|
|
303
|
+
svgfactory.stop(offset, config.positive_color)
|
|
304
|
+
);
|
|
207
305
|
target_defs.appendChild(linear_gradient);
|
|
208
306
|
}
|
|
209
307
|
points.push([5, 20]);
|
|
210
|
-
for (let i=0; i<mesh; i++) {
|
|
211
|
-
const t = i/mesh;
|
|
212
|
-
const h = config.interpFn(
|
|
213
|
-
|
|
214
|
-
|
|
308
|
+
for (let i = 0; i < mesh; i++) {
|
|
309
|
+
const t = i / mesh;
|
|
310
|
+
const h = config.interpFn(
|
|
311
|
+
(1 - t) * config.range[0] + t * config.range[1]
|
|
312
|
+
);
|
|
313
|
+
const height = 20 * h;
|
|
314
|
+
points.push([5 + (40 * i) / mesh, 20 - height]);
|
|
215
315
|
}
|
|
216
316
|
points.push([45, 20]);
|
|
217
|
-
root.appendChild(
|
|
317
|
+
root.appendChild(
|
|
318
|
+
svgfactory.path(points, fill, fill, linear_gradient)
|
|
319
|
+
);
|
|
218
320
|
} else if (config.type === 'gradient') {
|
|
219
321
|
const num_decimal_digits = 2;
|
|
220
322
|
const display_range = config.range.map(function(x) {
|
|
221
323
|
const num_digit_multiplier = Math.pow(10, num_decimal_digits);
|
|
222
|
-
return
|
|
324
|
+
return (
|
|
325
|
+
Math.round(x * num_digit_multiplier) / num_digit_multiplier
|
|
326
|
+
);
|
|
223
327
|
});
|
|
224
328
|
const gradient = svgfactory.gradient(config.colorFn);
|
|
225
|
-
const gradient_id = gradient.getAttribute(
|
|
329
|
+
const gradient_id = gradient.getAttribute('id');
|
|
226
330
|
target_defs.appendChild(gradient);
|
|
227
|
-
root.appendChild(
|
|
228
|
-
|
|
229
|
-
|
|
331
|
+
root.appendChild(
|
|
332
|
+
svgfactory.text(
|
|
333
|
+
display_range[0].toString(),
|
|
334
|
+
0,
|
|
335
|
+
0,
|
|
336
|
+
12,
|
|
337
|
+
'Arial',
|
|
338
|
+
'normal'
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
root.appendChild(
|
|
342
|
+
svgfactory.text(
|
|
343
|
+
display_range[1].toString(),
|
|
344
|
+
120,
|
|
345
|
+
0,
|
|
346
|
+
12,
|
|
347
|
+
'Arial',
|
|
348
|
+
'normal'
|
|
349
|
+
)
|
|
350
|
+
);
|
|
351
|
+
root.appendChild(
|
|
352
|
+
svgfactory.rect(30, 0, 60, 20, {
|
|
353
|
+
type: 'gradientId',
|
|
354
|
+
value: gradient_id,
|
|
355
|
+
})
|
|
356
|
+
);
|
|
230
357
|
}
|
|
231
358
|
return root;
|
|
232
359
|
}
|
|
233
360
|
|
|
234
|
-
public setWidth(w:number, model:OncoprintModel) {
|
|
361
|
+
public setWidth(w: number, model: OncoprintModel) {
|
|
235
362
|
this.width = w;
|
|
236
363
|
this.renderLegend(model);
|
|
237
364
|
}
|
|
238
|
-
public removeTrack(model:OncoprintModel) {
|
|
365
|
+
public removeTrack(model: OncoprintModel) {
|
|
239
366
|
this.renderLegend(model);
|
|
240
367
|
}
|
|
241
368
|
|
|
242
|
-
public addTracks(model:OncoprintModel) {
|
|
369
|
+
public addTracks(model: OncoprintModel) {
|
|
243
370
|
this.renderLegend(model);
|
|
244
371
|
}
|
|
245
372
|
|
|
246
|
-
public setTrackData(model:OncoprintModel) {
|
|
373
|
+
public setTrackData(model: OncoprintModel) {
|
|
247
374
|
this.renderLegend(model);
|
|
248
375
|
}
|
|
249
376
|
|
|
250
|
-
public setTrackImportantIds(model:OncoprintModel) {
|
|
377
|
+
public setTrackImportantIds(model: OncoprintModel) {
|
|
251
378
|
this.renderLegend(model);
|
|
252
379
|
}
|
|
253
380
|
|
|
254
|
-
public shareRuleSet(model:OncoprintModel) {
|
|
381
|
+
public shareRuleSet(model: OncoprintModel) {
|
|
255
382
|
this.renderLegend(model);
|
|
256
383
|
}
|
|
257
384
|
|
|
258
|
-
public setRuleSet(model:OncoprintModel) {
|
|
385
|
+
public setRuleSet(model: OncoprintModel) {
|
|
259
386
|
this.renderLegend(model);
|
|
260
387
|
}
|
|
261
388
|
|
|
262
|
-
public setTrackGroupLegendOrder(model:OncoprintModel) {
|
|
389
|
+
public setTrackGroupLegendOrder(model: OncoprintModel) {
|
|
263
390
|
this.renderLegend(model);
|
|
264
391
|
}
|
|
265
392
|
|
|
266
|
-
public hideTrackLegends(model:OncoprintModel) {
|
|
393
|
+
public hideTrackLegends(model: OncoprintModel) {
|
|
267
394
|
this.renderLegend(model);
|
|
268
395
|
}
|
|
269
396
|
|
|
270
|
-
public showTrackLegends(model:OncoprintModel) {
|
|
397
|
+
public showTrackLegends(model: OncoprintModel) {
|
|
271
398
|
this.renderLegend(model);
|
|
272
399
|
}
|
|
273
400
|
|
|
@@ -275,13 +402,17 @@ export default class OncoprintLegendView {
|
|
|
275
402
|
this.rendering_suppressed = true;
|
|
276
403
|
}
|
|
277
404
|
|
|
278
|
-
public releaseRendering(model:OncoprintModel) {
|
|
405
|
+
public releaseRendering(model: OncoprintModel) {
|
|
279
406
|
this.rendering_suppressed = false;
|
|
280
407
|
this.renderLegend(model);
|
|
281
408
|
}
|
|
282
409
|
|
|
283
|
-
public toSVGGroup(
|
|
284
|
-
|
|
410
|
+
public toSVGGroup(
|
|
411
|
+
model: OncoprintModel,
|
|
412
|
+
offset_x: number,
|
|
413
|
+
offset_y: number
|
|
414
|
+
) {
|
|
415
|
+
const root = svgfactory.group(offset_x || 0, offset_y || 0);
|
|
285
416
|
this.$svg.append(root);
|
|
286
417
|
this.renderLegend(model, root, true);
|
|
287
418
|
root.parentNode.removeChild(root);
|