import * as React from 'react'; import { observer } from 'mobx-react'; import { action, computed, makeObservable, observable } from 'mobx'; import { MakeMobxView } from '../../../shared/components/MobxView'; import { MSKTab, MSKTabs } from '../../../shared/components/MSKTabs/MSKTabs'; import Overlap from '../../groupComparison/Overlap'; import ClinicalData from '../../groupComparison/ClinicalData'; import MRNAEnrichments from '../../groupComparison/MRNAEnrichments'; import ProteinEnrichments from '../../groupComparison/ProteinEnrichments'; import LoadingIndicator from '../../../shared/components/loadingIndicator/LoadingIndicator'; import ErrorMessage from '../../../shared/components/ErrorMessage'; import { trackEvent } from '../../../shared/lib/tracking'; import ReactSelect from 'react-select'; import ResultsViewURLWrapper from '../ResultsViewURLWrapper'; import { OverlapStrategy } from '../../../shared/lib/comparison/ComparisonStore'; import ResultsViewComparisonStore from './ResultsViewComparisonStore'; import { AppStore } from '../../../AppStore'; import { ResultsViewPageStore } from '../ResultsViewPageStore'; import { ResultsViewComparisonSubTab } from '../ResultsViewPageHelpers'; import { GENOMIC_ALTERATIONS_TAB_NAME, GroupComparisonTab, } from '../../groupComparison/GroupComparisonTabs'; import Survival from '../../groupComparison/Survival'; import AlterationFilterWarning from '../../../shared/components/banners/AlterationFilterWarning'; import OqlStatusBanner from '../../../shared/components/banners/OqlStatusBanner'; import _ from 'lodash'; import groupComparisonStyles from '../../../pages/groupComparison/styles.module.scss'; import GroupSelector from '../../groupComparison/groupSelector/GroupSelector'; import CaseFilterWarning from '../../../shared/components/banners/CaseFilterWarning'; import MethylationEnrichments from 'pages/groupComparison/MethylationEnrichments'; import AlterationEnrichments from 'pages/groupComparison/AlterationEnrichments'; import AlterationEnrichmentTypeSelector from 'shared/lib/comparison/AlterationEnrichmentTypeSelector'; import GenericAssayEnrichments from 'pages/groupComparison/GenericAssayEnrichments'; import styles from 'pages/resultsView/comparison/styles.module.scss'; import { getServerConfig } from 'config/config'; import { AlterationFilterMenuSection } from 'pages/groupComparison/GroupComparisonUtils'; import { getSortedGenericAssayTabSpecs } from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils'; export interface IComparisonTabProps { urlWrapper: ResultsViewURLWrapper; appStore: AppStore; store: ResultsViewPageStore; } @observer export default class ComparisonTab extends React.Component< IComparisonTabProps, {} > { @observable.ref private store: ResultsViewComparisonStore; constructor(props: IComparisonTabProps) { super(props); makeObservable(this); (window as any).comparisonTab = this; this.store = new ResultsViewComparisonStore( this.props.appStore, this.props.urlWrapper, this.props.store ); } componentWillUnmount() { this.store && this.store.destroy(); } readonly overlapStrategySelector = MakeMobxView({ await: () => [this.store.overlapComputations], render: () => { if ( !this.store.overlapComputations.result!.totalSampleOverlap && !this.store.overlapComputations.result!.totalPatientOverlap ) { return null; } else { const includeLabel = 'Include overlapping samples and patients'; const excludeLabel = 'Exclude overlapping samples and patients'; return (
{ if (option) { this.onOverlapStrategySelect(option); } }} options={[ { label: includeLabel, value: OverlapStrategy.INCLUDE, }, { label: excludeLabel, value: OverlapStrategy.EXCLUDE, }, ]} clearable={false} searchable={false} value={{ label: this.store.overlapStrategy === OverlapStrategy.EXCLUDE ? excludeLabel : includeLabel, value: this.store.overlapStrategy, }} />
); } }, }); @computed get alterationEnrichmentTabName() { return GENOMIC_ALTERATIONS_TAB_NAME; } @action.bound public onOverlapStrategySelect(option: any) { trackEvent({ category: 'resultsView', action: 'setComparisonTabOverlapStrategy', label: option.value, }); this.store.updateOverlapStrategy(option.value as OverlapStrategy); } readonly tabs = MakeMobxView({ await: () => [ this.store._activeGroupsNotOverlapRemoved, this.store.activeGroups, this.store.mutationEnrichmentProfiles, this.store.structuralVariantEnrichmentProfiles, this.store.copyNumberEnrichmentProfiles, this.store.mRNAEnrichmentProfiles, this.store.proteinEnrichmentProfiles, this.store.methylationEnrichmentProfiles, this.store.survivalClinicalDataExists, this.store.genericAssayEnrichmentProfilesGroupedByGenericAssayType, ], render: () => { return ( {this.store.showSurvivalTab && ( )} {this.store.showAlterationsTab && ( {(this.store.activeGroups.isComplete && this.store.activeGroups.result!.length > 1 && getServerConfig().skin_show_settings_menu && ( )) || ( )} )} {this.store.showMRNATab && ( )} {this.store.showProteinTab && ( )} {this.store.showMethylationTab && ( )} {this.store.showGenericAssayTab && getSortedGenericAssayTabSpecs( this.store .genericAssayEnrichmentProfilesGroupedByGenericAssayType .result ).map(genericAssayTabSpecs => { return ( ); })} ); }, renderPending: () => ( ), renderError: () => , }); render() { if (!this.store) { return null; } return (
{this.overlapStrategySelector.component}
{this.tabs.component}
); } }