oncoprintjs 6.0.5 → 6.0.7

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/index.js CHANGED
@@ -803,6 +803,12 @@ function calculateTrackAndHeaderTops(model, zoomed) {
803
803
  }
804
804
 
805
805
  /* jshint browserify: true, asi: true */
806
+ exports.GAP_MODE_ENUM = void 0;
807
+ (function (GAP_MODE_ENUM) {
808
+ GAP_MODE_ENUM["SHOW_GAPS"] = "SHOW_GAPS";
809
+ GAP_MODE_ENUM["SHOW_GAPS_PERCENT"] = "SHOW_GAPS_PERCENT";
810
+ GAP_MODE_ENUM["HIDE_GAPS"] = "HIDE_GAPS";
811
+ })(exports.GAP_MODE_ENUM || (exports.GAP_MODE_ENUM = {}));
806
812
  var UnionOfSets = /** @class */ (function () {
807
813
  function UnionOfSets() {
808
814
  // a set, to be passed in as argument, is an object where the values are truthy
@@ -1608,7 +1614,10 @@ var OncoprintModel = /** @class */ (function () {
1608
1614
  var precomputedComparator = model.precomputed_comparator.get();
1609
1615
  var trackIdsWithGaps = model
1610
1616
  .getTracks()
1611
- .filter(function (trackId) { return model.getTrackShowGaps(trackId); });
1617
+ .filter(function (trackId) {
1618
+ return model.getTrackShowGaps(trackId) !==
1619
+ exports.GAP_MODE_ENUM.HIDE_GAPS;
1620
+ });
1612
1621
  var ids = model.visible_id_order.get();
1613
1622
  for (var i = 1; i < ids.length; i++) {
1614
1623
  for (var _i = 0, trackIdsWithGaps_1 = trackIdsWithGaps; _i < trackIdsWithGaps_1.length; _i++) {
@@ -2234,7 +2243,14 @@ var OncoprintModel = /** @class */ (function () {
2234
2243
  writable: true,
2235
2244
  value: function () {
2236
2245
  if (this.showGaps()) {
2237
- return 50; // this creates enough space for 3 digit percentage
2246
+ switch (this.gapMode()) {
2247
+ case exports.GAP_MODE_ENUM.SHOW_GAPS:
2248
+ return this.getCellWidth(true);
2249
+ case exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT:
2250
+ return 50;
2251
+ default:
2252
+ return 50;
2253
+ }
2238
2254
  }
2239
2255
  else {
2240
2256
  return this.getCellWidth(true);
@@ -2600,7 +2616,9 @@ var OncoprintModel = /** @class */ (function () {
2600
2616
  this.track_sort_direction[track_id] = ifndef(params.init_sort_direction, 1);
2601
2617
  this.track_can_show_gaps[track_id] = ifndef(params.track_can_show_gaps, false);
2602
2618
  var trackShowGaps = ifndef(params.show_gaps_on_init, false);
2603
- this.track_show_gaps[track_id] = trackShowGaps;
2619
+ this.track_show_gaps[track_id] = trackShowGaps
2620
+ ? exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT
2621
+ : exports.GAP_MODE_ENUM.HIDE_GAPS;
2604
2622
  var trackNotSorted = this.track_sort_direction[track_id] === 0;
2605
2623
  if (trackShowGaps && trackNotSorted) {
2606
2624
  this.track_sort_direction[track_id] = 1;
@@ -3075,7 +3093,20 @@ var OncoprintModel = /** @class */ (function () {
3075
3093
  configurable: true,
3076
3094
  writable: true,
3077
3095
  value: function () {
3078
- return ___default["default"].some(this.track_show_gaps);
3096
+ return ___default["default"](this.track_show_gaps)
3097
+ .values()
3098
+ .some(function (t) { return t !== exports.GAP_MODE_ENUM.HIDE_GAPS; });
3099
+ }
3100
+ });
3101
+ Object.defineProperty(OncoprintModel.prototype, "gapMode", {
3102
+ enumerable: false,
3103
+ configurable: true,
3104
+ writable: true,
3105
+ value: function () {
3106
+ var mode = ___default["default"](this.track_show_gaps)
3107
+ .values()
3108
+ .find(function (g) { return g !== exports.GAP_MODE_ENUM.HIDE_GAPS; });
3109
+ return mode || exports.GAP_MODE_ENUM.HIDE_GAPS;
3079
3110
  }
3080
3111
  });
3081
3112
  Object.defineProperty(OncoprintModel.prototype, "getOncoprintWidthNoColumnPaddingNoGaps", {
@@ -5287,14 +5318,16 @@ var OncoprintWebGLCellView = /** @class */ (function () {
5287
5318
  var track_id = tracks[i];
5288
5319
  var cell_top = model.getCellTops(track_id);
5289
5320
  var cell_height = model.getCellHeight(track_id);
5290
- if (model.showGaps()) {
5321
+ if (model.showGaps() &&
5322
+ model.gapMode() === exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT) {
5291
5323
  var gaps = this_1.getGaps(model, track_id);
5292
5324
  if (gaps) {
5293
5325
  gaps.forEach(function (gap, i) {
5294
5326
  var x = gapOffsets[i] - scroll_x - model.getGapSize();
5295
5327
  var y = model.getZoomedTrackTops()[track_id] +
5296
5328
  cell_height -
5297
- scroll_y;
5329
+ scroll_y -
5330
+ 4;
5298
5331
  _this.drawGapLabel(gap.labelFormatter(), x, y);
5299
5332
  _this.gapTooltipTargets.push({
5300
5333
  origin_x: x,
@@ -9562,6 +9595,7 @@ var OncoprintHeaderView = /** @class */ (function () {
9562
9595
  .appendTo($headerDiv)
9563
9596
  .attr({
9564
9597
  src: img$1,
9598
+ alt: 'Menu Dots Icon',
9565
9599
  width: MENU_DOTS_SIZE,
9566
9600
  height: MENU_DOTS_SIZE,
9567
9601
  })
@@ -9977,6 +10011,7 @@ var OncoprintTrackOptionsView = /** @class */ (function () {
9977
10011
  .appendTo($div)
9978
10012
  .attr({
9979
10013
  src: img$1,
10014
+ alt: 'Menu Dots Icon',
9980
10015
  width: this.img_size,
9981
10016
  height: this.img_size,
9982
10017
  })
@@ -10107,20 +10142,38 @@ var OncoprintTrackOptionsView = /** @class */ (function () {
10107
10142
  }
10108
10143
  if (model.getTrackCanShowGaps(track_id)) {
10109
10144
  $dropdown.append(OncoprintTrackOptionsView.$makeDropdownSeparator());
10110
- var $show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption('Show gaps', model.getTrackShowGaps(track_id) ? 'bold' : 'normal', false, function (evt) {
10145
+ var $show_gaps_percent_opt = OncoprintTrackOptionsView.$makeDropdownOption(model.getTrackShowGaps(track_id) ===
10146
+ exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT
10147
+ ? 'Hide gaps (w/%)'
10148
+ : 'Show Gaps (w/%)', model.getTrackShowGaps(track_id) ===
10149
+ exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT
10150
+ ? 'bold'
10151
+ : 'normal', false, function (evt) {
10111
10152
  evt.stopPropagation();
10112
10153
  $show_gaps_opt_1.css('font-weight', 'bold');
10113
- $dont_show_gaps_opt_1.css('font-weight', 'normal');
10114
- self.showGapsCallback(track_id, true);
10154
+ var mode = [
10155
+ exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT,
10156
+ ].includes(model.getTrackShowGaps(track_id))
10157
+ ? exports.GAP_MODE_ENUM.HIDE_GAPS
10158
+ : exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT;
10159
+ self.showGapsCallback(track_id, mode);
10115
10160
  });
10116
- var $dont_show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption("Don't show gaps", model.getTrackShowGaps(track_id) ? 'normal' : 'bold', false, function (evt) {
10161
+ var $show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption(model.getTrackShowGaps(track_id) === exports.GAP_MODE_ENUM.SHOW_GAPS
10162
+ ? 'Hide gaps'
10163
+ : 'Show Gaps', model.getTrackShowGaps(track_id) === exports.GAP_MODE_ENUM.SHOW_GAPS
10164
+ ? 'bold'
10165
+ : 'normal', false, function (evt) {
10117
10166
  evt.stopPropagation();
10118
- $show_gaps_opt_1.css('font-weight', 'normal');
10119
- $dont_show_gaps_opt_1.css('font-weight', 'bold');
10120
- self.showGapsCallback(track_id, false);
10167
+ $show_gaps_opt_1.css('font-weight', 'bold');
10168
+ var mode = [
10169
+ exports.GAP_MODE_ENUM.SHOW_GAPS,
10170
+ ].includes(model.getTrackShowGaps(track_id))
10171
+ ? exports.GAP_MODE_ENUM.HIDE_GAPS
10172
+ : exports.GAP_MODE_ENUM.SHOW_GAPS;
10173
+ self.showGapsCallback(track_id, mode);
10121
10174
  });
10122
10175
  $dropdown.append($show_gaps_opt_1);
10123
- $dropdown.append($dont_show_gaps_opt_1);
10176
+ $dropdown.append($show_gaps_percent_opt);
10124
10177
  }
10125
10178
  // Add custom options
10126
10179
  var custom_options = model.getTrackCustomOptions(track_id);
@@ -11951,7 +12004,7 @@ var OncoprintMinimapView = /** @class */ (function () {
11951
12004
  })
11952
12005
  .addClass('oncoprint-zoomtofit-btn')
11953
12006
  .appendTo($div);
11954
- $__default["default"]("<img src=\"" + img + "\" />")
12007
+ $__default["default"]("<img src=\"" + img + "\" alt=\"Zoom to Fit Icon\" />")
11955
12008
  .css({
11956
12009
  height: btn_height - 4,
11957
12010
  width: btn_width - 4,
@@ -14386,7 +14439,7 @@ var Oncoprint = /** @class */ (function () {
14386
14439
  }
14387
14440
  if (this.model.getTrackSortDirection(track_id) === 0) {
14388
14441
  if (this.model.getTrackShowGaps(track_id)) {
14389
- this.setTrackShowGaps(track_id, false);
14442
+ this.setTrackShowGaps(track_id, exports.GAP_MODE_ENUM.HIDE_GAPS);
14390
14443
  }
14391
14444
  }
14392
14445
  }
@@ -14456,9 +14509,10 @@ var Oncoprint = /** @class */ (function () {
14456
14509
  enumerable: false,
14457
14510
  configurable: true,
14458
14511
  writable: true,
14459
- value: function (track_id, showGaps) {
14460
- this.model.setTrackShowGaps(track_id, showGaps);
14461
- if (this.model.getTrackSortDirection(track_id) === 0 && showGaps) {
14512
+ value: function (track_id, gap_mode) {
14513
+ this.model.setTrackShowGaps(track_id, gap_mode);
14514
+ if (this.model.getTrackSortDirection(track_id) === 0 &&
14515
+ gap_mode !== exports.GAP_MODE_ENUM.HIDE_GAPS) {
14462
14516
  this.setTrackSortDirection(track_id, 1);
14463
14517
  }
14464
14518
  this.track_options_view.setTrackShowGaps(this.model, this.getCellViewHeight);