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.
Files changed (100) hide show
  1. package/README.md +34 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.es.js +14746 -0
  4. package/dist/index.es.js.map +1 -0
  5. package/dist/index.js +14760 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/js/CachedProperty.d.ts +10 -10
  8. package/dist/js/binarysearch.d.ts +1 -1
  9. package/dist/js/bucketsort.d.ts +16 -16
  10. package/dist/js/clustering.d.ts +14 -14
  11. package/dist/js/extractrgba.d.ts +4 -4
  12. package/dist/js/haselementsininterval.d.ts +1 -1
  13. package/dist/js/heatmapcolors.d.ts +5 -4
  14. package/dist/js/makesvgelement.d.ts +1 -1
  15. package/dist/js/modelutils.d.ts +7 -7
  16. package/dist/js/oncoprint.d.ts +168 -170
  17. package/dist/js/oncoprintheaderview.d.ts +23 -22
  18. package/dist/js/oncoprintlabelview.d.ts +79 -78
  19. package/dist/js/oncoprintlegendrenderer.d.ts +32 -31
  20. package/dist/js/oncoprintminimapview.d.ts +69 -68
  21. package/dist/js/oncoprintmodel.d.ts +403 -398
  22. package/dist/js/oncoprintruleset.d.ts +176 -177
  23. package/dist/js/oncoprintshape.d.ts +67 -67
  24. package/dist/js/oncoprintshapetosvg.d.ts +2 -2
  25. package/dist/js/oncoprintshapetovertexes.d.ts +5 -5
  26. package/dist/js/oncoprinttooltip.d.ts +23 -22
  27. package/dist/js/oncoprinttrackinfoview.d.ts +40 -39
  28. package/dist/js/oncoprinttrackoptionsview.d.ts +58 -57
  29. package/dist/js/oncoprintwebglcellview.d.ts +168 -167
  30. package/dist/js/oncoprintzoomslider.d.ts +28 -27
  31. package/dist/js/polyfill.d.ts +4 -4
  32. package/dist/js/precomputedcomparator.d.ts +13 -13
  33. package/dist/js/shaders.d.ts +2 -2
  34. package/dist/js/svgfactory.d.ts +24 -23
  35. package/dist/js/utils.d.ts +16 -16
  36. package/dist/js/workers/clustering-worker.d.ts +19 -20
  37. package/dist/test/gradientCategoricalRuleset.spec.d.ts +1 -1
  38. package/dist/test/monolith.spec.d.ts +1 -1
  39. package/jest.config.ts +2 -0
  40. package/package.json +20 -26
  41. package/rollup.config.ts +14 -0
  42. package/rules/geneticrules.ts +344 -305
  43. package/server.js +11 -0
  44. package/src/img/menudots.svg +9 -9
  45. package/src/img/zoomtofit.svg +12 -12
  46. package/src/index.tsx +13 -0
  47. package/src/js/CachedProperty.ts +6 -7
  48. package/src/js/binarysearch.ts +8 -3
  49. package/src/js/bucketsort.ts +89 -47
  50. package/src/js/clustering.ts +22 -10
  51. package/src/js/extractrgba.ts +16 -12
  52. package/src/js/haselementsininterval.ts +8 -4
  53. package/src/js/heatmapcolors.ts +515 -515
  54. package/src/js/main.js +1 -1
  55. package/src/js/makesvgelement.ts +2 -2
  56. package/src/js/modelutils.ts +11 -8
  57. package/src/js/oncoprint.ts +706 -385
  58. package/src/js/oncoprintheaderview.ts +165 -125
  59. package/src/js/oncoprintlabelview.ts +388 -170
  60. package/src/js/oncoprintlegendrenderer.ts +203 -72
  61. package/src/js/oncoprintminimapview.ts +965 -423
  62. package/src/js/oncoprintmodel.ts +905 -532
  63. package/src/js/oncoprintruleset.ts +694 -379
  64. package/src/js/oncoprintshape.ts +240 -97
  65. package/src/js/oncoprintshapetosvg.ts +77 -26
  66. package/src/js/oncoprintshapetovertexes.ts +153 -48
  67. package/src/js/oncoprinttooltip.ts +58 -27
  68. package/src/js/oncoprinttrackinfoview.ts +115 -59
  69. package/src/js/oncoprinttrackoptionsview.ts +354 -187
  70. package/src/js/oncoprintwebglcellview.ts +951 -415
  71. package/src/js/oncoprintzoomslider.ts +172 -107
  72. package/src/js/polyfill.ts +7 -3
  73. package/src/js/precomputedcomparator.ts +133 -50
  74. package/src/js/shaders.ts +2 -4
  75. package/src/js/svgfactory.ts +128 -73
  76. package/src/js/utils.ts +51 -31
  77. package/src/js/workers/clustering-worker.ts +50 -42
  78. package/src/test/gradientCategoricalRuleset.spec.ts +55 -38
  79. package/src/test/monolith.spec.ts +718 -285
  80. package/test/generate_data.py +108 -0
  81. package/test/glyphmap-data.js +1041 -0
  82. package/test/heatmap-data.js +1027 -0
  83. package/test/index.html +21 -0
  84. package/test/oncoprint-glyphmap.js +79 -0
  85. package/test/oncoprint-heatmap.js +123 -0
  86. package/tsconfig.json +4 -10
  87. package/tsconfig.test.json +11 -0
  88. package/.idea/misc.xml +0 -6
  89. package/.idea/modules.xml +0 -8
  90. package/.idea/oncoprintjs.iml +0 -12
  91. package/.idea/vcs.xml +0 -6
  92. package/.idea/workspace.xml +0 -105
  93. package/dist/.gitkeep +0 -0
  94. package/dist/js/minimaputils.d.ts +0 -0
  95. package/dist/oncoprint.bundle.js +0 -44313
  96. package/jest.config.js +0 -12
  97. package/src/js/minimaputils.ts +0 -0
  98. package/typings/custom.d.ts +0 -7
  99. package/typings/missing.d.ts +0 -7
  100. package/webpack.config.js +0 -43
@@ -1,62 +1,68 @@
1
1
  import './polyfill';
2
2
 
3
3
  import OncoprintModel, {
4
- ColumnId, ColumnLabel,
4
+ ColumnId,
5
+ ColumnLabel,
5
6
  ColumnProp,
6
7
  CustomTrackOption,
7
8
  Datum,
8
9
  LibraryTrackSpec,
9
10
  SortConfig,
10
- TrackGroup, TrackGroupHeader,
11
+ TrackGroup,
12
+ TrackGroupHeader,
11
13
  TrackGroupIndex,
12
14
  TrackId,
13
15
  TrackSortDirection,
14
16
  TrackSortSpecification,
15
17
  TrackTooltipFn,
16
- UserTrackSpec
17
- } from "./oncoprintmodel";
18
+ UserTrackSpec,
19
+ } from './oncoprintmodel';
18
20
  import OncoprintWebGLCellView from './oncoprintwebglcellview';
19
21
  import OncoprintLabelView from './oncoprintlabelview';
20
- import OncoprintRuleSet, {RuleSetParams} from './oncoprintruleset';
22
+ import OncoprintRuleSet, { RuleSetParams } from './oncoprintruleset';
21
23
  import OncoprintTrackOptionsView from './oncoprinttrackoptionsview';
22
24
  import OncoprintLegendView from './oncoprintlegendrenderer';
23
25
  import OncoprintToolTip from './oncoprinttooltip';
24
26
  import OncoprintTrackInfoView from './oncoprinttrackinfoview';
25
- import OncoprintMinimapView, {MinimapViewportSpec} from './oncoprintminimapview';
27
+ import OncoprintMinimapView, {
28
+ MinimapViewportSpec,
29
+ } from './oncoprintminimapview';
26
30
 
27
31
  import svgfactory from './svgfactory';
28
32
 
29
- import $ from "jquery";
30
- import {clamp} from "./utils";
31
- import OncoprintHeaderView from "./oncoprintheaderview";
32
-
33
- export * from "./oncoprintruleset";
34
- export * from "./oncoprintmodel";
35
- export {default as shapeToSvg} from "./oncoprintshapetosvg";
33
+ import $ from 'jquery';
34
+ import { clamp } from './utils';
35
+ import OncoprintHeaderView from './oncoprintheaderview';
36
36
 
37
37
  export type InitParams = {
38
- init_cell_width?:number;
39
- init_cell_padding?:number;
40
- cell_padding_off_cell_width_threshold?:number;
38
+ init_cell_width?: number;
39
+ init_cell_padding?: number;
40
+ cell_padding_off_cell_width_threshold?: number;
41
41
  init_horz_zoom?: number;
42
42
  init_vert_zoom?: number;
43
43
  init_track_group_padding?: number;
44
44
  init_cell_padding_on?: boolean;
45
- max_height?:number;
45
+ max_height?: number;
46
46
  };
47
47
 
