oncoprintjs 6.0.4 → 6.0.6
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 +1 -1
- package/dist/index.es.js +79 -23
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +78 -22
- package/dist/index.js.map +1 -1
- package/dist/js/oncoprint.d.ts +2 -2
- package/dist/js/oncoprintmodel.d.ts +9 -3
- package/dist/js/oncoprinttrackoptionsview.d.ts +2 -2
- package/package.json +2 -2
- package/src/index.tsx +1 -1
- package/src/js/oncoprint.ts +8 -5
- package/src/js/oncoprintmodel.ts +38 -7
- package/src/js/oncoprinttrackinfoview.ts +8 -4
- package/src/js/oncoprinttrackoptionsview.ts +39 -16
- package/src/js/oncoprintwebglcellview.ts +10 -5
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) {
|
|
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
|
-
|
|
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"]
|
|
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,
|
|
@@ -10107,20 +10140,38 @@ var OncoprintTrackOptionsView = /** @class */ (function () {
|
|
|
10107
10140
|
}
|
|
10108
10141
|
if (model.getTrackCanShowGaps(track_id)) {
|
|
10109
10142
|
$dropdown.append(OncoprintTrackOptionsView.$makeDropdownSeparator());
|
|
10110
|
-
var $
|
|
10143
|
+
var $show_gaps_percent_opt = OncoprintTrackOptionsView.$makeDropdownOption(model.getTrackShowGaps(track_id) ===
|
|
10144
|
+
exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT
|
|
10145
|
+
? 'Hide gaps (w/%)'
|
|
10146
|
+
: 'Show Gaps (w/%)', model.getTrackShowGaps(track_id) ===
|
|
10147
|
+
exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT
|
|
10148
|
+
? 'bold'
|
|
10149
|
+
: 'normal', false, function (evt) {
|
|
10111
10150
|
evt.stopPropagation();
|
|
10112
10151
|
$show_gaps_opt_1.css('font-weight', 'bold');
|
|
10113
|
-
|
|
10114
|
-
|
|
10152
|
+
var mode = [
|
|
10153
|
+
exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT,
|
|
10154
|
+
].includes(model.getTrackShowGaps(track_id))
|
|
10155
|
+
? exports.GAP_MODE_ENUM.HIDE_GAPS
|
|
10156
|
+
: exports.GAP_MODE_ENUM.SHOW_GAPS_PERCENT;
|
|
10157
|
+
self.showGapsCallback(track_id, mode);
|
|
10115
10158
|
});
|
|
10116
|
-
var $
|
|
10159
|
+
var $show_gaps_opt_1 = OncoprintTrackOptionsView.$makeDropdownOption(model.getTrackShowGaps(track_id) === exports.GAP_MODE_ENUM.SHOW_GAPS
|
|
10160
|
+
? 'Hide gaps'
|
|
10161
|
+
: 'Show Gaps', model.getTrackShowGaps(track_id) === exports.GAP_MODE_ENUM.SHOW_GAPS
|
|
10162
|
+
? 'bold'
|
|
10163
|
+
: 'normal', false, function (evt) {
|
|
10117
10164
|
evt.stopPropagation();
|
|
10118
|
-
$show_gaps_opt_1.css('font-weight', '
|
|
10119
|
-
|
|
10120
|
-
|
|
10165
|
+
$show_gaps_opt_1.css('font-weight', 'bold');
|
|
10166
|
+
var mode = [
|
|
10167
|
+
exports.GAP_MODE_ENUM.SHOW_GAPS,
|
|
10168
|
+
].includes(model.getTrackShowGaps(track_id))
|
|
10169
|
+
? exports.GAP_MODE_ENUM.HIDE_GAPS
|
|
10170
|
+
: exports.GAP_MODE_ENUM.SHOW_GAPS;
|
|
10171
|
+
self.showGapsCallback(track_id, mode);
|
|
10121
10172
|
});
|
|
10122
10173
|
$dropdown.append($show_gaps_opt_1);
|
|
10123
|
-
$dropdown.append($
|
|
10174
|
+
$dropdown.append($show_gaps_percent_opt);
|
|
10124
10175
|
}
|
|
10125
10176
|
// Add custom options
|
|
10126
10177
|
var custom_options = model.getTrackCustomOptions(track_id);
|
|
@@ -11085,6 +11136,7 @@ var OncoprintTrackInfoView = /** @class */ (function () {
|
|
|
11085
11136
|
var self = this;
|
|
11086
11137
|
var _loop_1 = function (j) {
|
|
11087
11138
|
(function () {
|
|
11139
|
+
var _a, _b;
|
|
11088
11140
|
var i = j;
|
|
11089
11141
|
var $new_label = $__default["default"]('<span>')
|
|
11090
11142
|
.css({
|
|
@@ -11099,19 +11151,22 @@ var OncoprintTrackInfoView = /** @class */ (function () {
|
|
|
11099
11151
|
if (!text) {
|
|
11100
11152
|
return;
|
|
11101
11153
|
}
|
|
11102
|
-
var
|
|
11154
|
+
var num = (_a = text.match(/^[\d\.]*/)) === null || _a === void 0 ? void 0 : _a[0];
|
|
11155
|
+
var suffix = (_b = text.match(/[^\d]*$/)) === null || _b === void 0 ? void 0 : _b[0];
|
|
11156
|
+
var float = parseFloat(num);
|
|
11103
11157
|
var formattedPercent = '';
|
|
11104
11158
|
if (isNaN(float)) {
|
|
11105
11159
|
formattedPercent = 'N/P';
|
|
11160
|
+
suffix = ''; // we don't want any suffix in this case
|
|
11106
11161
|
}
|
|
11107
11162
|
else if (_.isNumber(float)) {
|
|
11108
11163
|
formattedPercent =
|
|
11109
11164
|
float < 1 && float > 0
|
|
11110
|
-
? '<1
|
|
11111
|
-
: Math.round(float)
|
|
11165
|
+
? '<1'
|
|
11166
|
+
: Math.round(float).toString();
|
|
11112
11167
|
}
|
|
11113
11168
|
else ;
|
|
11114
|
-
$new_label.text(formattedPercent);
|
|
11169
|
+
$new_label.text(formattedPercent + suffix);
|
|
11115
11170
|
$new_label.appendTo(self.$text_ctr);
|
|
11116
11171
|
self.$label_elts.push($new_label);
|
|
11117
11172
|
setTimeout(function () {
|
|
@@ -14382,7 +14437,7 @@ var Oncoprint = /** @class */ (function () {
|
|
|
14382
14437
|
}
|
|
14383
14438
|
if (this.model.getTrackSortDirection(track_id) === 0) {
|
|
14384
14439
|
if (this.model.getTrackShowGaps(track_id)) {
|
|
14385
|
-
this.setTrackShowGaps(track_id,
|
|
14440
|
+
this.setTrackShowGaps(track_id, exports.GAP_MODE_ENUM.HIDE_GAPS);
|
|
14386
14441
|
}
|
|
14387
14442
|
}
|
|
14388
14443
|
}
|
|
@@ -14452,9 +14507,10 @@ var Oncoprint = /** @class */ (function () {
|
|
|
14452
14507
|
enumerable: false,
|
|
14453
14508
|
configurable: true,
|
|
14454
14509
|
writable: true,
|
|
14455
|
-
value: function (track_id,
|
|
14456
|
-
this.model.setTrackShowGaps(track_id,
|
|
14457
|
-
if (this.model.getTrackSortDirection(track_id) === 0 &&
|
|
14510
|
+
value: function (track_id, gap_mode) {
|
|
14511
|
+
this.model.setTrackShowGaps(track_id, gap_mode);
|
|
14512
|
+
if (this.model.getTrackSortDirection(track_id) === 0 &&
|
|
14513
|
+
gap_mode !== exports.GAP_MODE_ENUM.HIDE_GAPS) {
|
|
14458
14514
|
this.setTrackSortDirection(track_id, 1);
|
|
14459
14515
|
}
|
|
14460
14516
|
this.track_options_view.setTrackShowGaps(this.model, this.getCellViewHeight);
|