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,35 +1,42 @@
|
|
|
1
|
-
import svgfactory from
|
|
2
|
-
import $ from
|
|
3
|
-
import OncoprintToolTip from
|
|
4
|
-
import OncoprintModel from
|
|
1
|
+
import svgfactory from './svgfactory';
|
|
2
|
+
import $ from 'jquery';
|
|
3
|
+
import OncoprintToolTip from './oncoprinttooltip';
|
|
4
|
+
import OncoprintModel from './oncoprintmodel';
|
|
5
5
|
|
|
6
6
|
export default class OncoprintTrackInfoView {
|
|
7
|
-
|
|
8
|
-
private $
|
|
9
|
-
private $text_ctr:JQuery;
|
|
7
|
+
private $ctr: JQuery;
|
|
8
|
+
private $text_ctr: JQuery;
|
|
10
9
|
private base_font_size = 12;
|
|
11
10
|
private font_family = 'Arial';
|
|
12
11
|
private font_weight = 'bold';
|
|
13
12
|
private width = 0;
|
|
14
|
-
private $label_elts:JQuery[] = [];
|
|
13
|
+
private $label_elts: JQuery[] = [];
|
|
15
14
|
private rendering_suppressed = false;
|
|
16
|
-
private minimum_track_height:number;
|
|
15
|
+
private minimum_track_height: number;
|
|
17
16
|
|
|
18
|
-
constructor(private $div:JQuery, private tooltip:OncoprintToolTip) {
|
|
17
|
+
constructor(private $div: JQuery, private tooltip: OncoprintToolTip) {
|
|
19
18
|
this.tooltip.center = false;
|
|
20
19
|
|
|
21
|
-
this.$ctr = $('<div></div>')
|
|
22
|
-
|
|
20
|
+
this.$ctr = $('<div></div>')
|
|
21
|
+
.css({
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
'overflow-y': 'hidden',
|
|
24
|
+
'overflow-x': 'hidden',
|
|
25
|
+
})
|
|
26
|
+
.appendTo(this.$div);
|
|
27
|
+
this.$text_ctr = $('<div></div>')
|
|
28
|
+
.css({ position: 'absolute' })
|
|
29
|
+
.appendTo(this.$ctr);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
private destroyLabelElts() {
|
|
26
|
-
for (let i=0; i<this.$label_elts.length; i++) {
|
|
27
|
-
this.$label_elts[i].off(
|
|
33
|
+
for (let i = 0; i < this.$label_elts.length; i++) {
|
|
34
|
+
this.$label_elts[i].off('mousemove mouseleave');
|
|
28
35
|
}
|
|
29
36
|
this.$label_elts = [];
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
private renderAllInfo(model:OncoprintModel) {
|
|
39
|
+
private renderAllInfo(model: OncoprintModel) {
|
|
33
40
|
if (this.rendering_suppressed) {
|
|
34
41
|
return;
|
|
35
42
|
}
|
|
@@ -39,7 +46,10 @@ export default class OncoprintTrackInfoView {
|
|
|
39
46
|
const tracks = model.getTracks();
|
|
40
47
|
this.minimum_track_height = Number.POSITIVE_INFINITY;
|
|
41
48
|
for (let i = 0; i < tracks.length; i++) {
|
|
42
|
-
this.minimum_track_height = Math.min(
|
|
49
|
+
this.minimum_track_height = Math.min(
|
|
50
|
+
this.minimum_track_height,
|
|
51
|
+
model.getTrackHeight(tracks[i])
|
|
52
|
+
);
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
this.width = 0;
|
|
@@ -52,10 +62,13 @@ export default class OncoprintTrackInfoView {
|
|
|
52
62
|
for (let j = 0; j < tracks.length; j++) {
|
|
53
63
|
(function() {
|
|
54
64
|
const i = j;
|
|
55
|
-
const $new_label = $('<span>')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
const $new_label = $('<span>')
|
|
66
|
+
.css({
|
|
67
|
+
position: 'absolute',
|
|
68
|
+
'font-family': self.font_family,
|
|
69
|
+
'font-weight': self.font_weight,
|
|
70
|
+
'font-size': font_size,
|
|
71
|
+
})
|
|
59
72
|
.addClass('noselect');
|
|
60
73
|
const text = model.getTrackInfo(tracks[i]);
|
|
61
74
|
if (!text) {
|
|
@@ -65,95 +78,126 @@ export default class OncoprintTrackInfoView {
|
|
|
65
78
|
$new_label.appendTo(self.$text_ctr);
|
|
66
79
|
self.$label_elts.push($new_label);
|
|
67
80
|
setTimeout(function() {
|
|
68
|
-
$new_label
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
$new_label
|
|
82
|
+
.on('mousemove', function() {
|
|
83
|
+
const $tooltip_elt = model.$getTrackInfoTooltip(
|
|
84
|
+
tracks[i]
|
|
85
|
+
);
|
|
86
|
+
if ($tooltip_elt) {
|
|
87
|
+
const offset = $new_label[0].getBoundingClientRect();
|
|
88
|
+
self.tooltip.fadeIn(
|
|
89
|
+
200,
|
|
90
|
+
offset.left,
|
|
91
|
+
offset.top,
|
|
92
|
+
$tooltip_elt
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
.on('mouseleave', function() {
|
|
97
|
+
self.tooltip.hideIfNotAlreadyGoingTo(150);
|
|
98
|
+
});
|
|
77
99
|
}, 0); // delay to give time for render before adding events
|
|
78
|
-
const top =
|
|
79
|
-
|
|
80
|
-
|
|
100
|
+
const top =
|
|
101
|
+
label_tops[tracks[i]] +
|
|
102
|
+
(model.getCellHeight(tracks[i]) -
|
|
103
|
+
$new_label.outerHeight()) /
|
|
104
|
+
2;
|
|
105
|
+
$new_label.css({ top: top + 'px' });
|
|
106
|
+
self.width = Math.max(
|
|
107
|
+
32,
|
|
108
|
+
self.width,
|
|
109
|
+
$new_label[0].clientWidth
|
|
110
|
+
);
|
|
81
111
|
})();
|
|
82
112
|
}
|
|
83
113
|
if (this.width > 0) {
|
|
84
114
|
this.width += 10;
|
|
85
115
|
}
|
|
86
|
-
}
|
|
87
|
-
private scroll(scroll_y:number) {
|
|
116
|
+
}
|
|
117
|
+
private scroll(scroll_y: number) {
|
|
88
118
|
if (this.rendering_suppressed) {
|
|
89
119
|
return;
|
|
90
120
|
}
|
|
91
|
-
this.$text_ctr.css({
|
|
92
|
-
}
|
|
121
|
+
this.$text_ctr.css({ top: -scroll_y });
|
|
122
|
+
}
|
|
93
123
|
|
|
94
|
-
private resize(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
124
|
+
private resize(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
95
125
|
if (this.rendering_suppressed) {
|
|
96
126
|
return;
|
|
97
127
|
}
|
|
98
|
-
this.$div.css({
|
|
99
|
-
this.$ctr.css({
|
|
100
|
-
}
|
|
128
|
+
this.$div.css({ width: this.getWidth(), height: getCellViewHeight() });
|
|
129
|
+
this.$ctr.css({ width: this.getWidth(), height: getCellViewHeight() });
|
|
130
|
+
}
|
|
101
131
|
|
|
102
132
|
public getFontSize() {
|
|
103
|
-
return Math.max(
|
|
133
|
+
return Math.max(
|
|
134
|
+
Math.min(this.base_font_size, this.minimum_track_height),
|
|
135
|
+
7
|
|
136
|
+
);
|
|
104
137
|
}
|
|
105
138
|
public getWidth() {
|
|
106
139
|
return this.width;
|
|
107
140
|
}
|
|
108
|
-
public addTracks(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
141
|
+
public addTracks(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
109
142
|
this.renderAllInfo(model);
|
|
110
143
|
this.resize(model, getCellViewHeight);
|
|
111
144
|
}
|
|
112
|
-
public moveTrack(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
145
|
+
public moveTrack(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
113
146
|
this.renderAllInfo(model);
|
|
114
147
|
this.resize(model, getCellViewHeight);
|
|
115
148
|
}
|
|
116
|
-
public setTrackGroupOrder(
|
|
149
|
+
public setTrackGroupOrder(
|
|
150
|
+
model: OncoprintModel,
|
|
151
|
+
getCellViewHeight: () => number
|
|
152
|
+
) {
|
|
117
153
|
this.renderAllInfo(model);
|
|
118
154
|
this.resize(model, getCellViewHeight);
|
|
119
155
|
}
|
|
120
|
-
public removeTrack(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
156
|
+
public removeTrack(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
121
157
|
this.renderAllInfo(model);
|
|
122
158
|
this.resize(model, getCellViewHeight);
|
|
123
159
|
}
|
|
124
|
-
public setTrackInfo(
|
|
160
|
+
public setTrackInfo(
|
|
161
|
+
model: OncoprintModel,
|
|
162
|
+
getCellViewHeight: () => number
|
|
163
|
+
) {
|
|
125
164
|
this.renderAllInfo(model);
|
|
126
165
|
this.resize(model, getCellViewHeight);
|
|
127
166
|
}
|
|
128
|
-
public setTrackGroupHeader(
|
|
167
|
+
public setTrackGroupHeader(
|
|
168
|
+
model: OncoprintModel,
|
|
169
|
+
getCellViewHeight: () => number
|
|
170
|
+
) {
|
|
129
171
|
this.renderAllInfo(model);
|
|
130
172
|
this.resize(model, getCellViewHeight);
|
|
131
173
|
}
|
|
132
|
-
public setScroll(model:OncoprintModel) {
|
|
174
|
+
public setScroll(model: OncoprintModel) {
|
|
133
175
|
this.setVertScroll(model);
|
|
134
176
|
}
|
|
135
|
-
public setHorzScroll(model:OncoprintModel) {
|
|
136
|
-
|
|
137
|
-
public setVertScroll(model:OncoprintModel) {
|
|
177
|
+
public setHorzScroll(model: OncoprintModel) {}
|
|
178
|
+
public setVertScroll(model: OncoprintModel) {
|
|
138
179
|
this.scroll(model.getVertScroll());
|
|
139
180
|
}
|
|
140
|
-
public setZoom(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
181
|
+
public setZoom(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
141
182
|
this.setVertZoom(model, getCellViewHeight);
|
|
142
183
|
}
|
|
143
184
|
|
|
144
|
-
public setViewport(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
185
|
+
public setViewport(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
145
186
|
this.renderAllInfo(model);
|
|
146
187
|
this.resize(model, getCellViewHeight);
|
|
147
188
|
this.scroll(model.getVertScroll());
|
|
148
189
|
}
|
|
149
|
-
public setVertZoom(model:OncoprintModel, getCellViewHeight:()=>number) {
|
|
190
|
+
public setVertZoom(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
150
191
|
this.renderAllInfo(model);
|
|
151
192
|
this.resize(model, getCellViewHeight);
|
|
152
193
|
}
|
|
153
194
|
public suppressRendering() {
|
|
154
195
|
this.rendering_suppressed = true;
|
|
155
196
|
}
|
|
156
|
-
public releaseRendering(
|
|
197
|
+
public releaseRendering(
|
|
198
|
+
model: OncoprintModel,
|
|
199
|
+
getCellViewHeight: () => number
|
|
200
|
+
) {
|
|
157
201
|
this.rendering_suppressed = false;
|
|
158
202
|
this.renderAllInfo(model);
|
|
159
203
|
this.resize(model, getCellViewHeight);
|
|
@@ -162,8 +206,12 @@ export default class OncoprintTrackInfoView {
|
|
|
162
206
|
public destroy() {
|
|
163
207
|
this.destroyLabelElts();
|
|
164
208
|
}
|
|
165
|
-
public toSVGGroup(
|
|
166
|
-
|
|
209
|
+
public toSVGGroup(
|
|
210
|
+
model: OncoprintModel,
|
|
211
|
+
offset_x: number,
|
|
212
|
+
offset_y: number
|
|
213
|
+
) {
|
|
214
|
+
const root = svgfactory.group(offset_x || 0, offset_y || 0);
|
|
167
215
|
const cell_tops = model.getCellTops();
|
|
168
216
|
const tracks = model.getTracks();
|
|
169
217
|
|
|
@@ -173,8 +221,16 @@ export default class OncoprintTrackInfoView {
|
|
|
173
221
|
const track_id = tracks[i];
|
|
174
222
|
const y = cell_tops[track_id] + model.getCellHeight(track_id) / 2;
|
|
175
223
|
const info = model.getTrackInfo(track_id);
|
|
176
|
-
const text_elt = svgfactory.text(
|
|
177
|
-
|
|
224
|
+
const text_elt = svgfactory.text(
|
|
225
|
+
info,
|
|
226
|
+
0,
|
|
227
|
+
y,
|
|
228
|
+
font_size,
|
|
229
|
+
this.font_family,
|
|
230
|
+
this.font_weight,
|
|
231
|
+
'bottom'
|
|
232
|
+
);
|
|
233
|
+
text_elt.setAttribute('dy', '0.35em');
|
|
178
234
|
root.appendChild(text_elt);
|
|
179
235
|
}
|
|
180
236
|
return root;
|