From 0a9d60f917d3c18e7f94bae9106d410eaa20ff65 Mon Sep 17 00:00:00 2001 From: Onur Sumer Date: Fri, 31 Jan 2020 14:25:20 -0500 Subject: [PATCH] disabling a track if the corresponding annotation is disabled (fix cBioPortal/cbioportal/issues/7005) Signed-off-by: Onur Sumer --- .../mutationMapper/MutationMapper.tsx | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/shared/components/mutationMapper/MutationMapper.tsx b/src/shared/components/mutationMapper/MutationMapper.tsx index b61c7458de9..8b8d524d244 100644 --- a/src/shared/components/mutationMapper/MutationMapper.tsx +++ b/src/shared/components/mutationMapper/MutationMapper.tsx @@ -2,18 +2,19 @@ import * as React from 'react'; import _ from 'lodash'; import autobind from 'autobind-decorator'; import { observer } from 'mobx-react'; -import { computed, action, observable } from 'mobx'; +import { action, computed } from 'mobx'; import classnames from 'classnames'; import { - LollipopMutationPlot, + DataFilterType, FilterResetPanel, + LollipopMutationPlot, MutationMapper as DefaultMutationMapper, + onFilterOptionSelect, + ProteinImpactTypeBadgeSelector, TrackDataStatus, TrackName, + TrackSelector, TrackVisibility, - ProteinImpactTypeBadgeSelector, - onFilterOptionSelect, - DataFilterType, } from 'react-mutation-mapper'; import 'react-mutation-mapper/dist/styles.css'; @@ -207,6 +208,7 @@ export default class MutationMapper< pubMedCache={this.props.pubMedCache} onXAxisOffset={this.onXAxisOffset} geneWidth={this.geneWidth} + tracks={this.tracks} trackVisibility={this.trackVisibility} trackDataStatus={this.trackDataStatus} onTrackVisibilityChange={this.onTrackVisibilityChange} @@ -221,6 +223,25 @@ export default class MutationMapper< ); } + @computed + protected get tracks(): TrackName[] { + const defaultTracks: TrackName[] = TrackSelector.defaultProps.tracks!; + + const conditionalTracks = [ + { name: TrackName.OncoKB, enabled: this.props.enableOncoKb }, + { + name: TrackName.CancerHotspots, + enabled: this.props.enableHotspot, + }, + ]; + + // default tracks minus the disabled ones + return _.without( + defaultTracks, + ...conditionalTracks.filter(t => !t.enabled).map(t => t.name) + ); + } + protected get proteinChainPanel(): JSX.Element | null { return this.is3dPanelOpen ? (