igv 2.13.1 → 2.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/igv.esm.js CHANGED
@@ -17904,7 +17904,9 @@ const MenuUtils = {
17904
17904
  menuItems.push('<hr/>');
17905
17905
  menuItems.push(colorPickerMenuItem({trackView, label: "Set track color", option: "color"}));
17906
17906
  menuItems.push(unsetColorMenuItem({trackView, label: "Unset track color"}));
17907
- menuItems.push(colorPickerMenuItem({trackView, label: "Set alt color", option: "altColor"}));
17907
+ if(trackView.track.config.type === 'wig' || trackView.track.config.type === 'annotation') {
17908
+ menuItems.push(colorPickerMenuItem({trackView, label: "Set alt color", option: "altColor"}));
17909
+ }
17908
17910
  }
17909
17911
 
17910
17912
  if (trackView.track.menuItemList) {
@@ -18190,6 +18192,455 @@ function getTrackLabelText(track) {
18190
18192
  return txt
18191
18193
  }
18192
18194
 
18195
+ /*
18196
+ * The MIT License (MIT)
18197
+ *
18198
+ * Copyright (c) 2016-2017 The Regents of the University of California
18199
+ * Author: Jim Robinson
18200
+ *
18201
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18202
+ * of this software and associated documentation files (the "Software"), to deal
18203
+ * in the Software without restriction, including without limitation the rights
18204
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18205
+ * copies of the Software, and to permit persons to whom the Software is
18206
+ * furnished to do so, subject to the following conditions:
18207
+ *
18208
+ * The above copyright notice and this permission notice shall be included in
18209
+ * all copies or substantial portions of the Software.
18210
+ *
18211
+ *
18212
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18213
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18214
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18215
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18216
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18217
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18218
+ * THE SOFTWARE.
18219
+ */
18220
+
18221
+ class DataRangeDialog {
18222
+
18223
+ constructor(browser, $parent, alert) {
18224
+
18225
+ this.browser = browser;
18226
+
18227
+ // dialog container
18228
+ this.$container = $$1("<div>", {class: 'igv-generic-dialog-container'});
18229
+ $parent.append(this.$container);
18230
+ this.$container.offset({left: 0, top: 0});
18231
+
18232
+ // dialog header
18233
+ const $header = $$1("<div>", {class: 'igv-generic-dialog-header'});
18234
+ this.$container.append($header);
18235
+ attachDialogCloseHandlerWithParent$1($header[0], () => {
18236
+ this.$minimum_input.val(undefined);
18237
+ this.$maximum_input.val(undefined);
18238
+ this.$container.offset({left: 0, top: 0});
18239
+ this.$container.hide();
18240
+ });
18241
+
18242
+
18243
+ // minimun
18244
+ this.$minimum = $$1("<div>", {class: 'igv-generic-dialog-label-input'});
18245
+ this.$container.append(this.$minimum);
18246
+ const $mindiv = $$1('<div>');
18247
+ $mindiv.text('Minimum');
18248
+ this.$minimum.append($mindiv);
18249
+ this.$minimum_input = $$1("<input>");
18250
+ this.$minimum.append(this.$minimum_input);
18251
+
18252
+
18253
+ // maximum
18254
+ this.$maximum = $$1("<div>", {class: 'igv-generic-dialog-label-input'});
18255
+ this.$container.append(this.$maximum);
18256
+ const $maxdiv = $$1('<div>');
18257
+ $maxdiv.text('Maximum');
18258
+ this.$maximum.append($maxdiv);
18259
+ this.$maximum_input = $$1("<input>");
18260
+ this.$maximum.append(this.$maximum_input);
18261
+
18262
+ // ok | cancel
18263
+ const $buttons = $$1("<div>", {class: 'igv-generic-dialog-ok-cancel'});
18264
+ this.$container.append($buttons);
18265
+
18266
+ // ok
18267
+ this.$ok = $$1("<div>");
18268
+ $buttons.append(this.$ok);
18269
+ this.$ok.text('OK');
18270
+
18271
+ // cancel
18272
+ this.$cancel = $$1("<div>");
18273
+ $buttons.append(this.$cancel);
18274
+ this.$cancel.text('Cancel');
18275
+
18276
+ this.$cancel.on('click', () => {
18277
+ this.$minimum_input.val(undefined);
18278
+ this.$maximum_input.val(undefined);
18279
+ this.$container.offset({left: 0, top: 0});
18280
+ this.$container.hide();
18281
+ });
18282
+
18283
+ //this.$container.draggable({ handle:$header.get(0) });
18284
+ makeDraggable$1(this.$container.get(0), $header.get(0));
18285
+
18286
+ this.$container.hide();
18287
+ }
18288
+
18289
+ configure(trackView) {
18290
+
18291
+ const dataRange = trackView.dataRange();
18292
+ let min;
18293
+ let max;
18294
+ if (dataRange) {
18295
+ min = dataRange.min;
18296
+ max = dataRange.max;
18297
+ } else {
18298
+ min = 0;
18299
+ max = 100;
18300
+ }
18301
+
18302
+ this.$minimum_input.val(min);
18303
+ this.$maximum_input.val(max);
18304
+
18305
+ this.$minimum_input.unbind();
18306
+ this.$minimum_input.on('keyup', (e) => {
18307
+ if (13 === e.keyCode) {
18308
+ this.processResults(trackView);
18309
+ }
18310
+ });
18311
+
18312
+ this.$maximum_input.unbind();
18313
+ this.$maximum_input.on('keyup', (e) => {
18314
+ if (13 === e.keyCode) {
18315
+ this.processResults(trackView);
18316
+ }
18317
+ });
18318
+
18319
+ this.$ok.unbind();
18320
+ this.$ok.on('click', (e) => {
18321
+ this.processResults(trackView);
18322
+ });
18323
+ }
18324
+
18325
+
18326
+ processResults(trackView) {
18327
+
18328
+ const min = Number(this.$minimum_input.val());
18329
+ const max = Number(this.$maximum_input.val());
18330
+ if (isNaN(min) || isNaN(max)) {
18331
+ this.browser.alert.present(new Error('Must input numeric values'), undefined);
18332
+ } else {
18333
+ trackView.setDataRange(min, max);
18334
+ }
18335
+
18336
+ this.$minimum_input.val(undefined);
18337
+ this.$maximum_input.val(undefined);
18338
+ this.$container.offset({left: 0, top: 0});
18339
+ this.$container.hide();
18340
+ }
18341
+
18342
+ present($parent) {
18343
+
18344
+ const offset_top = $parent.offset().top;
18345
+ const scroll_top = $$1('body').scrollTop();
18346
+
18347
+ this.$container.offset({left: $parent.width() - this.$container.width(), top: (offset_top + scroll_top)});
18348
+ this.$container.show();
18349
+ }
18350
+ }
18351
+
18352
+ /*
18353
+ * The MIT License (MIT)
18354
+ *
18355
+ * Copyright (c) 2014 Broad Institute
18356
+ *
18357
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18358
+ * of ctx software and associated documentation files (the "Software"), to deal
18359
+ * in the Software without restriction, including without limitation the rights
18360
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18361
+ * copies of the Software, and to permit persons to whom the Software is
18362
+ * furnished to do so, subject to the following conditions:
18363
+ *
18364
+ * The above copyright notice and ctx permission notice shall be included in
18365
+ * all copies or substantial portions of the Software.
18366
+ *
18367
+ *
18368
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18369
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18370
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18371
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18372
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18373
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18374
+ * THE SOFTWARE.
18375
+ */
18376
+
18377
+
18378
+ const IGVGraphics = {
18379
+
18380
+ configureHighDPICanvas: function (ctx, w, h) {
18381
+
18382
+ const scaleFactor = window.devicePixelRatio;
18383
+ // const scaleFactor = 1
18384
+
18385
+ ctx.canvas.style.width = (`${w}px`);
18386
+ ctx.canvas.width = Math.floor(scaleFactor * w);
18387
+
18388
+ ctx.canvas.style.height = (`${h}px`);
18389
+ ctx.canvas.height = Math.floor(scaleFactor * h);
18390
+
18391
+ ctx.scale(scaleFactor, scaleFactor);
18392
+
18393
+ },
18394
+
18395
+ setProperties: function (ctx, properties) {
18396
+
18397
+ for (var key in properties) {
18398
+ if (properties.hasOwnProperty(key)) {
18399
+ var value = properties[key];
18400
+ ctx[key] = value;
18401
+ }
18402
+ }
18403
+ },
18404
+
18405
+ strokeLine: function (ctx, x1, y1, x2, y2, properties) {
18406
+
18407
+ x1 = Math.floor(x1) + 0.5;
18408
+ y1 = Math.floor(y1) + 0.5;
18409
+ x2 = Math.floor(x2) + 0.5;
18410
+ y2 = Math.floor(y2) + 0.5;
18411
+
18412
+ if (properties) {
18413
+ ctx.save();
18414
+ IGVGraphics.setProperties(ctx, properties);
18415
+ }
18416
+
18417
+ ctx.beginPath();
18418
+ ctx.moveTo(x1, y1);
18419
+ ctx.lineTo(x2, y2);
18420
+ ctx.stroke();
18421
+
18422
+ if (properties) ctx.restore();
18423
+ },
18424
+
18425
+ fillRect: function (ctx, x, y, w, h, properties) {
18426
+ x = Math.round(x);
18427
+ y = Math.round(y);
18428
+
18429
+ if (properties) {
18430
+ ctx.save();
18431
+ IGVGraphics.setProperties(ctx, properties);
18432
+ }
18433
+
18434
+ ctx.fillRect(x, y, w, h);
18435
+
18436
+ if (properties) ctx.restore();
18437
+ },
18438
+
18439
+ fillPolygon: function (ctx, x, y, properties) {
18440
+ if (properties) {
18441
+ ctx.save();
18442
+ IGVGraphics.setProperties(ctx, properties);
18443
+ }
18444
+ doPath(ctx, x, y);
18445
+ ctx.fill();
18446
+ if (properties) ctx.restore();
18447
+ },
18448
+
18449
+ strokePolygon: function (ctx, x, y, properties) {
18450
+ if (properties) {
18451
+ ctx.save();
18452
+ IGVGraphics.setProperties(ctx, properties);
18453
+ }
18454
+ doPath(ctx, x, y);
18455
+ ctx.stroke();
18456
+ if (properties) ctx.restore();
18457
+ },
18458
+
18459
+ fillText: function (ctx, text, x, y, properties, transforms) {
18460
+
18461
+ if (properties || transforms) {
18462
+ ctx.save();
18463
+ }
18464
+
18465
+ if (properties) {
18466
+ IGVGraphics.setProperties(ctx, properties);
18467
+ }
18468
+
18469
+ if (transforms) {
18470
+ // Slow path with context saving and extra translate
18471
+ ctx.translate(x, y);
18472
+
18473
+ for (var transform in transforms) {
18474
+ var value = transforms[transform];
18475
+
18476
+ // TODO: Add error checking for robustness
18477
+ if (transform === 'translate') {
18478
+ ctx.translate(value['x'], value['y']);
18479
+ }
18480
+ if (transform === 'rotate') {
18481
+ ctx.rotate(value['angle'] * Math.PI / 180);
18482
+ }
18483
+ }
18484
+
18485
+ ctx.fillText(text, 0, 0);
18486
+ } else {
18487
+ ctx.fillText(text, x, y);
18488
+ }
18489
+
18490
+ if (properties || transforms) ctx.restore();
18491
+ },
18492
+
18493
+ strokeText: function (ctx, text, x, y, properties, transforms) {
18494
+
18495
+
18496
+ if (properties || transforms) {
18497
+ ctx.save();
18498
+ }
18499
+
18500
+ if (properties) {
18501
+ IGVGraphics.setProperties(ctx, properties);
18502
+ }
18503
+
18504
+ if (transforms) {
18505
+ ctx.translate(x, y);
18506
+
18507
+ for (var transform in transforms) {
18508
+ var value = transforms[transform];
18509
+
18510
+ // TODO: Add error checking for robustness
18511
+ if (transform === 'translate') {
18512
+ ctx.translate(value['x'], value['y']);
18513
+ }
18514
+ if (transform === 'rotate') {
18515
+ ctx.rotate(value['angle'] * Math.PI / 180);
18516
+ }
18517
+ }
18518
+
18519
+ ctx.strokeText(text, 0, 0);
18520
+ } else {
18521
+ ctx.strokeText(text, x, y);
18522
+ }
18523
+
18524
+ if (properties || transforms) ctx.restore();
18525
+ },
18526
+
18527
+ strokeCircle: function (ctx, x, y, radius, properties) {
18528
+ if (properties) {
18529
+ ctx.save();
18530
+ IGVGraphics.setProperties(ctx, properties);
18531
+ }
18532
+ ctx.beginPath();
18533
+ ctx.arc(x, y, radius, 0, 2 * Math.PI);
18534
+ ctx.stroke();
18535
+ if (properties) ctx.restore();
18536
+ },
18537
+
18538
+ fillCircle: function (ctx, x, y, radius, properties) {
18539
+ if (properties) {
18540
+ ctx.save();
18541
+ IGVGraphics.setProperties(ctx, properties);
18542
+ }
18543
+ ctx.beginPath();
18544
+ ctx.arc(x, y, radius, 0, 2 * Math.PI);
18545
+ ctx.fill();
18546
+ if (properties) ctx.restore();
18547
+ },
18548
+
18549
+ drawArrowhead: function (ctx, x, y, size, lineWidth) {
18550
+
18551
+ ctx.save();
18552
+ if (!size) {
18553
+ size = 5;
18554
+ }
18555
+ if (lineWidth) {
18556
+ ctx.lineWidth = lineWidth;
18557
+ }
18558
+ ctx.beginPath();
18559
+ ctx.moveTo(x, y - size / 2);
18560
+ ctx.lineTo(x, y + size / 2);
18561
+ ctx.lineTo(x + size, y);
18562
+ ctx.lineTo(x, y - size / 2);
18563
+ ctx.closePath();
18564
+ ctx.fill();
18565
+ ctx.restore();
18566
+ },
18567
+
18568
+ dashedLine: function (ctx, x1, y1, x2, y2, dashLen, properties = {}) {
18569
+ if (dashLen === undefined) dashLen = 2;
18570
+ ctx.setLineDash([dashLen, dashLen]);
18571
+ IGVGraphics.strokeLine(ctx, x1, y1, x2, y2, properties);
18572
+ ctx.setLineDash([]);
18573
+ },
18574
+
18575
+ roundRect: function (ctx, x, y, width, height, radius, fill, stroke) {
18576
+
18577
+ if (typeof stroke == "undefined") {
18578
+ stroke = true;
18579
+ }
18580
+ if (typeof radius === "undefined") {
18581
+ radius = 5;
18582
+ }
18583
+ ctx.beginPath();
18584
+ ctx.moveTo(x + radius, y);
18585
+ ctx.lineTo(x + width - radius, y);
18586
+ ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
18587
+ ctx.lineTo(x + width, y + height - radius);
18588
+ ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
18589
+ ctx.lineTo(x + radius, y + height);
18590
+ ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
18591
+ ctx.lineTo(x, y + radius);
18592
+ ctx.quadraticCurveTo(x, y, x + radius, y);
18593
+ ctx.closePath();
18594
+ if (stroke) {
18595
+ ctx.stroke();
18596
+ }
18597
+ if (fill) {
18598
+ ctx.fill();
18599
+ }
18600
+ },
18601
+ polygon: function (ctx, x, y, fill, stroke) {
18602
+
18603
+ if (typeof stroke == "undefined") {
18604
+ stroke = true;
18605
+ }
18606
+
18607
+ ctx.beginPath();
18608
+ var len = x.length;
18609
+ ctx.moveTo(x[0], y[0]);
18610
+ for (var i = 1; i < len; i++) {
18611
+ ctx.lineTo(x[i], y[i]);
18612
+ // this.moveTo(x[i], y[i]);
18613
+ }
18614
+
18615
+ ctx.closePath();
18616
+ if (stroke) {
18617
+ ctx.stroke();
18618
+ }
18619
+ if (fill) {
18620
+ ctx.fill();
18621
+ }
18622
+ }
18623
+
18624
+
18625
+ };
18626
+
18627
+ function doPath(ctx, x, y) {
18628
+
18629
+
18630
+ var i, len = x.length;
18631
+ for (i = 0; i < len; i++) {
18632
+ x[i] = Math.round(x[i]);
18633
+ y[i] = Math.round(y[i]);
18634
+ }
18635
+
18636
+ ctx.beginPath();
18637
+ ctx.moveTo(x[0], y[0]);
18638
+ for (i = 1; i < len; i++) {
18639
+ ctx.lineTo(x[i], y[i]);
18640
+ }
18641
+ ctx.closePath();
18642
+ }
18643
+
18193
18644
  function div(options) {
18194
18645
  return create("div", options);
18195
18646
  }
@@ -18534,24 +18985,6 @@ class AlertDialog {
18534
18985
  }
18535
18986
  }
