<commit_before>import * as React from 'react';
import * as _ from 'lodash';
import MutualExclusivityTable from "./MutualExclusivityTable";
import { observer } from "mobx-react";
import { Checkbox } from 'react-bootstrap';
import styles from "./styles.module.scss";
import { computed, observable } from "mobx";
import { MutualExclusivity } from "../../../shared/model/MutualExclusivity";
import { ResultsViewPageStore } from "../ResultsViewPageStore";
import DiscreteCNACache from "../../../shared/cache/DiscreteCNACache";
import { If, Then, Else } from 'react-if';
import Loader from "../../../shared/components/loadingIndicator/LoadingIndicator";
import { getCountsText, getData, getFilteredData } from "./MutualExclusivityUtil";
import OqlStatusBanner from "../../../shared/components/oqlStatusBanner/OqlStatusBanner";

export interface IMutualExclusivityTabProps {
    store: ResultsViewPageStore
}

@observer
export default class MutualExclusivityTab extends React.Component<IMutualExclusivityTabProps, {}> {

    @observable mutualExclusivityFilter: boolean = true;
    @observable coOccurenceFilter: boolean = true;
    @observable significantPairsFilter: boolean = false;

    constructor(props: IMutualExclusivityTabProps) {
        super(props);
        this.mutualExclusivityFilterChange = this.mutualExclusivityFilterChange.bind(this);
        this.coOccurenceFilterChange = this.coOccurenceFilterChange.bind(this);
        this.significantPairsFilterChange = this.significantPairsFilterChange.bind(this);
    }

    @computed get data(): MutualExclusivity[] {
        return getData(this.props.store.isSampleAlteredMap.result!);
    }

    @computed get filteredData(): MutualExclusivity[] {
        return getFilteredData(this.data, this.mutualExclusivityFilter, this.coOccurenceFilter,
            this.significantPairsFilter);
    }

    private mutualExclusivityFilterChange() {
        this.mutualExclusivityFilter = !this.mutualExclusivityFilter;
    }

    private coOccurenceFilterChange() {
        this.coOccurenceFilter = !this.coOccurenceFilter;
    }

    private significantPairsFilterChange() {
        this.significantPairsFilter = !this.significantPairsFilter;
    }

    public render() {

        if (this.props.store.isSampleAlteredMap.isPending) {
            return <Loader isLoading={true} />
        } else if (this.props.store.isSampleAlteredMap.isComplete) {
            if (_.size(this.props.store.isSampleAlteredMap.result) > 1) {
                return (
                    <div>
                        <OqlStatusBanner className="mutex-oql-status-banner" store={this.props.store} tabReflectsOql={true} />
                        {getCountsText(this.data)}
                        <div className={styles.Checkboxes}>
                            <Checkbox checked={this.mutualExclusivityFilter}
                                      onChange={this.mutualExclusivityFilterChange}>
                                Mutual exclusivity
                            </Checkbox>
                            <Checkbox checked={this.coOccurenceFilter}
                                      onChange={this.coOccurenceFilterChange}>
                                Co-occurrence
                            </Checkbox>
                            <Checkbox checked={this.significantPairsFilter}
                                      onChange={this.significantPairsFilterChange}>
                                Significant only
                            </Checkbox>
                        </div>
                        <MutualExclusivityTable data={this.filteredData} />
                    </div>
                );
            } else {
                return <div className={"tabMessageContainer"}><commit_msg>Put Mutex OQLBanner tag inside of message container div<commit_after>import * as React from 'react';
import * as _ from 'lodash';
import MutualExclusivityTable from "./MutualExclusivityTable";
import { observer } from "mobx-react";
import { Checkbox } from 'react-bootstrap';
import styles from "./styles.module.scss";
import { computed, observable } from "mobx";
import { MutualExclusivity } from "../../../shared/model/MutualExclusivity";
import { ResultsViewPageStore } from "../ResultsViewPageStore";
import DiscreteCNACache from "../../../shared/cache/DiscreteCNACache";
import { If, Then, Else } from 'react-if';
import Loader from "../../../shared/components/loadingIndicator/LoadingIndicator";
import { getCountsText, getData, getFilteredData } from "./MutualExclusivityUtil";
import OqlStatusBanner from "../../../shared/components/oqlStatusBanner/OqlStatusBanner";

export interface IMutualExclusivityTabProps {
    store: ResultsViewPageStore
}

@observer
export default class MutualExclusivityTab extends React.Component<IMutualExclusivityTabProps, {}> {

    @observable mutualExclusivityFilter: boolean = true;
    @observable coOccurenceFilter: boolean = true;
    @observable significantPairsFilter: boolean = false;

    constructor(props: IMutualExclusivityTabProps) {
        super(props);
        this.mutualExclusivityFilterChange = this.mutualExclusivityFilterChange.bind(this);
        this.coOccurenceFilterChange = this.coOccurenceFilterChange.bind(this);
        this.significantPairsFilterChange = this.significantPairsFilterChange.bind(this);
    }

    @computed get data(): MutualExclusivity[] {
        return getData(this.props.store.isSampleAlteredMap.result!);
    }

    @computed get filteredData(): MutualExclusivity[] {
        return getFilteredData(this.data, this.mutualExclusivityFilter, this.coOccurenceFilter,
            this.significantPairsFilter);
    }

    private mutualExclusivityFilterChange() {
        this.mutualExclusivityFilter = !this.mutualExclusivityFilter;
    }

    private coOccurenceFilterChange() {
        this.coOccurenceFilter = !this.coOccurenceFilter;
    }

    private significantPairsFilterChange() {
        this.significantPairsFilter = !this.significantPairsFilter;
    }

    public render() {

        if (this.props.store.isSampleAlteredMap.isPending) {
            return <Loader isLoading={true} />
        } else if (this.props.store.isSampleAlteredMap.isComplete) {
            if (_.size(this.props.store.isSampleAlteredMap.result) > 1) {
                return (
                    <div>
                        <div className={"tabMessageContainer"}>
                            <OqlStatusBanner className="mutex-oql-status-banner" store={this.props.store} tabReflectsOql={true} />
                        </div>

                        {getCountsText(this.data)}

                        <div className={styles.Checkboxes}>
                            <Checkbox checked={this.mutualExclusivityFilter}
                                      onChange={this.mutualExclusivityFilterChange}>
                                Mutual exclusivity
                            </Checkbox>
                            <Checkbox checked={this.coOccurenceFilter}
                                      onChange={this.coOccurenceFilterChange}>
                                Co-occurrence
                            </Checkbox>
                            <Checkbox checked={this.significantPairsFilter}
                                      onChange={this.significantPairsFilterChange}>
                                Significant only
                            </Checkbox>
                        </div>
                        <MutualExclusivityTable data={this.filteredData} />
                    </div>
                );
            } else {
                return <div className={"tabMessageContainer"}>
{'fraction_non_alphanumeric': 0.09796987557301899, 'fraction_numerical': 0.0002619515389652914, 'mean_word_length': 2.242462845010616, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4626790', 'n_tokens_mistral': 2075, 'n_tokens_neox': 1945, 'n_words': 348}