<commit_before>import * as React from 'react';
import { observer } from 'mobx-react';
import { action, computed, observable, makeObservable } from 'mobx';
import autobind from 'autobind-decorator';
import GroupComparisonStore from './GroupComparisonStore';
import _ from 'lodash';
import {
    MUTATIONS_NOT_ENOUGH_GROUPS_MSG,
    MUTATIONS_TOO_MANY_GROUPS_MSG,
} from './GroupComparisonUtils';
import { MakeMobxView } from 'shared/components/MobxView';
import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator';
import ErrorMessage from 'shared/components/ErrorMessage';
import { LollipopGeneSelector } from './LollipopGeneSelector';
import GroupComparisonMutationsTabPlot from './GroupComparisonMutationsTabPlot';
import OverlapExclusionIndicator from './OverlapExclusionIndicator';
import { MSKTab, MSKTabs } from 'shared/components/MSKTabs/MSKTabs';
import GroupComparisonURLWrapper from './GroupComparisonURLWrapper';

interface IGroupComparisonMutationsTabProps {
    store: GroupComparisonStore;
    urlWrapper: GroupComparisonURLWrapper;
}

@observer
export default class GroupComparisonMutationsTab extends React.Component<
    IGroupComparisonMutationsTabProps,
    {}
> {
    @observable public geneTab: string | undefined;
    constructor(props: IGroupComparisonMutationsTabProps) {
        super(props);
        makeObservable(this);
    }

    @action.bound
    protected handleGeneChange(id: string) {
        this.geneTab = id;
        this.props.urlWrapper.updateURL({
            selectedGene: id,
        });
    }

    @computed get tabs() {
        return this.props.store.genesWithMaxFrequency.map(g => (
            <MSKTab
                key={g.hugoGeneSymbol}
                id={g.hugoGeneSymbol}
                linkText={g.hugoGeneSymbol}
            />
        ));
    }

    @computed get activeTabId(): string | undefined {
        let activeTabId;
        if (this.geneTab) {
            activeTabId = this.geneTab;
        } else if (this.props.store.userSelectedMutationMapperGene) {
            activeTabId = this.props.store.userSelectedMutationMapperGene;
        } else {
            activeTabId = this.props.store.activeMutationMapperGene!
                .hugoGeneSymbol;
        }
        return activeTabId;
    }

    readonly tabUI = MakeMobxView({
        await: () => [this.props.store.availableGenes],
        render: () => {
            // We only want 2 groups for our mirrored lollipop plot. Display message if not 2 groups
            if (this.props.store.activeGroups.result!.length < 2) {
                return (
                    <div className="alert alert-info">
                        {MUTATIONS_NOT_ENOUGH_GROUPS_MSG}
                    </div>
                );
            } else if (this.props.store.activeGroups.result!.length > 2) {
                return (
                    <div className="alert alert-info">
                        {MUTATIONS_TOO_MANY_GROUPS_MSG}
                    </div>
                );
            }
<commit_msg>removed geneTab<commit_after>import * as React from 'react';
import { observer } from 'mobx-react';
import { action, computed, observable, makeObservable } from 'mobx';
import autobind from 'autobind-decorator';
import GroupComparisonStore from './GroupComparisonStore';
import _ from 'lodash';
import {
    MUTATIONS_NOT_ENOUGH_GROUPS_MSG,
    MUTATIONS_TOO_MANY_GROUPS_MSG,
} from './GroupComparisonUtils';
import { MakeMobxView } from 'shared/components/MobxView';
import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator';
import ErrorMessage from 'shared/components/ErrorMessage';
import { LollipopGeneSelector } from './LollipopGeneSelector';
import GroupComparisonMutationsTabPlot from './GroupComparisonMutationsTabPlot';
import OverlapExclusionIndicator from './OverlapExclusionIndicator';
import { MSKTab, MSKTabs } from 'shared/components/MSKTabs/MSKTabs';
import GroupComparisonURLWrapper from './GroupComparisonURLWrapper';

interface IGroupComparisonMutationsTabProps {
    store: GroupComparisonStore;
    urlWrapper: GroupComparisonURLWrapper;
}

@observer
export default class GroupComparisonMutationsTab extends React.Component<
    IGroupComparisonMutationsTabProps,
    {}
> {
    constructor(props: IGroupComparisonMutationsTabProps) {
        super(props);
        makeObservable(this);
    }

    @action.bound
    protected handleGeneChange(id: string) {
        this.props.urlWrapper.updateURL({
            selectedGene: id,
        });
    }

    @computed get tabs() {
        return this.props.store.genesWithMaxFrequency.map(g => (
            <MSKTab
                key={g.hugoGeneSymbol}
                id={g.hugoGeneSymbol}
                linkText={g.hugoGeneSymbol}
            />
        ));
    }

    @computed get activeTabId(): string | undefined {
        let activeTabId;
        if (this.props.store.userSelectedMutationMapperGene) {
            activeTabId = this.props.store.userSelectedMutationMapperGene;
        } else {
            activeTabId = this.props.store.activeMutationMapperGene!
                .hugoGeneSymbol;
        }
        return activeTabId;
    }

    readonly tabUI = MakeMobxView({
        await: () => [this.props.store.availableGenes],
        render: () => {
            // We only want 2 groups for our mirrored lollipop plot. Display message if not 2 groups
            if (this.props.store.activeGroups.result!.length < 2) {
                return (
                    <div className="alert alert-info">
                        {MUTATIONS_NOT_ENOUGH_GROUPS_MSG}
                    </div>
                );
            } else if (this.props.store.activeGroups.result!.length > 2) {
                return (
                    <div className="alert alert-info">
                        {MUTATIONS_TOO_MANY_GROUPS_MSG}
                    </div>
                );
            }

{'fraction_non_alphanumeric': 0.09276782696857046, 'fraction_numerical': 0.0013518080432578573, 'mean_word_length': 2.5023668639053254, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5009338', 'n_tokens_mistral': 1701, 'n_tokens_neox': 1610, 'n_words': 327}