Skip to content

Commit

Permalink
disabling a track if the corresponding annotation is disabled (fix cB…
Browse files Browse the repository at this point in the history
  • Loading branch information
onursumer committed Jan 31, 2020
1 parent 402e47a commit 0a9d60f
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/shared/components/mutationMapper/MutationMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}
Expand All @@ -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 ? (
<ProteinChainPanel
Expand Down

0 comments on commit 0a9d60f

Please sign in to comment.