oncoprintjs 6.0.0 → 6.0.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.
@@ -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.0",
3
+ "version": "6.0.2",
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": "acc9cbdbb6f3c83f854679e84c03555be10769d3"
63
+ "gitHead": "015e5bda995b7f5db563416c53b9320e0c9da3a8"
64
64
  }
@@ -15,7 +15,9 @@ export const MUT_COLOR_TRUNC = '#000000';
15
15
  export const MUT_COLOR_TRUNC_PASSENGER = '#708090';
16
16
  export const MUT_COLOR_FUSION = '#8B00C9';
17
17
  export const MUT_COLOR_PROMOTER = '#00B7CE';
18
+ export const MUT_COLOR_PROMOTER_PASSENGER = '#8cedf9';
18
19
  export const MUT_COLOR_OTHER = '#cf58bc'; //'#cfb537';
20
+ export const MUT_COLOR_OTHER_PASSENGER = '#f96ae3';
19
21
 
20
22
  export const MRNA_COLOR_HIGH = '#ff9999';
21
23
  export const MRNA_COLOR_LOW = '#6699cc';
@@ -63,8 +65,10 @@ enum ShapeId {
63
65
 
64
66
  missenseMutationDriverRectangle = 'missenseMutationDriverRectangle',
65
67
  missenseMutationVUSRectangle = 'missenseMutationVUSRectangle',
66
- otherMutationRectangle = 'otherMutationRectangle',
67
- promoterMutationRectangle = 'promoterMutationRectangle',
68
+ otherMutationDriverRectangle = 'otherMutationDriverRectangle',
69
+ otherMutationVUSRectangle = 'otherMutationVUSRectangle',
70
+ promoterMutationDriverRectangle = 'promoterMutationDriverRectangle',
71
+ promoterMutationVUSRectangle = 'promoterMutationVUSRectangle',
68
72
  truncatingMutationDriverRectangle = 'truncatingMutationDriverRectangle',
69
73
  truncatingMutationVUSRectangle = 'truncatingMutationVUSRectangle',
70
74
  inframeMutationDriverRectangle = 'inframeMutationDriverRectangle',
@@ -189,7 +193,7 @@ const shapeBank = {
189
193
  height: 33.33,
190
194
  z: 6,
191
195
  },
192
- [ShapeId.otherMutationRectangle]: {
196
+ [ShapeId.otherMutationDriverRectangle]: {
193
197
  type: 'rectangle',
194
198
  fill: MUT_COLOR_OTHER,
195
199
  x: 0,
@@ -198,7 +202,16 @@ const shapeBank = {
198
202
  height: 33.33,
199
203
  z: 6,
200
204
  },
201
- [ShapeId.promoterMutationRectangle]: {
205
+ [ShapeId.otherMutationVUSRectangle]: {
206
+ type: 'rectangle',
207
+ fill: MUT_COLOR_OTHER_PASSENGER,
208
+ x: 0,
209
+ y: 33.33,
210
+ width: 100,
211
+ height: 33.33,
212
+ z: 6,
213
+ },
214
+ [ShapeId.promoterMutationDriverRectangle]: {
202
215
  type: 'rectangle',
203
216
  fill: MUT_COLOR_PROMOTER,
204
217
  x: 0,
@@ -207,6 +220,15 @@ const shapeBank = {
207
220
  height: 33.33,
208
221
  z: 6,
209
222
  },
223
+ [ShapeId.promoterMutationVUSRectangle]: {
224
+ type: 'rectangle',
225
+ fill: MUT_COLOR_PROMOTER_PASSENGER,
226
+ x: 0,
227
+ y: 33.33,
228
+ width: 100,
229
+ height: 33.33,
230
+ z: 6,
231
+ },
210
232
  [ShapeId.truncatingMutationDriverRectangle]: {
211
233
  type: 'rectangle',
212
234
  fill: MUT_COLOR_TRUNC,
@@ -406,12 +428,16 @@ export const genetic_rule_set_different_colors_no_recurrence: IGeneticAlteration
406
428
  conditional: shallowExtend(non_mutation_rule_params.conditional, {
407
429
  disp_mut: {
408
430
  'other,other_rec': {
409
- shapes: [shapeBank[ShapeId.otherMutationRectangle]],
431
+ shapes: [
432
+ shapeBank[ShapeId.otherMutationDriverRectangle],
433
+ ],
410
434
  legend_label: 'Other Mutation',
411
435
  legend_order: MUTATION_LEGEND_ORDER,
412
436
  },
413
437
  'promoter,promoter_rec': {
414
- shapes: [shapeBank[ShapeId.promoterMutationRectangle]],
438
+ shapes: [
439
+ shapeBank[ShapeId.promoterMutationDriverRectangle],
440
+ ],
415
441
  legend_label: 'Promoter Mutation',
416
442
  legend_order: MUTATION_LEGEND_ORDER,
417
443
  },
@@ -451,14 +477,31 @@ export const genetic_rule_set_different_colors_recurrence: IGeneticAlterationRul
451
477
  always: non_mutation_rule_params.always,
452
478
  conditional: shallowExtend(non_mutation_rule_params.conditional, {
453
479
  disp_mut: {
454
- 'other,other_rec': {
455
- shapes: [shapeBank[ShapeId.otherMutationRectangle]],
456
- legend_label: 'Other Mutation',
480
+ other_rec: {
481
+ shapes: [
482
+ shapeBank[ShapeId.otherMutationDriverRectangle],
483
+ ],
484
+ legend_label: 'Other Mutation (putative driver)',
457
485
  legend_order: MUTATION_LEGEND_ORDER,
458
486
  },
459
- 'promoter,promoter_rec': {
460
- shapes: [shapeBank[ShapeId.promoterMutationRectangle]],
461
- legend_label: 'Promoter Mutation',
487
+ other: {
488
+ shapes: [shapeBank[ShapeId.otherMutationVUSRectangle]],
489
+ legend_label: 'Other Mutation (unknown significance)',
490
+ legend_order: MUTATION_LEGEND_ORDER,
491
+ },
492
+ promoter_rec: {
493
+ shapes: [
494
+ shapeBank[ShapeId.promoterMutationDriverRectangle],
495
+ ],
496
+ legend_label: 'Promoter Mutation (putative driver)',
497
+ legend_order: MUTATION_LEGEND_ORDER,
498
+ },
499
+ promoter: {
500
+ shapes: [
501
+ shapeBank[ShapeId.promoterMutationVUSRectangle],
502
+ ],
503
+ legend_label:
504
+ 'Promoter Mutation (unknown significance)',
462
505
  legend_order: MUTATION_LEGEND_ORDER,
463
506
  },
464
507
  trunc_rec: {
@@ -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
- this.track_show_gaps[track_id] = ifndef(
1342
- params.show_gaps_on_init,
1343
- false
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
  }