18536
18987
 
18537
- // The global Alert dialog
18538
-
18539
- let alertDialog;
18540
-
18541
- const Alert = {
18542
-
18543
- init(root, config={}) {
18544
- alertDialog = new AlertDialog(root, config);
18545
- },
18546
-
18547
- presentAlert (alert, callback) {
18548
- if(!alertDialog) {
18549
- this.init(document.body);
18550
- }
18551
- alertDialog.present(alert, callback);
18552
- },
18553
- };
18554
-
18555
18988
  class InputDialog {
18556
18989
 
18557
18990
  constructor(parent) {
@@ -19903,451 +20336,15 @@ if (typeof document !== 'undefined') {
19903
20336
  }
19904
20337
  }
19905
20338
 
19906
- /*
19907
- * The MIT License (MIT)
19908
- *
19909
- * Copyright (c) 2016-2017 The Regents of the University of California
19910
- * Author: Jim Robinson
19911
- *
19912
- * Permission is hereby granted, free of charge, to any person obtaining a copy
19913
- * of this software and associated documentation files (the "Software"), to deal
19914
- * in the Software without restriction, including without limitation the rights
19915
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19916
- * copies of the Software, and to permit persons to whom the Software is
19917
- * furnished to do so, subject to the following conditions:
19918
- *
19919
- * The above copyright notice and this permission notice shall be included in
19920
- * all copies or substantial portions of the Software.
19921
- *
19922
- *
19923
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19924
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19925
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19926
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19927
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19928
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19929
- * THE SOFTWARE.
19930
- */
19931
-
19932
- class DataRangeDialog {
19933
-
19934
- constructor($parent, alert) {
19935
-
19936
- // dialog container
19937
- this.$container = $$1("<div>", {class: 'igv-generic-dialog-container'});
19938
- $parent.append(this.$container);
19939
- this.$container.offset({left: 0, top: 0});
19940
-
19941
- // dialog header
19942
- const $header = $$1("<div>", {class: 'igv-generic-dialog-header'});
19943
- this.$container.append($header);
19944
- attachDialogCloseHandlerWithParent$1($header[0], () => {
19945
- this.$minimum_input.val(undefined);
19946
- this.$maximum_input.val(undefined);
19947
- this.$container.offset({left: 0, top: 0});
19948
- this.$container.hide();
19949
- });
19950
-
19951
-
19952
- // minimun
19953
- this.$minimum = $$1("<div>", {class: 'igv-generic-dialog-label-input'});
19954
- this.$container.append(this.$minimum);
19955
- const $mindiv = $$1('<div>');
19956
- $mindiv.text('Minimum');
19957
- this.$minimum.append($mindiv);
19958
- this.$minimum_input = $$1("<input>");
19959
- this.$minimum.append(this.$minimum_input);
19960
-
19961
-
19962
- // maximum
19963
- this.$maximum = $$1("<div>", {class: 'igv-generic-dialog-label-input'});
19964
- this.$container.append(this.$maximum);
19965
- const $maxdiv = $$1('<div>');
19966
- $maxdiv.text('Maximum');
19967
- this.$maximum.append($maxdiv);
19968
- this.$maximum_input = $$1("<input>");
19969
- this.$maximum.append(this.$maximum_input);
19970
-
19971
- // ok | cancel
19972
- const $buttons = $$1("<div>", {class: 'igv-generic-dialog-ok-cancel'});
19973
- this.$container.append($buttons);
19974
-
19975
- // ok
19976
- this.$ok = $$1("<div>");
19977
- $buttons.append(this.$ok);
19978
- this.$ok.text('OK');
19979
-
19980
- // cancel
19981
- this.$cancel = $$1("<div>");
19982
- $buttons.append(this.$cancel);
19983
- this.$cancel.text('Cancel');
19984
-
19985
- this.$cancel.on('click', () => {
19986
- this.$minimum_input.val(undefined);
19987
- this.$maximum_input.val(undefined);
19988
- this.$container.offset({left: 0, top: 0});
19989
- this.$container.hide();
19990
- });
19991
-
19992
- //this.$container.draggable({ handle:$header.get(0) });
19993
- makeDraggable$1(this.$container.get(0), $header.get(0));
19994
-
19995
- this.$container.hide();
19996
- }
19997
-
19998
- configure(trackView) {
19999
-
20000
- const dataRange = trackView.dataRange();
20001
- let min;
20002
- let max;
20003
- if (dataRange) {
20004
- min = dataRange.min;
20005
- max = dataRange.max;
20006
- } else {
20007
- min = 0;
20008
- max = 100;
20009
- }
20010
-
20011
- this.$minimum_input.val(min);
20012
- this.$maximum_input.val(max);
20013
-
20014
- this.$minimum_input.unbind();
20015
- this.$minimum_input.on('keyup', (e) => {
20016
- if (13 === e.keyCode) {
20017
- this.processResults(trackView);
20018
- }
20019
- });
20020
-
20021
- this.$maximum_input.unbind();
20022
- this.$maximum_input.on('keyup', (e) => {
20023
- if (13 === e.keyCode) {
20024
- this.processResults(trackView);
20025
- }
20026
- });
20027
-
20028
- this.$ok.unbind();
20029
- this.$ok.on('click', (e) => {
20030
- this.processResults(trackView);
20031
- });
20032
- }
20033
-
20034
-
20035
- processResults(trackView) {
20036
-
20037
- const min = Number(this.$minimum_input.val());
20038
- const max = Number(this.$maximum_input.val());
20039
- if (isNaN(min) || isNaN(max)) {
20040
- Alert.presentAlert(new Error('Must input numeric values'), undefined);
20041
- } else {
20042
- trackView.setDataRange(min, max);
20043
- }
20044
-
20045
- this.$minimum_input.val(undefined);
20046
- this.$maximum_input.val(undefined);
20047
- this.$container.offset({left: 0, top: 0});
20048
- this.$container.hide();
20049
- }
20050
-
20051
- present($parent) {
20052
-
20053
- const offset_top = $parent.offset().top;
20054
- const scroll_top = $$1('body').scrollTop();
20055
-
20056
- this.$container.offset({left: $parent.width() - this.$container.width(), top: (offset_top + scroll_top)});
20057
- this.$container.show();
20058
- }
20059
- }
20060
-
20061
- /*
20062
- * The MIT License (MIT)
20063
- *
20064
- * Copyright (c) 2014 Broad Institute
20065
- *
20066
- * Permission is hereby granted, free of charge, to any person obtaining a copy
20067
- * of ctx software and associated documentation files (the "Software"), to deal
20068
- * in the Software without restriction, including without limitation the rights
20069
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20070
- * copies of the Software, and to permit persons to whom the Software is
20071
- * furnished to do so, subject to the following conditions:
20072
- *
20073
- * The above copyright notice and ctx permission notice shall be included in
20074
- * all copies or substantial portions of the Software.
20075
- *
20076
- *
20077
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20078
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20079
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20080
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20081
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20082
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20083
- * THE SOFTWARE.
20084
- */
20085
-
20086
-
20087
- const IGVGraphics = {
20088
-
20089
- configureHighDPICanvas: function (ctx, w, h) {
20090
-
20091
- const scaleFactor = window.devicePixelRatio;
20092
- // const scaleFactor = 1
20093
-
20094
- ctx.canvas.style.width = (`${w}px`);
20095
- ctx.canvas.width = Math.floor(scaleFactor * w);
20096
-
20097
- ctx.canvas.style.height = (`${h}px`);
20098
- ctx.canvas.height = Math.floor(scaleFactor * h);
20099
-
20100
- ctx.scale(scaleFactor, scaleFactor);
20101
-
20102
- },
20103
-
20104
- setProperties: function (ctx, properties) {
20105
-
20106
- for (var key in properties) {
20107
- if (properties.hasOwnProperty(key)) {
20108
- var value = properties[key];
20109
- ctx[key] = value;
20110
- }
20111
- }
20112
- },
20113
-
20114
- strokeLine: function (ctx, x1, y1, x2, y2, properties) {
20115
-
20116
- x1 = Math.floor(x1) + 0.5;
20117
- y1 = Math.floor(y1) + 0.5;
20118
- x2 = Math.floor(x2) + 0.5;
20119
- y2 = Math.floor(y2) + 0.5;
20120
-
20121
- if (properties) {
20122
- ctx.save();
20123
- IGVGraphics.setProperties(ctx, properties);
20124
- }
20125
-
20126
- ctx.beginPath();
20127
- ctx.moveTo(x1, y1);
20128
- ctx.lineTo(x2, y2);
20129
- ctx.stroke();
20130
-
20131
- if (properties) ctx.restore();
20132
- },
20133
-
20134
- fillRect: function (ctx, x, y, w, h, properties) {
20135
- x = Math.round(x);
20136
- y = Math.round(y);
20137
-
20138
- if (properties) {
20139
- ctx.save();
20140
- IGVGraphics.setProperties(ctx, properties);
20141
- }
20142
-
20143
- ctx.fillRect(x, y, w, h);
20144
-
20145
- if (properties) ctx.restore();
20146
- },
20147
-
20148
- fillPolygon: function (ctx, x, y, properties) {
20149
- if (properties) {
20150
- ctx.save();
20151
- IGVGraphics.setProperties(ctx, properties);
20152
- }
20153
- doPath(ctx, x, y);
20154
- ctx.fill();
20155
- if (properties) ctx.restore();
20156
- },
20157
-
20158
- strokePolygon: function (ctx, x, y, properties) {
20159
- if (properties) {
20160
- ctx.save();
20161
- IGVGraphics.setProperties(ctx, properties);
20162
- }
20163
- doPath(ctx, x, y);
20164
- ctx.stroke();
20165
- if (properties) ctx.restore();
20166
- },
20167
-
20168
- fillText: function (ctx, text, x, y, properties, transforms) {
20169
-
20170
- if (properties || transforms) {
20171
- ctx.save();
20172
- }
20173
-
20174
- if (properties) {
20175
- IGVGraphics.setProperties(ctx, properties);
20176
- }
20177
-
20178
- if (transforms) {
20179
- // Slow path with context saving and extra translate
20180
- ctx.translate(x, y);
20181
-
20182
- for (var transform in transforms) {
20183
- var value = transforms[transform];
20184
-
20185
- // TODO: Add error checking for robustness
20186
- if (transform === 'translate') {
20187
- ctx.translate(value['x'], value['y']);
20188
- }
20189
- if (transform === 'rotate') {
20190
- ctx.rotate(value['angle'] * Math.PI / 180);
20191
- }
20192
- }
20193
-
20194
- ctx.fillText(text, 0, 0);
20195
- } else {
20196
- ctx.fillText(text, x, y);
20197
- }
20198
-
20199
- if (properties || transforms) ctx.restore();
20200
- },
20201
-
20202
- strokeText: function (ctx, text, x, y, properties, transforms) {
20203
-
20204
-
20205
- if (properties || transforms) {
20206
- ctx.save();
20207
- }
20208
-
20209
- if (properties) {
20210
- IGVGraphics.setProperties(ctx, properties);
20211
- }
20212
-
20213
- if (transforms) {
20214
- ctx.translate(x, y);
20215
-
20216
- for (var transform in transforms) {
20217
- var value = transforms[transform];
20218
-
20219
- // TODO: Add error checking for robustness
20220
- if (transform === 'translate') {
20221
- ctx.translate(value['x'], value['y']);
20222
- }
20223
- if (transform === 'rotate') {
20224
- ctx.rotate(value['angle'] * Math.PI / 180);
20225
- }
20226
- }
20227
-
20228
- ctx.strokeText(text, 0, 0);
20229
- } else {
20230
- ctx.strokeText(text, x, y);
20231
- }
20232
-
20233
- if (properties || transforms) ctx.restore();
20234
- },
20235
-
20236
- strokeCircle: function (ctx, x, y, radius, properties) {
20237
- if (properties) {
20238
- ctx.save();
20239
- IGVGraphics.setProperties(ctx, properties);
20240
- }
20241
- ctx.beginPath();
20242
- ctx.arc(x, y, radius, 0, 2 * Math.PI);
20243
- ctx.stroke();
20244
- if (properties) ctx.restore();
20245
- },
20246
-
20247
- fillCircle: function (ctx, x, y, radius, properties) {
20248
- if (properties) {
20249
- ctx.save();
20250
- IGVGraphics.setProperties(ctx, properties);
20251
- }
20252
- ctx.beginPath();
20253
- ctx.arc(x, y, radius, 0, 2 * Math.PI);
20254
- ctx.fill();
20255
- if (properties) ctx.restore();
20256
- },
20257
-
20258
- drawArrowhead: function (ctx, x, y, size, lineWidth) {
20259
-
20260
- ctx.save();
20261
- if (!size) {
20262
- size = 5;
20263
- }
20264
- if (lineWidth) {
20265
- ctx.lineWidth = lineWidth;
20266
- }
20267
- ctx.beginPath();
20268
- ctx.moveTo(x, y - size / 2);
20269
- ctx.lineTo(x, y + size / 2);
20270
- ctx.lineTo(x + size, y);
20271
- ctx.lineTo(x, y - size / 2);
20272
- ctx.closePath();
20273
- ctx.fill();
20274
- ctx.restore();
20275
- },
20276
-
20277
- dashedLine: function (ctx, x1, y1, x2, y2, dashLen, properties = {}) {
20278
- if (dashLen === undefined) dashLen = 2;
20279
- ctx.setLineDash([dashLen, dashLen]);
20280
- IGVGraphics.strokeLine(ctx, x1, y1, x2, y2, properties);
20281
- ctx.setLineDash([]);
20282
- },
20283
-
20284
- roundRect: function (ctx, x, y, width, height, radius, fill, stroke) {
20285
-
20286
- if (typeof stroke == "undefined") {
20287
- stroke = true;
20288
- }
20289
- if (typeof radius === "undefined") {
20290
- radius = 5;
20291
- }
20292
- ctx.beginPath();
20293
- ctx.moveTo(x + radius, y);
20294
- ctx.lineTo(x + width - radius, y);
20295
- ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
20296
- ctx.lineTo(x + width, y + height - radius);
20297
- ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
20298
- ctx.lineTo(x + radius, y + height);
20299
- ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
20300
- ctx.lineTo(x, y + radius);
20301
- ctx.quadraticCurveTo(x, y, x + radius, y);
20302
- ctx.closePath();
20303
- if (stroke) {
20304
- ctx.stroke();
20305
- }
20306
- if (fill) {
20307
- ctx.fill();
20308
- }
20309
- },
20310
- polygon: function (ctx, x, y, fill, stroke) {
20311
-
20312
- if (typeof stroke == "undefined") {
20313
- stroke = true;
20314
- }
20315
-
20316
- ctx.beginPath();
20317
- var len = x.length;
20318
- ctx.moveTo(x[0], y[0]);
20319
- for (var i = 1; i < len; i++) {
20320
- ctx.lineTo(x[i], y[i]);
20321
- // this.moveTo(x[i], y[i]);
20322
- }
20339
+ class Alert {
20340
+ constructor(parent) {
20341
+ this.dialog = new AlertDialog(parent);
20323
20342
 
20324
- ctx.closePath();
20325
- if (stroke) {
20326
- ctx.stroke();
20327
- }
20328
- if (fill) {
20329
- ctx.fill();
20330
- }
20331
20343
  }
20332
20344
 
20333
-
20334
- };
20335
-
20336
- function doPath(ctx, x, y) {
20337
-
20338
-
20339
- var i, len = x.length;
20340
- for (i = 0; i < len; i++) {
20341
- x[i] = Math.round(x[i]);
20342
- y[i] = Math.round(y[i]);
20343
- }
20344
-
20345
- ctx.beginPath();
20346
- ctx.moveTo(x[0], y[0]);
20347
- for (i = 1; i < len; i++) {
20348
- ctx.lineTo(x[i], y[i]);
20345
+ present(alert, callback) {
20346
+ this.dialog.present(alert, callback);
20349
20347
  }
20350
- ctx.closePath();
20351
20348
  }
20352
20349
 
20353
20350
  const FileFormats = {
@@ -21318,7 +21315,7 @@ class SequenceTrack {
21318
21315
  } else if (this.reversed) {
21319
21316
  seq = reverseComplementSequence(seq);
21320
21317
  }
21321
- Alert.presentAlert(seq);
21318
+ this.browser.alert.present(seq);
21322
21319
  }
21323
21320
  }
21324
21321
  ];
@@ -21336,7 +21333,7 @@ class SequenceTrack {
21336
21333
  await navigator.clipboard.writeText(seq);
21337
21334
  } catch (e) {
21338
21335
  console.error(e);
21339
- Alert.presentAlert(`error copying sequence to clipboard ${e}`);
21336
+ this.browser.alert.present(`error copying sequence to clipboard ${e}`);
21340
21337
  }
21341
21338
  }
21342
21339
 
@@ -23862,7 +23859,7 @@ const Cytoband = function (start, end, name, typestain) {
23862
23859
  }
23863
23860
  };
