<commit_before>import * as React from "react";
import {Observer, observer} from "mobx-react";
import {VictoryAxis, VictoryChart, VictoryLabel, VictoryLine, VictoryScatter} from "victory";
import CBIOPORTAL_VICTORY_THEME from "../../../shared/theme/cBioPoralTheme";
import {computed, observable} from "mobx";
import {Mutation, Sample} from "../../../shared/api/generated/CBioPortalAPI";
import {stringListToIndexSet} from "../../../public-lib";
import _ from "lodash";
import {getVariantAlleleFrequency} from "../../../shared/lib/MutationUtils";
import WindowStore from "../../../shared/components/window/WindowStore";
import TruncatedTextWithTooltipSVG from "../../../shared/components/TruncatedTextWithTooltipSVG";
import {Popover} from "react-bootstrap";
import classnames from "classnames";
import styles from "../../resultsView/survival/styles.module.scss";
import autobind from "autobind-decorator";
import {Portal} from "react-portal";
import {CoverageInformation} from "../../resultsView/ResultsViewPageStoreUtils";
import {isSampleProfiled} from "../../../shared/lib/isSampleProfiled";
import SampleLabelSVG from "../../../shared/components/sampleLabel/SampleLabel";
import SampleManager from "../sampleManager";
import PatientViewMutationsDataStore from "./PatientViewMutationsDataStore";
import ComplexKeyMap from "../../../shared/lib/complexKeyDataStructures/ComplexKeyMap";

export interface IVAFLineChartProps {
    mutations:Mutation[][];
    samples:Sample[];
    coverageInformation:CoverageInformation;
    mutationProfileId:string;
    sampleManager:SampleManager|null;
    dataStore:PatientViewMutationsDataStore;
}

enum NoMutationReason {
    NO_VAF_DATA="NO_VAF_DATA",
    NOT_SEQUENCED="NOT_SEQUENCED",
    NOT_MUTATED="NOT_MUTATED"
}

interface IPoint {
    x:number,
    y:number,
    sampleId:string,
    proteinChange:string,
    hugoGeneSymbol:string,
    lineData:IPoint[],

    noMutationReason?:NoMutationReason
}

const LINE_COLOR = "#c43a31";
const THICK_LINE_STROKE_WIDTH = 6;

class ScaleCapturer extends React.Component<any, any>{
    render() {
        this.props.scaleCallback(this.props.scale);

        return <g/>;
    }
}

class Tick extends React.Component<any, any>{
    render() {
        let {sampleIdOrder, sampleManager, text:index, ...rest} = this.props;
        const sampleId = sampleIdOrder[index];
        return (
            <g transform={`rotate(50, ${rest.x}, ${rest.y})`}>
                <SampleLabelSVG
                    label={index+1}
                    color={sampleManager ? sampleManager.getColorForSample(sampleId) : "black"}
                    x={rest.x+10}
                    y={rest.y-5}
                    r={6}
                    textDy={-1}
                />
                <TruncatedTextWithTooltipSVG
                    text={sampleId}<commit_msg>Use neutral color (black) for vaf curves<commit_after>import * as React from "react";
import {Observer, observer} from "mobx-react";
import {VictoryAxis, VictoryChart, VictoryLabel, VictoryLine, VictoryScatter} from "victory";
import CBIOPORTAL_VICTORY_THEME from "../../../shared/theme/cBioPoralTheme";
import {computed, observable} from "mobx";
import {Mutation, Sample} from "../../../shared/api/generated/CBioPortalAPI";
import {stringListToIndexSet} from "../../../public-lib";
import _ from "lodash";
import {getVariantAlleleFrequency} from "../../../shared/lib/MutationUtils";
import WindowStore from "../../../shared/components/window/WindowStore";
import TruncatedTextWithTooltipSVG from "../../../shared/components/TruncatedTextWithTooltipSVG";
import {Popover} from "react-bootstrap";
import classnames from "classnames";
import styles from "../../resultsView/survival/styles.module.scss";
import autobind from "autobind-decorator";
import {Portal} from "react-portal";
import {CoverageInformation} from "../../resultsView/ResultsViewPageStoreUtils";
import {isSampleProfiled} from "../../../shared/lib/isSampleProfiled";
import SampleLabelSVG from "../../../shared/components/sampleLabel/SampleLabel";
import SampleManager from "../sampleManager";
import PatientViewMutationsDataStore from "./PatientViewMutationsDataStore";
import ComplexKeyMap from "../../../shared/lib/complexKeyDataStructures/ComplexKeyMap";

export interface IVAFLineChartProps {
    mutations:Mutation[][];
    samples:Sample[];
    coverageInformation:CoverageInformation;
    mutationProfileId:string;
    sampleManager:SampleManager|null;
    dataStore:PatientViewMutationsDataStore;
}

enum NoMutationReason {
    NO_VAF_DATA="NO_VAF_DATA",
    NOT_SEQUENCED="NOT_SEQUENCED",
    NOT_MUTATED="NOT_MUTATED"
}

interface IPoint {
    x:number,
    y:number,
    sampleId:string,
    proteinChange:string,
    hugoGeneSymbol:string,
    lineData:IPoint[],

    noMutationReason?:NoMutationReason
}

const LINE_COLOR = "#000000";
const THICK_LINE_STROKE_WIDTH = 6;

class ScaleCapturer extends React.Component<any, any>{
    render() {
        this.props.scaleCallback(this.props.scale);

        return <g/>;
    }
}

class Tick extends React.Component<any, any>{
    render() {
        let {sampleIdOrder, sampleManager, text:index, ...rest} = this.props;
        const sampleId = sampleIdOrder[index];
        return (
            <g transform={`rotate(50, ${rest.x}, ${rest.y})`}>
                <SampleLabelSVG
                    label={index+1}
                    color={sampleManager ? sampleManager.getColorForSample(sampleId) : "black"}
                    x={rest.x+10}
                    y={rest.y-5}
                    r={6}
                    textDy={-1}
                />
                <TruncatedTextWithTooltipSVG
                    text={sampleId}
{'fraction_non_alphanumeric': 0.13640358586746354, 'fraction_numerical': 0.0049217788715064156, 'mean_word_length': 3.326996197718631, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '2487115', 'n_tokens_mistral': 1702, 'n_tokens_neox': 1663, 'n_words': 333}