react-mutation-mapper 0.8.70 → 0.8.71

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.
@@ -28,6 +28,7 @@ export declare type LollipopMutationPlotProps<T extends Mutation> = {
28
28
  lollipopTooltipCountInfo?: (count: number, mutations?: Partial<T>[], axisMode?: AxisScale, group?: string) => JSX.Element;
29
29
  yAxisLabelFormatter?: (symbol?: string, groupName?: string) => string;
30
30
  axisMode?: AxisScale;
31
+ onScaleToggle?: (selectedScale: AxisScale) => void;
31
32
  customControls?: JSX.Element;
32
33
  onXAxisOffset?: (offset: number) => void;
33
34
  geneWidth: number;
@@ -41,6 +42,7 @@ export declare type LollipopMutationPlotProps<T extends Mutation> = {
41
42
  showYMaxSlider?: boolean;
42
43
  showLegendToggle?: boolean;
43
44
  showDownloadControls?: boolean;
45
+ showPercentToggle?: boolean;
44
46
  filterResetPanel?: JSX.Element;
45
47
  legend?: JSX.Element;
46
48
  loadingIndicator?: JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { TrackDataStatus, TrackName, TrackVisibility } from '../track/TrackSelector';
3
3
  import 'react-rangeslider/lib/index.css';
4
+ import { AxisScale } from './AxisScaleSwitch';
4
5
  declare type LollipopMutationPlotControlsProps = {
5
6
  showControls: boolean;
6
7
  hugoGeneSymbol: string;
@@ -32,6 +33,9 @@ declare type LollipopMutationPlotControlsProps = {
32
33
  showDownloadControls?: boolean;
33
34
  onTrackVisibilityChange?: (selectedTrackIds: string[]) => void;
34
35
  getSVG: () => SVGElement;
36
+ axisMode?: AxisScale;
37
+ onScaleToggle?: (selectedScale: AxisScale) => void;
38
+ showPercentToggle?: boolean;
35
39
  };
36
40
  export default class LollipopMutationPlotControls extends React.Component<LollipopMutationPlotControlsProps, {}> {
37
41
  constructor(props: any);
@@ -43,6 +47,7 @@ export default class LollipopMutationPlotControls extends React.Component<Lollip
43
47
  protected get trackSelector(): JSX.Element;
44
48
  protected get legendToggle(): JSX.Element;
45
49
  protected get downloadControls(): JSX.Element;
50
+ protected get percentToggle(): JSX.Element;
46
51
  render(): JSX.Element;
47
52
  }
48
53
  export {};
package/dist/index.es.js CHANGED
@@ -19,9 +19,9 @@ import { Collapse } from 'react-collapse';
19
19
  import numeral from 'numeral';
20
20
  import Slider from 'react-rangeslider';
21
21
  import 'react-rangeslider/lib/index.css';
22
+ import { ButtonGroup } from 'react-bootstrap';
22
23
  import oncoKbImg from 'oncokb-styles/dist/images/oncogenic.svg';
23
24
  import 'oncokb-frontend-commons/dist/styles.css';
24
- import { ButtonGroup } from 'react-bootstrap';
25
25
  import request, { get } from 'superagent';
26
26
  import memoize from 'memoize-weak-decorator';
27
27
  import { cached } from 'mobxpromise';
@@ -5775,6 +5775,124 @@ var LollipopPlot = /** @class */ (function (_super) {
5775
5775
 
5776
5776
  var styles$5 = {"fade-out":"lollipopMutationPlot-module_fade-out__3PbXO","fade-in":"lollipopMutationPlot-module_fade-in__8bsOR","input-addon":"lollipopMutationPlot-module_input-addon__1P_lA","ymax-number-input":"lollipopMutationPlot-module_ymax-number-input__3oJoA"};
5777
5777
 
5778
+ var AxisScale;
5779
+ (function (AxisScale) {
5780
+ AxisScale["PERCENT"] = "%";
5781
+ AxisScale["COUNT"] = "#";
5782
+ })(AxisScale || (AxisScale = {}));
5783
+ var AxisScaleSwitch = /** @class */ (function (_super) {
5784
+ __extends(AxisScaleSwitch, _super);
5785
+ function AxisScaleSwitch(props) {
5786
+ var _this = _super.call(this, props) || this;
5787
+ Object.defineProperty(_this, "selectedScale", {
5788
+ enumerable: true,
5789
+ configurable: true,
5790
+ writable: true,
5791
+ value: void 0
5792
+ });
5793
+ _this.selectedScale = props.selectedScale;
5794
+ makeObservable(_this);
5795
+ return _this;
5796
+ }
5797
+ Object.defineProperty(AxisScaleSwitch.prototype, "toggleButton", {
5798
+ enumerable: false,
5799
+ configurable: true,
5800
+ writable: true,
5801
+ value: function (scale, onClick) {
5802
+ return (React.createElement("button", { className: classNames({
5803
+ 'btn-secondary': this.props.selectedScale === scale,
5804
+ 'btn-outline-secondary': this.props.selectedScale !== scale,
5805
+ }, 'btn', 'btn-sm', 'btn-axis-switch'), style: {
5806
+ lineHeight: 1,
5807
+ cursor: this.props.selectedScale === scale
5808
+ ? 'default'
5809
+ : 'pointer',
5810
+ fontWeight: this.props.selectedScale === scale
5811
+ ? 'bolder'
5812
+ : 'normal',
5813
+ color: this.props.selectedScale === scale ? '#fff' : '#6c757d',
5814
+ backgroundColor: this.props.selectedScale === scale ? '#6c757d' : '#fff',
5815
+ borderColor: '#6c757d',
5816
+ }, onClick: onClick }, scale));
5817
+ }
5818
+ });
5819
+ Object.defineProperty(AxisScaleSwitch.prototype, "render", {
5820
+ enumerable: false,
5821
+ configurable: true,
5822
+ writable: true,
5823
+ value: function () {
5824
+ return (React.createElement(ButtonGroup, { "aria-label": "" },
5825
+ this.toggleButton(AxisScale.PERCENT, this.handlePercentClick),
5826
+ this.toggleButton(AxisScale.COUNT, this.handleCountClick)));
5827
+ }
5828
+ });
5829
+ Object.defineProperty(AxisScaleSwitch.prototype, "handlePercentClick", {
5830
+ enumerable: false,
5831
+ configurable: true,
5832
+ writable: true,
5833
+ value: function () {
5834
+ this.selectedScale = AxisScale.PERCENT;
5835
+ this.props.onChange(this.selectedScale);
5836
+ }
5837
+ });
5838
+ Object.defineProperty(AxisScaleSwitch.prototype, "handleCountClick", {
5839
+ enumerable: false,
5840
+ configurable: true,
5841
+ writable: true,
5842
+ value: function () {
5843
+ this.selectedScale = AxisScale.COUNT;
5844
+ this.props.onChange(this.selectedScale);
5845
+ }
5846
+ });
5847
+ Object.defineProperty(AxisScaleSwitch, "defaultProps", {
5848
+ enumerable: true,
5849
+ configurable: true,
5850
+ writable: true,
5851
+ value: {
5852
+ selectedScale: AxisScale.COUNT,
5853
+ }
5854
+ });
5855
+ __decorate([
5856
+ observable
5857
+ ], AxisScaleSwitch.prototype, "selectedScale", void 0);
5858
+ __decorate([
5859
+ action.bound
5860
+ ], AxisScaleSwitch.prototype, "handlePercentClick", null);
5861
+ __decorate([
5862
+ action.bound
5863
+ ], AxisScaleSwitch.prototype, "handleCountClick", null);
5864
+ AxisScaleSwitch = __decorate([
5865
+ observer
5866
+ ], AxisScaleSwitch);
5867
+ return AxisScaleSwitch;
5868
+ }(React.Component));
5869
+
5870
+ var PercentToggle = /** @class */ (function (_super) {
5871
+ __extends(PercentToggle, _super);
5872
+ function PercentToggle(props) {
5873
+ return _super.call(this, props) || this;
5874
+ }
5875
+ Object.defineProperty(PercentToggle.prototype, "render", {
5876
+ enumerable: false,
5877
+ configurable: true,
5878
+ writable: true,
5879
+ value: function () {
5880
+ return (React.createElement("div", { className: "small", style: {
5881
+ display: 'flex',
5882
+ alignItems: 'center',
5883
+ marginLeft: 10,
5884
+ } },
5885
+ React.createElement("div", { style: {
5886
+ marginLeft: 10,
5887
+ marginRight: 10,
5888
+ } },
5889
+ React.createElement("div", { style: { textAlign: 'center' } }, "Y-Axis:"),
5890
+ React.createElement(AxisScaleSwitch, { selectedScale: this.props.axisMode, onChange: this.props.onScaleToggle }))));
5891
+ }
5892
+ });
5893
+ return PercentToggle;
5894
+ }(React.Component));
5895
+
5778
5896
  function formatInputValue(value, step) {
5779
5897
  if (step === void 0) { step = 1; }
5780
5898
  var decimalZeros = numberOfLeadingDecimalZeros(step);
@@ -5814,14 +5932,14 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
5814
5932
  alignItems: 'center',
5815
5933
  marginLeft: 10,
5816
5934
  } },
5817
- React.createElement("span", null,
5818
- label,
5819
- ":"),
5820
5935
  React.createElement("div", { style: {
5821
5936
  width: width,
5822
5937
  marginLeft: 10,
5823
5938
  marginRight: 10,
5824
5939
  } },
5940
+ React.createElement("div", { style: { textAlign: 'center' } },
5941
+ label,
5942
+ ":"),
5825
5943
  React.createElement(Slider, { min: yMaxSliderStep, max: calcYMaxInput(undefined, yMaxSliderStep, countRange, oppositeCountRange, yAxisSameScale), tooltip: false, step: yMaxSliderStep, onChange: onYAxisMaxSliderChange, value: yMaxSlider })),
5826
5944
  React.createElement(EditableSpan, { className: styles$5['ymax-number-input'], value: formatInputValue(yMaxInput, yMaxSliderStep), setValue: onYAxisMaxChange, numericOnly: yMaxSliderStep >= 1, onFocus: this.props.onYMaxInputFocused, onBlur: this.props.onYMaxInputBlurred })));
5827
5945
  }
@@ -5836,7 +5954,7 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
5836
5954
  Object.defineProperty(LollipopMutationPlotControls.prototype, "bottomYMaxSlider", {
5837
5955
  get: function () {
5838
5956
  if (this.showBottomYAxisSlider) {
5839
- return this.maxValueSlider(this.props.bottomCountRange, this.props.countRange, this.props.onBottomYAxisMaxSliderChange, this.props.onBottomYAxisMaxChange, this.props.bottomYMaxSlider, this.props.bottomYMaxInput, this.props.yAxisSameScale, 'Bottom Y-Axis Max', 100, this.props.bottomYMaxSliderStep);
5957
+ return this.maxValueSlider(this.props.bottomCountRange, this.props.countRange, this.props.onBottomYAxisMaxSliderChange, this.props.onBottomYAxisMaxChange, this.props.bottomYMaxSlider, this.props.bottomYMaxInput, this.props.yAxisSameScale, 'Bottom Y-Axis Max', this.props.yMaxSliderWidth, this.props.bottomYMaxSliderStep);
5840
5958
  }
5841
5959
  else {
5842
5960
  return null;
@@ -5869,6 +5987,13 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
5869
5987
  enumerable: false,
5870
5988
  configurable: true
5871
5989
  });
5990
+ Object.defineProperty(LollipopMutationPlotControls.prototype, "percentToggle", {
5991
+ get: function () {
5992
+ return (React.createElement(PercentToggle, { axisMode: this.props.axisMode, onScaleToggle: this.props.onScaleToggle }));
5993
+ },
5994
+ enumerable: false,
5995
+ configurable: true
5996
+ });
5872
5997
  Object.defineProperty(LollipopMutationPlotControls.prototype, "render", {
5873
5998
  enumerable: false,
5874
5999
  configurable: true,
@@ -5884,6 +6009,7 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
5884
6009
  this.trackSelector,
5885
6010
  this.props.showYMaxSlider && this.yMaxSlider,
5886
6011
  this.props.showYMaxSlider && this.bottomYMaxSlider,
6012
+ this.props.showPercentToggle && this.percentToggle,
5887
6013
  this.props.filterResetPanel,
5888
6014
  this.props.customControls,
5889
6015
  React.createElement("div", { style: { display: 'flex', marginLeft: 'auto' } },
@@ -5902,12 +6028,15 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
5902
6028
  showYMaxSlider: true,
5903
6029
  showLegendToggle: true,
5904
6030
  showDownloadControls: true,
5905
- yMaxSliderWidth: 100,
6031
+ yMaxSliderWidth: 110,
5906
6032
  }
5907
6033
  });
5908
6034
  __decorate([
5909
6035
  computed
5910
6036
  ], LollipopMutationPlotControls.prototype, "showBottomYAxisSlider", null);
6037
+ __decorate([
6038
+ computed
6039
+ ], LollipopMutationPlotControls.prototype, "percentToggle", null);
5911
6040
  LollipopMutationPlotControls = __decorate([
5912
6041
  observer
5913
6042
  ], LollipopMutationPlotControls);
@@ -8381,7 +8510,7 @@ var LollipopMutationPlot = /** @class */ (function (_super) {
8381
8510
  if (this.props.store.pfamDomainData.isComplete &&
8382
8511
  this.props.store.pfamDomainData.result) {
8383
8512
  return (React.createElement("div", { style: { display: 'inline-block' }, ref: function (div) { return (_this.divContainer = div); }, onMouseEnter: this.handlers.onMouseEnterPlot, onMouseLeave: this.handlers.onMouseLeavePlot },
8384
- React.createElement(LollipopMutationPlotControls, { showControls: this.showControls, showYMaxSlider: this.props.showYMaxSlider, showLegendToggle: this.props.showLegendToggle, showDownloadControls: this.props.showDownloadControls, hugoGeneSymbol: this.hugoGeneSymbol, countRange: this.countRange, bottomCountRange: this.bottomCountRange, onYAxisMaxSliderChange: this.handlers.handleYAxisMaxSliderChange, onYAxisMaxChange: this.handlers.handleYAxisMaxChange, onBottomYAxisMaxSliderChange: this.handlers.handleBottomYAxisMaxSliderChange, onBottomYAxisMaxChange: this.handlers.handleBottomYAxisMaxChange, onYMaxInputFocused: this.handlers.onYMaxInputFocused, onYMaxInputBlurred: this.handlers.onYMaxInputBlurred, onToggleLegend: this.handlers.handleToggleLegend, yMaxSlider: this.yMaxSlider, yMaxSliderStep: this.yMaxSliderStep, yMaxInput: this.yMaxInput, yAxisSameScale: this.props.yAxisSameScale, bottomYMaxSlider: this.bottomYMaxSlider, bottomYMaxSliderStep: this.bottomYMaxSliderStep, bottomYMaxInput: this.bottomYMaxInput, customControls: this.props.customControls, filterResetPanel: this.props.filterResetPanel, trackVisibility: this.trackVisibility, tracks: this.props.tracks, trackDataStatus: this.props.trackDataStatus, showTrackSelector: this.props.showTrackSelector, onTrackVisibilityChange: this.onTrackVisibilityChange, getSVG: this.getSVG }),
8513
+ React.createElement(LollipopMutationPlotControls, { showControls: this.showControls, showYMaxSlider: this.props.showYMaxSlider, showLegendToggle: this.props.showLegendToggle, showDownloadControls: this.props.showDownloadControls, hugoGeneSymbol: this.hugoGeneSymbol, countRange: this.countRange, bottomCountRange: this.bottomCountRange, onYAxisMaxSliderChange: this.handlers.handleYAxisMaxSliderChange, onYAxisMaxChange: this.handlers.handleYAxisMaxChange, onBottomYAxisMaxSliderChange: this.handlers.handleBottomYAxisMaxSliderChange, onBottomYAxisMaxChange: this.handlers.handleBottomYAxisMaxChange, onYMaxInputFocused: this.handlers.onYMaxInputFocused, onYMaxInputBlurred: this.handlers.onYMaxInputBlurred, onToggleLegend: this.handlers.handleToggleLegend, yMaxSlider: this.yMaxSlider, yMaxSliderStep: this.yMaxSliderStep, yMaxInput: this.yMaxInput, yAxisSameScale: this.props.yAxisSameScale, bottomYMaxSlider: this.bottomYMaxSlider, bottomYMaxSliderStep: this.bottomYMaxSliderStep, bottomYMaxInput: this.bottomYMaxInput, customControls: this.props.customControls, filterResetPanel: this.props.filterResetPanel, trackVisibility: this.trackVisibility, tracks: this.props.tracks, trackDataStatus: this.props.trackDataStatus, showTrackSelector: this.props.showTrackSelector, onTrackVisibilityChange: this.onTrackVisibilityChange, getSVG: this.getSVG, axisMode: this.props.axisMode, onScaleToggle: this.props.onScaleToggle, showPercentToggle: this.props.showPercentToggle }),
8385
8514
  React.createElement(Collapse, { isOpened: this.controlsConfig.legendShown }, this.props.legend || React.createElement(DefaultLollipopPlotLegend, null)),
8386
8515
  React.createElement(LollipopPlot, { sequence: this.sequence, lollipops: this.lollipops, domains: this.domains, dataStore: this.props.store.dataStore, vizWidth: this.props.geneWidth, vizHeight: this.props.vizHeight, hugoGeneSymbol: this.hugoGeneSymbol, xMax: this.proteinLength, yMax: this.yMaxInput, yMaxFractionDigits: this.yMaxSliderStep < 1
8387
8516
  ? this.props.yMaxFractionDigits
@@ -8493,118 +8622,6 @@ var LollipopMutationPlot = /** @class */ (function (_super) {
8493
8622
  return LollipopMutationPlot;
8494
8623
  }(React.Component));
8495
8624
 
8496
- var AxisScale;
8497
- (function (AxisScale) {
8498
- AxisScale["PERCENT"] = "%";
8499
- AxisScale["COUNT"] = "#";
8500
- })(AxisScale || (AxisScale = {}));
8501
- var AxisScaleSwitch = /** @class */ (function (_super) {
8502
- __extends(AxisScaleSwitch, _super);
8503
- function AxisScaleSwitch(props) {
8504
- var _this = _super.call(this, props) || this;
8505
- Object.defineProperty(_this, "selectedScale", {
8506
- enumerable: true,
8507
- configurable: true,
8508
- writable: true,
8509
- value: void 0
8510
- });
8511
- _this.selectedScale = props.selectedScale;
8512
- makeObservable(_this);
8513
- return _this;
8514
- }
8515
- Object.defineProperty(AxisScaleSwitch.prototype, "toggleButton", {
8516
- enumerable: false,
8517
- configurable: true,
8518
- writable: true,
8519
- value: function (scale, onClick) {
8520
- return (React.createElement("button", { className: classNames({
8521
- 'btn-secondary': this.props.selectedScale === scale,
8522
- 'btn-outline-secondary': this.props.selectedScale !== scale,
8523
- }, 'btn', 'btn-sm', 'btn-axis-switch'), style: {
8524
- lineHeight: 1,
8525
- cursor: this.props.selectedScale === scale
8526
- ? 'default'
8527
- : 'pointer',
8528
- fontWeight: this.props.selectedScale === scale
8529
- ? 'bolder'
8530
- : 'normal',
8531
- color: this.props.selectedScale === scale ? '#fff' : '#6c757d',
8532
- backgroundColor: this.props.selectedScale === scale ? '#6c757d' : '#fff',
8533
- borderColor: '#6c757d',
8534
- }, onClick: onClick }, scale));
8535
- }
8536
- });
8537
- Object.defineProperty(AxisScaleSwitch.prototype, "render", {
8538
- enumerable: false,
8539
- configurable: true,
8540
- writable: true,
8541
- value: function () {
8542
- return (React.createElement(ButtonGroup, { "aria-label": "" },
8543
- this.toggleButton(AxisScale.PERCENT, this.handlePercentClick),
8544
- this.toggleButton(AxisScale.COUNT, this.handleCountClick)));
8545
- }
8546
- });
8547
- Object.defineProperty(AxisScaleSwitch.prototype, "handlePercentClick", {
8548
- enumerable: false,
8549
- configurable: true,
8550
- writable: true,
8551
- value: function () {
8552
- this.selectedScale = AxisScale.PERCENT;
8553
- this.props.onChange(this.selectedScale);
8554
- }
8555
- });
8556
- Object.defineProperty(AxisScaleSwitch.prototype, "handleCountClick", {
8557
- enumerable: false,
8558
- configurable: true,
8559
- writable: true,
8560
- value: function () {
8561
- this.selectedScale = AxisScale.COUNT;
8562
- this.props.onChange(this.selectedScale);
8563
- }
8564
- });
8565
- Object.defineProperty(AxisScaleSwitch, "defaultProps", {
8566
- enumerable: true,
8567
- configurable: true,
8568
- writable: true,
8569
- value: {
8570
- selectedScale: AxisScale.COUNT,
8571
- }
8572
- });
8573
- __decorate([
8574
- observable
8575
- ], AxisScaleSwitch.prototype, "selectedScale", void 0);
8576
- __decorate([
8577
- action.bound
8578
- ], AxisScaleSwitch.prototype, "handlePercentClick", null);
8579
- __decorate([
8580
- action.bound
8581
- ], AxisScaleSwitch.prototype, "handleCountClick", null);
8582
- AxisScaleSwitch = __decorate([
8583
- observer
8584
- ], AxisScaleSwitch);
8585
- return AxisScaleSwitch;
8586
- }(React.Component));
8587
-
8588
- var PercentToggle = /** @class */ (function (_super) {
8589
- __extends(PercentToggle, _super);
8590
- function PercentToggle(props) {
8591
- return _super.call(this, props) || this;
8592
- }
8593
- Object.defineProperty(PercentToggle.prototype, "render", {
8594
- enumerable: false,
8595
- configurable: true,
8596
- writable: true,
8597
- value: function () {
8598
- return (React.createElement("div", { className: "small", style: { display: 'flex', alignItems: 'center' } },
8599
- React.createElement("span", { style: { marginLeft: 10, marginRight: 10 } },
8600
- "Y-Axis:",
8601
- ' '),
8602
- React.createElement(AxisScaleSwitch, { selectedScale: this.props.axisMode, onChange: this.props.onScaleToggle })));
8603
- }
8604
- });
8605
- return PercentToggle;
8606
- }(React.Component));
8607
-
8608
8625
  var LollipopTooltipCountInfo = function (_a) {
8609
8626
  var count = _a.count, mutations = _a.mutations, axisMode = _a.axisMode;
8610
8627
  var decimalZeros = numberOfLeadingDecimalZeros(count);