<commit_before>import * as React from "react";
import * as _ from 'lodash';
import {Checkbox, ButtonGroup, Panel, Radio } from 'react-bootstrap';
import {computed, observable} from "mobx";
import {observer} from "mobx-react";
import Slider from 'react-rangeslider';
import Select from 'react-select';
import {FormGroup, ControlLabel, FormControl} from 'react-bootstrap';
import jsPDF from 'jspdf';
import {If, Then, Else} from 'react-if';
import classnames from 'classnames';

import 'react-select/dist/react-select.css';
import 'react-rangeslider/lib/index.css';

import SummaryBarGraph from './SummaryBarGraph';
import {ExtendedSample} from "../../../pages/resultsView/ResultsViewPageStore";

const orderedLabels: Record<keyof IAlterationCountMap, string> = {
    multiple: "Multiple Alterations",
    protExpressionDown: "Protein Downregulation",
    protExpressionUp: "Protein Upregulation",
    mrnaExpressionDown: "mRNA Downregulation",
    mrnaExpressionUp: "mRNA Upregulation",
    hetloss: "Shallow Deletion",
    homdel: "Deep Deletion",
    gain: "Gain",
    amp: "Amplification",
    fusion: "Fusion",
    mutated: "Mutation"
};

export interface IAlterationCountMap {
    mutated: number;
    amp: number;
    homdel: number;
    hetloss: number;
    gain: number;
    fusion: number;
    mrnaExpressionUp: number;
    mrnaExpressionDown: number;
    protExpressionUp: number;
    protExpressionDown: number;
    multiple: number;
};


export interface IAlterationData {
    alterationTotal: number;
    sampleTotal: number;
    alterationTypeCounts: IAlterationCountMap;
    alteredSampleCount: number;
    parentCancerType: string;

}

export interface IBarGraphDataset {
    label: string;
    totalCases: number;
    altTotalPercent: number;
    total: number;
    count: number;
    percent: number;
    backgroundColor: string;
}

export interface IBarChartSortedData {
    data: IBarGraphDataset[];
    label: string;
    sortCount: number;
    sortBy: string;
    symbol: string;
}

export interface IBarGraphConfigOptions {
    labels: string[];
    datasets: IBarGraphDataset[];
}

interface ICancerSummaryContentProps {
    dataByCancerSubType?: {
        [cancerType: string]: IAlterationData
    };
    dataByCancerType?: {
        [cancerType: string]: IAlterationData
    };
    groupedAlterationData: {
        [groupType: string]: IAlterationData
    }
    groupAlterationsBy: string;
    gene: string;
    width: number;
    handlePivotChange: (e: any) => void;
}

const GroupByOptions = [
    {value: 'studyId', label: 'Cancer Study'},
    {value: 'cancerType', label: 'Cancer Type'},
    {value: 'cancerTypeDetailed', label: 'Detailed Cancer Type'}
];

@observer
export class CancerSummaryContent extends React.Component<ICancerSummaryContentProps, {}> {

    private inputYAxisEl: any;
    private inputXAxisEl: any;
    @observable private tempAltCasesInputValue = 0;
    @observable private tempTotalCasesInputValue = 0;
    @observable private pngAnchor = '';
    @observable private pdf: { anchor: string; width: number; height: number } = {anchor: '', width: 0, height: 0};
    @observable private showControls = false;
    @observable private showGenomicAlt = true;
    @observable private yAxis: 'alt-freq' | 'abs-count' = 'alt-freq';<commit_msg>Change 'Detailed Cancer Type' to 'Cancer Type Detailed'<commit_after>import * as React from "react";
import * as _ from 'lodash';
import {Checkbox, ButtonGroup, Panel, Radio } from 'react-bootstrap';
import {computed, observable} from "mobx";
import {observer} from "mobx-react";
import Slider from 'react-rangeslider';
import Select from 'react-select';
import {FormGroup, ControlLabel, FormControl} from 'react-bootstrap';
import jsPDF from 'jspdf';
import {If, Then, Else} from 'react-if';
import classnames from 'classnames';

import 'react-select/dist/react-select.css';
import 'react-rangeslider/lib/index.css';

import SummaryBarGraph from './SummaryBarGraph';
import {ExtendedSample} from "../../../pages/resultsView/ResultsViewPageStore";

const orderedLabels: Record<keyof IAlterationCountMap, string> = {
    multiple: "Multiple Alterations",
    protExpressionDown: "Protein Downregulation",
    protExpressionUp: "Protein Upregulation",
    mrnaExpressionDown: "mRNA Downregulation",
    mrnaExpressionUp: "mRNA Upregulation",
    hetloss: "Shallow Deletion",
    homdel: "Deep Deletion",
    gain: "Gain",
    amp: "Amplification",
    fusion: "Fusion",
    mutated: "Mutation"
};

export interface IAlterationCountMap {
    mutated: number;
    amp: number;
    homdel: number;
    hetloss: number;
    gain: number;
    fusion: number;
    mrnaExpressionUp: number;
    mrnaExpressionDown: number;
    protExpressionUp: number;
    protExpressionDown: number;
    multiple: number;
};


export interface IAlterationData {
    alterationTotal: number;
    sampleTotal: number;
    alterationTypeCounts: IAlterationCountMap;
    alteredSampleCount: number;
    parentCancerType: string;

}

export interface IBarGraphDataset {
    label: string;
    totalCases: number;
    altTotalPercent: number;
    total: number;
    count: number;
    percent: number;
    backgroundColor: string;
}

export interface IBarChartSortedData {
    data: IBarGraphDataset[];
    label: string;
    sortCount: number;
    sortBy: string;
    symbol: string;
}

export interface IBarGraphConfigOptions {
    labels: string[];
    datasets: IBarGraphDataset[];
}

interface ICancerSummaryContentProps {
    dataByCancerSubType?: {
        [cancerType: string]: IAlterationData
    };
    dataByCancerType?: {
        [cancerType: string]: IAlterationData
    };
    groupedAlterationData: {
        [groupType: string]: IAlterationData
    }
    groupAlterationsBy: string;
    gene: string;
    width: number;
    handlePivotChange: (e: any) => void;
}

const GroupByOptions = [
    {value: 'studyId', label: 'Cancer Study'},
    {value: 'cancerType', label: 'Cancer Type'},
    {value: 'cancerTypeDetailed', label: 'Cancer Type Detailed'}
];

@observer
export class CancerSummaryContent extends React.Component<ICancerSummaryContentProps, {}> {

    private inputYAxisEl: any;
    private inputXAxisEl: any;
    @observable private tempAltCasesInputValue = 0;
    @observable private tempTotalCasesInputValue = 0;
    @observable private pngAnchor = '';
    @observable private pdf: { anchor: string; width: number; height: number } = {anchor: '', width: 0, height: 0};
    @observable private showControls = false;
    @observable private showGenomicAlt = true;
    @observable private yAxis: 'alt-freq' | 'abs-count' = 'alt-freq';
{'fraction_non_alphanumeric': 0.11003627569528417, 'fraction_numerical': 0.0012091898428053204, 'mean_word_length': 4.210236220472441, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6438319', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1995, 'n_words': 540}