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
@@ -2,42 +2,46 @@ import gl_matrix from 'gl-matrix';
2
2
  import OncoprintZoomSlider from './oncoprintzoomslider';
3
3
  import $ from 'jquery';
4
4
  import zoomToFitIcon from '../img/zoomtofit.svg';
5
- import OncoprintModel, {ColumnIndex, TrackId} from "./oncoprintmodel";
5
+ import OncoprintModel, { ColumnIndex, TrackId } from './oncoprintmodel';
6
6
  import OncoprintWebGLCellView, {
7
7
  OncoprintShaderProgram,
8
- OncoprintTrackBuffer, OncoprintVertexTrackBuffer,
9
- OncoprintWebGLContext
10
- } from "./oncoprintwebglcellview";
8
+ OncoprintTrackBuffer,
9
+ OncoprintVertexTrackBuffer,
10
+ OncoprintWebGLContext,
11
+ } from './oncoprintwebglcellview';
11
12
  import MouseMoveEvent = JQuery.MouseMoveEvent;
12
- import {clamp, cloneShallow} from "./utils";
13
- import _ from "lodash";
13
+ import { clamp, cloneShallow } from './utils';
14
+ import _ from 'lodash';
14
15
 
15
16
  export type MinimapViewportSpec = {
16
- left_col:ColumnIndex; // leftmost col included in viewport
17
- right_col:ColumnIndex; // col at the boundary of viewport, first col to the right of viewport
18
- scroll_y_proportion:number; // between 0 and 1
19
- zoom_y:number; // between 0 and 1
17
+ left_col: ColumnIndex; // leftmost col included in viewport
18
+ right_col: ColumnIndex; // col at the boundary of viewport, first col to the right of viewport
19
+ scroll_y_proportion: number; // between 0 and 1
20
+ zoom_y: number; // between 0 and 1
20
21
  };
21
22
 
22
23
  type OverlayRectParams = {
23
- top:number;
24
- left_col:ColumnIndex;
25
- right_col:ColumnIndex;
26
- height:number;
24
+ top: number;
25
+ left_col: ColumnIndex;
26
+ right_col: ColumnIndex;
27
+ height: number;
27
28
  };
28
29
 