48
- export type HorzZoomCallback = (zoom:number)=>void;
49
- export type MinimapCloseCallback = ()=>void;
50
- export type CellMouseOverCallback = (uid:ColumnId|null, track_id?:TrackId)=>void;
51
- export type CellClickCallback = (uid:ColumnId|null, track_id?:TrackId)=>void;
52
- export type ClipboardChangeCallback = (ids:ColumnId[])=>void;
53
-
54
- const nextTrackId = (function () {
48
+ export type HorzZoomCallback = (zoom: number) => void;
49
+ export type MinimapCloseCallback = () => void;
50
+ export type CellMouseOverCallback = (
51
+ uid: ColumnId | null,
52
+ track_id?: TrackId
53
+ ) => void;
54
+ export type CellClickCallback = (
55
+ uid: ColumnId | null,
56
+ track_id?: TrackId
57
+ ) => void;
58
+ export type ClipboardChangeCallback = (ids: ColumnId[]) => void;
59
+
60
+ const nextTrackId = (function() {
55
61
  let ctr = 0;
56
- return function () {
62
+ return function() {
57
63
  ctr += 1;
58
64
  return ctr;
59
- }
65
+ };
60
66
  })();
61
67
 
62
68
  export default class Oncoprint {
@@ -67,148 +73,191 @@ export default class Oncoprint {
67
73
  this.lastSortId = (this.lastSortId + 1) % 1000000; // make sure we don't have any overflow problems. Definitely won't have a million sorts pending at once
68
74
  }
69
75
 
70
- public destroyed:boolean;
71
- public webgl_unavailable:boolean;
72
- private $ctr:JQuery;
73
- private $oncoprint_ctr:JQuery;
74
- private $cell_div:JQuery;
75
- private $header_div:JQuery;
76
- private $legend_div:JQuery;
77
- private $track_options_div:JQuery;
78
- private $track_info_div:JQuery;
79
- private $dummy_scroll_div:JQuery;
80
- private $minimap_div:JQuery;
81
- private $cell_canvas:JQuery;
82
- private $cell_overlay_canvas:JQuery;
83
-
84
- public model:OncoprintModel;
85
- public header_view:OncoprintHeaderView;
86
- public cell_view:OncoprintWebGLCellView;
87
- public minimap_view:OncoprintMinimapView;
88
- public track_options_view:OncoprintTrackOptionsView;
89
- public track_info_view:OncoprintTrackInfoView;
76
+ public destroyed: boolean;
77
+ public webgl_unavailable: boolean;
78
+ private $ctr: JQuery;
79
+ private $oncoprint_ctr: JQuery;
80
+ private $cell_div: JQuery;
81
+ private $header_div: JQuery;
82
+ private $legend_div: JQuery;
83
+ private $track_options_div: JQuery;
84
+ private $track_info_div: JQuery;
85
+ private $dummy_scroll_div: JQuery;
86
+ private $minimap_div: JQuery;
87
+ private $cell_canvas: JQuery;
88
+ private $cell_overlay_canvas: JQuery;
89
+
90
+ public model: OncoprintModel;
91
+ public header_view: OncoprintHeaderView;
92
+ public cell_view: OncoprintWebGLCellView;
93
+ public minimap_view: OncoprintMinimapView;
94
+ public track_options_view: OncoprintTrackOptionsView;
95
+ public track_info_view: OncoprintTrackInfoView;
90
96
  public label_view: OncoprintLabelView;
91
97
  public legend_view: OncoprintLegendView;
92
98
 
93
- private keep_horz_zoomed_to_fit:boolean;
94
- private keep_horz_zoomed_to_fit_ids:ColumnId[];
95
- private pending_resize_and_organize:boolean;
99
+ private keep_horz_zoomed_to_fit: boolean;
100
+ private keep_horz_zoomed_to_fit_ids: ColumnId[];
101
+ private pending_resize_and_organize: boolean;
96
102
 
97
- private horz_zoom_callbacks:HorzZoomCallback[];
98
- private minimap_close_callbacks:MinimapCloseCallback[];
99
- private cell_mouse_over_callbacks:CellMouseOverCallback[];
100
- private cell_click_callbacks:CellClickCallback[];
101
- private id_clipboard:ColumnId[];
102
- private clipboard_change_callbacks:ClipboardChangeCallback[];
103
+ private horz_zoom_callbacks: HorzZoomCallback[];
104
+ private minimap_close_callbacks: MinimapCloseCallback[];
105
+ private cell_mouse_over_callbacks: CellMouseOverCallback[];
106
+ private cell_click_callbacks: CellClickCallback[];
107
+ private id_clipboard: ColumnId[];
108
+ private clipboard_change_callbacks: ClipboardChangeCallback[];
103
109
 
104
- private target_dummy_scroll_left:number;
105
- private target_dummy_scroll_top:number;
110
+ private target_dummy_scroll_left: number;
111
+ private target_dummy_scroll_top: number;
106
112
 
107
- private getCellViewHeight = ()=>this.cell_view.getVisibleAreaHeight(this.model);
113
+ private getCellViewHeight = () =>
114
+ this.cell_view.getVisibleAreaHeight(this.model);
108
115
 
109
- constructor(private ctr_selector:string, private width:number, params?:InitParams) {
116
+ constructor(
117
+ private ctr_selector: string,
118
+ private width: number,
119
+ params?: InitParams
120
+ ) {
110
121
  params = params || {};
111
122
 
112
123
  const self = this;
113
124
 
114
125
  this.destroyed = false;
115
- this.webgl_unavailable = (document.createElement('canvas').getContext('experimental-webgl') === null);
126
+ this.webgl_unavailable =
127
+ document
128
+ .createElement('canvas')
129
+ .getContext('experimental-webgl') === null;
116
130
  if (this.webgl_unavailable) {
117
- $(ctr_selector).append("<p class='oncoprintjs__webgl_unavailable_message'>WebGL context cannot be retrieved, so oncoprint cannot be used. Please visit <a href='http://webglreport.com'>WebGL Report</a> to explore your browsers WebGL capabilities.</p>");
131
+ $(ctr_selector).append(
132
+ "<p class='oncoprintjs__webgl_unavailable_message'>WebGL context cannot be retrieved, so oncoprint cannot be used. Please visit <a href='http://webglreport.com'>WebGL Report</a> to explore your browsers WebGL capabilities.</p>"
133
+ );
118
134
  return;
119
135
  }
120
136
 
121
- const $ctr = $('<span></span>').css({'position':'relative', 'display':'inline-block'}).appendTo(ctr_selector);
137
+ const $ctr = $('<span></span>')
138
+ .css({ position: 'relative', display: 'inline-block' })
139
+ .appendTo(ctr_selector);
122
140
  const $oncoprint_ctr = $('<div></div>')
123
- .css({'position':'absolute', 'display':'inline-block'})
141
+ .css({ position: 'absolute', display: 'inline-block' })
124
142
  .appendTo($ctr);
125
143
 
126
- const $tooltip_ctr = $('<span></span>').css({'position':'fixed', 'top':0, 'left':0, "z-index":99999}).appendTo(ctr_selector);
127
- const $legend_ctr = $('<div></div>').css({'position':'absolute', 'display':'inline-block', 'top':0, 'left':0, 'min-height':1})
144
+ const $tooltip_ctr = $('<span></span>')
145
+ .css({ position: 'fixed', top: 0, left: 0, 'z-index': 99999 })
146
+ .appendTo(ctr_selector);
147
+ const $legend_ctr = $('<div></div>')
148
+ .css({
149
+ position: 'absolute',
150
+ display: 'inline-block',
151
+ top: 0,
152
+ left: 0,
153
+ 'min-height': 1,
154
+ })
128
155
  .appendTo($ctr);
129
156
 
130
157
  const $label_canvas = $('<canvas></canvas>')
131
- .css({'display':'inline-block',
132
- 'position':'absolute',
133
- 'left':'0px',
134
- 'top':'0px'})
135
- .addClass("noselect")
136
- .attr({'width':'150', 'height':'250'}) as JQuery<HTMLCanvasElement>;
158
+ .css({
159
+ display: 'inline-block',
160
+ position: 'absolute',
161
+ left: '0px',
162
+ top: '0px',
163
+ })
164
+ .addClass('noselect')
165
+ .attr({ width: '150', height: '250' }) as JQuery<HTMLCanvasElement>;
137
166
 
138
167
  const $header_div = $('<div></div>')
139
- .css({position:'absolute'})
140
- .addClass("oncoprintjs__header_div");
168
+ .css({ position: 'absolute' })
169
+ .addClass('oncoprintjs__header_div');
141
170
 
142
171
  const $track_options_div = $('<div></div>')
143
- .css({'position':'absolute',
144
- 'left':'150px',
145
- 'top':'0px'})
146
- .addClass("noselect")
147
- .attr({'width':'50', 'height':'250'});
172
+ .css({ position: 'absolute', left: '150px', top: '0px' })
173
+ .addClass('noselect')
174
+ .attr({ width: '50', height: '250' });
148
175
 
149
176
  const $legend_div = $('<div></div>')
150
- .css({'position':'absolute',
151
- 'top':'250px',
152
- 'min-height':1})
153
- .addClass("noselect oncoprint-legend-div");
177
+ .css({ position: 'absolute', top: '250px', 'min-height': 1 })
178
+ .addClass('noselect oncoprint-legend-div');
154
179
 
155
180
  const $cell_div = $('<div>')
156
- .css({'width':width,
157
- 'display':'inline-block',
158
- 'position':'absolute',
159
- 'left':'200px',
160
- 'top':'0px'})
161
- .addClass("noselect");
181
+ .css({
182
+ width: width,
183
+ display: 'inline-block',
184
+ position: 'absolute',
185
+ left: '200px',
186
+ top: '0px',
187
+ })
188
+ .addClass('noselect');
162
189
 
163
190
  const $cell_canvas = $('<canvas></canvas>')
164
- .attr({'width':'0px', 'height':'0px'})
165
- .css({'position':'absolute', 'top':'0px', 'left':'0px'})
166
- .addClass("noselect") as JQuery<HTMLCanvasElement>;
191
+ .attr({ width: '0px', height: '0px' })
192
+ .css({ position: 'absolute', top: '0px', left: '0px' })
193
+ .addClass('noselect') as JQuery<HTMLCanvasElement>;
167
194
 
168
195
  const $dummy_scroll_div = $('<div>')
169
- .css({'position':'absolute',
170
- 'overflow-x':'scroll',
171
- 'overflow-y':'scroll',
172
- 'top':'0',
173
- 'left':'0px',
174
- 'height':'1px',
175
- }).addClass('oncoprintjs__scroll_div');
196
+ .css({
197
+ position: 'absolute',
198
+ 'overflow-x': 'scroll',
199
+ 'overflow-y': 'scroll',
200
+ top: '0',
201
+ left: '0px',
202
+ height: '1px',
203
+ })
204
+ .addClass('oncoprintjs__scroll_div');
176
205
 
177
- const $dummy_scroll_div_contents = $('<div>').appendTo($dummy_scroll_div);
206
+ const $dummy_scroll_div_contents = $('<div>').appendTo(
207
+ $dummy_scroll_div
208
+ );
178
209
 
179
210
  const $cell_overlay_canvas = $('<canvas></canvas>')
180
- .attr({'width':'0px', 'height':'0px'})
181
- .css({'position':'absolute',
182
- 'top':'0px',
183
- 'left':'0px'})
184
- .addClass("noselect")
185
- .addClass('oncoprintjs__cell_overlay_div') as JQuery<HTMLCanvasElement>;
211
+ .attr({ width: '0px', height: '0px' })
212
+ .css({ position: 'absolute', top: '0px', left: '0px' })
213
+ .addClass('noselect')
214
+ .addClass('oncoprintjs__cell_overlay_div') as JQuery<
215
+ HTMLCanvasElement
216
+ >;
186
217
 
187
218
  const $column_label_canvas = $('<canvas></canvas>')
188
- .attr({'width':'0px', 'height':'0px'})
189
- .css({'position':'absolute',
190
- 'top':'0px',
191
- 'left':'0px',
192
- 'pointer-events':'none' // since column label canvas is on top of cell overlay canvas, we need to make it not capture any mouse events
219
+ .attr({ width: '0px', height: '0px' })
220
+ .css({
221
+ position: 'absolute',
222
+ top: '0px',
223
+ left: '0px',
224
+ 'pointer-events': 'none', // since column label canvas is on top of cell overlay canvas, we need to make it not capture any mouse events
193
225
  })
194
- .addClass("noselect")
195
- .addClass('oncoprintjs__column_label_canvas') as JQuery<HTMLCanvasElement>;
196
-
197
- const $track_info_div = $('<div>')
198
- .css({'position':'absolute'});
199
-
200
- const $minimap_div = $('<div>').css({'position':'absolute', 'outline':'solid 1px black', 'display': 'none'}).addClass("noselect");
226
+ .addClass('noselect')
227
+ .addClass('oncoprintjs__column_label_canvas') as JQuery<
228
+ HTMLCanvasElement
229
+ >;
230
+
231
+ const $track_info_div = $('<div>').css({ position: 'absolute' });
232
+
233
+ const $minimap_div = $('<div>')
234
+ .css({
235
+ position: 'absolute',
236
+ outline: 'solid 1px black',
237
+ display: 'none',
238
+ })
239
+ .addClass('noselect');
201
240
 
202
241
  const $minimap_canvas = $('<canvas></canvas>')
203
242
  .attr('width', 300)
204
243
  .attr('height', 300)
205
- .css({'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':0})
206
- .addClass("noselect") as JQuery<HTMLCanvasElement>;
244
+ .css({
245
+ position: 'absolute',
246
+ top: '0px',
247
+ left: '0px',
248
+ 'z-index': 0,
249
+ })
250
+ .addClass('noselect') as JQuery<HTMLCanvasElement>;
207
251
  const $minimap_overlay_canvas = $('<canvas></canvas>')
208
252
  .attr('width', 300)
209
253
  .attr('height', 300)
210
- .css({'position': 'absolute', 'top':'0px', 'left':'0px', 'z-index':1})
211
- .addClass("noselect") as JQuery<HTMLCanvasElement>;
254
+ .css({
255
+ position: 'absolute',
256
+ top: '0px',
257
+ left: '0px',
258
+ 'z-index': 1,
259
+ })
260
+ .addClass('noselect') as JQuery<HTMLCanvasElement>;
212
261
 
213
262
  $label_canvas.appendTo($oncoprint_ctr);
214
263
  $cell_div.appendTo($oncoprint_ctr);
@@ -222,9 +271,9 @@ export default class Oncoprint {
222
271
 
223
272
  $cell_canvas.appendTo($cell_div);
224
273
  $cell_overlay_canvas.appendTo($cell_div);
225
- $column_label_canvas.appendTo($cell_div);// column labels should show above the overlay canvas because the text should show over the highlights
274
+ $column_label_canvas.appendTo($cell_div); // column labels should show above the overlay canvas because the text should show over the highlights
226
275
  $dummy_scroll_div.appendTo($cell_div);
227
- $dummy_scroll_div.on("mousemove mousedown mouseup", function(evt) {
276
+ $dummy_scroll_div.on('mousemove mousedown mouseup', function(evt) {
228
277
  $cell_overlay_canvas.trigger(evt);
229
278
  });
230
279
  $minimap_canvas.appendTo($minimap_div);
@@ -240,8 +289,6 @@ export default class Oncoprint {
240
289
  this.$dummy_scroll_div = $dummy_scroll_div;
241
290
  this.$minimap_div = $minimap_div;
242
291
 
243
-
244
-
245
292
  this.$cell_canvas = $cell_canvas;
246
293
  this.$cell_overlay_canvas = $cell_overlay_canvas;
247
294
 
@@ -249,11 +296,28 @@ export default class Oncoprint {
249
296
 
250
297
  this.header_view = new OncoprintHeaderView(this.$header_div);
251
298
 
252
- this.cell_view = new OncoprintWebGLCellView($cell_div, $cell_canvas, $cell_overlay_canvas, $column_label_canvas, $dummy_scroll_div_contents, this.model, new OncoprintToolTip($tooltip_ctr),
299
+ this.cell_view = new OncoprintWebGLCellView(
300
+ $cell_div,
301
+ $cell_canvas,
302
+ $cell_overlay_canvas,
303
+ $column_label_canvas,
304
+ $dummy_scroll_div_contents,
305
+ this.model,
306
+ new OncoprintToolTip($tooltip_ctr),
253
307
  function(left, right) {
254
- const enclosed_ids = self.model.getIdsInZoomedLeftInterval(left, right);
255
- self.setHorzZoom(self.model.getHorzZoomToFit(self.cell_view.getVisibleAreaWidth(), enclosed_ids));
256
- self.$dummy_scroll_div.scrollLeft(self.model.getZoomedColumnLeft(enclosed_ids[0]));
308
+ const enclosed_ids = self.model.getIdsInZoomedLeftInterval(
309
+ left,
310
+ right
311
+ );
312
+ self.setHorzZoom(
313
+ self.model.getHorzZoomToFit(
314
+ self.cell_view.getVisibleAreaWidth(),
315
+ enclosed_ids
316
+ )
317
+ );
318
+ self.$dummy_scroll_div.scrollLeft(
319
+ self.model.getZoomedColumnLeft(enclosed_ids[0])
320
+ );
257
321
  },
258
322
  function(uid, track_id) {
259
323
  self.doCellMouseOver(uid, track_id);
@@ -263,78 +327,121 @@ export default class Oncoprint {
263
327
  }
264
328
  );
265
329
 
266
- this.minimap_view = new OncoprintMinimapView($minimap_div, $minimap_canvas, $minimap_overlay_canvas, this.model, this.cell_view, 150, 150,
267
- function(x,y) {
268
- self.setScroll(x,y);
330
+ this.minimap_view = new OncoprintMinimapView(
331
+ $minimap_div,
332
+ $minimap_canvas,
333
+ $minimap_overlay_canvas,
334
+ this.model,
335
+ this.cell_view,
336
+ 150,
337
+ 150,
338
+ function(x, y) {
339
+ self.setScroll(x, y);
269
340
  },
270
- function(vp:MinimapViewportSpec) {
341
+ function(vp: MinimapViewportSpec) {
271
342
  self.setViewport(vp);
272
343
  },
273
- function(val:number) {
344
+ function(val: number) {
274
345
  self.setHorzZoomCentered(val);
275
346
  },
276
- function(val:number) {
347
+ function(val: number) {
277
348
  // Save unzoomed vertical center pre-zoom
278
- const prev_viewport = self.cell_view.getViewportOncoprintSpace(self.model);
279
- const center_onc_space = (prev_viewport.top + prev_viewport.bottom) / 2;
349
+ const prev_viewport = self.cell_view.getViewportOncoprintSpace(
350
+ self.model
351
+ );
352
+ const center_onc_space =
353
+ (prev_viewport.top + prev_viewport.bottom) / 2;
280
354
 
281
355
  // Execute zoom
282
356
  self.setVertZoom(val);
283
357
 
284
358
  // Set scroll to recenter the vertical center
285
- const viewport = self.cell_view.getViewportOncoprintSpace(self.model);
286
- const half_viewport_height_zoomed = self.model.getVertZoom() * (viewport.bottom - viewport.top) / 2;
287
-
288
- self.setVertScroll(center_onc_space * self.model.getVertZoom() - half_viewport_height_zoomed);
359
+ const viewport = self.cell_view.getViewportOncoprintSpace(
360
+ self.model
361
+ );
362
+ const half_viewport_height_zoomed =
363
+ (self.model.getVertZoom() *
364
+ (viewport.bottom - viewport.top)) /
365
+ 2;
366
+
367
+ self.setVertScroll(
368
+ center_onc_space * self.model.getVertZoom() -
369
+ half_viewport_height_zoomed
370
+ );
289
371
  },
290
372
  function() {
291
373
  self.updateHorzZoomToFit();
292
374
  const left = self.model.getZoomedColumnLeft();
293
- self.setHorzScroll(Math.min.apply(null, self.keep_horz_zoomed_to_fit_ids.map(function(id) { return left[id]; })));
375
+ self.setHorzScroll(
376
+ Math.min.apply(
377
+ null,
378
+ self.keep_horz_zoomed_to_fit_ids.map(function(id) {
379
+ return left[id];
380
+ })
381
+ )
382
+ );
294
383
  },
295
384
  function() {
296
385
  self.setMinimapVisible(false);
297
- });
386
+ }
387
+ );
298
388
 
299
- this.track_options_view = new OncoprintTrackOptionsView($track_options_div,
300
- function (track_id:TrackId) {
389
+ this.track_options_view = new OncoprintTrackOptionsView(
390
+ $track_options_div,
391
+ function(track_id: TrackId) {
301
392
  // move up
302
393
  const tracks = self.model.getContainingTrackGroup(track_id);
303
394
  const index = tracks.indexOf(track_id);
304
395
  if (index > 0) {
305
396
  let new_previous_track = null;
306
397
  if (index >= 2) {
307
- new_previous_track = tracks[index-2];
398
+ new_previous_track = tracks[index - 2];
308
399
  }
309
400
  self.moveTrack(track_id, new_previous_track);
310
401
  }
311
402
  },
312
- function (track_id:TrackId) {
403
+ function(track_id: TrackId) {
313
404
  // move down
314
405
  const tracks = self.model.getContainingTrackGroup(track_id);
315
406
  const index = tracks.indexOf(track_id);
316
407
  if (index < tracks.length - 1) {
317
- self.moveTrack(track_id, tracks[index+1]);
408
+ self.moveTrack(track_id, tracks[index + 1]);
318
409
  }
319
410
  },
320
- function (track_id:TrackId) {
321
- const callback = self.model.getTrackRemoveOptionCallback(track_id);
411
+ function(track_id: TrackId) {
412
+ const callback = self.model.getTrackRemoveOptionCallback(
413
+ track_id
414
+ );
322
415
  if (callback) {
323
416
  callback(track_id);
324
417
  } else {
325
418
  self.removeTrack(track_id);
326
419
  }
327
420
  },
328
- function (track_id, dir) { self.setTrackSortDirection(track_id, dir); },
329
- function (track_id:TrackId) { self.removeExpansionTracksFor(track_id); },
421
+ function(track_id, dir) {
422
+ self.setTrackSortDirection(track_id, dir);
423
+ },
424
+ function(track_id: TrackId) {
425
+ self.removeExpansionTracksFor(track_id);
426
+ },
330
427
  self.setTrackShowGaps.bind(self)
331
428
  );
332
- this.track_info_view = new OncoprintTrackInfoView($track_info_div, new OncoprintToolTip($tooltip_ctr));
429
+ this.track_info_view = new OncoprintTrackInfoView(
430
+ $track_info_div,
431
+ new OncoprintToolTip($tooltip_ctr)
432
+ );
333
433
 
334
434
  //this.track_info_view = new OncoprintTrackInfoView($track_info_div);
335
435
 
336
- this.label_view = new OncoprintLabelView($label_canvas, this.model, new OncoprintToolTip($tooltip_ctr, {noselect: true}));
337
- this.label_view.setDragCallback(function(target_track, new_previous_track) {
436
+ this.label_view = new OncoprintLabelView(
437
+ $label_canvas,
438
+ this.model,
439
+ new OncoprintToolTip($tooltip_ctr, { noselect: true })
440
+ );
441
+ this.label_view.setDragCallback(function(
442
+ target_track,
443
+ new_previous_track
444
+ ) {
338
445
  self.moveTrack(target_track, new_previous_track);
339
446
  });
340
447
 
@@ -350,10 +457,13 @@ export default class Oncoprint {
350
457
  this.target_dummy_scroll_top = 0;
351
458
 
352
459
  (function setUpOncoprintScroll(oncoprint) {
353
- $dummy_scroll_div.scroll(function (e) {
460
+ $dummy_scroll_div.scroll(function(e) {
354
461
  const dummy_scroll_left = $dummy_scroll_div.scrollLeft();
355
462
  const dummy_scroll_top = $dummy_scroll_div.scrollTop();
356
- if (dummy_scroll_left !== self.target_dummy_scroll_left || dummy_scroll_top !== self.target_dummy_scroll_top) {
463
+ if (
464
+ dummy_scroll_left !== self.target_dummy_scroll_left ||
465
+ dummy_scroll_top !== self.target_dummy_scroll_top
466
+ ) {
357
467
  // In setDummyScrollDivScroll, where we intend to set the scroll programmatically without
358
468
  // triggering the handler, we set target_dummy_scroll_left and target_dummy_scroll_top,
359
469
  // so if they're not set (we get inside this block), then it's a user-triggered scroll.
@@ -362,16 +472,28 @@ export default class Oncoprint {
362
472
  self.target_dummy_scroll_left = dummy_scroll_left;
363
473
  self.target_dummy_scroll_top = dummy_scroll_top;
364
474
  const maximum_dummy_scroll_div_scroll = oncoprint.maxDummyScrollDivScroll();
365
- const maximum_div_scroll_left = maximum_dummy_scroll_div_scroll.left;
366
- const maximum_div_scroll_top = maximum_dummy_scroll_div_scroll.top;
367
- let scroll_left_prop = maximum_div_scroll_left > 0 ? dummy_scroll_left / maximum_div_scroll_left : 0;
368
- let scroll_top_prop = maximum_div_scroll_top > 0 ? dummy_scroll_top / maximum_div_scroll_top : 0;
475
+ const maximum_div_scroll_left =
476
+ maximum_dummy_scroll_div_scroll.left;
477
+ const maximum_div_scroll_top =
478
+ maximum_dummy_scroll_div_scroll.top;
479
+ let scroll_left_prop =
480
+ maximum_div_scroll_left > 0
481
+ ? dummy_scroll_left / maximum_div_scroll_left
482
+ : 0;
483
+ let scroll_top_prop =
484
+ maximum_div_scroll_top > 0
485
+ ? dummy_scroll_top / maximum_div_scroll_top
486
+ : 0;
369
487
  scroll_left_prop = clamp(scroll_left_prop, 0, 1);
370
488
  scroll_top_prop = clamp(scroll_top_prop, 0, 1);
371
489
  const maximum_scroll_left = oncoprint.maxOncoprintScrollLeft();
372
490
  const maximum_scroll_top = oncoprint.maxOncoprintScrollTop();
373
- const scroll_left = Math.round(maximum_scroll_left * scroll_left_prop);
374
- const scroll_top = Math.round(maximum_scroll_top * scroll_top_prop);
491
+ const scroll_left = Math.round(
492
+ maximum_scroll_left * scroll_left_prop
493
+ );
494
+ const scroll_top = Math.round(
495
+ maximum_scroll_top * scroll_top_prop
496
+ );
375
497
  self.keep_horz_zoomed_to_fit = false;
376
498
 
377
499
  oncoprint.doSetScroll(scroll_left, scroll_top);
@@ -394,24 +516,36 @@ export default class Oncoprint {
394
516
  if (this.model.rendering_suppressed_depth > 0) {
395
517
  return;
396
518
  }
397
- this.$legend_div.css({'top': this.cell_view.getVisibleAreaHeight(this.model) + 30});
519
+ this.$legend_div.css({
520
+ top: this.cell_view.getVisibleAreaHeight(this.model) + 30,
521
+ });
398
522
  }
399
523
  private setLegendTopAfterTimeout() {
400
524
  if (this.model.rendering_suppressed_depth > 0) {
401
525
  return;
402
526
  }
403
527
  const self = this;
404
- setTimeout(function () {
528
+ setTimeout(function() {
405
529
  self.setHeight();
406
530
  self._SetLegendTop();
407
531
  }, 0);
408
532
  }
409
533
 
410
534
  private setHeight() {
411
- this.$ctr.css({'min-height': this.cell_view.getVisibleAreaHeight(this.model) + Math.max(this.$legend_div.outerHeight(), (this.$minimap_div.is(":visible") ? this.$minimap_div.outerHeight() : 0)) + 30});
535
+ this.$ctr.css({
536
+ 'min-height':
537
+ this.cell_view.getVisibleAreaHeight(this.model) +
538
+ Math.max(
539
+ this.$legend_div.outerHeight(),
540
+ this.$minimap_div.is(':visible')
541
+ ? this.$minimap_div.outerHeight()
542
+ : 0
543
+ ) +
544
+ 30,
545
+ });
412
546
  }
413
547
 
414
- private resizeAndOrganize(onComplete?:()=>void) {
548
+ private resizeAndOrganize(onComplete?: () => void) {
415
549
  if (this.model.rendering_suppressed_depth > 0) {
416
550
  return;
417
551
  }
@@ -421,26 +555,35 @@ export default class Oncoprint {
421
555
  this.pending_resize_and_organize = true;
422
556
  return;
423
557
  }
424
- this.$track_options_div.css({'left': this.label_view.getWidth()});
558
+ this.$track_options_div.css({ left: this.label_view.getWidth() });
425
559
  this.$header_div.css({
426
560
  left: 0,
427
561
  top: 0,
428
562
  width: this.width,
429
- height: this.cell_view.getVisibleAreaHeight(this.model)
563
+ height: this.cell_view.getVisibleAreaHeight(this.model),
564
+ });
565
+ this.$track_info_div.css({
566
+ left:
567
+ this.label_view.getWidth() + this.track_options_view.getWidth(),
430
568
  });
431
- this.$track_info_div.css({'left': this.label_view.getWidth() + this.track_options_view.getWidth()});
432
- const cell_div_left = this.label_view.getWidth() + this.track_options_view.getWidth() + this.track_info_view.getWidth();
569
+ const cell_div_left =
570
+ this.label_view.getWidth() +
571
+ this.track_options_view.getWidth() +
572
+ this.track_info_view.getWidth();
433
573
  this.$cell_div.css('left', cell_div_left);
434
574
  this.cell_view.setWidth(this.width - cell_div_left - 20, this.model);
435
575
 
436
576
  this._SetLegendTop();
437
- this.legend_view.setWidth(this.width - this.$minimap_div.outerWidth() - 20, this.model);
577
+ this.legend_view.setWidth(
578
+ this.width - this.$minimap_div.outerWidth() - 20,
579
+ this.model
580
+ );
438
581
 
439
582
  this.setHeight();
440
- this.$ctr.css({'min-width': this.width});
583
+ this.$ctr.css({ 'min-width': this.width });
441
584
 
442
585
  const self = this;
443
- setTimeout(function () {
586
+ setTimeout(function() {
444
587
  if (self.keep_horz_zoomed_to_fit) {
445
588
  self.updateHorzZoomToFit();
446
589
  }
@@ -448,38 +591,65 @@ export default class Oncoprint {
448
591
  }, 0);
449
592
  }
450
593
 
451
- private resizeAndOrganizeAfterTimeout(onComplete?:()=>void) {
594
+ private resizeAndOrganizeAfterTimeout(onComplete?: () => void) {
452
595
  if (this.model.rendering_suppressed_depth > 0) {
453
596
  return;
454
597
  }
455
598
  const self = this;
456
- setTimeout(function () {
599
+ setTimeout(function() {
457
600
  self.resizeAndOrganize(onComplete);
458
601
  }, 0);
459
602
  }
460
603
 
461
604
  private maxOncoprintScrollLeft() {
462
- return Math.max(0, this.cell_view.getTotalWidth(this.model) - this.cell_view.getVisibleAreaWidth());
605
+ return Math.max(
606
+ 0,
607
+ this.cell_view.getTotalWidth(this.model) -
608
+ this.cell_view.getVisibleAreaWidth()
609
+ );
463
610
  }
464
611
 
465
612
  private maxOncoprintScrollTop() {
466
- return Math.max(0, this.cell_view.getTotalHeight(this.model)-this.cell_view.getVisibleAreaHeight(this.model));
613
+ return Math.max(
614
+ 0,
615
+ this.cell_view.getTotalHeight(this.model) -
616
+ this.cell_view.getVisibleAreaHeight(this.model)
617
+ );
467
618
  }
468
619
 
469
620
  private maxDummyScrollDivScroll() {
470
621
  const dummy_scroll_div_client_size = this.cell_view.getDummyScrollDivClientSize();
471
- const maximum_div_scroll_left = Math.max(0, (this.$dummy_scroll_div[0].scrollWidth - dummy_scroll_div_client_size.width));
472
- const maximum_div_scroll_top = Math.max(0, (this.$dummy_scroll_div[0].scrollHeight - dummy_scroll_div_client_size.height));
473
- return {'left': maximum_div_scroll_left, 'top': maximum_div_scroll_top};
622
+ const maximum_div_scroll_left = Math.max(
623
+ 0,
624
+ this.$dummy_scroll_div[0].scrollWidth -
625
+ dummy_scroll_div_client_size.width
626
+ );
627
+ const maximum_div_scroll_top = Math.max(
628
+ 0,
629
+ this.$dummy_scroll_div[0].scrollHeight -
630
+ dummy_scroll_div_client_size.height
631
+ );
632
+ return { left: maximum_div_scroll_left, top: maximum_div_scroll_top };
474
633
  }
475
634
 
476
- public setMinimapVisible(visible:boolean) {
477
- if(this.webgl_unavailable || this.destroyed) {
635
+ public setMinimapVisible(visible: boolean) {
636
+ if (this.webgl_unavailable || this.destroyed) {
478
637
  return;
479
638
  }
480
639
  if (visible) {
481
- this.$minimap_div.css({'display': 'block', 'top': 0, 'left': $(this.ctr_selector).width() - this.$minimap_div.outerWidth() - 10});
482
- this.minimap_view.setMinimapVisible(true, this.model, this.cell_view);
640
+ this.$minimap_div.css({
641
+ display: 'block',
642
+ top: 0,
643
+ left:
644
+ $(this.ctr_selector).width() -
645
+ this.$minimap_div.outerWidth() -
646
+ 10,
647
+ });
648
+ this.minimap_view.setMinimapVisible(
649
+ true,
650
+ this.model,
651
+ this.cell_view
652
+ );
483
653
  } else {
484
654
  this.$minimap_div.css('display', 'none');
485
655
  this.minimap_view.setMinimapVisible(false);
@@ -488,30 +658,28 @@ export default class Oncoprint {
488
658
  this.resizeAndOrganizeAfterTimeout();
489
659
  }
490
660
 
491
- public scrollTo(left:number) {
492
- if(this.webgl_unavailable || this.destroyed) {
661
+ public scrollTo(left: number) {
662
+ if (this.webgl_unavailable || this.destroyed) {
493
663
  return;
494
664
  }
495
665
  this.$dummy_scroll_div.scrollLeft(left);
496
666
  }
497
- public onHorzZoom(callback:HorzZoomCallback) {
498
- if(this.webgl_unavailable || this.destroyed) {
667
+ public onHorzZoom(callback: HorzZoomCallback) {
668
+ if (this.webgl_unavailable || this.destroyed) {
499
669
  return;
500
670
  }
501
671
  this.horz_zoom_callbacks.push(callback);
502
672
  }
503
- public onMinimapClose(callback:MinimapCloseCallback) {
504
- if(this.webgl_unavailable || this.destroyed) {
673
+ public onMinimapClose(callback: MinimapCloseCallback) {
674
+ if (this.webgl_unavailable || this.destroyed) {
505
675
  return;
506
676
  }
507
677
  this.minimap_close_callbacks.push(callback);
508
678
  }
509
679
 
510
-
511
-
512
680
  // methods that propagate/delegate to views
513
- public moveTrack(target_track:TrackId, new_previous_track:TrackId) {
514
- if(this.webgl_unavailable || this.destroyed) {
681
+ public moveTrack(target_track: TrackId, new_previous_track: TrackId) {
682
+ if (this.webgl_unavailable || this.destroyed) {
515
683
  return;
516
684
  }
517
685
  this.model.moveTrack(target_track, new_previous_track);
@@ -522,14 +690,24 @@ export default class Oncoprint {
522
690
  this.track_info_view.moveTrack(this.model, this.getCellViewHeight);
523
691
  this.minimap_view.moveTrack(this.model, this.cell_view);
524
692
 
525
- if (this.model.keep_sorted && this.model.isSortAffected([target_track, new_previous_track], "track")) {
693
+ if (
694
+ this.model.keep_sorted &&
695
+ this.model.isSortAffected(
696
+ [target_track, new_previous_track],
697
+ 'track'
698
+ )
699
+ ) {
526
700
  this.sort();
527
701
  }
528
702
 
529
703
  this.resizeAndOrganizeAfterTimeout();
530
704
  }
531
- public setTrackGroupOrder(index:TrackGroupIndex, track_order:TrackId[], dont_sort?:boolean) {
532
- if(this.webgl_unavailable || this.destroyed) {
705
+ public setTrackGroupOrder(
706
+ index: TrackGroupIndex,
707
+ track_order: TrackId[],
708
+ dont_sort?: boolean
709
+ ) {
710
+ if (this.webgl_unavailable || this.destroyed) {
533
711
  return;
534
712
  }
535
713
  this.model.setTrackGroupOrder(index, track_order);
@@ -537,16 +715,23 @@ export default class Oncoprint {
537
715
  this.header_view.render(this.model);
538
716
  this.label_view.setTrackGroupOrder(this.model, this.getCellViewHeight);
539
717
  this.track_options_view.setTrackGroupOrder(this.model);
540
- this.track_info_view.setTrackGroupOrder(this.model, this.getCellViewHeight);
718
+ this.track_info_view.setTrackGroupOrder(
719
+ this.model,
720
+ this.getCellViewHeight
721
+ );
541
722
 
542
- if (!dont_sort && this.model.keep_sorted && this.model.isSortAffected(index, "group")) {
723
+ if (
724
+ !dont_sort &&
725
+ this.model.keep_sorted &&
726
+ this.model.isSortAffected(index, 'group')
727
+ ) {
543
728
  this.sort();
544
729
  }
545
730
 
546
731
  this.resizeAndOrganizeAfterTimeout();
547
732
  }
548
- public setTrackGroupLegendOrder(group_order:TrackGroupIndex[]) {
549
- if(this.webgl_unavailable || this.destroyed) {
733
+ public setTrackGroupLegendOrder(group_order: TrackGroupIndex[]) {
734
+ if (this.webgl_unavailable || this.destroyed) {
550
735
  return;
551
736
  }
552
737
  this.model.setTrackGroupLegendOrder(group_order);
@@ -555,24 +740,27 @@ export default class Oncoprint {
555
740
  this.resizeAndOrganizeAfterTimeout();
556
741
  }
557
742
 
558
- public keepSorted(keep_sorted?:boolean) {
559
- if(this.webgl_unavailable || this.destroyed) {
743
+ public keepSorted(keep_sorted?: boolean) {
744
+ if (this.webgl_unavailable || this.destroyed) {
560
745
  return;
561
746
  }
562
747
  const oldValue = this.model.keep_sorted;
563
- this.model.keep_sorted = typeof keep_sorted === 'undefined' ? true : keep_sorted;
748
+ this.model.keep_sorted =
749
+ typeof keep_sorted === 'undefined' ? true : keep_sorted;
564
750
  if (this.model.keep_sorted && this.model.keep_sorted !== oldValue) {
565
751
  this.sort();
566
752
  }
567
753
  }
568
754
 
569
- public addTracks(params_list:UserTrackSpec<Datum>[]) {
570
- if(this.webgl_unavailable || this.destroyed) {
571
- return;
755
+ public addTracks(params_list: UserTrackSpec<Datum>[]) {
756
+ if (this.webgl_unavailable || this.destroyed) {
757
+ return [];
572
758
  }
573
759
  // Update model
574
- const track_ids:TrackId[] = [];
575
- const library_params_list = (params_list as LibraryTrackSpec<Datum>[]).map(function (o) {
760
+ const track_ids: TrackId[] = [];
761
+ const library_params_list = (params_list as LibraryTrackSpec<
762
+ Datum
763
+ >[]).map(function(o) {
576
764
  o.track_id = nextTrackId();
577
765
  o.rule_set = OncoprintRuleSet(o.rule_set_params);
578
766
  track_ids.push(o.track_id);
@@ -582,22 +770,29 @@ export default class Oncoprint {
582
770
  this.model.addTracks(library_params_list);
583
771
  // Update views
584
772
  this.cell_view.addTracks(this.model, track_ids);
585
- this.label_view.addTracks(this.model, track_ids, this.getCellViewHeight);
773
+ this.label_view.addTracks(
774
+ this.model,
775
+ track_ids,
776
+ this.getCellViewHeight
777
+ );
586
778
  this.header_view.render(this.model);
587
779
  this.track_options_view.addTracks(this.model, this.getCellViewHeight);
588
780
  this.track_info_view.addTracks(this.model, this.getCellViewHeight);
589
781
  this.legend_view.addTracks(this.model);
590
782
  this.minimap_view.addTracks(this.model, this.cell_view);
591
783
 
592
- if (this.model.keep_sorted && this.model.isSortAffected(track_ids, "track")) {
784
+ if (
785
+ this.model.keep_sorted &&
786
+ this.model.isSortAffected(track_ids, 'track')
787
+ ) {
593
788
  this.sort();
594
789
  }
595
790
  this.resizeAndOrganizeAfterTimeout();
596
791
  return track_ids;
597
792
  }
598
793
 
599
- public removeTrack(track_id:TrackId) {
600
- if(this.webgl_unavailable || this.destroyed) {
794
+ public removeTrack(track_id: TrackId) {
795
+ if (this.webgl_unavailable || this.destroyed) {
601
796
  return;
602
797
  }
603
798
  // Update model
@@ -606,59 +801,66 @@ export default class Oncoprint {
606
801
  this.cell_view.removeTrack(this.model, track_id);
607
802
  this.header_view.render(this.model);
608
803
  this.label_view.removeTrack(this.model, this.getCellViewHeight);
609
- this.track_options_view.removeTrack(this.model, track_id, this.getCellViewHeight);
804
+ this.track_options_view.removeTrack(
805
+ this.model,
806
+ track_id,
807
+ this.getCellViewHeight
808
+ );
610
809
  this.track_info_view.removeTrack(this.model, this.getCellViewHeight);
611
810
  this.legend_view.removeTrack(this.model);
612
811
  this.minimap_view.removeTrack(this.model, this.cell_view);
613
812
 
614
- if (this.model.keep_sorted && this.model.isSortAffected(track_id, "track")) {
813
+ if (
814
+ this.model.keep_sorted &&
815
+ this.model.isSortAffected(track_id, 'track')
816
+ ) {
615
817
  this.sort();
616
818
  }
617
819
  this.resizeAndOrganizeAfterTimeout();
618
820
  }
619
821
 
620
- public removeTracks(track_ids:TrackId[]) {
621
- if(this.webgl_unavailable || this.destroyed) {
822
+ public removeTracks(track_ids: TrackId[]) {
823
+ if (this.webgl_unavailable || this.destroyed) {
622
824
  return;
623
825
  }
624
- for (let i=0; i<track_ids.length; i++) {
826
+ for (let i = 0; i < track_ids.length; i++) {
625
827
  this.removeTrack(track_ids[i]);
626
828
  }
627
829
  }
628
830
 
629
831
  public getTracks() {
630
- if(this.webgl_unavailable || this.destroyed) {
631
- return;
832
+ if (this.webgl_unavailable || this.destroyed) {
833
+ return [];
632
834
  }
633
835
  return this.model.getTracks().slice();
634
836
  }
635
837
 
636
838
  public removeAllTracks() {
637
- if(this.webgl_unavailable || this.destroyed) {
839
+ if (this.webgl_unavailable || this.destroyed) {
638
840
  return;
639
841
  }
640
842
  const track_ids = this.model.getTracks();
641
843
  this.removeTracks(track_ids);
642
844
  }
643
845
 
644
- public removeExpansionTracksFor(track_id:TrackId) {
846
+ public removeExpansionTracksFor(track_id: TrackId) {
645
847
  // remove all expansion tracks for this track
646
848
  this.removeTracks(this.model.track_expansion_tracks[track_id].slice());
647
849
  }
648
850
 
649
- public disableTrackExpansion(track_id:TrackId) {
851
+ public disableTrackExpansion(track_id: TrackId) {
650
852
  this.model.disableTrackExpansion(track_id);
651
853
  }
652
854
 
653
- public enableTrackExpansion(track_id:TrackId) {
855
+ public enableTrackExpansion(track_id: TrackId) {
654
856
  this.model.enableTrackExpansion(track_id);
655
857
  }
656
858
 
657
- public removeAllExpansionTracksInGroup(index:TrackGroupIndex) {
859
+ public removeAllExpansionTracksInGroup(index: TrackGroupIndex) {
658
860
  const tracks_in_group = this.model.getTrackGroups()[index].tracks,
659
861
  expanded_tracks = [];
660
862
  let i;
661
- for (i = 0; i < tracks_in_group.length ; i++) {
863
+ for (i = 0; i < tracks_in_group.length; i++) {
662
864
  if (this.model.isTrackExpanded(tracks_in_group[i])) {
663
865
  expanded_tracks.push(tracks_in_group[i]);
664
866
  }
@@ -671,16 +873,16 @@ export default class Oncoprint {
671
873
  this.releaseRendering();
672
874
  }
673
875
 
674
- public setHorzZoomToFit(ids:ColumnId[]) {
675
- if(this.webgl_unavailable || this.destroyed) {
876
+ public setHorzZoomToFit(ids: ColumnId[]) {
877
+ if (this.webgl_unavailable || this.destroyed) {
676
878
  return;
677
879
  }
678
880
  this.keep_horz_zoomed_to_fit = true;
679
881
  this.updateHorzZoomToFitIds(ids);
680
882
  this.updateHorzZoomToFit();
681
883
  }
682
- public updateHorzZoomToFitIds(ids:ColumnId[]) {
683
- if(this.webgl_unavailable || this.destroyed) {
884
+ public updateHorzZoomToFitIds(ids: ColumnId[]) {
885
+ if (this.webgl_unavailable || this.destroyed) {
684
886
  return;
685
887
  }
686
888
  this.keep_horz_zoomed_to_fit_ids = ids.slice();
@@ -689,65 +891,77 @@ export default class Oncoprint {
689
891
  }
690
892
  }
691
893
  private updateHorzZoomToFit() {
692
- this.setHorzZoom(this.getHorzZoomToFit(this.keep_horz_zoomed_to_fit_ids), true);
894
+ this.setHorzZoom(
895
+ this.getHorzZoomToFit(this.keep_horz_zoomed_to_fit_ids),
896
+ true
897
+ );
693
898
  }
694
- private getHorzZoomToFit(ids:ColumnId[]) {
899
+ private getHorzZoomToFit(ids: ColumnId[]) {
695
900
  ids = ids || [];
696
- return this.model.getHorzZoomToFit(this.cell_view.getVisibleAreaWidth(), ids);
901
+ return this.model.getHorzZoomToFit(
902
+ this.cell_view.getVisibleAreaWidth(),
903
+ ids
904
+ );
697
905
  }
698
906
  private executeHorzZoomCallbacks() {
699
- for (let i=0; i<this.horz_zoom_callbacks.length; i++) {
907
+ for (let i = 0; i < this.horz_zoom_callbacks.length; i++) {
700
908
  this.horz_zoom_callbacks[i](this.model.getHorzZoom());
701
909
  }
702
910
  }
703
911
 
704
912
  private executeMinimapCloseCallbacks() {
705
- for (let i=0; i<this.minimap_close_callbacks.length; i++) {
913
+ for (let i = 0; i < this.minimap_close_callbacks.length; i++) {
706
914
  this.minimap_close_callbacks[i]();
707
915
  }
708
916
  }
709
917
 
710
- private doCellMouseOver(uid:ColumnId, track_id:TrackId) {
918
+ private doCellMouseOver(uid: ColumnId, track_id: TrackId) {
711
919
  if (uid !== null) {
712
920
  this.highlightTrackLabelOnly(track_id);
713
921
  } else {
714
922
  this.highlightTrackLabelOnly(null);
715
923
  }
716
- for (let i=0; i<this.cell_mouse_over_callbacks.length; i++) {
924
+ for (let i = 0; i < this.cell_mouse_over_callbacks.length; i++) {
717
925
  this.cell_mouse_over_callbacks[i](uid, track_id);
718
926
  }
719
927
  }
720
928
 
721
- private doCellClick(uid:ColumnId, track_id:TrackId) {
722
- for (let i=0; i<this.cell_click_callbacks.length; i++) {
929
+ private doCellClick(uid: ColumnId, track_id: TrackId) {
930
+ for (let i = 0; i < this.cell_click_callbacks.length; i++) {
723
931
  this.cell_click_callbacks[i](uid, track_id);
724
932
  }
725
933
  }
726
934
 
727
935
  public getHorzZoom() {
728
- if(this.webgl_unavailable || this.destroyed) {
729
- return;
936
+ if (this.webgl_unavailable || this.destroyed) {
937
+ return undefined;
730
938
  }
731
939
  return this.model.getHorzZoom();
732
940
  }
733
941
 
734
- public setHorzZoomCentered(z:number) {
942
+ public setHorzZoomCentered(z: number) {
735
943
  // Save id thats at center pre-zoom
736
- const centerColIndex = this.cell_view.getViewportOncoprintSpace(this.model).center_col_index;
944
+ const centerColIndex = this.cell_view.getViewportOncoprintSpace(
945
+ this.model
946
+ ).center_col_index;
737
947
  const centerId = this.model.getIdOrder()[centerColIndex];
738
948
 
739
949
  // Execute zoom
740
950
  this.setHorzZoom(z);
741
951
 
742
952
  // Set scroll to recenter the saved id
743
- this.setHorzScroll(this.model.getZoomedColumnLeft(centerId) - this.cell_view.visible_area_width/2);
953
+ this.setHorzScroll(
954
+ this.model.getZoomedColumnLeft(centerId) -
955
+ this.cell_view.visible_area_width / 2
956
+ );
744
957
  }
745
958
 
746
- public setHorzZoom(z:number, still_keep_horz_zoomed_to_fit?:boolean) {
747
- if(this.webgl_unavailable || this.destroyed) {
748
- return;
959
+ public setHorzZoom(z: number, still_keep_horz_zoomed_to_fit?: boolean) {
960
+ if (this.webgl_unavailable || this.destroyed) {
961
+ return undefined;
749
962
  }
750
- this.keep_horz_zoomed_to_fit = this.keep_horz_zoomed_to_fit && still_keep_horz_zoomed_to_fit;
963
+ this.keep_horz_zoomed_to_fit =
964
+ this.keep_horz_zoomed_to_fit && still_keep_horz_zoomed_to_fit;
751
965
 
752
966
  if (this.model.getHorzZoom() !== z) {
753
967
  // Update model if new zoom is different
@@ -763,15 +977,15 @@ export default class Oncoprint {
763
977
  }
764
978
 
765
979
  public getVertZoom() {
766
- if(this.webgl_unavailable || this.destroyed) {
767
- return;
980
+ if (this.webgl_unavailable || this.destroyed) {
981
+ return undefined;
768
982
  }
769
983
  return this.model.getVertZoom();
770
984
  }
771
985
 
772
- public setVertZoom(z:number) {
773
- if(this.webgl_unavailable || this.destroyed) {
774
- return;
986
+ public setVertZoom(z: number) {
987
+ if (this.webgl_unavailable || this.destroyed) {
988
+ return undefined;
775
989
  }
776
990
  // Update model
777
991
  this.model.setVertZoom(z);
@@ -787,7 +1001,7 @@ export default class Oncoprint {
787
1001
  return this.model.getVertZoom();
788
1002
  }
789
1003
 
790
- private doSetScroll(scroll_left:number, scroll_top:number) {
1004
+ private doSetScroll(scroll_left: number, scroll_top: number) {
791
1005
  // Update model
792
1006
  scroll_left = Math.min(scroll_left, this.maxOncoprintScrollLeft());
793
1007
  scroll_top = Math.min(scroll_top, this.maxOncoprintScrollTop());
@@ -808,8 +1022,10 @@ export default class Oncoprint {
808
1022
 
809
1023
  const maximum_scroll_left = this.maxOncoprintScrollLeft();
810
1024
  const maximum_scroll_top = this.maxOncoprintScrollTop();
811
- let onc_scroll_left_prop = maximum_scroll_left > 0 ? scroll_left/maximum_scroll_left : 0;
812
- let onc_scroll_top_prop = maximum_scroll_top > 0 ? scroll_top/maximum_scroll_top : 0;
1025
+ let onc_scroll_left_prop =
1026
+ maximum_scroll_left > 0 ? scroll_left / maximum_scroll_left : 0;
1027
+ let onc_scroll_top_prop =
1028
+ maximum_scroll_top > 0 ? scroll_top / maximum_scroll_top : 0;
813
1029
  onc_scroll_left_prop = clamp(onc_scroll_left_prop, 0, 1);
814
1030
  onc_scroll_top_prop = clamp(onc_scroll_top_prop, 0, 1);
815
1031
 
@@ -817,22 +1033,26 @@ export default class Oncoprint {
817
1033
  const maximum_div_scroll_left = maximum_dummy_scroll_div_scroll.left;
818
1034
  const maximum_div_scroll_top = maximum_dummy_scroll_div_scroll.top;
819
1035
 
820
- this.target_dummy_scroll_left = Math.round(onc_scroll_left_prop * maximum_div_scroll_left);
821
- this.target_dummy_scroll_top = Math.round(onc_scroll_top_prop * maximum_div_scroll_top);
1036
+ this.target_dummy_scroll_left = Math.round(
1037
+ onc_scroll_left_prop * maximum_div_scroll_left
1038
+ );
1039
+ this.target_dummy_scroll_top = Math.round(
1040
+ onc_scroll_top_prop * maximum_div_scroll_top
1041
+ );
822
1042
  this.$dummy_scroll_div.scrollLeft(this.target_dummy_scroll_left);
823
1043
  this.$dummy_scroll_div.scrollTop(this.target_dummy_scroll_top);
824
1044
  }
825
1045
 
826
- public setScroll(scroll_left:number, scroll_top:number) {
827
- if(this.webgl_unavailable || this.destroyed) {
1046
+ public setScroll(scroll_left: number, scroll_top: number) {
1047
+ if (this.webgl_unavailable || this.destroyed) {
828
1048
  return;
829
1049
  }
830
1050
  this.doSetScroll(scroll_left, scroll_top);
831
1051
  this.setDummyScrollDivScroll();
832
1052
  }
833
1053
 
834
- public setZoom(zoom_x:number, zoom_y:number) {
835
- if(this.webgl_unavailable || this.destroyed) {
1054
+ public setZoom(zoom_x: number, zoom_y: number) {
1055
+ if (this.webgl_unavailable || this.destroyed) {
836
1056
  return;
837
1057
  }
838
1058
  // Update model
@@ -846,9 +1066,9 @@ export default class Oncoprint {
846
1066
  this.minimap_view.setZoom(this.model, this.cell_view);
847
1067
  }
848
1068
 
849
- public setHorzScroll(s:number) {
850
- if(this.webgl_unavailable || this.destroyed) {
851
- return;
1069
+ public setHorzScroll(s: number) {
1070
+ if (this.webgl_unavailable || this.destroyed) {
1071
+ return undefined;
852
1072
  }
853
1073
  // Update model
854
1074
  this.model.setHorzScroll(Math.min(s, this.maxOncoprintScrollLeft()));
@@ -863,9 +1083,9 @@ export default class Oncoprint {
863
1083
 
864
1084
  return this.model.getHorzScroll();
865
1085
  }
866
- public setVertScroll(s:number) {
867
- if(this.webgl_unavailable || this.destroyed) {
868
- return;
1086
+ public setVertScroll(s: number) {
1087
+ if (this.webgl_unavailable || this.destroyed) {
1088
+ return undefined;
869
1089
  }
870
1090
  // Update model
871
1091
  this.model.setVertScroll(Math.min(s, this.maxOncoprintScrollTop()));
@@ -881,31 +1101,43 @@ export default class Oncoprint {
881
1101
 
882
1102
  return this.model.getVertScroll();
883
1103
  }
884
- public setViewport(vp:MinimapViewportSpec) {
885
- if(this.webgl_unavailable || this.destroyed) {
1104
+ public setViewport(vp: MinimapViewportSpec) {
1105
+ if (this.webgl_unavailable || this.destroyed) {
886
1106
  return;
887
1107
  }
888
1108
  // Zoom
889
- const zoom_x = this.model.getHorzZoomToFitCols(this.cell_view.getVisibleAreaWidth(), vp.left_col, vp.right_col);
1109
+ const zoom_x = this.model.getHorzZoomToFitCols(
1110
+ this.cell_view.getVisibleAreaWidth(),
1111
+ vp.left_col,
1112
+ vp.right_col
1113
+ );
890
1114
  this.setZoom(zoom_x, vp.zoom_y);
891
1115
  // Scroll
892
- const scroll_left = Math.min(this.model.getZoomedColumnLeft(this.model.getIdOrder()[vp.left_col]), this.maxOncoprintScrollLeft());
893
- const scroll_top = Math.min(vp.scroll_y_proportion*this.model.getOncoprintHeight(), this.maxOncoprintScrollTop());
1116
+ const scroll_left = Math.min(
1117
+ this.model.getZoomedColumnLeft(
1118
+ this.model.getIdOrder()[vp.left_col]
1119
+ ),
1120
+ this.maxOncoprintScrollLeft()
1121
+ );
1122
+ const scroll_top = Math.min(
1123
+ vp.scroll_y_proportion * this.model.getOncoprintHeight(),
1124
+ this.maxOncoprintScrollTop()
1125
+ );
894
1126
  this.setScroll(scroll_left, scroll_top);
895
1127
 
896
1128
  this.executeHorzZoomCallbacks();
897
1129
  }
898
1130
 
899
- public getTrackData(track_id:TrackId) {
900
- if(this.webgl_unavailable || this.destroyed) {
901
- return;
1131
+ public getTrackData(track_id: TrackId) {
1132
+ if (this.webgl_unavailable || this.destroyed) {
1133
+ return undefined;
902
1134
  }
903
1135
  return this.model.getTrackData(track_id);
904
1136
  }
905
1137
 
906
- public getTrackDataIdKey(track_id:TrackId) {
907
- if(this.webgl_unavailable || this.destroyed) {
908
- return;
1138
+ public getTrackDataIdKey(track_id: TrackId) {
1139
+ if (this.webgl_unavailable || this.destroyed) {
1140
+ return undefined;
909
1141
  }
910
1142
  return this.model.getTrackDataIdKey(track_id);
911
1143
  }
@@ -918,8 +1150,12 @@ export default class Oncoprint {
918
1150
  * @param {string} data_id_key - name of the property of the
919
1151
  * data objects to use as the (column) key
920
1152
  */
921
- public setTrackData(track_id:TrackId, data:Datum[], data_id_key:string&keyof Datum) {
922
- if(this.webgl_unavailable || this.destroyed) {
1153
+ public setTrackData(
1154
+ track_id: TrackId,
1155
+ data: Datum[],
1156
+ data_id_key: string & keyof Datum
1157
+ ) {
1158
+ if (this.webgl_unavailable || this.destroyed) {
923
1159
  return;
924
1160
  }
925
1161
  this.model.setTrackData(track_id, data, data_id_key);
@@ -928,14 +1164,20 @@ export default class Oncoprint {
928
1164
  this.legend_view.setTrackData(this.model);
929
1165
  this.minimap_view.setTrackData(this.model, this.cell_view);
930
1166
 
931
- if (this.model.keep_sorted && this.model.isSortAffected(track_id, "track")) {
1167
+ if (
1168
+ this.model.keep_sorted &&
1169
+ this.model.isSortAffected(track_id, 'track')
1170
+ ) {
932
1171
  this.sort();
933
1172
  }
934
1173
  this.resizeAndOrganizeAfterTimeout();
935
1174
  }
936
1175
 
937
- public setTrackImportantIds(track_id:TrackId, ids:ColumnId[]|undefined) {
938
- if(this.webgl_unavailable || this.destroyed) {
1176
+ public setTrackImportantIds(
1177
+ track_id: TrackId,
1178
+ ids: ColumnId[] | undefined
1179
+ ) {
1180
+ if (this.webgl_unavailable || this.destroyed) {
939
1181
  return;
940
1182
  }
941
1183
  this.model.setTrackImportantIds(track_id, ids);
@@ -944,8 +1186,8 @@ export default class Oncoprint {
944
1186
  this.resizeAndOrganizeAfterTimeout();
945
1187
  }
946
1188
 
947
- public setTrackGroupSortPriority(priority:TrackGroupIndex[]) {
948
- if(this.webgl_unavailable || this.destroyed) {
1189
+ public setTrackGroupSortPriority(priority: TrackGroupIndex[]) {
1190
+ if (this.webgl_unavailable || this.destroyed) {
949
1191
  return;
950
1192
  }
951
1193
  this.model.setTrackGroupSortPriority(priority);
@@ -958,7 +1200,7 @@ export default class Oncoprint {
958
1200
  }
959
1201
 
960
1202
  public resetSortableTracksSortDirection() {
961
- if(this.webgl_unavailable || this.destroyed) {
1203
+ if (this.webgl_unavailable || this.destroyed) {
962
1204
  return;
963
1205
  }
964
1206
  this.model.resetSortableTracksSortDirection(true);
@@ -968,14 +1210,17 @@ export default class Oncoprint {
968
1210
  }
969
1211
  }
970
1212
 
971
- public setTrackSortDirection(track_id:TrackId, dir:TrackSortDirection) {
972
- if(this.webgl_unavailable || this.destroyed) {
973
- return;
1213
+ public setTrackSortDirection(track_id: TrackId, dir: TrackSortDirection) {
1214
+ if (this.webgl_unavailable || this.destroyed) {
1215
+ return undefined;
974
1216
  }
975
1217
  if (this.model.isTrackSortDirectionChangeable(track_id)) {
976
1218
  this.model.setTrackSortDirection(track_id, dir);
977
1219
 
978
- if (this.model.keep_sorted && this.model.isSortAffected(track_id, "track")) {
1220
+ if (
1221
+ this.model.keep_sorted &&
1222
+ this.model.isSortAffected(track_id, 'track')
1223
+ ) {
979
1224
  this.sort();
980
1225
  }
981
1226
 
@@ -988,56 +1233,71 @@ export default class Oncoprint {
988
1233
  return this.model.getTrackSortDirection(track_id);
989
1234
  }
990
1235
 
991
- public setTrackSortComparator(track_id:TrackId, sortCmpFn:TrackSortSpecification<Datum>) {
992
- if(this.webgl_unavailable || this.destroyed) {
1236
+ public setTrackSortComparator(
1237
+ track_id: TrackId,
1238
+ sortCmpFn: TrackSortSpecification<Datum>
1239
+ ) {
1240
+ if (this.webgl_unavailable || this.destroyed) {
993
1241
  return;
994
1242
  }
995
1243
  this.model.setTrackSortComparator(track_id, sortCmpFn);
996
- if (this.model.keep_sorted && this.model.isSortAffected(track_id, "track")) {
1244
+ if (
1245
+ this.model.keep_sorted &&
1246
+ this.model.isSortAffected(track_id, 'track')
1247
+ ) {
997
1248
  this.sort();
998
1249
  }
999
1250
  }
1000
1251
 
1001
- public getTrackSortDirection(track_id:TrackId) {
1002
- if(this.webgl_unavailable || this.destroyed) {
1003
- return;
1252
+ public getTrackSortDirection(track_id: TrackId) {
1253
+ if (this.webgl_unavailable || this.destroyed) {
1254
+ return undefined;
1004
1255
  }
1005
1256
  return this.model.getTrackSortDirection(track_id);
1006
1257
  }
1007
1258
 
1008
- public setTrackInfo(track_id:TrackId, msg:string) {
1009
- if(this.webgl_unavailable || this.destroyed) {
1259
+ public setTrackInfo(track_id: TrackId, msg: string) {
1260
+ if (this.webgl_unavailable || this.destroyed) {
1010
1261
  return;
1011
1262
  }
1012
1263
  this.model.setTrackInfo(track_id, msg);
1013
1264
  this.track_info_view.setTrackInfo(this.model, this.getCellViewHeight);
1014
1265
  }
1015
1266
 
1016
- public setTrackTooltipFn(track_id:TrackId, tooltipFn:TrackTooltipFn<Datum>) {
1017
- if(this.webgl_unavailable || this.destroyed) {
1267
+ public setTrackTooltipFn(
1268
+ track_id: TrackId,
1269
+ tooltipFn: TrackTooltipFn<Datum>
1270
+ ) {
1271
+ if (this.webgl_unavailable || this.destroyed) {
1018
1272
  return;
1019
1273
  }
1020
1274
  this.model.setTrackTooltipFn(track_id, tooltipFn);
1021
1275
  }
1022
1276
 
1023
- public setShowTrackSublabels(show:boolean) {
1277
+ public setShowTrackSublabels(show: boolean) {
1024
1278
  this.model.setShowTrackSublabels(show);
1025
- this.label_view.setShowTrackSublabels(this.model, this.getCellViewHeight);
1279
+ this.label_view.setShowTrackSublabels(
1280
+ this.model,
1281
+ this.getCellViewHeight
1282
+ );
1026
1283
 
1027
1284
  this.resizeAndOrganizeAfterTimeout();
1028
1285
  }
1029
1286
 
1030
- public setTrackShowGaps(track_id:TrackId, showGaps:boolean) {
1287
+ public setTrackShowGaps(track_id: TrackId, showGaps: boolean) {
1031
1288
  this.model.setTrackShowGaps(track_id, showGaps);
1032
1289
  if (this.model.getTrackSortDirection(track_id) === 0 && showGaps) {
1033
1290
  this.setTrackSortDirection(track_id, 1);
1034
1291
  }
1035
- this.track_options_view.setTrackShowGaps(this.model, this.getCellViewHeight);
1292
+ this.track_options_view.setTrackShowGaps(
1293
+ this.model,
1294
+ this.getCellViewHeight
1295
+ );
1036
1296
  this.cell_view.setTrackShowGaps(this.model);
1037
1297
  }
1038
1298
 
1039
1299
  public sort() {
1040
- if(this.webgl_unavailable || this.destroyed) {
1300
+ if (this.webgl_unavailable || this.destroyed) {
1041
1301
  return;
1042
1302
  }
1043
1303
  const self = this;
@@ -1069,8 +1329,8 @@ export default class Oncoprint {
1069
1329
  });
1070
1330
  }
1071
1331
 
1072
- public shareRuleSet(source_track_id:TrackId, target_track_id:TrackId) {
1073
- if(this.webgl_unavailable || this.destroyed) {
1332
+ public shareRuleSet(source_track_id: TrackId, target_track_id: TrackId) {
1333
+ if (this.webgl_unavailable || this.destroyed) {
1074
1334
  return;
1075
1335
  }
1076
1336
  this.model.shareRuleSet(source_track_id, target_track_id);
@@ -1079,8 +1339,8 @@ export default class Oncoprint {
1079
1339
  this.minimap_view.shareRuleSet(this.model, this.cell_view);
1080
1340
  }
1081
1341
 
1082
- public setRuleSet(track_id:TrackId, rule_set_params:RuleSetParams) {
1083
- if(this.webgl_unavailable || this.destroyed) {
1342
+ public setRuleSet(track_id: TrackId, rule_set_params: RuleSetParams) {
1343
+ if (this.webgl_unavailable || this.destroyed) {
1084
1344
  return;
1085
1345
  }
1086
1346
  this.model.setRuleSet(track_id, OncoprintRuleSet(rule_set_params));
@@ -1090,8 +1350,8 @@ export default class Oncoprint {
1090
1350
  this.resizeAndOrganizeAfterTimeout();
1091
1351
  }
1092
1352
 
1093
- public setSortConfig(params:SortConfig) {
1094
- if(this.webgl_unavailable || this.destroyed) {
1353
+ public setSortConfig(params: SortConfig) {
1354
+ if (this.webgl_unavailable || this.destroyed) {
1095
1355
  return;
1096
1356
  }
1097
1357
  this.model.setSortConfig(params);
@@ -1102,8 +1362,8 @@ export default class Oncoprint {
1102
1362
  this.sort();
1103
1363
  }
1104
1364
  }
1105
- public setIdOrder(ids:ColumnId[]) {
1106
- if(this.webgl_unavailable || this.destroyed) {
1365
+ public setIdOrder(ids: ColumnId[]) {
1366
+ if (this.webgl_unavailable || this.destroyed) {
1107
1367
  return;
1108
1368
  }
1109
1369
  // Update model
@@ -1117,22 +1377,31 @@ export default class Oncoprint {
1117
1377
  }
1118
1378
  }
1119
1379
 
1120
- public setTrackGroupHeader(index:TrackGroupIndex, header?:TrackGroupHeader) {
1380
+ public setTrackGroupHeader(
1381
+ index: TrackGroupIndex,
1382
+ header?: TrackGroupHeader
1383
+ ) {
1121
1384
  if (this.webgl_unavailable || this.destroyed) {
1122
1385
  return;
1123
1386
  }
1124
1387
  this.model.setTrackGroupHeader(index, header);
1125
1388
  this.label_view.setTrackGroupHeader(this.model, this.getCellViewHeight);
1126
1389
  this.header_view.render(this.model);
1127
- this.track_info_view.setTrackGroupHeader(this.model, this.getCellViewHeight);
1128
- this.track_options_view.setTrackGroupHeader(this.model, this.getCellViewHeight);
1390
+ this.track_info_view.setTrackGroupHeader(
1391
+ this.model,
1392
+ this.getCellViewHeight
1393
+ );
1394
+ this.track_options_view.setTrackGroupHeader(
1395
+ this.model,
1396
+ this.getCellViewHeight
1397
+ );
1129
1398
  this.minimap_view.setTrackGroupHeader(this.model, this.cell_view);
1130
1399
  this.cell_view.setTrackGroupHeader(this.model);
1131
1400
  this.resizeAndOrganizeAfterTimeout();
1132
1401
  }
1133
1402
 
1134
1403
  public disableInteraction() {
1135
- if(this.webgl_unavailable || this.destroyed) {
1404
+ if (this.webgl_unavailable || this.destroyed) {
1136
1405
  return;
1137
1406
  }
1138
1407
  //this.label_view.disableInteraction();
@@ -1142,7 +1411,7 @@ export default class Oncoprint {
1142
1411
  //this.legend_view.disableInteraction();
1143
1412
  }
1144
1413
  public enableInteraction() {
1145
- if(this.webgl_unavailable || this.destroyed) {
1414
+ if (this.webgl_unavailable || this.destroyed) {
1146
1415
  return;
1147
1416
  }
1148
1417
  //this.label_view.enableInteraction();
@@ -1152,7 +1421,7 @@ export default class Oncoprint {
1152
1421
  //this.legend_view.enableInteraction();
1153
1422
  }
1154
1423
  public suppressRendering() {
1155
- if(this.webgl_unavailable || this.destroyed) {
1424
+ if (this.webgl_unavailable || this.destroyed) {
1156
1425
  return;
1157
1426
  }
1158
1427
  this.model.rendering_suppressed_depth += 1;
@@ -1165,20 +1434,32 @@ export default class Oncoprint {
1165
1434
  this.minimap_view.suppressRendering();
1166
1435
  }
1167
1436
 
1168
- public releaseRendering(onComplete?:()=>void) {
1169
- if(this.webgl_unavailable || this.destroyed) {
1437
+ public releaseRendering(onComplete?: () => void) {
1438
+ if (this.webgl_unavailable || this.destroyed) {
1170
1439
  return;
1171
1440
  }
1172
1441
  if (this.model.rendering_suppressed_depth > 0) {
1173
1442
  this.model.rendering_suppressed_depth -= 1;
1174
- this.model.rendering_suppressed_depth = Math.max(0, this.model.rendering_suppressed_depth);
1443
+ this.model.rendering_suppressed_depth = Math.max(
1444
+ 0,
1445
+ this.model.rendering_suppressed_depth
1446
+ );
1175
1447
  if (this.model.rendering_suppressed_depth === 0) {
1176
1448
  this.model.releaseRendering();
1177
- this.label_view.releaseRendering(this.model, this.getCellViewHeight);
1449
+ this.label_view.releaseRendering(
1450
+ this.model,
1451
+ this.getCellViewHeight
1452
+ );
1178
1453
  this.header_view.releaseRendering(this.model);
1179
1454
  this.cell_view.releaseRendering(this.model);
1180
- this.track_options_view.releaseRendering(this.model, this.getCellViewHeight);
1181
- this.track_info_view.releaseRendering(this.model, this.getCellViewHeight);
1455
+ this.track_options_view.releaseRendering(
1456
+ this.model,
1457
+ this.getCellViewHeight
1458
+ );
1459
+ this.track_info_view.releaseRendering(
1460
+ this.model,
1461
+ this.getCellViewHeight
1462
+ );
1182
1463
  this.legend_view.releaseRendering(this.model);
1183
1464
  this.minimap_view.releaseRendering(this.model, this.cell_view);
1184
1465
  this.resizeAndOrganizeAfterTimeout(onComplete);
@@ -1186,8 +1467,8 @@ export default class Oncoprint {
1186
1467
  }
1187
1468
  }
1188
1469
 
1189
- public triggerPendingResizeAndOrganize(onComplete?:()=>void) {
1190
- if(this.webgl_unavailable || this.destroyed) {
1470
+ public triggerPendingResizeAndOrganize(onComplete?: () => void) {
1471
+ if (this.webgl_unavailable || this.destroyed) {
1191
1472
  return;
1192
1473
  }
1193
1474
  if (this.pending_resize_and_organize) {
@@ -1196,8 +1477,8 @@ export default class Oncoprint {
1196
1477
  }
1197
1478
  }
1198
1479
 
1199
- public hideIds(to_hide:ColumnId[], show_others?:boolean) {
1200
- if(this.webgl_unavailable || this.destroyed) {
1480
+ public hideIds(to_hide: ColumnId[], show_others?: boolean) {
1481
+ if (this.webgl_unavailable || this.destroyed) {
1201
1482
  return;
1202
1483
  }
1203
1484
  this.model.hideIds(to_hide, show_others);
@@ -1205,8 +1486,8 @@ export default class Oncoprint {
1205
1486
  this.minimap_view.hideIds(this.model, this.cell_view);
1206
1487
  }
1207
1488
 
1208
- public hideTrackLegends(track_ids:TrackId[]) {
1209
- if(this.webgl_unavailable || this.destroyed) {
1489
+ public hideTrackLegends(track_ids: TrackId[]) {
1490
+ if (this.webgl_unavailable || this.destroyed) {
1210
1491
  return;
1211
1492
  }
1212
1493
  track_ids = [].concat(track_ids);
@@ -1215,8 +1496,8 @@ export default class Oncoprint {
1215
1496
  this.setLegendTopAfterTimeout();
1216
1497
  }
1217
1498
 
1218
- public showTrackLegends(track_ids:TrackId[]) {
1219
- if(this.webgl_unavailable || this.destroyed) {
1499
+ public showTrackLegends(track_ids: TrackId[]) {
1500
+ if (this.webgl_unavailable || this.destroyed) {
1220
1501
  return;
1221
1502
  }
1222
1503
  track_ids = [].concat(track_ids);
@@ -1225,72 +1506,83 @@ export default class Oncoprint {
1225
1506
  this.setLegendTopAfterTimeout();
1226
1507
  }
1227
1508
 
1228
- public setCellPaddingOn(cell_padding_on:boolean) {
1229
- if(this.webgl_unavailable || this.destroyed) {
1509
+ public setCellPaddingOn(cell_padding_on: boolean) {
1510
+ if (this.webgl_unavailable || this.destroyed) {
1230
1511
  return;
1231
1512
  }
1232
1513
  this.model.setCellPaddingOn(cell_padding_on);
1233
1514
  this.cell_view.setCellPaddingOn(this.model);
1234
1515
  }
1235
1516
 
1236
- public setTrackCustomOptions(track_id:TrackId, options:CustomTrackOption[]|undefined) {
1517
+ public setTrackCustomOptions(
1518
+ track_id: TrackId,
1519
+ options: CustomTrackOption[] | undefined
1520
+ ) {
1237
1521
  this.model.setTrackCustomOptions(track_id, options);
1238
1522
  this.track_options_view.setTrackCustomOptions(this.model);
1239
1523
  }
1240
1524
 
1241
- public setTrackInfoTooltip(track_id:TrackId, $tooltip_elt:JQuery|undefined) {
1525
+ public setTrackInfoTooltip(
1526
+ track_id: TrackId,
1527
+ $tooltip_elt: JQuery | undefined
1528
+ ) {
1242
1529
  this.model.setTrackInfoTooltip(track_id, $tooltip_elt);
1243
1530
  }
1244
1531
 
1245
- public setTrackMovable(track_id:TrackId, movable:boolean) {
1532
+ public setTrackMovable(track_id: TrackId, movable: boolean) {
1246
1533
  this.model.setTrackMovable(track_id, movable);
1247
1534
  this.track_options_view.setTrackMovable(this.model);
1248
1535
  this.label_view.setTrackMovable(this.model);
1249
1536
  }
1250
1537
 
1251
- public setWidth(width:number) {
1538
+ public setWidth(width: number) {
1252
1539
  this.width = width;
1253
1540
 
1254
1541
  this.resizeAndOrganize();
1255
1542
  }
1256
1543
 
1257
- public setColumnLabels(labels:ColumnProp<ColumnLabel>) {
1544
+ public setColumnLabels(labels: ColumnProp<ColumnLabel>) {
1258
1545
  this.model.setColumnLabels(labels);
1259
1546
  this.cell_view.setColumnLabels(this.model);
1260
1547
  this.resizeAndOrganizeAfterTimeout();
1261
1548
  }
1262
1549
 
1263
- public setShowTrackLabels(s:boolean) {
1550
+ public setShowTrackLabels(s: boolean) {
1264
1551
  this.model.setShowTrackLabels(s);
1265
1552
  this.label_view.setShowTrackLabels(this.model, this.getCellViewHeight);
1266
1553
  this.resizeAndOrganizeAfterTimeout();
1267
1554
  }
1268
1555
 
1269
- public onCellMouseOver(callback:CellMouseOverCallback) {
1556
+ public onCellMouseOver(callback: CellMouseOverCallback) {
1270
1557
  this.cell_mouse_over_callbacks.push(callback);
1271
1558
  }
1272
1559
 
1273
- public onCellClick(callback:CellClickCallback) {
1560
+ public onCellClick(callback: CellClickCallback) {
1274
1561
  this.cell_click_callbacks.push(callback);
1275
1562
  }
1276
1563
 
1277
- public toSVG(with_background?:boolean) {
1278
- if(this.webgl_unavailable || this.destroyed) {
1279
- return;
1564
+ public toSVG(with_background?: boolean) {
1565
+ if (this.webgl_unavailable || this.destroyed) {
1566
+ return undefined;
1280
1567
  }
1281
1568
  // Returns svg DOM element
1282
1569
  const root = svgfactory.svg(10, 10);
1283
1570
  this.$ctr.append(root);
1284
- const everything_group = svgfactory.group(0,0);
1571
+ const everything_group = svgfactory.group(0, 0);
1285
1572
  root.appendChild(everything_group);
1286
1573
 
1287
- const bgrect = svgfactory.bgrect(10,10,[255,255,255,1]);
1574
+ const bgrect = svgfactory.bgrect(10, 10, [255, 255, 255, 1]);
1288
1575
 
1289
1576
  if (with_background) {
1290
1577
  everything_group.appendChild(bgrect);
1291
1578
  }
1292
1579
 
1293
- const label_view_group = this.label_view.toSVGGroup(this.model, true, 0, 0);
1580
+ const label_view_group = this.label_view.toSVGGroup(
1581
+ this.model,
1582
+ true,
1583
+ 0,
1584
+ 0
1585
+ );
1294
1586
  everything_group.appendChild(label_view_group);
1295
1587
 
1296
1588
  const header_view_group = this.header_view.toSVGGroup(this.model, 0, 0);
@@ -1299,14 +1591,31 @@ export default class Oncoprint {
1299
1591
  const label_view_width = label_view_group.getBBox().width;
1300
1592
  const label_view_padding = label_view_width > 0 ? 30 : 0;
1301
1593
  const track_info_group_x = label_view_width + label_view_padding;
1302
- const track_info_group = this.track_info_view.toSVGGroup(this.model, track_info_group_x, 0);
1594
+ const track_info_group = this.track_info_view.toSVGGroup(
1595
+ this.model,
1596
+ track_info_group_x,
1597
+ 0
1598
+ );
1303
1599
  everything_group.appendChild(track_info_group);
1304
1600
 
1305
- const cell_view_group_x = track_info_group_x + track_info_group.getBBox().width + 10;
1306
- const cell_view_group = this.cell_view.toSVGGroup(this.model, cell_view_group_x, 0);
1601
+ const cell_view_group_x =
1602
+ track_info_group_x + track_info_group.getBBox().width + 10;
1603
+ const cell_view_group = this.cell_view.toSVGGroup(
1604
+ this.model,
1605
+ cell_view_group_x,
1606
+ 0
1607
+ );
1307
1608
  everything_group.appendChild(cell_view_group);
1308
1609
 
1309
- everything_group.appendChild(this.legend_view.toSVGGroup(this.model, 0, cell_view_group.getBBox().y + cell_view_group.getBBox().height+20));
1610
+ everything_group.appendChild(
1611
+ this.legend_view.toSVGGroup(
1612
+ this.model,
1613
+ 0,
1614
+ cell_view_group.getBBox().y +
1615
+ cell_view_group.getBBox().height +
1616
+ 20
1617
+ )
1618
+ );
1310
1619
 
1311
1620
  const everything_box = everything_group.getBBox();
1312
1621
  const everything_width = everything_box.x + everything_box.width;
@@ -1323,9 +1632,12 @@ export default class Oncoprint {
1323
1632
  return root;
1324
1633
  }
1325
1634
 
1326
- public toCanvas(callback:(canvas:HTMLCanvasElement, truncated:boolean)=>void, resolution?:number) {
1327
- if(this.webgl_unavailable || this.destroyed) {
1328
- return;
1635
+ public toCanvas(
1636
+ callback: (canvas: HTMLCanvasElement, truncated: boolean) => void,
1637
+ resolution?: number
1638
+ ) {
1639
+ if (this.webgl_unavailable || this.destroyed) {
1640
+ return undefined;
1329
1641
  }
1330
1642
  // Returns data url, requires IE >= 11
1331
1643
 
@@ -1337,17 +1649,26 @@ export default class Oncoprint {
1337
1649
  const canvas = document.createElement('canvas');
1338
1650
 
1339
1651
  resolution = resolution || 1;
1340
- const truncated = width*resolution > MAX_CANVAS_SIDE || height*resolution > MAX_CANVAS_SIDE;
1341
- canvas.setAttribute('width', Math.min(MAX_CANVAS_SIDE, width*resolution).toString());
1342
- canvas.setAttribute('height', Math.min(MAX_CANVAS_SIDE, height*resolution).toString());
1652
+ const truncated =
1653
+ width * resolution > MAX_CANVAS_SIDE ||
1654
+ height * resolution > MAX_CANVAS_SIDE;
1655
+ canvas.setAttribute(
1656
+ 'width',
1657
+ Math.min(MAX_CANVAS_SIDE, width * resolution).toString()
1658
+ );
1659
+ canvas.setAttribute(
1660
+ 'height',
1661
+ Math.min(MAX_CANVAS_SIDE, height * resolution).toString()
1662
+ );
1343
1663
 
1344
- const container = document.createElement("div");
1664
+ const container = document.createElement('div');
1345
1665
  container.appendChild(svg);
1346
1666
  const svg_data_str = container.innerHTML;
1347
- const svg_data_uri = "data:image/svg+xml;base64,"+window.btoa(svg_data_str);
1667
+ const svg_data_uri =
1668
+ 'data:image/svg+xml;base64,' + window.btoa(svg_data_str);
1348
1669
 
1349
1670
  const ctx = canvas.getContext('2d');
1350
- ctx.setTransform(resolution,0,0,resolution,0,0);
1671
+ ctx.setTransform(resolution, 0, 0, resolution, 0, 0);
1351
1672
  const img = new Image();
1352
1673
 
1353
1674
  img.onload = function() {
@@ -1355,15 +1676,15 @@ export default class Oncoprint {
1355
1676
  callback(canvas, truncated);
1356
1677
  };
1357
1678
  img.onerror = function() {
1358
- console.log("IMAGE LOAD ERROR");
1679
+ console.log('IMAGE LOAD ERROR');
1359
1680
  };
1360
1681
 
1361
1682
  img.src = svg_data_uri;
1362
1683
  return img;
1363
1684
  }
1364
1685
 
1365
- public toDataUrl(callback:(dataURL:string)=>void) {
1366
- if(this.webgl_unavailable || this.destroyed) {
1686
+ public toDataUrl(callback: (dataURL: string) => void) {
1687
+ if (this.webgl_unavailable || this.destroyed) {
1367
1688
  return;
1368
1689
  }
1369
1690
  this.toCanvas(function(canvas) {
@@ -1371,15 +1692,15 @@ export default class Oncoprint {
1371
1692
  });
1372
1693
  }
1373
1694
 
1374
- public highlightTrackLabelOnly(track_id:TrackId) {
1375
- if(this.webgl_unavailable || this.destroyed) {
1695
+ public highlightTrackLabelOnly(track_id: TrackId) {
1696
+ if (this.webgl_unavailable || this.destroyed) {
1376
1697
  return;
1377
1698
  }
1378
1699
  this.label_view.highlightTrackLabelOnly(track_id, this.model);
1379
1700
  }
1380
1701
 
1381
- public setHighlightedTracks(track_ids:TrackId[]) {
1382
- if(this.webgl_unavailable || this.destroyed) {
1702
+ public setHighlightedTracks(track_ids: TrackId[]) {
1703
+ if (this.webgl_unavailable || this.destroyed) {
1383
1704
  return;
1384
1705
  }
1385
1706
  this.model.setHighlightedTracks(track_ids);
@@ -1387,45 +1708,45 @@ export default class Oncoprint {
1387
1708
  this.cell_view.setHighlightedTracks(this.model);
1388
1709
  }
1389
1710
 
1390
- public setHighlightedIds(ids:ColumnId[]) {
1391
- if(this.webgl_unavailable || this.destroyed) {
1711
+ public setHighlightedIds(ids: ColumnId[]) {
1712
+ if (this.webgl_unavailable || this.destroyed) {
1392
1713
  return;
1393
1714
  }
1394
1715
  this.model.setHighlightedIds(ids);
1395
1716
  this.cell_view.setHighlightedIds(this.model);
1396
1717
  }
1397
1718
 
1398
- public getIdOrder(all?:boolean) {
1399
- if(this.webgl_unavailable || this.destroyed) {
1400
- return;
1719
+ public getIdOrder(all?: boolean) {
1720
+ if (this.webgl_unavailable || this.destroyed) {
1721
+ return undefined;
1401
1722
  }
1402
1723
  return this.model.getIdOrder(all);
1403
1724
  }
1404
1725
 
1405
- public setIdClipboardContents(array:ColumnId[]) {
1406
- if(this.webgl_unavailable || this.destroyed) {
1726
+ public setIdClipboardContents(array: ColumnId[]) {
1727
+ if (this.webgl_unavailable || this.destroyed) {
1407
1728
  return;
1408
1729
  }
1409
1730
  this.id_clipboard = array.slice();
1410
- for (let i=0; i<this.clipboard_change_callbacks.length; i++) {
1731
+ for (let i = 0; i < this.clipboard_change_callbacks.length; i++) {
1411
1732
  this.clipboard_change_callbacks[i](array);
1412
1733
  }
1413
1734
  }
1414
1735
  public getIdClipboardContents() {
1415
- if(this.webgl_unavailable || this.destroyed) {
1416
- return;
1736
+ if (this.webgl_unavailable || this.destroyed) {
1737
+ return undefined;
1417
1738
  }
1418
1739
  return this.id_clipboard.slice();
1419
1740
  }
1420
- public onClipboardChange(callback:ClipboardChangeCallback) {
1421
- if(this.webgl_unavailable || this.destroyed) {
1741
+ public onClipboardChange(callback: ClipboardChangeCallback) {
1742
+ if (this.webgl_unavailable || this.destroyed) {
1422
1743
  return;
1423
1744
  }
1424
1745
  this.clipboard_change_callbacks.push(callback);
1425
1746
  }
1426
1747
 
1427
1748
  public destroy() {
1428
- if(this.webgl_unavailable || this.destroyed) {
1749
+ if (this.webgl_unavailable || this.destroyed) {
1429
1750
  return;
1430
1751
  }
1431
1752
  this.cell_view.destroy();
@@ -1436,7 +1757,7 @@ export default class Oncoprint {
1436
1757
  }
1437
1758
 
1438
1759
  public clearMouseOverEffects() {
1439
- if(this.webgl_unavailable || this.destroyed) {
1760
+ if (this.webgl_unavailable || this.destroyed) {
1440
1761
  return;
1441
1762
  }
1442
1763
  this.cell_view.clearOverlay();