23864
23861
 
23865
- const _version = "2.13.1";
23862
+ const _version = "2.13.2";
23866
23863
  function version() {
23867
23864
  return _version
23868
23865
  }
@@ -23972,7 +23969,7 @@ const GenomeUtils = {
23972
23969
  },
23973
23970
 
23974
23971
  // Expand a genome id to a reference object, if needed
23975
- expandReference: function (idOrConfig) {
23972
+ expandReference: function (alert, idOrConfig) {
23976
23973
 
23977
23974
  // idOrConfig might be json
23978
23975
  if (isString$3(idOrConfig) && idOrConfig.startsWith("{")) {
@@ -23997,7 +23994,7 @@ const GenomeUtils = {
23997
23994
  const knownGenomes = GenomeUtils.KNOWN_GENOMES;
23998
23995
  const reference = knownGenomes[genomeID];
23999
23996
  if (!reference) {
24000
- Alert.presentAlert(new Error(`Unknown genome id: ${genomeID}`), undefined);
23997
+ alert.present(new Error(`Unknown genome id: ${genomeID}`), undefined);
24001
23998
  }
24002
23999
  return reference
24003
24000
  } else {
@@ -24518,7 +24515,7 @@ class TrackViewport extends Viewport {
24518
24515
  // Track might have been removed during load
24519
24516
  if (this.trackView && this.trackView.disposed !== true) {
24520
24517
  this.showMessage(NOT_LOADED_MESSAGE);
24521
- Alert.presentAlert(error);
24518
+ this.browser.alert.present(error);
24522
24519
  console.error(error);
24523
24520
  }
24524
24521
  } finally {
@@ -36779,7 +36776,7 @@ class CramReader {
36779
36776
  if (message && message.indexOf("MD5") >= 0) {
36780
36777
  message = "Sequence mismatch. Is this the correct genome for the loaded CRAM?";
36781
36778
  }
36782
- Alert.presentAlert(new Error(message));
36779
+ this.browser.alert.present(new Error(message));
36783
36780
  throw error
36784
36781
  }
36785
36782
  }
@@ -41048,7 +41045,7 @@ class AlignmentTrack {
41048
41045
  const frameEnd = clickedAlignment.mate.position + bpWidth / 2;
41049
41046
  this.browser.addMultiLocusPanel(clickedAlignment.mate.chr, frameStart, frameEnd, referenceFrame);
41050
41047
  } else {
41051
- Alert.presentAlert(`Reference does not contain chromosome: ${clickedAlignment.mate.chr}`);
41048
+ this.browser.alert.present(`Reference does not contain chromosome: ${clickedAlignment.mate.chr}`);
41052
41049
  }
41053
41050
  }
41054
41051
  },
@@ -41061,9 +41058,9 @@ class AlignmentTrack {
41061
41058
  click: () => {
41062
41059
  const seqstring = clickedAlignment.seq; //.map(b => String.fromCharCode(b)).join("");
41063
41060
  if (!seqstring || "*" === seqstring) {
41064
- Alert.presentAlert("Read sequence: *");
41061
+ this.browser.alert.present("Read sequence: *");
41065
41062
  } else {
41066
- Alert.presentAlert(seqstring);
41063
+ this.browser.alert.present(seqstring);
41067
41064
  }
41068
41065
  }
41069
41066
  });
@@ -41078,7 +41075,7 @@ class AlignmentTrack {
41078
41075
  await navigator.clipboard.writeText(seq);
41079
41076
  } catch (e) {
41080
41077
  console.error(e);
41081
- Alert.presentAlert(`error copying sequence to clipboard ${e}`);
41078
+ this.browser.alert.present(`error copying sequence to clipboard ${e}`);
41082
41079
  }
41083
41080
 
41084
41081
  }