29
30
  class OverlayRectSpec {
30
31
  constructor(
31
- private params:OverlayRectParams,
32
- private getCellWidth:()=>number
32
+ private params: OverlayRectParams,
33
+ private getCellWidth: () => number
33
34
  ) {}
34
35
 
35
- public setParams(p:OverlayRectParams) {
36
+ public setParams(p: OverlayRectParams) {
36
37
  this.params = p;
37
38
  }
38
39
 
39
40
  public clone() {
40
- return new OverlayRectSpec(cloneShallow(this.params), this.getCellWidth);
41
+ return new OverlayRectSpec(
42
+ cloneShallow(this.params),
43
+ this.getCellWidth
44
+ );
41
45
  }
42
46
 
43
47
  public get left_col() {
@@ -74,56 +78,68 @@ class OverlayRectSpec {
74
78
  }
75
79
 
76
80
  export default class OncoprintMinimapView {
77
- private handleContextLost:()=>void;
81
+ private handleContextLost: () => void;
78
82
  private layout_numbers = {
79
- window_width:-1,
80
- window_height:-1,
81
- vertical_zoom_area_width:-1,
82
- horizontal_zoom_area_height:-1,
83
- padding:-1,
84
- window_bar_height:-1,
85
- canvas_left:-1,
86
- canvas_top:-1
83
+ window_width: -1,
84
+ window_height: -1,
85
+ vertical_zoom_area_width: -1,
86
+ horizontal_zoom_area_height: -1,
87
+ padding: -1,
88
+ window_bar_height: -1,
89
+ canvas_left: -1,
90
+ canvas_top: -1,
87
91
  };
88
- private current_rect:OverlayRectSpec;
89
-
90
- private $window_bar:JQuery;
91
- private $close_btn:JQuery;
92
- private horizontal_zoom:OncoprintZoomSlider;
93
- private vertical_zoom:OncoprintZoomSlider;
94
-
95
- private ctx:OncoprintWebGLContext|null;
96
- private ext:ANGLE_instanced_arrays | null;
97
- private overlay_ctx:CanvasRenderingContext2D|null;
98
- private pMatrix:any;
99
- private mvMatrix:any;
100
- private shader_program:OncoprintShaderProgram;
101
-
102
- private resize_hover:"r"|"l"|"t"|"b"|"tl"|"br"|"bl"|"tr"|false = false;
92
+ private current_rect: OverlayRectSpec;
93
+
94
+ private $window_bar: JQuery;
95
+ private $close_btn: JQuery;
96
+ private horizontal_zoom: OncoprintZoomSlider;
97
+ private vertical_zoom: OncoprintZoomSlider;
98
+
99
+ private ctx: OncoprintWebGLContext | null;
100
+ private ext: ANGLE_instanced_arrays | null;
101
+ private overlay_ctx: CanvasRenderingContext2D | null;
102
+ private pMatrix: any;
103
+ private mvMatrix: any;
104
+ private shader_program: OncoprintShaderProgram;
105
+
106
+ private resize_hover:
107
+ | 'r'
108
+ | 'l'
109
+ | 't'
110
+ | 'b'
111
+ | 'tl'
112
+ | 'br'
113
+ | 'bl'
114
+ | 'tr'
115
+ | false = false;
103
116
 
104
117
  private rendering_suppressed = false;
105
118
  private visible = false;
106
119
 
107
120
  constructor(
108
- private $div:JQuery,
109
- private $canvas:JQuery<HTMLCanvasElement>,
110
- private $overlay_canvas:JQuery<HTMLCanvasElement>,
111
- model:OncoprintModel,
112
- cell_view:OncoprintWebGLCellView,
113
- width:number,
114
- height:number,
115
- drag_callback:(x:number, y:number)=>void,
116
- viewport_callback:(vp:MinimapViewportSpec)=>void,
117
- horz_zoom_callback:(z:number)=>void,
118
- vert_zoom_callback:(z:number)=>void,
119
- zoom_to_fit_callback:()=>void,
120
- close_callback:()=>void
121
+ private $div: JQuery,
122
+ private $canvas: JQuery<HTMLCanvasElement>,
123
+ private $overlay_canvas: JQuery<HTMLCanvasElement>,
124
+ model: OncoprintModel,
125
+ cell_view: OncoprintWebGLCellView,
126
+ width: number,
127
+ height: number,
128
+ drag_callback: (x: number, y: number) => void,
129
+ viewport_callback: (vp: MinimapViewportSpec) => void,
130
+ horz_zoom_callback: (z: number) => void,
131
+ vert_zoom_callback: (z: number) => void,
132
+ zoom_to_fit_callback: () => void,
133
+ close_callback: () => void
121
134
  ) {
122
135
  this.$div = $div;
123
136
  this.$canvas = $canvas;
124
137
  this.$overlay_canvas = $overlay_canvas;
125
138
 
126
- this.current_rect = new OverlayRectSpec({ top:0, left_col: 0, right_col:0, height:0}, ()=>model.getCellWidth(true)*this.getZoom(model).x)
139
+ this.current_rect = new OverlayRectSpec(
140
+ { top: 0, left_col: 0, right_col: 0, height: 0 },
141
+ () => model.getCellWidth(true) * this.getZoom(model).x
142
+ );
127
143
 
128
144
  const self = this;
129
145
  const padding = 4;
@@ -131,18 +147,26 @@ export default class OncoprintMinimapView {
131
147
  const horizontal_zoom_area_height = 20;
132
148
  const window_bar_height = 20;
133
149
 
134
- this.handleContextLost = (function() {
150
+ this.handleContextLost = function() {
135
151
  // catch when context lost and refresh it
136
152
  // eg if cell view uses a ton of contexts, then browser clears oldest context,
137
153
  // then the minimap would be empty until we refresh the context and rerender
138
154
  self.drawOncoprintAndOverlayRect(model, cell_view);
139
- }).bind(this);
155
+ }.bind(this);
140
156
 
141
- this.$canvas[0].addEventListener("webglcontextlost", this.handleContextLost);
157
+ this.$canvas[0].addEventListener(
158
+ 'webglcontextlost',
159
+ this.handleContextLost
160
+ );
142
161
 
143
162
  this.layout_numbers = {
144
163
  window_width: padding + width + padding + vertical_zoom_area_width,
145
- window_height: window_bar_height + padding + height + padding + horizontal_zoom_area_height,
164
+ window_height:
165
+ window_bar_height +
166
+ padding +
167
+ height +
168
+ padding +
169
+ horizontal_zoom_area_height,
146
170
  vertical_zoom_area_width: vertical_zoom_area_width,
147
171
  horizontal_zoom_area_height: horizontal_zoom_area_height,
148
172
  padding: padding,
@@ -151,181 +175,285 @@ export default class OncoprintMinimapView {
151
175
  canvas_top: window_bar_height + padding,
152
176
  };
153
177
 
154
- this.$div.css({'min-width': this.layout_numbers.window_width,
178
+ this.$div.css({
179
+ 'min-width': this.layout_numbers.window_width,
155
180
  'min-height': this.layout_numbers.window_height,
156
- 'outline':'solid 1px black', 'background-color':'#ffffff'});
181
+ outline: 'solid 1px black',
182
+ 'background-color': '#ffffff',
183
+ });
157
184
 
158
- this.$window_bar = $('<div>').css({'position':'absolute',
159
- 'min-width': this.layout_numbers.window_width,
160
- 'min-height': this.layout_numbers.window_bar_height,
161
- 'background-color':'#cccccc'})
185
+ this.$window_bar = $('<div>')
186
+ .css({
187
+ position: 'absolute',
188
+ 'min-width': this.layout_numbers.window_width,
189
+ 'min-height': this.layout_numbers.window_bar_height,
190
+ 'background-color': '#cccccc',
191
+ })
162
192
  .appendTo(this.$div);
163
193
 
164
- this.$close_btn = $('<div>').css({'position':'absolute',
165
- 'top': 3,
166
- 'left': 3,
167
- 'min-width': this.layout_numbers.window_bar_height - 6,
168
- 'min-height': this.layout_numbers.window_bar_height - 6,
169
- 'cursor': 'pointer'})
194
+ this.$close_btn = $('<div>')
195
+ .css({
196
+ position: 'absolute',
197
+ top: 3,
198
+ left: 3,
199
+ 'min-width': this.layout_numbers.window_bar_height - 6,
200
+ 'min-height': this.layout_numbers.window_bar_height - 6,
201
+ cursor: 'pointer',
202
+ })
170
203
  .appendTo(this.$div);
171
- $('<span>').addClass("icon fa fa-times-circle").css('font-size', (this.layout_numbers.window_bar_height - 6) + "px").appendTo(this.$close_btn);
204
+ $('<span>')
205
+ .addClass('icon fa fa-times-circle')
206
+ .css('font-size', this.layout_numbers.window_bar_height - 6 + 'px')
207
+ .appendTo(this.$close_btn);
172
208
 
173
- this.$close_btn.click(close_callback || function(){});
209
+ this.$close_btn.click(close_callback || function() {});
174
210
 
175
211
  this.$canvas[0].width = width;
176
212
  this.$canvas[0].height = height;
177
- this.$canvas.css({'top': this.layout_numbers.canvas_top, 'left':this.layout_numbers.canvas_left});
213
+ this.$canvas.css({
214
+ top: this.layout_numbers.canvas_top,
215
+ left: this.layout_numbers.canvas_left,
216
+ });
178
217
  this.$overlay_canvas[0].width = width;
179
218
  this.$overlay_canvas[0].height = width;
180
- this.$overlay_canvas.css({'top': this.layout_numbers.canvas_top, 'left':this.layout_numbers.canvas_left, 'outline':'solid 1px #444444'});
181
-
182
- this.horizontal_zoom = new OncoprintZoomSlider(this.$div, {'btn_size': this.layout_numbers.horizontal_zoom_area_height - padding,
183
- 'horizontal': true,
184
- 'width': width,
185
- 'init_val': model.getHorzZoom(),
186
- 'left': padding,
187
- 'top': this.layout_numbers.canvas_top + height + padding,
188
- 'onChange': function(val) { horz_zoom_callback(val); }});
189
- this.vertical_zoom = new OncoprintZoomSlider(this.$div, {'btn_size': this.layout_numbers.vertical_zoom_area_width - padding,
190
- 'vertical': true,
191
- 'height': height,
192
- 'init_val': model.getVertZoom(),
193
- 'left': this.layout_numbers.canvas_left + width + padding,
194
- 'top': this.layout_numbers.window_bar_height + padding,
195
- 'onChange': function(val) { vert_zoom_callback(val); }});
219
+ this.$overlay_canvas.css({
220
+ top: this.layout_numbers.canvas_top,
221
+ left: this.layout_numbers.canvas_left,
222
+ outline: 'solid 1px #444444',
223
+ });
224
+
225
+ this.horizontal_zoom = new OncoprintZoomSlider(this.$div, {
226
+ btn_size: this.layout_numbers.horizontal_zoom_area_height - padding,
227
+ horizontal: true,
228
+ width: width,
229
+ init_val: model.getHorzZoom(),
230
+ left: padding,
231
+ top: this.layout_numbers.canvas_top + height + padding,
232
+ onChange: function(val) {
233
+ horz_zoom_callback(val);
234
+ },
235
+ });
236
+ this.vertical_zoom = new OncoprintZoomSlider(this.$div, {
237
+ btn_size: this.layout_numbers.vertical_zoom_area_width - padding,
238
+ vertical: true,
239
+ height: height,
240
+ init_val: model.getVertZoom(),
241
+ left: this.layout_numbers.canvas_left + width + padding,
242
+ top: this.layout_numbers.window_bar_height + padding,
243
+ onChange: function(val) {
244
+ vert_zoom_callback(val);
245
+ },
246
+ });
196
247
 
197
248
  (function setUpZoomToFitButton() {
198
- const btn_height = self.layout_numbers.horizontal_zoom_area_height - padding;
199
- const btn_width = self.layout_numbers.vertical_zoom_area_width - padding;
200
- const $btn = $('<div>').css({'position': 'absolute',
201
- 'min-height': btn_height,
202
- 'min-width': btn_width,
203
- 'outline': 'solid 1px black',
204
- 'left': self.layout_numbers.canvas_left + width + padding,
205
- 'top': self.layout_numbers.canvas_top + height + padding,
206
- 'background-size': (btn_width - 4) + 'px '+ (btn_height - 4) + 'px',
207
- 'background-position': '2px 2px',
208
- 'background-image': 'url('+zoomToFitIcon+')',
209
- 'background-repeat': 'no-repeat',
210
- 'cursor': 'pointer'}).addClass('oncoprint-zoomtofit-btn')
249
+ const btn_height =
250
+ self.layout_numbers.horizontal_zoom_area_height - padding;
251
+ const btn_width =
252
+ self.layout_numbers.vertical_zoom_area_width - padding;
253
+ const $btn = $('<div>')
254
+ .css({
255
+ position: 'absolute',
256
+ height: btn_height,
257
+ width: btn_width,
258
+ outline: 'solid 1px black',
259
+ left: self.layout_numbers.canvas_left + width + padding,
260
+ top: self.layout_numbers.canvas_top + height + padding,
261
+ cursor: 'pointer',
262
+ })
263
+ .addClass('oncoprint-zoomtofit-btn')
211
264
  .appendTo($div);
212
- $btn.hover(function () {
213
- $(this).css({'background-color': '#cccccc'});
214
- }, function () {
215
- $(this).css({'background-color': '#ffffff'});
216
- });
265
+ $(`<img src="${zoomToFitIcon}" />`)
266
+ .css({
267
+ height: btn_height - 4,
268
+ width: btn_width - 4,
269
+ 'margin-top': -6,
270
+ 'margin-left': 2,
271
+ })
272
+ .appendTo($btn);
273
+ $btn.hover(
274
+ function() {
275
+ $(this).css({ 'background-color': '#cccccc' });
276
+ },
277
+ function() {
278
+ $(this).css({ 'background-color': '#ffffff' });
279
+ }
280
+ );
217
281
 
218
282
  zoom_to_fit_callback = zoom_to_fit_callback || function() {};
219
283
  $btn.click(zoom_to_fit_callback);
220
284
  })();
221
285
  this.getWebGLContextAndSetUpMatrices();
222
286
  this.setUpShaders();
223
- this.overlay_ctx = $overlay_canvas[0].getContext("2d");
287
+ this.overlay_ctx = $overlay_canvas[0].getContext('2d');
224
288
 
225
289
  // Set up dragging
226
290
  const resize_hit_zone = 5;
227
- function mouseInRectDragZone(x:number, y:number) {
228
- return ((x >= self.current_rect.left + resize_hit_zone) &&
229
- (x <= self.current_rect.left + self.current_rect.width - resize_hit_zone) &&
230
- (y >= self.current_rect.top + resize_hit_zone) &&
231
- (y <= self.current_rect.top + self.current_rect.height - resize_hit_zone));
291
+ function mouseInRectDragZone(x: number, y: number) {
292
+ return (
293
+ x >= self.current_rect.left + resize_hit_zone &&
294
+ x <=
295
+ self.current_rect.left +
296
+ self.current_rect.width -
297
+ resize_hit_zone &&
298
+ y >= self.current_rect.top + resize_hit_zone &&
299
+ y <=
300
+ self.current_rect.top +
301
+ self.current_rect.height -
302
+ resize_hit_zone
303
+ );
232
304
  }
233
305
 
234
- function mouseInsideRectHitZone(x:number, y:number) {
235
- return (x >= self.current_rect.left - resize_hit_zone) &&
236
- (x <= self.current_rect.left + self.current_rect.width + resize_hit_zone) &&
237
- (y >= self.current_rect.top - resize_hit_zone) &&
238
- (y <= self.current_rect.top + self.current_rect.height + resize_hit_zone);
306
+ function mouseInsideRectHitZone(x: number, y: number) {
307
+ return (
308
+ x >= self.current_rect.left - resize_hit_zone &&
309
+ x <=
310
+ self.current_rect.left +
311
+ self.current_rect.width +
312
+ resize_hit_zone &&
313
+ y >= self.current_rect.top - resize_hit_zone &&
314
+ y <=
315
+ self.current_rect.top +
316
+ self.current_rect.height +
317
+ resize_hit_zone
318
+ );
239
319
  }
240
320
 
241
- function mouseInRightHorzResizeZone(x:number, y:number) {
242
- return !mouseInTopLeftResizeZone(x,y) && !mouseInTopRightResizeZone(x,y) &&
243
- !mouseInBottomLeftResizeZone(x,y) && !mouseInBottomRightResizeZone(x,y) &&
244
- mouseInsideRectHitZone(x,y) &&
245
- (Math.abs(x - (self.current_rect.left + self.current_rect.width)) < resize_hit_zone);
321
+ function mouseInRightHorzResizeZone(x: number, y: number) {
322
+ return (
323
+ !mouseInTopLeftResizeZone(x, y) &&
324
+ !mouseInTopRightResizeZone(x, y) &&
325
+ !mouseInBottomLeftResizeZone(x, y) &&
326
+ !mouseInBottomRightResizeZone(x, y) &&
327
+ mouseInsideRectHitZone(x, y) &&
328
+ Math.abs(
329
+ x - (self.current_rect.left + self.current_rect.width)
330
+ ) < resize_hit_zone
331
+ );
246
332
  }
247
333
 
248
- function mouseInLeftHorzResizeZone(x:number, y:number) {
249
- return !mouseInTopLeftResizeZone(x,y) && !mouseInTopRightResizeZone(x,y) &&
250
- !mouseInBottomLeftResizeZone(x,y) && !mouseInBottomRightResizeZone(x,y) &&
251
- mouseInsideRectHitZone(x,y) &&
252
- (Math.abs(x - self.current_rect.left) < resize_hit_zone);
334
+ function mouseInLeftHorzResizeZone(x: number, y: number) {
335
+ return (
336
+ !mouseInTopLeftResizeZone(x, y) &&
337
+ !mouseInTopRightResizeZone(x, y) &&
338
+ !mouseInBottomLeftResizeZone(x, y) &&
339
+ !mouseInBottomRightResizeZone(x, y) &&
340
+ mouseInsideRectHitZone(x, y) &&
341
+ Math.abs(x - self.current_rect.left) < resize_hit_zone
342
+ );
253
343
  }
254
344
 
255
- function mouseInTopVertResizeZone(x:number, y:number) {
256
- return !mouseInTopLeftResizeZone(x,y) && !mouseInTopRightResizeZone(x,y) &&
257
- !mouseInBottomLeftResizeZone(x,y) && !mouseInBottomRightResizeZone(x,y) &&
258
- mouseInsideRectHitZone(x,y) &&
259
- (Math.abs(y - self.current_rect.top) < resize_hit_zone);
345
+ function mouseInTopVertResizeZone(x: number, y: number) {
346
+ return (
347
+ !mouseInTopLeftResizeZone(x, y) &&
348
+ !mouseInTopRightResizeZone(x, y) &&
349
+ !mouseInBottomLeftResizeZone(x, y) &&
350
+ !mouseInBottomRightResizeZone(x, y) &&
351
+ mouseInsideRectHitZone(x, y) &&
352
+ Math.abs(y - self.current_rect.top) < resize_hit_zone
353
+ );
260
354
  }
261
355
 
262
- function mouseInBottomVertResizeZone(x:number, y:number) {
263
- return !mouseInTopLeftResizeZone(x, y) && !mouseInTopRightResizeZone(x, y) &&
264
- !mouseInBottomLeftResizeZone(x, y) && !mouseInBottomRightResizeZone(x, y) &&
265
- mouseInsideRectHitZone(x,y) &&
266
- (Math.abs(y - (self.current_rect.top + self.current_rect.height)) < resize_hit_zone);
356
+ function mouseInBottomVertResizeZone(x: number, y: number) {
357
+ return (
358
+ !mouseInTopLeftResizeZone(x, y) &&
359
+ !mouseInTopRightResizeZone(x, y) &&
360
+ !mouseInBottomLeftResizeZone(x, y) &&
361
+ !mouseInBottomRightResizeZone(x, y) &&
362
+ mouseInsideRectHitZone(x, y) &&
363
+ Math.abs(
364
+ y - (self.current_rect.top + self.current_rect.height)
365
+ ) < resize_hit_zone
366
+ );
267
367
  }
268
368
 
269
- function mouseInTopLeftResizeZone(x:number, y:number) {
270
- return (Math.abs(y - self.current_rect.top) < resize_hit_zone) &&
271
- (Math.abs(x - self.current_rect.left) < resize_hit_zone);
369
+ function mouseInTopLeftResizeZone(x: number, y: number) {
370
+ return (
371
+ Math.abs(y - self.current_rect.top) < resize_hit_zone &&
372
+ Math.abs(x - self.current_rect.left) < resize_hit_zone
373
+ );
272
374
  }
273
375
 
274
- function mouseInBottomLeftResizeZone(x:number, y:number) {
275
- return (Math.abs(y - (self.current_rect.top + self.current_rect.height)) < resize_hit_zone) &&
276
- (Math.abs(x - self.current_rect.left) < resize_hit_zone);
376
+ function mouseInBottomLeftResizeZone(x: number, y: number) {
377
+ return (
378
+ Math.abs(
379
+ y - (self.current_rect.top + self.current_rect.height)
380
+ ) < resize_hit_zone &&
381
+ Math.abs(x - self.current_rect.left) < resize_hit_zone
382
+ );
277
383
  }
278
384
 
279
- function mouseInTopRightResizeZone(x:number, y:number) {
280
- return (Math.abs(y - self.current_rect.top) < resize_hit_zone) &&
281
- (Math.abs(x - (self.current_rect.left + self.current_rect.width)) < resize_hit_zone);
385
+ function mouseInTopRightResizeZone(x: number, y: number) {
386
+ return (
387
+ Math.abs(y - self.current_rect.top) < resize_hit_zone &&
388
+ Math.abs(
389
+ x - (self.current_rect.left + self.current_rect.width)
390
+ ) < resize_hit_zone
391
+ );
282
392
  }
283
393
 
284
- function mouseInBottomRightResizeZone(x:number, y:number) {
285
- return (Math.abs(y - (self.current_rect.top + self.current_rect.height)) < resize_hit_zone) &&
286
- (Math.abs(x - (self.current_rect.left + self.current_rect.width)) < resize_hit_zone);
394
+ function mouseInBottomRightResizeZone(x: number, y: number) {
395
+ return (
396
+ Math.abs(
397
+ y - (self.current_rect.top + self.current_rect.height)
398
+ ) < resize_hit_zone &&
399
+ Math.abs(
400
+ x - (self.current_rect.left + self.current_rect.width)
401
+ ) < resize_hit_zone
402
+ );
287
403
  }
288
404
 
289
- function updateRectResizeHoverLocation(x?:number, y?:number) {
290
- if (typeof x === "undefined") {
405
+ function updateRectResizeHoverLocation(x?: number, y?: number) {
406
+ if (typeof x === 'undefined') {
291
407
  self.resize_hover = false;
292
408
  } else {
293
409
  if (mouseInRightHorzResizeZone(x, y)) {
294
- self.resize_hover = "r";
410
+ self.resize_hover = 'r';
295
411
  } else if (mouseInLeftHorzResizeZone(x, y)) {
296
- self.resize_hover = "l";
412
+ self.resize_hover = 'l';
297
413
  } else if (mouseInTopVertResizeZone(x, y)) {
298
- self.resize_hover = "t";
414
+ self.resize_hover = 't';
299
415
  } else if (mouseInBottomVertResizeZone(x, y)) {
300
- self.resize_hover = "b";
416
+ self.resize_hover = 'b';
301
417
  } else if (mouseInTopLeftResizeZone(x, y)) {
302
- self.resize_hover = "tl";
418
+ self.resize_hover = 'tl';
303
419
  } else if (mouseInBottomRightResizeZone(x, y)) {
304
- self.resize_hover = "br";
420
+ self.resize_hover = 'br';
305
421
  } else if (mouseInBottomLeftResizeZone(x, y)) {
306
- self.resize_hover = "bl";
422
+ self.resize_hover = 'bl';
307
423
  } else if (mouseInTopRightResizeZone(x, y)) {
308
- self.resize_hover = "tr";
424
+ self.resize_hover = 'tr';
309
425
  } else {
310
426
  self.resize_hover = false;
311
427
  }
312
428
  }
313
429
  }
314
430
 
315
- function updateCSSCursor(x?:number, y?:number) {
431
+ function updateCSSCursor(x?: number, y?: number) {
316
432
  let cursor_val;
317
- if (typeof x === "undefined") {
433
+ if (typeof x === 'undefined') {
318
434
  cursor_val = 'auto';
319
435
  } else {
320
436
  if (mouseInRectDragZone(x, y)) {
321
437
  cursor_val = 'move';
322
- } else if (mouseInRightHorzResizeZone(x, y) || mouseInLeftHorzResizeZone(x, y)) {
438
+ } else if (
439
+ mouseInRightHorzResizeZone(x, y) ||
440
+ mouseInLeftHorzResizeZone(x, y)
441
+ ) {
323
442
  cursor_val = 'ew-resize';
324
- } else if (mouseInTopVertResizeZone(x, y) || mouseInBottomVertResizeZone(x, y)) {
443
+ } else if (
444
+ mouseInTopVertResizeZone(x, y) ||
445
+ mouseInBottomVertResizeZone(x, y)
446
+ ) {
325
447
  cursor_val = 'ns-resize';
326
- } else if (mouseInTopLeftResizeZone(x, y) || mouseInBottomRightResizeZone(x, y)) {
448
+ } else if (
449
+ mouseInTopLeftResizeZone(x, y) ||
450
+ mouseInBottomRightResizeZone(x, y)
451
+ ) {
327
452
  cursor_val = 'nwse-resize';
328
- } else if (mouseInBottomLeftResizeZone(x, y) || mouseInTopRightResizeZone(x, y)) {
453
+ } else if (
454
+ mouseInBottomLeftResizeZone(x, y) ||
455
+ mouseInTopRightResizeZone(x, y)
456
+ ) {
329
457
  cursor_val = 'nesw-resize';
330
458
  } else {
331
459
  cursor_val = 'auto';
@@ -334,7 +462,11 @@ export default class OncoprintMinimapView {
334
462
  $div.css('cursor', cursor_val);
335
463
  }
336
464
 
337
- function getCanvasMouse(view:OncoprintMinimapView, div_mouse_x:number, div_mouse_y:number) {
465
+ function getCanvasMouse(
466
+ view: OncoprintMinimapView,
467
+ div_mouse_x: number,
468
+ div_mouse_y: number
469
+ ) {
338
470
  const canv_top = parseInt(view.$canvas[0].style.top, 10);
339
471
  const canv_left = parseInt(view.$canvas[0].style.left, 10);
340
472
  const canv_width = parseInt(view.$canvas[0].width as any, 10);
@@ -343,28 +475,44 @@ export default class OncoprintMinimapView {
343
475
  const mouse_x = div_mouse_x - canv_left;
344
476
  const mouse_y = div_mouse_y - canv_top;
345
477
 
346
- const outside = mouse_x < 0 || mouse_x >= canv_width || mouse_y < 0 || mouse_y >= canv_height;
478
+ const outside =
479
+ mouse_x < 0 ||
480
+ mouse_x >= canv_width ||
481
+ mouse_y < 0 ||
482
+ mouse_y >= canv_height;
347
483
 
348
- return {'mouse_x': mouse_x,
349
- 'mouse_y': mouse_y,
350
- 'outside': outside};
484
+ return { mouse_x: mouse_x, mouse_y: mouse_y, outside: outside };
351
485
  }
352
486
 
353
487
  let dragging = false;
354
- let drag_type:"move"|"resize_r"|"resize_l"|"resize_b"|"resize_t"|"resize_tr"|"resize_br"|"resize_tl"|"resize_bl"|false = false;
488
+ let drag_type:
489
+ | 'move'
490
+ | 'resize_r'
491
+ | 'resize_l'
492
+ | 'resize_b'
493
+ | 'resize_t'
494
+ | 'resize_tr'
495
+ | 'resize_br'
496
+ | 'resize_tl'
497
+ | 'resize_bl'
498
+ | false = false;
355
499
  let drag_start_col = -1;
356
500
  let drag_start_vert_scroll = -1;
357
501
  let drag_start_x = -1;
358
502
  let drag_start_y = -1;
359
503
  let drag_start_vert_zoom = -1;
360
504
  let y_ratio = -1;
361
- let drag_start_rect:OverlayRectSpec;
505
+ let drag_start_rect: OverlayRectSpec;
362
506
 
363
- $(document).on("mousedown", function (evt) {
507
+ $(document).on('mousedown', function(evt) {
364
508
  const offset = self.$div.offset();
365
509
  const overlay_mouse_x = evt.pageX - offset.left;
366
510
  const overlay_mouse_y = evt.pageY - offset.top;
367
- const mouse = getCanvasMouse(self, overlay_mouse_x, overlay_mouse_y);
511
+ const mouse = getCanvasMouse(
512
+ self,
513
+ overlay_mouse_x,
514
+ overlay_mouse_y
515
+ );
368
516
 
369
517
  if (!mouse.outside) {
370
518
  const mouse_x = mouse.mouse_x;
@@ -372,190 +520,267 @@ export default class OncoprintMinimapView {
372
520
  dragging = false;
373
521
  drag_type = false;
374
522
 
375
-
376
- y_ratio = model.getOncoprintHeight() / parseInt(self.$canvas[0].height as any, 10);
523
+ y_ratio =
524
+ model.getOncoprintHeight() /
525
+ parseInt(self.$canvas[0].height as any, 10);
377
526
  if (mouseInRectDragZone(mouse_x, mouse_y)) {
378
- drag_type = "move";
527
+ drag_type = 'move';
379
528
  } else if (mouseInRightHorzResizeZone(mouse_x, mouse_y)) {
380
- drag_type = "resize_r";
529
+ drag_type = 'resize_r';
381
530
  } else if (mouseInLeftHorzResizeZone(mouse_x, mouse_y)) {
382
- drag_type = "resize_l";
531
+ drag_type = 'resize_l';
383
532
  } else if (mouseInTopVertResizeZone(mouse_x, mouse_y)) {
384
- drag_type = "resize_t";
533
+ drag_type = 'resize_t';
385
534
  } else if (mouseInBottomVertResizeZone(mouse_x, mouse_y)) {
386
- drag_type = "resize_b";
535
+ drag_type = 'resize_b';
387
536
  } else if (mouseInTopRightResizeZone(mouse_x, mouse_y)) {
388
- drag_type = "resize_tr";
537
+ drag_type = 'resize_tr';
389
538
  } else if (mouseInBottomRightResizeZone(mouse_x, mouse_y)) {
390
- drag_type = "resize_br";
539
+ drag_type = 'resize_br';
391
540
  } else if (mouseInTopLeftResizeZone(mouse_x, mouse_y)) {
392
- drag_type = "resize_tl";
541
+ drag_type = 'resize_tl';
393
542
  } else if (mouseInBottomLeftResizeZone(mouse_x, mouse_y)) {
394
- drag_type = "resize_bl";
543
+ drag_type = 'resize_bl';
395
544
  }
396
545
  if (drag_type !== false) {
397
546
  dragging = true;
398
547
  drag_start_x = mouse_x;
399
548
  drag_start_y = mouse_y;
400
- drag_start_col = model.getClosestColumnIndexToLeft(model.getHorzScroll(), true);
549
+ drag_start_col = model.getClosestColumnIndexToLeft(
550
+ model.getHorzScroll(),
551
+ true
552
+ );
401
553
  drag_start_vert_scroll = model.getVertScroll();
402
554
  drag_start_vert_zoom = model.getVertZoom();
403
555
  drag_start_rect = self.current_rect.clone();
404
556
  }
405
557
  }
406
558
  });
407
- $(document).on("mousemove", function (evt) {
559
+ $(document).on('mousemove', function(evt) {
408
560
  const offset = self.$div.offset();
409
561
  const overlay_mouse_x = evt.pageX - offset.left;
410
562
  const overlay_mouse_y = evt.pageY - offset.top;
411
- const mouse = getCanvasMouse(self, overlay_mouse_x, overlay_mouse_y);
563
+ const mouse = getCanvasMouse(
564
+ self,
565
+ overlay_mouse_x,
566
+ overlay_mouse_y
567
+ );
412
568
  const mouse_x = mouse.mouse_x;
413
569
  const mouse_y = mouse.mouse_y;
414
570
  let zoom = self.getZoom(model);
415
- let cell_width = model.getCellWidth(true)*zoom.x;
571
+ let cell_width = model.getCellWidth(true) * zoom.x;
416
572
  if (dragging) {
417
573
  evt.preventDefault();
418
- let delta_col = Math.floor(mouse_x / cell_width) - Math.floor(drag_start_x / cell_width);
574
+ let delta_col =
575
+ Math.floor(mouse_x / cell_width) -
576
+ Math.floor(drag_start_x / cell_width);
419
577
  let delta_y = mouse_y - drag_start_y;
420
- if (drag_type === "move") {
578
+ if (drag_type === 'move') {
421
579
  const delta_y_scroll = delta_y * y_ratio;
422
- drag_callback(self.colToLeft(model, clamp(drag_start_col + delta_col, 0, model.getIdOrder().length-1)), drag_start_vert_scroll + delta_y_scroll);
580
+ drag_callback(
581
+ self.colToLeft(
582
+ model,
583
+ clamp(
584
+ drag_start_col + delta_col,
585
+ 0,
586
+ model.getIdOrder().length - 1
587
+ )
588
+ ),
589
+ drag_start_vert_scroll + delta_y_scroll
590
+ );
423
591
  } else {
424
- let render_rect:OverlayRectParams;
592
+ let render_rect: OverlayRectParams;
425
593
  zoom = self.getZoom(model);
426
594
  const max_num_cols = model.getIdOrder().length;
427
- const min_num_cols = Math.ceil(cell_view.getVisibleAreaWidth() / (model.getCellWidth(true) + model.getCellPadding(true, true)));
595
+ const min_num_cols = Math.ceil(
596
+ cell_view.getVisibleAreaWidth() /
597
+ (model.getCellWidth(true) +
598
+ model.getCellPadding(true, true))
599
+ );
428
600
  const max_height = model.getOncoprintHeight(true) * zoom.y;
429
- const min_height = cell_view.getVisibleAreaHeight(model) * zoom.y;
601
+ const min_height =
602
+ cell_view.getVisibleAreaHeight(model) * zoom.y;
430
603
  const drag_start_right_col = drag_start_rect.right_col;
431
- const drag_start_bottom = drag_start_rect.top + drag_start_rect.height;
432
- if (drag_type === "resize_r") {
604
+ const drag_start_bottom =
605
+ drag_start_rect.top + drag_start_rect.height;
606
+ if (drag_type === 'resize_r') {
433
607
  // Width must be valid
434
- delta_col = clamp(delta_col,
608
+ delta_col = clamp(
609
+ delta_col,
435
610
  min_num_cols - drag_start_rect.num_cols,
436
- max_num_cols - drag_start_rect.num_cols);
611
+ max_num_cols - drag_start_rect.num_cols
612
+ );
437
613
  // Right must be valid
438
- delta_col = Math.min(delta_col, max_num_cols - drag_start_right_col);
614
+ delta_col = Math.min(
615
+ delta_col,
616
+ max_num_cols - drag_start_right_col
617
+ );
439
618
  render_rect = {
440
- 'top': drag_start_rect.top,
441
- 'left_col': drag_start_rect.left_col,
442
- 'right_col': drag_start_rect.right_col + delta_col,
443
- 'height': drag_start_rect.height
619
+ top: drag_start_rect.top,
620
+ left_col: drag_start_rect.left_col,
621
+ right_col: drag_start_rect.right_col + delta_col,
622
+ height: drag_start_rect.height,
444
623
  };
445
- } else if (drag_type === "resize_l") {
624
+ } else if (drag_type === 'resize_l') {
446
625
  // Width must be valid
447
- delta_col = clamp(delta_col,
626
+ delta_col = clamp(
627
+ delta_col,
448
628
  drag_start_rect.num_cols - max_num_cols,
449
- drag_start_rect.num_cols - min_num_cols);
629
+ drag_start_rect.num_cols - min_num_cols
630
+ );
450
631
  // Left must be valid
451
- delta_col = Math.max(delta_col, -drag_start_rect.left_col);
632
+ delta_col = Math.max(
633
+ delta_col,
634
+ -drag_start_rect.left_col
635
+ );
452
636
  render_rect = {
453
- 'top': drag_start_rect.top,
454
- 'left_col': drag_start_rect.left_col + delta_col,
455
- 'right_col': drag_start_rect.right_col,
456
- 'height': drag_start_rect.height
637
+ top: drag_start_rect.top,
638
+ left_col: drag_start_rect.left_col + delta_col,
639
+ right_col: drag_start_rect.right_col,
640
+ height: drag_start_rect.height,
457
641
  };
458
- } else if (drag_type === "resize_t") {
642
+ } else if (drag_type === 'resize_t') {
459
643
  // Height must be valid
460
- delta_y = clamp(delta_y,
644
+ delta_y = clamp(
645
+ delta_y,
461
646
  drag_start_rect.height - max_height,
462
- drag_start_rect.height - min_height);
647
+ drag_start_rect.height - min_height
648
+ );
463
649
  // Top must be valid
464
650
  delta_y = Math.max(delta_y, -drag_start_rect.top);
465
651
  render_rect = {
466
- 'top': drag_start_rect.top + delta_y,
467
- 'left_col': drag_start_rect.left_col,
468
- 'right_col': drag_start_rect.right_col,
469
- 'height': drag_start_rect.height - delta_y
652
+ top: drag_start_rect.top + delta_y,
653
+ left_col: drag_start_rect.left_col,
654
+ right_col: drag_start_rect.right_col,
655
+ height: drag_start_rect.height - delta_y,
470
656
  };
471
- } else if (drag_type === "resize_b") {
657
+ } else if (drag_type === 'resize_b') {
472
658
  // Height must be valid
473
- delta_y = clamp(delta_y,
659
+ delta_y = clamp(
660
+ delta_y,
474
661
  min_height - drag_start_rect.height,
475
- max_height - drag_start_rect.height);
662
+ max_height - drag_start_rect.height
663
+ );
476
664
  // Bottom must be valid
477
- delta_y = Math.min(delta_y, max_height - drag_start_bottom);
665
+ delta_y = Math.min(
666
+ delta_y,
667
+ max_height - drag_start_bottom
668
+ );
478
669
  render_rect = {
479
- 'top': drag_start_rect.top,
480
- 'left_col': drag_start_rect.left_col,
481
- 'right_col': drag_start_rect.right_col,
482
- 'height': drag_start_rect.height + delta_y
670
+ top: drag_start_rect.top,
671
+ left_col: drag_start_rect.left_col,
672
+ right_col: drag_start_rect.right_col,
673
+ height: drag_start_rect.height + delta_y,
483
674
  };
484
- } else if (drag_type === "resize_tr") {
675
+ } else if (drag_type === 'resize_tr') {
485
676
  // Width must be valid
486
- delta_col = clamp(delta_col,
677
+ delta_col = clamp(
678
+ delta_col,
487
679
  min_num_cols - drag_start_rect.num_cols,
488
- max_num_cols - drag_start_rect.num_cols);
680
+ max_num_cols - drag_start_rect.num_cols
681
+ );
489
682
  // Right must be valid
490
- delta_col = Math.min(delta_col, max_num_cols - drag_start_right_col);
683
+ delta_col = Math.min(
684
+ delta_col,
685
+ max_num_cols - drag_start_right_col
686
+ );
491
687
  // Height must be valid
492
- delta_y = clamp(delta_y,
688
+ delta_y = clamp(
689
+ delta_y,
493
690
  drag_start_rect.height - max_height,
494
- drag_start_rect.height - min_height);
691
+ drag_start_rect.height - min_height
692
+ );
495
693
  // Top must be valid
496
694
  delta_y = Math.max(delta_y, -drag_start_rect.top);
497
695
  render_rect = {
498
- 'top': drag_start_rect.top + delta_y,
499
- 'left_col': drag_start_rect.left_col,
500
- 'right_col': drag_start_rect.right_col + delta_col,
501
- 'height': drag_start_rect.height - delta_y
696
+ top: drag_start_rect.top + delta_y,
697
+ left_col: drag_start_rect.left_col,
698
+ right_col: drag_start_rect.right_col + delta_col,
699
+ height: drag_start_rect.height - delta_y,
502
700
  };
503
- } else if (drag_type === "resize_tl") {
701
+ } else if (drag_type === 'resize_tl') {
504
702
  // Width must be valid
505
- delta_col = clamp(delta_col,
703
+ delta_col = clamp(
704
+ delta_col,
506
705
  drag_start_rect.num_cols - max_num_cols,
507
- drag_start_rect.num_cols - min_num_cols);
706
+ drag_start_rect.num_cols - min_num_cols
707
+ );
508
708
  // Left must be valid
509
- delta_col = Math.max(delta_col, -drag_start_rect.left_col);
709
+ delta_col = Math.max(
710
+ delta_col,
711
+ -drag_start_rect.left_col
712
+ );
510
713
  // Height must be valid
511
- delta_y = clamp(delta_y,
714
+ delta_y = clamp(
715
+ delta_y,
512
716
  drag_start_rect.height - max_height,
513
- drag_start_rect.height - min_height);
717
+ drag_start_rect.height - min_height
718
+ );
514
719
  // Top must be valid
515
720
  delta_y = Math.max(delta_y, -drag_start_rect.top);
516
721
  render_rect = {
517
- 'top': drag_start_rect.top + delta_y,
518
- 'left_col': drag_start_rect.left_col + delta_col,
519
- 'right_col': drag_start_rect.right_col,
520
- 'height': drag_start_rect.height - delta_y
722
+ top: drag_start_rect.top + delta_y,
723
+ left_col: drag_start_rect.left_col + delta_col,
724
+ right_col: drag_start_rect.right_col,
725
+ height: drag_start_rect.height - delta_y,
521
726
  };
522
- } else if (drag_type === "resize_br") {
727
+ } else if (drag_type === 'resize_br') {
523
728
  // Height must be valid
524
- delta_y = clamp(delta_y,
729
+ delta_y = clamp(
730
+ delta_y,
525
731
  min_height - drag_start_rect.height,
526
- max_height - drag_start_rect.height);
732
+ max_height - drag_start_rect.height
733
+ );
527
734
  // Bottom must be valid
528
- delta_y = Math.min(delta_y, max_height - drag_start_bottom);
735
+ delta_y = Math.min(
736
+ delta_y,
737
+ max_height - drag_start_bottom
738
+ );
529
739
  // Width must be valid
530
- delta_col = clamp(delta_col,
740
+ delta_col = clamp(
741
+ delta_col,
531
742
  min_num_cols - drag_start_rect.num_cols,
532
- max_num_cols - drag_start_rect.num_cols);
743
+ max_num_cols - drag_start_rect.num_cols
744
+ );
533
745
  // Right must be valid
534
- delta_col = Math.min(delta_col, max_num_cols - drag_start_right_col);
746
+ delta_col = Math.min(
747
+ delta_col,
748
+ max_num_cols - drag_start_right_col
749
+ );
535
750
  render_rect = {
536
- 'top': drag_start_rect.top,
537
- 'left_col': drag_start_rect.left_col,
538
- 'right_col': drag_start_rect.right_col + delta_col,
539
- 'height': drag_start_rect.height + delta_y
751
+ top: drag_start_rect.top,
752
+ left_col: drag_start_rect.left_col,
753
+ right_col: drag_start_rect.right_col + delta_col,
754
+ height: drag_start_rect.height + delta_y,
540
755
  };
541
- } else if (drag_type === "resize_bl") {
756
+ } else if (drag_type === 'resize_bl') {
542
757
  // Height must be valid
543
- delta_y = clamp(delta_y,
758
+ delta_y = clamp(
759
+ delta_y,
544
760
  min_height - drag_start_rect.height,
545
- max_height - drag_start_rect.height);
761
+ max_height - drag_start_rect.height
762
+ );
546
763
  // Bottom must be valid
547
- delta_y = Math.min(delta_y, max_height - drag_start_bottom);
764
+ delta_y = Math.min(
765
+ delta_y,
766
+ max_height - drag_start_bottom
767
+ );
548
768
  // Width must be valid
549
- delta_col = clamp(delta_col,
769
+ delta_col = clamp(
770
+ delta_col,
550
771
  drag_start_rect.num_cols - max_num_cols,
551
- drag_start_rect.num_cols - min_num_cols);
772
+ drag_start_rect.num_cols - min_num_cols
773
+ );
552
774
  // Left must be valid
553
- delta_col = Math.max(delta_col, -drag_start_rect.left_col);
775
+ delta_col = Math.max(
776
+ delta_col,
777
+ -drag_start_rect.left_col
778
+ );
554
779
  render_rect = {
555
- 'top': drag_start_rect.top,
556
- 'left_col': drag_start_rect.left_col + delta_col,
557
- 'right_col': drag_start_rect.right_col,
558
- 'height': drag_start_rect.height + delta_y,
780
+ top: drag_start_rect.top,
781
+ left_col: drag_start_rect.left_col + delta_col,
782
+ right_col: drag_start_rect.right_col,
783
+ height: drag_start_rect.height + delta_y,
559
784
  };
560
785
  }
561
786
  self.current_rect.setParams(render_rect);
@@ -575,13 +800,28 @@ export default class OncoprintMinimapView {
575
800
 
576
801
  function endDrag() {
577
802
  if (dragging) {
578
- if (["resize_t", "resize_b", "resize_l", "resize_r",
579
- "resize_tl", "resize_tr", "resize_bl", "resize_br"].indexOf(drag_type as any) > -1) {
803
+ if (
804
+ [
805
+ 'resize_t',
806
+ 'resize_b',
807
+ 'resize_l',
808
+ 'resize_r',
809
+ 'resize_tl',
810
+ 'resize_tr',
811
+ 'resize_bl',
812
+ 'resize_br',
813
+ ].indexOf(drag_type as any) > -1
814
+ ) {
580
815
  viewport_callback({
581
816
  left_col: self.current_rect.left_col,
582
- scroll_y_proportion: (self.current_rect.top / parseInt(self.$canvas[0].height as any, 10)),
817
+ scroll_y_proportion:
818
+ self.current_rect.top /
819
+ parseInt(self.$canvas[0].height as any, 10),
583
820
  right_col: self.current_rect.right_col,
584
- zoom_y: (drag_start_rect.height / self.current_rect.height) * drag_start_vert_zoom
821
+ zoom_y:
822
+ (drag_start_rect.height /
823
+ self.current_rect.height) *
824
+ drag_start_vert_zoom,
585
825
  });
586
826
  }
587
827
  dragging = false;
@@ -589,12 +829,16 @@ export default class OncoprintMinimapView {
589
829
  }
590
830
  }
591
831
 
592
- $(document).on("mouseup", function (evt) {
832
+ $(document).on('mouseup', function(evt) {
593
833
  const offset = self.$div.offset();
594
834
  const overlay_mouse_x = evt.pageX - offset.left;
595
835
  const overlay_mouse_y = evt.pageY - offset.top;
596
836
  endDrag();
597
- const mouse = getCanvasMouse(self, overlay_mouse_x, overlay_mouse_y);
837
+ const mouse = getCanvasMouse(
838
+ self,
839
+ overlay_mouse_x,
840
+ overlay_mouse_y
841
+ );
598
842
  if (!mouse.outside) {
599
843
  let mouse_x = mouse.mouse_x;
600
844
  let mouse_y = mouse.mouse_y;
@@ -612,32 +856,38 @@ export default class OncoprintMinimapView {
612
856
  let start_mouse_y = 0;
613
857
  let start_left = 0;
614
858
  let start_top = 0;
615
- function handleDrag(evt:MouseMoveEvent) {
859
+ function handleDrag(evt: MouseMoveEvent) {
616
860
  evt.preventDefault();
617
861
  const delta_mouse_x = evt.pageX - start_mouse_x;
618
862
  const delta_mouse_y = evt.pageY - start_mouse_y;
619
- self.setWindowPosition(start_left + delta_mouse_x, start_top + delta_mouse_y);
863
+ self.setWindowPosition(
864
+ start_left + delta_mouse_x,
865
+ start_top + delta_mouse_y
866
+ );
620
867
  }
621
- self.$window_bar.hover(function() {
622
- $(this).css({'cursor':'move'});
623
- }, function() {
624
- $(this).css({'cursor':'auto'});
625
- });
868
+ self.$window_bar.hover(
869
+ function() {
870
+ $(this).css({ cursor: 'move' });
871
+ },
872
+ function() {
873
+ $(this).css({ cursor: 'auto' });
874
+ }
875
+ );
626
876
 
627
- self.$window_bar.on("mousedown", function (evt) {
877
+ self.$window_bar.on('mousedown', function(evt) {
628
878
  start_mouse_x = evt.pageX;
629
879
  start_mouse_y = evt.pageY;
630
880
  start_left = parseInt(self.$div.css('left'), 10);
631
881
  start_top = parseInt(self.$div.css('top'), 10);
632
- $(document).on("mousemove", handleDrag);
882
+ $(document).on('mousemove', handleDrag);
633
883
  });
634
- $(document).on("mouseup click", function () {
635
- $(document).off("mousemove", handleDrag);
884
+ $(document).on('mouseup click', function() {
885
+ $(document).off('mousemove', handleDrag);
636
886
  });
637
887
  })();
638
888
  }
639
889
 
640
- private colToLeft(model:OncoprintModel, colIndex:number) {
890
+ private colToLeft(model: OncoprintModel, colIndex: number) {
641
891
  return model.getZoomedColumnLeft(model.getIdOrder()[colIndex]);
642
892
  }
643
893
 
@@ -647,9 +897,12 @@ export default class OncoprintMinimapView {
647
897
 
648
898
  private getNewCanvas() {
649
899
  const old_canvas = this.$canvas[0];
650
- old_canvas.removeEventListener("webglcontextlost", this.handleContextLost);
900
+ old_canvas.removeEventListener(
901
+ 'webglcontextlost',
902
+ this.handleContextLost
903
+ );
651
904
  const new_canvas = old_canvas.cloneNode();
652
- new_canvas.addEventListener("webglcontextlost", this.handleContextLost);
905
+ new_canvas.addEventListener('webglcontextlost', this.handleContextLost);
653
906
  const parent_node = old_canvas.parentNode;
654
907
  parent_node.removeChild(old_canvas);
655
908
  parent_node.insertBefore(new_canvas, this.$overlay_canvas[0]);
@@ -661,7 +914,12 @@ export default class OncoprintMinimapView {
661
914
  private getWebGLCanvasContext() {
662
915
  try {
663
916
  const canvas = this.$canvas[0];
664
- const ctx = this.ctx || canvas.getContext("experimental-webgl", {alpha: false, antialias: true}) as OncoprintWebGLContext;
917
+ const ctx =
918
+ this.ctx ||
919
+ (canvas.getContext('experimental-webgl', {
920
+ alpha: false,
921
+ antialias: true,
922
+ }) as OncoprintWebGLContext);
665
923
  ctx.clearColor(1.0, 1.0, 1.0, 1.0);
666
924
  ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT);
667
925
  ctx.viewportWidth = canvas.width;
@@ -680,7 +938,7 @@ export default class OncoprintMinimapView {
680
938
  }
681
939
 
682
940
  private ensureWebGLContext() {
683
- for (let i=0; i<5; i++) {
941
+ for (let i = 0; i < 5; i++) {
684
942
  if (!this.ctx || this.ctx.isContextLost()) {
685
943
  // have to get a new canvas when context is lost by browser
686
944
  this.getNewCanvas();
@@ -691,37 +949,51 @@ export default class OncoprintMinimapView {
691
949
  }
692
950
  }
693
951
  if (!this.ctx || this.ctx.isContextLost()) {
694
- throw new Error("Unable to get WebGL context for Oncoprint Minimap");
952
+ throw new Error(
953
+ 'Unable to get WebGL context for Oncoprint Minimap'
954
+ );
695
955
  }
696
956
  }
697
957
 
698
- private createShaderProgram(vertex_shader:WebGLShader, fragment_shader:WebGLShader) {
958
+ private createShaderProgram(
959
+ vertex_shader: WebGLShader,
960
+ fragment_shader: WebGLShader
961
+ ) {
699
962
  const program = this.ctx.createProgram();
700
963
  this.ctx.attachShader(program, vertex_shader);
701
964
  this.ctx.attachShader(program, fragment_shader);
702
965
 
703
966
  this.ctx.linkProgram(program);
704
967
 
705
- const success = this.ctx.getProgramParameter(program, this.ctx.LINK_STATUS);
968
+ const success = this.ctx.getProgramParameter(
969
+ program,
970
+ this.ctx.LINK_STATUS
971
+ );
706
972
  if (!success) {
707
973
  const msg = this.ctx.getProgramInfoLog(program);
708
974
  this.ctx.deleteProgram(program);
709
- throw "Unable to link shader program: " + msg;
975
+ throw 'Unable to link shader program: ' + msg;
710
976
  }
711
977
 
712
978
  return program;
713
979
  }
714
980
 
715
- private createShader(source:string, type:"VERTEX_SHADER"|"FRAGMENT_SHADER") {
981
+ private createShader(
982
+ source: string,
983
+ type: 'VERTEX_SHADER' | 'FRAGMENT_SHADER'
984
+ ) {
716
985
  const shader = this.ctx.createShader(this.ctx[type]);
717
986
  this.ctx.shaderSource(shader, source);
718
987
  this.ctx.compileShader(shader);
719
988
 
720
- const success = this.ctx.getShaderParameter(shader, this.ctx.COMPILE_STATUS);
989
+ const success = this.ctx.getShaderParameter(
990
+ shader,
991
+ this.ctx.COMPILE_STATUS
992
+ );
721
993
  if (!success) {
722
994
  const msg = this.ctx.getShaderInfoLog(shader);
723
995
  this.ctx.deleteShader(shader);
724
- throw "Unable to compile shader: " + msg;
996
+ throw 'Unable to compile shader: ' + msg;
725
997
  }
726
998
 
727
999
  return shader;
@@ -738,13 +1010,22 @@ export default class OncoprintMinimapView {
738
1010
  self.mvMatrix = mvMatrix;
739
1011
 
740
1012
  const pMatrix = gl_matrix.mat4.create();
741
- gl_matrix.mat4.ortho(pMatrix, 0, self.ctx.viewportWidth, self.ctx.viewportHeight, 0, -5, 1000); // y axis inverted so that y increases down like SVG
1013
+ gl_matrix.mat4.ortho(
1014
+ pMatrix,
1015
+ 0,
1016
+ self.ctx.viewportWidth,
1017
+ self.ctx.viewportHeight,
1018
+ 0,
1019
+ -5,
1020
+ 1000
1021
+ ); // y axis inverted so that y increases down like SVG
742
1022
  self.pMatrix = pMatrix;
743
1023
  })(this);
744
1024
  }
745
1025
 
746
1026
  private setUpShaders() {
747
- const vertex_shader_source = ['precision highp float;',
1027
+ const vertex_shader_source = [
1028
+ 'precision highp float;',
748
1029
  'attribute float aPosVertex;',
749
1030
  'attribute float aColVertex;',
750
1031
  'attribute float aVertexOncoprintColumn;',
@@ -772,96 +1053,201 @@ export default class OncoprintMinimapView {
772
1053
  ' gl_Position *= vec4(zoomX, zoomY, 1.0, 1.0);',
773
1054
  ' gl_Position = uPMatrix * uMVMatrix * gl_Position;',
774
1055
  ' texCoord = (aColVertex + 0.5) / texSize;',
775
- '}'].join('\n');
776
- const fragment_shader_source = ['precision mediump float;',
1056
+ '}',
1057
+ ].join('\n');
1058
+ const fragment_shader_source = [
1059
+ 'precision mediump float;',
777
1060
  'varying float texCoord;',
778
1061
  'uniform sampler2D uSampler;',
779
1062
  'void main(void) {',
780
1063
  ' gl_FragColor = texture2D(uSampler, vec2(texCoord, 0.5));',
781
- '}'].join('\n');
782
- const vertex_shader = this.createShader(vertex_shader_source, 'VERTEX_SHADER');
783
- const fragment_shader = this.createShader(fragment_shader_source, 'FRAGMENT_SHADER');
784
-
785
- const shader_program = this.createShaderProgram(vertex_shader, fragment_shader) as OncoprintShaderProgram;
786
- shader_program.vertexPositionAttribute = this.ctx.getAttribLocation(shader_program, 'aPosVertex');
787
- this.ctx.enableVertexAttribArray(shader_program.vertexPositionAttribute);
788
- shader_program.vertexColorAttribute = this.ctx.getAttribLocation(shader_program, 'aColVertex');
1064
+ '}',
1065
+ ].join('\n');
1066
+ const vertex_shader = this.createShader(
1067
+ vertex_shader_source,
1068
+ 'VERTEX_SHADER'
1069
+ );
1070
+ const fragment_shader = this.createShader(
1071
+ fragment_shader_source,
1072
+ 'FRAGMENT_SHADER'
1073
+ );
1074
+
1075
+ const shader_program = this.createShaderProgram(
1076
+ vertex_shader,
1077
+ fragment_shader
1078
+ ) as OncoprintShaderProgram;
1079
+ shader_program.vertexPositionAttribute = this.ctx.getAttribLocation(
1080
+ shader_program,
1081
+ 'aPosVertex'
1082
+ );
1083
+ this.ctx.enableVertexAttribArray(
1084
+ shader_program.vertexPositionAttribute
1085
+ );
1086
+ shader_program.vertexColorAttribute = this.ctx.getAttribLocation(
1087
+ shader_program,
1088
+ 'aColVertex'
1089
+ );
789
1090
  this.ctx.enableVertexAttribArray(shader_program.vertexColorAttribute);
790
- shader_program.vertexOncoprintColumnAttribute = this.ctx.getAttribLocation(shader_program, 'aVertexOncoprintColumn');
791
- this.ctx.enableVertexAttribArray(shader_program.vertexOncoprintColumnAttribute);
792
-
793
- shader_program.samplerUniform = this.ctx.getUniformLocation(shader_program, 'uSampler');
794
- shader_program.pMatrixUniform = this.ctx.getUniformLocation(shader_program, 'uPMatrix');
795
- shader_program.mvMatrixUniform = this.ctx.getUniformLocation(shader_program, 'uMVMatrix');
796
- shader_program.columnWidthUniform = this.ctx.getUniformLocation(shader_program, 'columnWidth');
797
- shader_program.zoomXUniform = this.ctx.getUniformLocation(shader_program, 'zoomX');
798
- shader_program.zoomYUniform = this.ctx.getUniformLocation(shader_program, 'zoomY');
799
- shader_program.offsetYUniform = this.ctx.getUniformLocation(shader_program, 'offsetY');
800
- shader_program.positionBitPackBaseUniform = this.ctx.getUniformLocation(shader_program, 'positionBitPackBase');
801
- shader_program.texSizeUniform = this.ctx.getUniformLocation(shader_program, 'texSize');
1091
+ shader_program.vertexOncoprintColumnAttribute = this.ctx.getAttribLocation(
1092
+ shader_program,
1093
+ 'aVertexOncoprintColumn'
1094
+ );
1095
+ this.ctx.enableVertexAttribArray(
1096
+ shader_program.vertexOncoprintColumnAttribute
1097
+ );
1098
+
1099
+ shader_program.samplerUniform = this.ctx.getUniformLocation(
1100
+ shader_program,
1101
+ 'uSampler'
1102
+ );
1103
+ shader_program.pMatrixUniform = this.ctx.getUniformLocation(
1104
+ shader_program,
1105
+ 'uPMatrix'
1106
+ );
1107
+ shader_program.mvMatrixUniform = this.ctx.getUniformLocation(
1108
+ shader_program,
1109
+ 'uMVMatrix'
1110
+ );
1111
+ shader_program.columnWidthUniform = this.ctx.getUniformLocation(
1112
+ shader_program,
1113
+ 'columnWidth'
1114
+ );
1115
+ shader_program.zoomXUniform = this.ctx.getUniformLocation(
1116
+ shader_program,
1117
+ 'zoomX'
1118
+ );
1119
+ shader_program.zoomYUniform = this.ctx.getUniformLocation(
1120
+ shader_program,
1121
+ 'zoomY'
1122
+ );
1123
+ shader_program.offsetYUniform = this.ctx.getUniformLocation(
1124
+ shader_program,
1125
+ 'offsetY'
1126
+ );
1127
+ shader_program.positionBitPackBaseUniform = this.ctx.getUniformLocation(
1128
+ shader_program,
1129
+ 'positionBitPackBase'
1130
+ );
1131
+ shader_program.texSizeUniform = this.ctx.getUniformLocation(
1132
+ shader_program,
1133
+ 'texSize'
1134
+ );
802
1135
 
803
1136
  this.shader_program = shader_program;
804
1137
  }
805
1138
 
806
- private getTrackBuffers(cell_view:OncoprintWebGLCellView, track_id:TrackId) {
1139
+ private getTrackBuffers(
1140
+ cell_view: OncoprintWebGLCellView,
1141
+ track_id: TrackId
1142
+ ) {
807
1143
  const pos_buffer = this.ctx.createBuffer() as OncoprintVertexTrackBuffer;
808
1144
  const pos_array = cell_view.vertex_data[track_id].pos_array;
809
- const universal_shapes_start_index = cell_view.vertex_data[track_id].universal_shapes_start_index;
1145
+ const universal_shapes_start_index =
1146
+ cell_view.vertex_data[track_id].universal_shapes_start_index;
810
1147
 
811
1148
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, pos_buffer);
812
- this.ctx.bufferData(this.ctx.ARRAY_BUFFER, pos_array, this.ctx.STATIC_DRAW);
1149
+ this.ctx.bufferData(
1150
+ this.ctx.ARRAY_BUFFER,
1151
+ pos_array,
1152
+ this.ctx.STATIC_DRAW
1153
+ );
813
1154
  pos_buffer.itemSize = 1;
814
- pos_buffer.specificShapesNumItems = universal_shapes_start_index / pos_buffer.itemSize;
815
- pos_buffer.universalShapesNumItems = (pos_array.length - universal_shapes_start_index) / pos_buffer.itemSize;
1155
+ pos_buffer.specificShapesNumItems =
1156
+ universal_shapes_start_index / pos_buffer.itemSize;
1157
+ pos_buffer.universalShapesNumItems =
1158
+ (pos_array.length - universal_shapes_start_index) /
1159
+ pos_buffer.itemSize;
816
1160
 
817
1161
  const col_buffer = this.ctx.createBuffer() as OncoprintVertexTrackBuffer;
818
1162
  const col_array = cell_view.vertex_data[track_id].col_array;
819
1163
 
820
1164
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, col_buffer);
821
- this.ctx.bufferData(this.ctx.ARRAY_BUFFER, col_array, this.ctx.STATIC_DRAW);
1165
+ this.ctx.bufferData(
1166
+ this.ctx.ARRAY_BUFFER,
1167
+ col_array,
1168
+ this.ctx.STATIC_DRAW
1169
+ );
822
1170
  col_buffer.itemSize = 1;
823
- col_buffer.specificShapesNumItems = universal_shapes_start_index / col_buffer.itemSize;
824
- col_buffer.universalShapesNumItems = (col_array.length - universal_shapes_start_index) / col_buffer.itemSize;
1171
+ col_buffer.specificShapesNumItems =
1172
+ universal_shapes_start_index / col_buffer.itemSize;
1173
+ col_buffer.universalShapesNumItems =
1174
+ (col_array.length - universal_shapes_start_index) /
1175
+ col_buffer.itemSize;
825
1176
 
826
1177
  const tex = this.ctx.createTexture();
827
1178
  this.ctx.bindTexture(this.ctx.TEXTURE_2D, tex);
828
1179
 
829
1180
  const color_bank = cell_view.vertex_data[track_id].col_bank;
830
- const width = Math.pow(2, Math.ceil((Math as any).log2(color_bank.length / 4)));
1181
+ const width = Math.pow(
1182
+ 2,
1183
+ Math.ceil((Math as any).log2(color_bank.length / 4))
1184
+ );
831
1185
  while (color_bank.length < 4 * width) {
832
1186
  color_bank.push(0);
833
1187
  }
834
1188
  const height = 1;
835
- this.ctx.texImage2D(this.ctx.TEXTURE_2D, 0, this.ctx.RGBA, width, height, 0, this.ctx.RGBA, this.ctx.UNSIGNED_BYTE, new Uint8Array(color_bank));
836
- this.ctx.texParameteri(this.ctx.TEXTURE_2D, this.ctx.TEXTURE_MIN_FILTER, this.ctx.NEAREST);
837
- this.ctx.texParameteri(this.ctx.TEXTURE_2D, this.ctx.TEXTURE_MAG_FILTER, this.ctx.NEAREST);
838
-
839
- const color_texture = {'texture': tex, 'size': width};
1189
+ this.ctx.texImage2D(
1190
+ this.ctx.TEXTURE_2D,
1191
+ 0,
1192
+ this.ctx.RGBA,
1193
+ width,
1194
+ height,
1195
+ 0,
1196
+ this.ctx.RGBA,
1197
+ this.ctx.UNSIGNED_BYTE,
1198
+ new Uint8Array(color_bank)
1199
+ );
1200
+ this.ctx.texParameteri(
1201
+ this.ctx.TEXTURE_2D,
1202
+ this.ctx.TEXTURE_MIN_FILTER,
1203
+ this.ctx.NEAREST
1204
+ );
1205
+ this.ctx.texParameteri(
1206
+ this.ctx.TEXTURE_2D,
1207
+ this.ctx.TEXTURE_MAG_FILTER,
1208
+ this.ctx.NEAREST
1209
+ );
1210
+
1211
+ const color_texture = { texture: tex, size: width };
840
1212
 
841
1213
  const vertex_column_buffer = this.ctx.createBuffer() as OncoprintTrackBuffer;
842
1214
  const vertex_column_array = cell_view.vertex_column_array[track_id];
843
1215
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, vertex_column_buffer);
844
- this.ctx.bufferData(this.ctx.ARRAY_BUFFER, new Float32Array(vertex_column_array), this.ctx.STATIC_DRAW);
1216
+ this.ctx.bufferData(
1217
+ this.ctx.ARRAY_BUFFER,
1218
+ new Float32Array(vertex_column_array),
1219
+ this.ctx.STATIC_DRAW
1220
+ );
845
1221
  vertex_column_buffer.itemSize = 1;
846
- vertex_column_buffer.numItems = vertex_column_array.length / vertex_column_buffer.itemSize;
1222
+ vertex_column_buffer.numItems =
1223
+ vertex_column_array.length / vertex_column_buffer.itemSize;
847
1224
 
848
- return {'position': pos_buffer,
849
- 'color': col_buffer,
850
- 'color_tex': color_texture,
851
- 'column': vertex_column_buffer};
852
- };
1225
+ return {
1226
+ position: pos_buffer,
1227
+ color: col_buffer,
1228
+ color_tex: color_texture,
1229
+ column: vertex_column_buffer,
1230
+ };
1231
+ }
853
1232
 
854
- private getSimpleCountBuffer(model:OncoprintModel) {
1233
+ private getSimpleCountBuffer(model: OncoprintModel) {
855
1234
  const numColumns = model.getIdOrder().length;
856
1235
  const buffer = this.ctx.createBuffer() as OncoprintTrackBuffer;
857
1236
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, buffer);
858
- this.ctx.bufferData(this.ctx.ARRAY_BUFFER, new Float32Array(_.range(0, numColumns)), this.ctx.STATIC_DRAW);
1237
+ this.ctx.bufferData(
1238
+ this.ctx.ARRAY_BUFFER,
1239
+ new Float32Array(_.range(0, numColumns)),
1240
+ this.ctx.STATIC_DRAW
1241
+ );
859
1242
  buffer.itemSize = 1;
860
1243
  buffer.numItems = numColumns;
861
1244
  return buffer;
862
1245
  }
863
1246
 
864
- private drawOncoprint(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1247
+ private drawOncoprint(
1248
+ model: OncoprintModel,
1249
+ cell_view: OncoprintWebGLCellView
1250
+ ) {
865
1251
  if (!this.shouldRender) {
866
1252
  return;
867
1253
  }
@@ -888,50 +1274,136 @@ export default class OncoprintMinimapView {
888
1274
  this.ctx.useProgram(shader_program);
889
1275
 
890
1276
  if (forSpecificShapes) {
891
- this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, buffers.position);
892
- this.ctx.vertexAttribPointer(shader_program.vertexPositionAttribute, buffers.position.itemSize, this.ctx.FLOAT, false, 0, 0);
1277
+ this.ctx.bindBuffer(
1278
+ this.ctx.ARRAY_BUFFER,
1279
+ buffers.position
1280
+ );
1281
+ this.ctx.vertexAttribPointer(
1282
+ shader_program.vertexPositionAttribute,
1283
+ buffers.position.itemSize,
1284
+ this.ctx.FLOAT,
1285
+ false,
1286
+ 0,
1287
+ 0
1288
+ );
893
1289
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, buffers.color);
894
- this.ctx.vertexAttribPointer(shader_program.vertexColorAttribute, buffers.color.itemSize, this.ctx.FLOAT, false, 0, 0);
1290
+ this.ctx.vertexAttribPointer(
1291
+ shader_program.vertexColorAttribute,
1292
+ buffers.color.itemSize,
1293
+ this.ctx.FLOAT,
1294
+ false,
1295
+ 0,
1296
+ 0
1297
+ );
895
1298
 
896
1299
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, buffers.column);
897
- this.ctx.vertexAttribPointer(shader_program.vertexOncoprintColumnAttribute, buffers.column.itemSize, this.ctx.FLOAT, false, 0, 0);
1300
+ this.ctx.vertexAttribPointer(
1301
+ shader_program.vertexOncoprintColumnAttribute,
1302
+ buffers.column.itemSize,
1303
+ this.ctx.FLOAT,
1304
+ false,
1305
+ 0,
1306
+ 0
1307
+ );
898
1308
  // make sure to set divisor 0, otherwise the track will only use the first item in the column buffer
899
- this.ext.vertexAttribDivisorANGLE(shader_program.vertexOncoprintColumnAttribute, 0);
1309
+ this.ext.vertexAttribDivisorANGLE(
1310
+ shader_program.vertexOncoprintColumnAttribute,
1311
+ 0
1312
+ );
900
1313
  } else {
901
1314
  // set up for drawArraysInstanced
902
- const universalShapesStart = buffers.position.specificShapesNumItems * buffers.position.itemSize;
903
- this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, buffers.position);
904
- this.ctx.vertexAttribPointer(shader_program.vertexPositionAttribute, buffers.position.itemSize, this.ctx.FLOAT, false, 0, 4*universalShapesStart);
1315
+ const universalShapesStart =
1316
+ buffers.position.specificShapesNumItems *
1317
+ buffers.position.itemSize;
1318
+ this.ctx.bindBuffer(
1319
+ this.ctx.ARRAY_BUFFER,
1320
+ buffers.position
1321
+ );
1322
+ this.ctx.vertexAttribPointer(
1323
+ shader_program.vertexPositionAttribute,
1324
+ buffers.position.itemSize,
1325
+ this.ctx.FLOAT,
1326
+ false,
1327
+ 0,
1328
+ 4 * universalShapesStart
1329
+ );
905
1330
 
906
1331
  this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, buffers.color);
907
- this.ctx.vertexAttribPointer(shader_program.vertexColorAttribute, buffers.color.itemSize, this.ctx.FLOAT, false, 0, 4*universalShapesStart);
1332
+ this.ctx.vertexAttribPointer(
1333
+ shader_program.vertexColorAttribute,
1334
+ buffers.color.itemSize,
1335
+ this.ctx.FLOAT,
1336
+ false,
1337
+ 0,
1338
+ 4 * universalShapesStart
1339
+ );
908
1340
 
909
- this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, simple_count_buffer);
910
- this.ctx.vertexAttribPointer(shader_program.vertexOncoprintColumnAttribute, 1, this.ctx.FLOAT, false, 0, 0);
911
- this.ext.vertexAttribDivisorANGLE(shader_program.vertexOncoprintColumnAttribute, 1);
1341
+ this.ctx.bindBuffer(
1342
+ this.ctx.ARRAY_BUFFER,
1343
+ simple_count_buffer
1344
+ );
1345
+ this.ctx.vertexAttribPointer(
1346
+ shader_program.vertexOncoprintColumnAttribute,
1347
+ 1,
1348
+ this.ctx.FLOAT,
1349
+ false,
1350
+ 0,
1351
+ 0
1352
+ );
1353
+ this.ext.vertexAttribDivisorANGLE(
1354
+ shader_program.vertexOncoprintColumnAttribute,
1355
+ 1
1356
+ );
912
1357
  }
913
1358
 
914
1359
  this.ctx.activeTexture(this.ctx.TEXTURE0);
915
- this.ctx.bindTexture(this.ctx.TEXTURE_2D, buffers.color_tex.texture);
1360
+ this.ctx.bindTexture(
1361
+ this.ctx.TEXTURE_2D,
1362
+ buffers.color_tex.texture
1363
+ );
916
1364
  this.ctx.uniform1i(this.shader_program.samplerUniform, 0);
917
- this.ctx.uniform1f(this.shader_program.texSizeUniform, buffers.color_tex.size);
918
-
919
- this.ctx.uniformMatrix4fv(this.shader_program.pMatrixUniform, false, this.pMatrix);
920
- this.ctx.uniformMatrix4fv(this.shader_program.mvMatrixUniform, false, this.mvMatrix);
921
- this.ctx.uniform1f(this.shader_program.columnWidthUniform, model.getCellWidth(true));
1365
+ this.ctx.uniform1f(
1366
+ this.shader_program.texSizeUniform,
1367
+ buffers.color_tex.size
1368
+ );
1369
+
1370
+ this.ctx.uniformMatrix4fv(
1371
+ this.shader_program.pMatrixUniform,
1372
+ false,
1373
+ this.pMatrix
1374
+ );
1375
+ this.ctx.uniformMatrix4fv(
1376
+ this.shader_program.mvMatrixUniform,
1377
+ false,
1378
+ this.mvMatrix
1379
+ );
1380
+ this.ctx.uniform1f(
1381
+ this.shader_program.columnWidthUniform,
1382
+ model.getCellWidth(true)
1383
+ );
922
1384
  this.ctx.uniform1f(this.shader_program.zoomXUniform, zoom.x);
923
1385
  this.ctx.uniform1f(this.shader_program.zoomYUniform, zoom.y);
924
- this.ctx.uniform1f(this.shader_program.offsetYUniform, cell_top);
925
- this.ctx.uniform1f(this.shader_program.positionBitPackBaseUniform, cell_view.position_bit_pack_base);
926
-
1386
+ this.ctx.uniform1f(
1387
+ this.shader_program.offsetYUniform,
1388
+ cell_top
1389
+ );
1390
+ this.ctx.uniform1f(
1391
+ this.shader_program.positionBitPackBaseUniform,
1392
+ cell_view.position_bit_pack_base
1393
+ );
927
1394
 
928
1395
  if (forSpecificShapes) {
929
- this.ctx.drawArrays(this.ctx.TRIANGLES, 0, buffers.position.specificShapesNumItems);
1396
+ this.ctx.drawArrays(
1397
+ this.ctx.TRIANGLES,
1398
+ 0,
1399
+ buffers.position.specificShapesNumItems
1400
+ );
930
1401
  } else {
931
1402
  this.ext.drawArraysInstancedANGLE(
932
1403
  this.ctx.TRIANGLES,
933
1404
  0,
934
- buffers.position.itemSize * buffers.position.universalShapesNumItems,
1405
+ buffers.position.itemSize *
1406
+ buffers.position.universalShapesNumItems,
935
1407
  simple_count_buffer.numItems
936
1408
  );
937
1409
  }
@@ -940,18 +1412,26 @@ export default class OncoprintMinimapView {
940
1412
  }
941
1413
  }
942
1414
 
943
- private getZoom(model:OncoprintModel) {
944
- let zoom_x = parseInt(this.$canvas[0].width as any, 10) / model.getOncoprintWidthNoColumnPaddingNoGaps();
945
- let zoom_y = parseInt(this.$canvas[0].height as any, 10) / model.getOncoprintHeight(true);
1415
+ private getZoom(model: OncoprintModel) {
1416
+ let zoom_x =
1417
+ parseInt(this.$canvas[0].width as any, 10) /
1418
+ model.getOncoprintWidthNoColumnPaddingNoGaps();
1419
+ let zoom_y =
1420
+ parseInt(this.$canvas[0].height as any, 10) /
1421
+ model.getOncoprintHeight(true);
946
1422
  zoom_x = Math.max(0, Math.min(1, zoom_x));
947
1423
  zoom_y = Math.max(0, Math.min(1, zoom_y));
948
1424
  return {
949
1425
  x: zoom_x,
950
- y: zoom_y
1426
+ y: zoom_y,
951
1427
  };
952
1428
  }
953
1429
 
954
- private drawOverlayRect(model:OncoprintModel, cell_view:OncoprintWebGLCellView, opt_rect?:OverlayRectSpec) {
1430
+ private drawOverlayRect(
1431
+ model: OncoprintModel,
1432
+ cell_view: OncoprintWebGLCellView,
1433
+ opt_rect?: OverlayRectSpec
1434
+ ) {
955
1435
  if (!this.shouldRender) {
956
1436
  return;
957
1437
  }
@@ -971,9 +1451,13 @@ export default class OncoprintMinimapView {
971
1451
 
972
1452
  const zoom = this.getZoom(model);
973
1453
  left_col = model.getClosestColumnIndexToLeft(viewport.left, false);
974
- right_col = model.getClosestColumnIndexToLeft(viewport.right, false, true);
1454
+ right_col = model.getClosestColumnIndexToLeft(
1455
+ viewport.right,
1456
+ false,
1457
+ true
1458
+ );
975
1459
  left = left_col * cell_width * zoom.x;
976
- width = (right_col-left_col) * cell_width * zoom.x;
1460
+ width = (right_col - left_col) * cell_width * zoom.x;
977
1461
  top = viewport.top * zoom.y;
978
1462
  height = (viewport.bottom - viewport.top) * zoom.y;
979
1463
  }
@@ -984,58 +1468,73 @@ export default class OncoprintMinimapView {
984
1468
  const canv_height = parseInt(canv.height as any, 10);
985
1469
 
986
1470
  // Clear
987
- ctx.fillStyle = "rgba(0,0,0,0)";
1471
+ ctx.fillStyle = 'rgba(0,0,0,0)';
988
1472
  ctx.clearRect(0, 0, canv_width, canv_height);
989
1473
  // Draw rectangle
990
- ctx.fillStyle = "rgba(255,255,255,0.4)";
1474
+ ctx.fillStyle = 'rgba(255,255,255,0.4)';
991
1475
  ctx.fillRect(left, top, width, height);
992
1476
  // Draw border line by line
993
- const unhover_color = "rgba(0,0,0,0.75)";
994
- const hover_color = "rgba(255,0,0,1)";
1477
+ const unhover_color = 'rgba(0,0,0,0.75)';
1478
+ const hover_color = 'rgba(255,0,0,1)';
995
1479
  const unhover_width = 1;
996
1480
  const hover_width = 2;
997
- const top_is_hovered = this.resize_hover === "t" || this.resize_hover === "tr" || this.resize_hover === "tl";
998
- const right_is_hovered = this.resize_hover === "r" || this.resize_hover === "tr" || this.resize_hover === "br";
999
- const bottom_is_hovered = this.resize_hover === "b" || this.resize_hover === "br" || this.resize_hover === "bl";
1000
- const left_is_hovered = this.resize_hover === "l" || this.resize_hover === "tl" || this.resize_hover === "bl";
1481
+ const top_is_hovered =
1482
+ this.resize_hover === 't' ||
1483
+ this.resize_hover === 'tr' ||
1484
+ this.resize_hover === 'tl';
1485
+ const right_is_hovered =
1486
+ this.resize_hover === 'r' ||
1487
+ this.resize_hover === 'tr' ||
1488
+ this.resize_hover === 'br';
1489
+ const bottom_is_hovered =
1490
+ this.resize_hover === 'b' ||
1491
+ this.resize_hover === 'br' ||
1492
+ this.resize_hover === 'bl';
1493
+ const left_is_hovered =
1494
+ this.resize_hover === 'l' ||
1495
+ this.resize_hover === 'tl' ||
1496
+ this.resize_hover === 'bl';
1001
1497
  // Draw top border
1002
1498
  ctx.beginPath();
1003
1499
  ctx.moveTo(left, top);
1004
1500
  ctx.strokeStyle = top_is_hovered ? hover_color : unhover_color;
1005
1501
  ctx.lineWidth = top_is_hovered ? hover_width : unhover_width;
1006
- ctx.lineTo(left+width, top);
1502
+ ctx.lineTo(left + width, top);
1007
1503
  ctx.stroke();
1008
1504
  // Draw right border
1009
1505
  ctx.beginPath();
1010
- ctx.moveTo(left+width, top);
1506
+ ctx.moveTo(left + width, top);
1011
1507
  ctx.strokeStyle = right_is_hovered ? hover_color : unhover_color;
1012
1508
  ctx.lineWidth = right_is_hovered ? hover_width : unhover_width;
1013
- ctx.lineTo(left+width, top+height);
1509
+ ctx.lineTo(left + width, top + height);
1014
1510
  ctx.stroke();
1015
1511
  // Draw bottom border
1016
1512
  ctx.beginPath();
1017
- ctx.moveTo(left+width, top+height);
1513
+ ctx.moveTo(left + width, top + height);
1018
1514
  ctx.strokeStyle = bottom_is_hovered ? hover_color : unhover_color;
1019
1515
  ctx.lineWidth = bottom_is_hovered ? hover_width : unhover_width;
1020
- ctx.lineTo(left, top+height);
1516
+ ctx.lineTo(left, top + height);
1021
1517
  ctx.stroke();
1022
1518
  // Draw left border
1023
1519
  ctx.beginPath();
1024
- ctx.moveTo(left, top+height);
1520
+ ctx.moveTo(left, top + height);
1025
1521
  ctx.strokeStyle = left_is_hovered ? hover_color : unhover_color;
1026
1522
  ctx.lineWidth = left_is_hovered ? hover_width : unhover_width;
1027
1523
  ctx.lineTo(left, top);
1028
1524
  ctx.stroke();
1029
1525
 
1030
1526
  this.current_rect.setParams({
1031
- 'top':top,
1032
- 'left_col':left_col,
1033
- 'right_col':right_col,
1034
- 'height':height,
1527
+ top: top,
1528
+ left_col: left_col,
1529
+ right_col: right_col,
1530
+ height: height,
1035
1531
  });
1036
1532
  }
1037
1533
 
1038
- private drawOncoprintAndOverlayRect(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1534
+ private drawOncoprintAndOverlayRect(
1535
+ model: OncoprintModel,
1536
+ cell_view: OncoprintWebGLCellView
1537
+ ) {
1039
1538
  if (!this.shouldRender) {
1040
1539
  return;
1041
1540
  }
@@ -1043,75 +1542,114 @@ export default class OncoprintMinimapView {
1043
1542
  this.drawOverlayRect(model, cell_view);
1044
1543
  }
1045
1544
 
1046
-
1047
1545
  // API BEGINS HERE
1048
1546
 
1049
- public moveTrack(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1547
+ public moveTrack(model: OncoprintModel, cell_view: OncoprintWebGLCellView) {
1050
1548
  this.drawOncoprintAndOverlayRect(model, cell_view);
1051
1549
  }
1052
- public addTracks(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1550
+ public addTracks(model: OncoprintModel, cell_view: OncoprintWebGLCellView) {
1053
1551
  this.drawOncoprintAndOverlayRect(model, cell_view);
1054
1552
  }
1055
- public removeTrack(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1553
+ public removeTrack(
1554
+ model: OncoprintModel,
1555
+ cell_view: OncoprintWebGLCellView
1556
+ ) {
1056
1557
  this.drawOncoprintAndOverlayRect(model, cell_view);
1057
1558
  }
1058
- public setHorzZoom(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1559
+ public setHorzZoom(
1560
+ model: OncoprintModel,
1561
+ cell_view: OncoprintWebGLCellView
1562
+ ) {
1059
1563
  this.drawOverlayRect(model, cell_view);
1060
1564
  this.horizontal_zoom.setSliderValue(model.getHorzZoom());
1061
1565
  }
1062
- public setVertZoom(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1566
+ public setVertZoom(
1567
+ model: OncoprintModel,
1568
+ cell_view: OncoprintWebGLCellView
1569
+ ) {
1063
1570
  this.drawOverlayRect(model, cell_view);
1064
1571
  this.vertical_zoom.setSliderValue(model.getVertZoom());
1065
1572
  }
1066
- public setZoom(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1573
+ public setZoom(model: OncoprintModel, cell_view: OncoprintWebGLCellView) {
1067
1574
  this.drawOverlayRect(model, cell_view);
1068
1575
  this.horizontal_zoom.setSliderValue(model.getHorzZoom());
1069
1576
  this.vertical_zoom.setSliderValue(model.getVertZoom());
1070
1577
  }
1071
- public setScroll(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1578
+ public setScroll(model: OncoprintModel, cell_view: OncoprintWebGLCellView) {
1072
1579
  this.drawOverlayRect(model, cell_view);
1073
1580
  }
1074
- public setHorzScroll(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1581
+ public setHorzScroll(
1582
+ model: OncoprintModel,
1583
+ cell_view: OncoprintWebGLCellView
1584
+ ) {
1075
1585
  this.drawOverlayRect(model, cell_view);
1076
1586
  }
1077
- public setVertScroll(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1587
+ public setVertScroll(
1588
+ model: OncoprintModel,
1589
+ cell_view: OncoprintWebGLCellView
1590
+ ) {
1078
1591
  this.drawOverlayRect(model, cell_view);
1079
1592
  }
1080
- public setViewport(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1593
+ public setViewport(
1594
+ model: OncoprintModel,
1595
+ cell_view: OncoprintWebGLCellView
1596
+ ) {
1081
1597
  this.drawOverlayRect(model, cell_view);
1082
1598
  this.horizontal_zoom.setSliderValue(model.getHorzZoom());
1083
1599
  this.vertical_zoom.setSliderValue(model.getVertZoom());
1084
1600
  }
1085
- public sort(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1601
+ public sort(model: OncoprintModel, cell_view: OncoprintWebGLCellView) {
1086
1602
  this.drawOncoprintAndOverlayRect(model, cell_view);
1087
1603
  }
1088
- public setTrackData(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1604
+ public setTrackData(
1605
+ model: OncoprintModel,
1606
+ cell_view: OncoprintWebGLCellView
1607
+ ) {
1089
1608
  this.drawOncoprintAndOverlayRect(model, cell_view);
1090
1609
  }
1091
- public shareRuleSet(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1610
+ public shareRuleSet(
1611
+ model: OncoprintModel,
1612
+ cell_view: OncoprintWebGLCellView
1613
+ ) {
1092
1614
  this.drawOncoprintAndOverlayRect(model, cell_view);
1093
1615
  }
1094
- public setRuleSet(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1616
+ public setRuleSet(
1617
+ model: OncoprintModel,
1618
+ cell_view: OncoprintWebGLCellView
1619
+ ) {
1095
1620
  this.drawOncoprintAndOverlayRect(model, cell_view);
1096
1621
  }
1097
- public setIdOrder(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1622
+ public setIdOrder(
1623
+ model: OncoprintModel,
1624
+ cell_view: OncoprintWebGLCellView
1625
+ ) {
1098
1626
  this.drawOncoprintAndOverlayRect(model, cell_view);
1099
1627
  }
1100
- public setTrackGroupHeader(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1628
+ public setTrackGroupHeader(
1629
+ model: OncoprintModel,
1630
+ cell_view: OncoprintWebGLCellView
1631
+ ) {
1101
1632
  this.drawOncoprintAndOverlayRect(model, cell_view);
1102
1633
  }
1103
1634
  public suppressRendering() {
1104
1635
  this.rendering_suppressed = true;
1105
1636
  }
1106
- public releaseRendering(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1637
+ public releaseRendering(
1638
+ model: OncoprintModel,
1639
+ cell_view: OncoprintWebGLCellView
1640
+ ) {
1107
1641
  this.rendering_suppressed = false;
1108
1642
  this.drawOncoprintAndOverlayRect(model, cell_view);
1109
1643
  }
1110
- public hideIds(model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1644
+ public hideIds(model: OncoprintModel, cell_view: OncoprintWebGLCellView) {
1111
1645
  this.drawOncoprintAndOverlayRect(model, cell_view);
1112
1646
  }
1113
1647
 
1114
- public setMinimapVisible(visible:boolean, model?:OncoprintModel, cell_view?:OncoprintWebGLCellView) {
1648
+ public setMinimapVisible(
1649
+ visible: boolean,
1650
+ model?: OncoprintModel,
1651
+ cell_view?: OncoprintWebGLCellView
1652
+ ) {
1115
1653
  this.visible = visible;
1116
1654
 
1117
1655
  if (this.visible && model && cell_view) {
@@ -1119,17 +1657,21 @@ export default class OncoprintMinimapView {
1119
1657
  }
1120
1658
  }
1121
1659
 
1122
- public setWindowPosition(x:number, y:number) {
1123
- this.$div.css({'top': y, 'left': x});
1660
+ public setWindowPosition(x: number, y: number) {
1661
+ this.$div.css({ top: y, left: x });
1124
1662
  }
1125
1663
 
1126
- public setWidth(w:number, model:OncoprintModel, cell_view:OncoprintWebGLCellView) {
1664
+ public setWidth(
1665
+ w: number,
1666
+ model: OncoprintModel,
1667
+ cell_view: OncoprintWebGLCellView
1668
+ ) {
1127
1669
  this.$canvas[0].width = w;
1128
1670
  this.$overlay_canvas[0].width = w;
1129
1671
  this.getWebGLContextAndSetUpMatrices();
1130
1672
  this.setUpShaders();
1131
- this.overlay_ctx = this.$overlay_canvas[0].getContext("2d");
1673
+ this.overlay_ctx = this.$overlay_canvas[0].getContext('2d');
1132
1674
 
1133
1675
  this.drawOncoprintAndOverlayRect(model, cell_view);
1134
1676
  }
1135
- }
1677
+ }