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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { default as OncoprintJS, InitParams, HorzZoomCallback, MinimapCloseCallback, CellMouseOverCallback, CellClickCallback, ClipboardChangeCallback, } from './js/oncoprint';
2
2
  export * from './js/oncoprintruleset';
3
- export { default as OncoprintModel } from './js/oncoprintmodel';
3
+ export { default as OncoprintModel, GAP_MODE_ENUM } from './js/oncoprintmodel';
4
4
  export * from './js/oncoprintmodel';
5
5
  export { default as shapeToSvg } from './js/oncoprintshapetosvg';
package/dist/index.es.js CHANGED
@@ -793,6 +793,12 @@ function calculateTrackAndHeaderTops(model, zoomed) {
793
793
  }
794
794
 
795
795
  /* jshint browserify: true, asi: true */
796
+ var GAP_MODE_ENUM;
797
+ (function (GAP_MODE_ENUM) {
798
+ GAP_MODE_ENUM["SHOW_GAPS"] = "SHOW_GAPS";
799
+ GAP_MODE_ENUM["SHOW_GAPS_PERCENT"] = "SHOW_GAPS_PERCENT";
800
+ GAP_MODE_ENUM["HIDE_GAPS"] = "HIDE_GAPS";
801
+ })(GAP_MODE_ENUM || (GAP_MODE_ENUM = {}));
796
802
  var UnionOfSets = /** @class */ (function () {
797
803
  function UnionOfSets() {
798
804
  // a set, to be passed in as argument, is an object where the values are truthy
@@ -1598,7 +1604,10 @@ var OncoprintModel = /** @class */ (function () {
1598
1604
  var precomputedComparator = model.precomputed_comparator.get();
1599
1605
  var trackIdsWithGaps = model
1600
1606
  .getTracks()
1601
- .filter(function (trackId) { return model.getTrackShowGaps(trackId); });
1607
+ .filter(function (trackId) {
1608
+ return model.getTrackShowGaps(trackId) !==
1609
+ GAP_MODE_ENUM.HIDE_GAPS;
1610
+ });
1602
1611
  var ids = model.visible_id_order.get();
1603
1612
  for (var i = 1; i < ids.length; i++) {
1604
1613
  for (var _i = 0, trackIdsWithGaps_1 = trackIdsWithGaps; _i < trackIdsWithGaps_1.length; _i++) {
@@ -2224,7 +2233,14 @@ var OncoprintModel = /** @class */ (function () {
2224
2233
  writable: true,
2225
2234
  value: function () {
2226
2235
  if (this.showGaps()) {
2227
- return 50; // this creates enough space for 3 digit percentage
2236
+ switch (this.gapMode()) {
2237
+ case GAP_MODE_ENUM.SHOW_GAPS:
2238
+ return this.getCellWidth(true);
2239
+ case GAP_MODE_ENUM.SHOW_GAPS_PERCENT:
2240
+ return 50;
2241
+ default:
2242
+ return 50;
2243
+ }
2228
2244
  }
2229
2245
  else {
2230
2246
  return this.getCellWidth(true);
@@ -2590,7 +2606,9 @@ var OncoprintModel = /** @class */ (function () {
2590
2606
  this.track_sort_direction[track_id] = ifndef(params.init_sort_direction, 1);
2591
2607
  this.track_can_show_gaps[track_id] = ifndef(params.track_can_show_gaps, false);
2592
2608
  var trackShowGaps = ifndef(params.show_gaps_on_init, false);
2593
- this.track_show_gaps[track_id] = trackShowGaps;
2609
+ this.track_show_gaps[track_id] = trackShowGaps
2610
+ ? GAP_MODE_ENUM.SHOW_GAPS_PERCENT
2611
+ : GAP_MODE_ENUM.HIDE_GAPS;
2594
2612
  var trackNotSorted = this.track_sort_direction[track_id] === 0;
2595
2613
  if (trackShowGaps && trackNotSorted) {
2596
2614
  this.track_sort_direction[track_id] = 1;
@@ -3065,7 +3083,20 @@ var OncoprintModel = /** @class */ (function () {
3065
3083
  configurable: true,
3066
3084
  writable: true,
3067
3085
  value: function () {
3068
- return _.some(this.track_show_gaps);
3086
+ return _(this.track_show_gaps)
3087
+ .values()
3088
+ .some(function (t) { return t !== GAP_MODE_ENUM.HIDE_GAPS; });
3089
+ }
3090
+ });
3091
+ Object.defineProperty(OncoprintModel.prototype, "gapMode", {
3092
+ enumerable: false,
3093
+ configurable: true,
3094
+ writable: true,
3095
+ value: function () {
3096
+ var mode = _(this.track_show_gaps)
3097
+ .values()
3098
+ .find(function (g) { return g !== GAP_MODE_ENUM.HIDE_GAPS; });
3099
+ return mode || GAP_MODE_ENUM.HIDE_GAPS;
3069
3100
  }
3070
3101
  });
3071
3102
  Object.defineProperty(OncoprintModel.prototype, "getOncoprintWidthNoColumnPaddingNoGaps", {
@@ -5277,14 +5308,16 @@ var OncoprintWebGLCellView = /** @class */ (function () {
5277
5308
  var track_id = tracks[i];
5278
5309
  var cell_top = model.getCellTops(track_id);
5279
5310
  var cell_height = model.getCellHeight(track_id);
5280
- if (model.showGaps()) {
5311
+ if (model.showGaps() &&
5312
+ model.gapMode() === GAP_MODE_ENUM.SHOW_GAPS_PERCENT) {
5281
5313
  var gaps = this_1.getGaps(model, track_id);
5282
5314
  if (gaps) {
5283
5315
  gaps.forEach(function (gap, i) {
5284
5316
  var x = gapOffsets[i] - scroll_x - model.getGapSize();
5285
5317
  var y = model.getZoomedTrackTops()[track_id] +
5286
5318
  cell_height -
5287
- scroll_y;
5319
+ scroll_y -
5320
+ 4;
5288
5321
  _this.drawGapLabel(gap.labelFormatter(), x, y);
5289
5322
  _this.gapTooltipTargets.push({
5290
5323
  origin_x: x,
@@ -9552,6 +9585,7 @@ var OncoprintHeaderView = /** @class */ (function () {
9552
9585
  .appendTo($headerDiv)
9553
9586
  .attr({
9554
9587
  src: img$1,
9588
+ alt: 'Menu Dots Icon',
9555
9589
  width: MENU_DOTS_SIZE,
9556
9590
  height: MENU_DOTS_SIZE,
9557
9591
  })
@@ -9967,6 +10001,7 @@ var OncoprintTrackOptionsView = /** @class */ (function () {
9967
10001
  .appendTo($div)
9968
10002
  .attr({
9969
10003
  src: img$1,
10004
+ alt: 'Menu Dots Icon',
9970
10005
  width: this.img_size,
9971
10006
  height: this.img_size,
9972
10007
  })
@@ -10097,20 +10132,38 @@ var OncoprintTrackOptionsView = /** @class */ (function () {
10097
10132
  }
10098
10133
  if (model.getTrackCanShowGaps(track_id)) {
10099
10134
  $dropdown.append(OncoprintTrackOptionsView.$makeDropdownSeparator());
10100
- var $show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption('Show gaps', model.getTrackShowGaps(track_id) ? 'bold' : 'normal', false, function (evt) {
10135
+ var $show_gaps_percent_opt = OncoprintTrackOptionsView.$makeDropdownOption(model.getTrackShowGaps(track_id) ===
10136
+ GAP_MODE_ENUM.SHOW_GAPS_PERCENT
10137
+ ? 'Hide gaps (w/%)'
10138
+ : 'Show Gaps (w/%)', model.getTrackShowGaps(track_id) ===
10139
+ GAP_MODE_ENUM.SHOW_GAPS_PERCENT
10140
+ ? 'bold'
10141
+ : 'normal', false, function (evt) {
10101
10142
  evt.stopPropagation();
10102
10143
  $show_gaps_opt_1.css('font-weight', 'bold');
10103
- $dont_show_gaps_opt_1.css('font-weight', 'normal');
10104
- self.showGapsCallback(track_id, true);
10144
+ var mode = [
10145
+ GAP_MODE_ENUM.SHOW_GAPS_PERCENT,
10146
+ ].includes(model.getTrackShowGaps(track_id))
10147
+ ? GAP_MODE_ENUM.HIDE_GAPS
10148
+ : GAP_MODE_ENUM.SHOW_GAPS_PERCENT;
10149
+ self.showGapsCallback(track_id, mode);
10105
10150
  });
10106
- var $dont_show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption("Don't show gaps", model.getTrackShowGaps(track_id) ? 'normal' : 'bold', false, function (evt) {
10151
+ var $show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption(model.getTrackShowGaps(track_id) === GAP_MODE_ENUM.SHOW_GAPS
10152
+ ? 'Hide gaps'
10153
+ : 'Show Gaps', model.getTrackShowGaps(track_id) === GAP_MODE_ENUM.SHOW_GAPS
10154
+ ? 'bold'
10155
+ : 'normal', false, function (evt) {
10107
10156
  evt.stopPropagation();
10108
- $show_gaps_opt_1.css('font-weight', 'normal');
10109
- $dont_show_gaps_opt_1.css('font-weight', 'bold');
10110
- self.showGapsCallback(track_id, false);
10157
+ $show_gaps_opt_1.css('font-weight', 'bold');
10158
+ var mode = [
10159
+ GAP_MODE_ENUM.SHOW_GAPS,
10160
+ ].includes(model.getTrackShowGaps(track_id))
10161
+ ? GAP_MODE_ENUM.HIDE_GAPS
10162
+ : GAP_MODE_ENUM.SHOW_GAPS;
10163
+ self.showGapsCallback(track_id, mode);
10111
10164
  });
10112
10165
  $dropdown.append($show_gaps_opt_1);
10113
- $dropdown.append($dont_show_gaps_opt_1);
10166
+ $dropdown.append($show_gaps_percent_opt);
10114
10167
  }
10115
10168
  // Add custom options
10116
10169
  var custom_options = model.getTrackCustomOptions(track_id);
@@ -11941,7 +11994,7 @@ var OncoprintMinimapView = /** @class */ (function () {
11941
11994
  })
11942
11995
  .addClass('oncoprint-zoomtofit-btn')
11943
11996
  .appendTo($div);
11944
- $$1("<img src=\"" + img + "\" />")
11997
+ $$1("<img src=\"" + img + "\" alt=\"Zoom to Fit Icon\" />")
11945
11998
  .css({
11946
11999
  height: btn_height - 4,
11947
12000
  width: btn_width - 4,
@@ -14376,7 +14429,7 @@ var Oncoprint = /** @class */ (function () {
14376
14429
  }
14377
14430
  if (this.model.getTrackSortDirection(track_id) === 0) {
14378
14431
  if (this.model.getTrackShowGaps(track_id)) {
14379
- this.setTrackShowGaps(track_id, false);
14432
+ this.setTrackShowGaps(track_id, GAP_MODE_ENUM.HIDE_GAPS);
14380
14433
  }
14381
14434
  }
14382
14435
  }
@@ -14446,9 +14499,10 @@ var Oncoprint = /** @class */ (function () {
14446
14499
  enumerable: false,
14447
14500
  configurable: true,
14448
14501
  writable: true,
14449
- value: function (track_id, showGaps) {
14450
- this.model.setTrackShowGaps(track_id, showGaps);
14451
- if (this.model.getTrackSortDirection(track_id) === 0 && showGaps) {
14502
+ value: function (track_id, gap_mode) {
14503
+ this.model.setTrackShowGaps(track_id, gap_mode);
14504
+ if (this.model.getTrackSortDirection(track_id) === 0 &&
14505
+ gap_mode !== GAP_MODE_ENUM.HIDE_GAPS) {
14452
14506
  this.setTrackSortDirection(track_id, 1);
14453
14507
  }
14454
14508
  this.track_options_view.setTrackShowGaps(this.model, this.getCellViewHeight);
@@ -14987,5 +15041,5 @@ var Oncoprint = /** @class */ (function () {
14987
15041
  return Oncoprint;
14988
15042
  }());
14989
15043
 
14990
- export { GeneticAlterationRuleSet, LinearInterpRangeType, Oncoprint as OncoprintJS, OncoprintModel, Rule, RuleSet, RuleSetType, shapeToSVG as shapeToSvg };
15044
+ export { GAP_MODE_ENUM, GeneticAlterationRuleSet, LinearInterpRangeType, Oncoprint as OncoprintJS, OncoprintModel, Rule, RuleSet, RuleSetType, shapeToSVG as shapeToSvg };
14991
15045
  //# sourceMappingURL=index.es.js.map