import * as React from 'react';
import { observer } from 'mobx-react';
import { action, computed, observable, makeObservable } from 'mobx';
import autobind from 'autobind-decorator';
import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator';
import { convertToMutationMapperProps } from 'shared/components/mutationMapper/MutationMapperServerConfig';
import { getGenomeNexusHgvsgUrl } from 'shared/api/urls';
import { getServerConfig } from 'config/config';
import GroupComparisonMutationMapper from './GroupComparisonMutationMapper';
import { Mutation } from 'cbioportal-ts-api-client';
import MutationMapperToolStore from 'pages/staticPages/tools/mutationMapper/MutationMapperToolStore';
import GroupComparisonStore from './GroupComparisonStore';
import _ from 'lodash';
import { MakeMobxView } from 'shared/components/MobxView';
import { countUniqueMutations } from 'shared/lib/MutationUtils';
import ErrorMessage from 'shared/components/ErrorMessage';
import { AxisScale } from 'react-mutation-mapper';
import { LollipopTooltipCountInfo } from './LollipopTooltipCountInfo';
import { AnnotatedMutation } from 'shared/model/AnnotatedMutation';
interface IGroupComparisonMutationsTabPlotProps {
store: GroupComparisonStore;
onScaleToggle: (selectedScale: AxisScale) => void;
mutations?: Mutation[];
filters?: any;
}
@observer
export default class GroupComparisonMutationsTabPlot extends React.Component<
IGroupComparisonMutationsTabPlotProps,
{}
> {
constructor(props: IGroupComparisonMutationsTabPlotProps) {
super(props);
makeObservable(this);
}
@computed get mutationMapperToolStore() {
const store = new MutationMapperToolStore(
this.props.store.filteredAndAnnotatedMutations.result,
{
...this.props.filters,
countUniqueMutations: this.countUniqueMutationsInGroup,
}
);
return store;
}
@autobind
protected countUniqueMutationsInGroup(
mutations: Mutation[],
group: string
) {
return this.props.store.axisMode === AxisScale.COUNT
? countUniqueMutations(mutations)
: (countUniqueMutations(mutations) /
this.props.store.groupToProfiledPatients.result![group]
.length) *
100;
}
@autobind
protected plotLollipopTooltipCountInfo(
count: number,
mutations: Mutation[],
axisMode: AxisScale,
group: string
): JSX.Element {
return (