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 ed08876
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions src/shared/components/mutationMapper/MutationMapper.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
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 {observer} from 'mobx-react';
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 All @@ -27,18 +28,12 @@ import PubMedCache from 'shared/cache/PubMedCache';
import GenomeNexusCache from 'shared/cache/GenomeNexusCache';
import GenomeNexusMutationAssessorCache from 'shared/cache/GenomeNexusMutationAssessorCache';
import GenomeNexusMyVariantInfoCache from 'shared/cache/GenomeNexusMyVariantInfoCache';
import { IMyCancerGenomeData } from 'shared/model/MyCancerGenome';
import {IMyCancerGenomeData} from 'shared/model/MyCancerGenome';
import PdbHeaderCache from 'shared/cache/PdbHeaderCache';
import {
DEFAULT_PROTEIN_IMPACT_TYPE_COLORS,
getColorForProteinImpactType,
} from 'shared/lib/MutationUtils';
import {DEFAULT_PROTEIN_IMPACT_TYPE_COLORS, getColorForProteinImpactType,} from 'shared/lib/MutationUtils';
import ProteinChainPanel from 'shared/components/proteinChainPanel/ProteinChainPanel';
import MutationMapperStore from './MutationMapperStore';
import {
findProteinImpactTypeFilter,
PROTEIN_IMPACT_TYPE_FILTER_ID,
} from './MutationMapperDataStore';
import {findProteinImpactTypeFilter, PROTEIN_IMPACT_TYPE_FILTER_ID,} from './MutationMapperDataStore';
import WindowStore from '../window/WindowStore';

import styles from './mutationMapper.module.scss';
Expand Down Expand Up @@ -207,6 +202,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 +217,22 @@ 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 ed08876

Please sign in to comment.