oncoprintjs 6.0.0 → 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.
- package/dist/index.es.js +17 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/js/oncoprintmodel.d.ts +3 -0
- package/package.json +2 -2
- package/src/js/oncoprintmodel.ts +21 -10
- package/src/js/oncoprinttrackoptionsview.ts +1 -0
|
@@ -42,6 +42,7 @@ export declare type ActiveRulesCount = {
|
|
|
42
42
|
[ruleId: number]: number;
|
|
43
43
|
};
|
|
44
44
|
export declare type TrackSortDirectionChangeCallback = (track_id: TrackId, dir: number) => void;
|
|
45
|
+
export declare type TrackGapChangeCallBack = (track_id: TrackId, on: boolean) => void;
|
|
45
46
|
export declare type CustomTrackOption = {
|
|
46
47
|
label?: string;
|
|
47
48
|
separator?: boolean;
|
|
@@ -80,6 +81,7 @@ export declare type UserTrackSpec<D> = {
|
|
|
80
81
|
sortCmpFn: TrackSortSpecification<D>;
|
|
81
82
|
sort_direction_changeable?: boolean;
|
|
82
83
|
onSortDirectionChange?: TrackSortDirectionChangeCallback;
|
|
84
|
+
onGapChange?: TrackGapChangeCallBack;
|
|
83
85
|
init_sort_direction?: TrackSortDirection;
|
|
84
86
|
data?: D[];
|
|
85
87
|
rule_set_params?: RuleSetParams;
|
|
@@ -187,6 +189,7 @@ export default class OncoprintModel {
|
|
|
187
189
|
private track_sort_direction_changeable;
|
|
188
190
|
private track_sort_direction;
|
|
189
191
|
private track_sort_direction_change_callback;
|
|
192
|
+
private track_gap_change_callback;
|
|
190
193
|
private track_data;
|
|
191
194
|
private track_rule_set_id;
|
|
192
195
|
private track_active_rules;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oncoprintjs",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "A data visualization for cancer genomic data.",
|
|
5
5
|
"types": "./dist/js/oncoprint.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"tayden-clusterfck": "^0.7.0",
|
|
61
61
|
"typescript": "4.0.3"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "f4d4f999c480f95b907d4c37947f421f16edb4f5"
|
|
64
64
|
}
|
package/src/js/oncoprintmodel.ts
CHANGED
|
@@ -61,6 +61,7 @@ export type TrackSortDirectionChangeCallback = (
|
|
|
61
61
|
track_id: TrackId,
|
|
62
62
|
dir: number
|
|
63
63
|
) => void;
|
|
64
|
+
export type TrackGapChangeCallBack = (track_id: TrackId, on: boolean) => void;
|
|
64
65
|
export type CustomTrackOption = {
|
|
65
66
|
label?: string;
|
|
66
67
|
separator?: boolean;
|
|
@@ -99,6 +100,7 @@ export type UserTrackSpec<D> = {
|
|
|
99
100
|
sortCmpFn: TrackSortSpecification<D>;
|
|
100
101
|
sort_direction_changeable?: boolean;
|
|
101
102
|
onSortDirectionChange?: TrackSortDirectionChangeCallback;
|
|
103
|
+
onGapChange?: TrackGapChangeCallBack;
|
|
102
104
|
init_sort_direction?: TrackSortDirection;
|
|
103
105
|
data?: D[];
|
|
104
106
|
rule_set_params?: RuleSetParams;
|
|
@@ -288,6 +290,7 @@ export default class OncoprintModel {
|
|
|
288
290
|
private track_sort_direction_change_callback: TrackProp<
|
|
289
291
|
TrackSortDirectionChangeCallback
|
|
290
292
|
>;
|
|
293
|
+
private track_gap_change_callback: TrackProp<TrackGapChangeCallBack>;
|
|
291
294
|
private track_data: TrackProp<Datum[]>;
|
|
292
295
|
private track_rule_set_id: TrackProp<RuleSetId>;
|
|
293
296
|
private track_active_rules: TrackProp<ActiveRules>;
|
|
@@ -391,6 +394,7 @@ export default class OncoprintModel {
|
|
|
391
394
|
this.track_sort_direction_changeable = {};
|
|
392
395
|
this.track_sort_direction = {}; // 1: ascending, -1: descending, 0: not
|
|
393
396
|
this.track_sort_direction_change_callback = {};
|
|
397
|
+
this.track_gap_change_callback = {};
|
|
394
398
|
this.track_data = {};
|
|
395
399
|
this.track_rule_set_id = {}; // track id -> rule set id
|
|
396
400
|
this.track_active_rules = {}; // from track id to active rule map (map with rule ids as keys)
|
|
@@ -662,7 +666,7 @@ export default class OncoprintModel {
|
|
|
662
666
|
|
|
663
667
|
public setTrackShowGaps(trackId: TrackId, show: boolean) {
|
|
664
668
|
this.track_show_gaps[trackId] = show;
|
|
665
|
-
|
|
669
|
+
this.track_gap_change_callback[trackId](trackId, show);
|
|
666
670
|
this.ids_after_a_gap.update(this);
|
|
667
671
|
}
|
|
668
672
|
|
|
@@ -1334,14 +1338,22 @@ export default class OncoprintModel {
|
|
|
1334
1338
|
params.expandButtonTextGetter;
|
|
1335
1339
|
}
|
|
1336
1340
|
|
|
1341
|
+
this.track_sort_direction[track_id] = ifndef(
|
|
1342
|
+
params.init_sort_direction,
|
|
1343
|
+
1
|
|
1344
|
+
);
|
|
1345
|
+
|
|
1337
1346
|
this.track_can_show_gaps[track_id] = ifndef(
|
|
1338
1347
|
params.track_can_show_gaps,
|
|
1339
1348
|
false
|
|
1340
1349
|
);
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1350
|
+
|
|
1351
|
+
const trackShowGaps = ifndef(params.show_gaps_on_init, false);
|
|
1352
|
+
this.track_show_gaps[track_id] = trackShowGaps;
|
|
1353
|
+
const trackNotSorted = this.track_sort_direction[track_id] === 0;
|
|
1354
|
+
if (trackShowGaps && trackNotSorted) {
|
|
1355
|
+
this.track_sort_direction[track_id] = 1;
|
|
1356
|
+
}
|
|
1345
1357
|
|
|
1346
1358
|
this.track_sort_cmp_fn[track_id] = params.sortCmpFn;
|
|
1347
1359
|
|
|
@@ -1352,6 +1364,10 @@ export default class OncoprintModel {
|
|
|
1352
1364
|
this.track_sort_direction_change_callback[
|
|
1353
1365
|
track_id
|
|
1354
1366
|
] = ifndef(params.onSortDirectionChange, function() {});
|
|
1367
|
+
this.track_gap_change_callback[track_id] = ifndef(
|
|
1368
|
+
params.onGapChange,
|
|
1369
|
+
function() {}
|
|
1370
|
+
);
|
|
1355
1371
|
this.track_data[track_id] = ifndef(params.data, []);
|
|
1356
1372
|
this.track_data_id_key[track_id] = ifndef(params.data_id_key, 'id');
|
|
1357
1373
|
|
|
@@ -1372,11 +1388,6 @@ export default class OncoprintModel {
|
|
|
1372
1388
|
this.setTrackImportantIds(track_id, params.important_ids);
|
|
1373
1389
|
}
|
|
1374
1390
|
|
|
1375
|
-
this.track_sort_direction[track_id] = ifndef(
|
|
1376
|
-
params.init_sort_direction,
|
|
1377
|
-
1
|
|
1378
|
-
);
|
|
1379
|
-
|
|
1380
1391
|
params.target_group = ifndef(params.target_group, 0);
|
|
1381
1392
|
this.ensureTrackGroupExists(params.target_group);
|
|
1382
1393
|
|
|
@@ -571,6 +571,7 @@ export default class OncoprintTrackOptionsView {
|
|
|
571
571
|
this.resize(model, getCellViewHeight);
|
|
572
572
|
}
|
|
573
573
|
public addTracks(model: OncoprintModel, getCellViewHeight: () => number) {
|
|
574
|
+
this.setTrackShowGaps(model, getCellViewHeight);
|
|
574
575
|
this.renderAllOptions(model);
|
|
575
576
|
this.resize(model, getCellViewHeight);
|
|
576
577
|
}
|