@@ -43843,7 +43840,7 @@ class FeatureTrack extends TrackBase {
43843
43840
  else if (f.strand === '-') {
43844
43841
  seq = reverseComplementSequence(seq);
43845
43842
  }
43846
- Alert.presentAlert(seq);
43843
+ this.browser.alert.present(seq);
43847
43844
 
43848
43845
  }
43849
43846
  }];
@@ -43864,7 +43861,7 @@ class FeatureTrack extends TrackBase {
43864
43861
  await navigator.clipboard.writeText(seq);
43865
43862
  } catch (e) {
43866
43863
  console.error(e);
43867
- Alert.presentAlert(`error copying sequence to clipboard ${e}`);
43864
+ this.browser.alert.present(`error copying sequence to clipboard ${e}`);
43868
43865
  }
43869
43866
  }
43870
43867
  }
@@ -44017,6 +44014,7 @@ class WigTrack extends TrackBase {
44017
44014
  start,
44018
44015
  end,
44019
44016
  bpPerPixel,
44017
+ visibilityWindow: this.visibilityWindow,
44020
44018
  windowFunction: this.windowFunction
44021
44019
  });
44022
44020
  if (this.normalize && this.featureSource.normalizationFactor) {
@@ -44036,7 +44034,9 @@ class WigTrack extends TrackBase {
44036
44034
 
44037
44035
  menuItemList() {
44038
44036
  let items = [];
44037
+
44039
44038
  if (this.flipAxis !== undefined) {
44039
+ items.push('<hr>');
44040
44040
  items.push({
44041
44041
  label: "Flip y-axis",
44042
44042
  click: () => {
@@ -45126,8 +45126,13 @@ class InteractionTrack extends TrackBase {
45126
45126
  }
45127
45127
 
45128
45128
  // Create the FeatureSource and override the default whole genome method
45129
- this.featureSource = FeatureSource(config, this.browser.genome);
45130
- this.featureSource.getWGFeatures = getWGFeatures;
45129
+ if (config.featureSource) {
45130
+ this.featureSource = config.featureSource;
45131
+ delete config._featureSource;
45132
+ } else {
45133
+ this.featureSource = FeatureSource(config, this.browser.genome);
45134
+ this.featureSource.getWGFeatures = getWGFeatures;
45135
+ }
45131
45136
  }
45132
45137
 
45133
45138
  async postInit() {
@@ -45206,10 +45211,16 @@ class InteractionTrack extends TrackBase {
45206
45211
  // Reset transient property drawState. An undefined value => feature has not been drawn.
45207
45212
  feature.drawState = undefined;
45208
45213
 
45209
- let color = this.color || feature.color || DEFAULT_ARC_COLOR;
45210
- if (color && this.config.useScore) {
45211
- color = getAlphaColor(color, scoreShade(feature.score));
45214
+ let color;
45215
+ if(typeof this.color === 'function') {
45216
+ color = this.color(feature);
45217
+ } else {
45218
+ color = this.color || feature.color || DEFAULT_ARC_COLOR;
45219
+ if (color && this.config.useScore) {
45220
+ color = getAlphaColor(color, scoreShade(feature.score));
45221
+ }
45212
45222
  }
45223
+
45213
45224
  ctx.lineWidth = feature.thickness || this.thickness || 1;
45214
45225
 
45215
45226
  if (feature.chr1 === feature.chr2 || feature.chr === 'all') {
@@ -45482,18 +45493,10 @@ class InteractionTrack extends TrackBase {
45482
45493
 
45483
45494
  menuItemList() {
45484
45495
 
45485
- let items = [
45486
-
45487
- {
45488
- name: "Set track color",
45489
- click: () => {
45490
- this.trackView.presentColorPicker();
45491
- }
45492
- },
45493
- '<hr/>'
45494
- ];
45496
+ let items = [];
45495
45497
 
45496
45498
  if (this.hasValue) {
45499
+ items.push("<hr/>");
45497
45500
  const lut =
45498
45501
  {
45499
45502
  "nested": "Nested",
@@ -51735,7 +51738,7 @@ class Browser {
51735
51738
  this.root = div$1({class: 'igv-container'});
51736
51739
  parentDiv.appendChild(this.root);
51737
51740
 
51738
- Alert.init(this.root);
51741
+ this.alert = new Alert(this.root);
51739
51742
 
51740
51743
  this.columnContainer = div$1({class: 'igv-column-container'});
51741
51744
  this.root.appendChild(this.columnContainer);
@@ -51913,7 +51916,7 @@ class Browser {
51913
51916
  this.inputDialog = new InputDialog(this.root);
51914
51917
  this.inputDialog.container.id = `igv-input-dialog-${guid$2()}`;
51915
51918
 
51916
- this.dataRangeDialog = new DataRangeDialog($$1(this.root));
51919
+ this.dataRangeDialog = new DataRangeDialog(this, $$1(this.root));
51917
51920
  this.dataRangeDialog.$container.get(0).id = `igv-data-range-dialog-${guid$2()}`;
51918
51921
 
51919
51922
  this.genericColorPicker = new GenericColorPicker({parent: this.columnContainer, width: 432});
@@ -52115,7 +52118,7 @@ class Browser {
52115
52118
  // Track gear column
52116
52119
  createColumn(this.columnContainer, 'igv-gear-menu-column');
52117
52120
 
52118
- const genomeConfig = await GenomeUtils.expandReference(session.reference || session.genome);
52121
+ const genomeConfig = await GenomeUtils.expandReference(this.alert, (session.reference || session.genome));
52119
52122
  await this.loadReference(genomeConfig, session.locus);
52120
52123
 
52121
52124
  this.centerLineList = this.createCenterLineList(this.columnContainer);
@@ -52294,7 +52297,7 @@ class Browser {
52294
52297
  */
52295
52298
  async loadGenome(idOrConfig) {
52296
52299
 
52297
- const genomeConfig = await GenomeUtils.expandReference(idOrConfig);
52300
+ const genomeConfig = await GenomeUtils.expandReference(this.alert, idOrConfig);
52298
52301
  await this.loadReference(genomeConfig, undefined);
52299
52302
 
52300
52303
  const tracks = genomeConfig.tracks || [];
@@ -52495,7 +52498,7 @@ class Browser {
52495
52498
  msg = httpMessages[msg];
52496
52499
  }
52497
52500
  msg += (": " + config.url);
52498
- Alert.presentAlert(new Error(msg), undefined);
52501
+ this.alert.present(new Error(msg), undefined);
52499
52502
  }
52500
52503
  }
52501
52504
 
@@ -52618,8 +52621,7 @@ class Browser {
52618
52621
 
52619
52622
  const track = TrackFactory.getTrack(type, config, this);
52620
52623
  if (undefined === track) {
52621
- Alert.presentAlert(new Error(`Error creating track. Could not determine track type for file: ${config.url || config}`), undefined);
52622
- return
52624
+ this.alert.present(new Error(`Error creating track. Could not determine track type for file: ${config.url || config}`), undefined);
52623
52625
  } else {
52624
52626
 
52625
52627
  if (config.roi && config.roi.length > 0) {
@@ -53114,7 +53116,7 @@ class Browser {
53114
53116
  async doSearch(string, init) {
53115
53117
  const success = await this.search(string, init);
53116
53118
  if (!success) {
53117
- Alert.presentAlert(new Error(`Unrecognized locus: <b> ${string} </b>`));
53119
+ this.alert.present(new Error(`Unrecognized locus: <b> ${string} </b>`));
53118
53120
  }
53119
53121
  return success
53120
53122
  }