import * as React from 'react';
import hotspotStyles from './hotspotInfo.module.scss';
import { getNCBIlink } from 'cbioportal-frontend-commons';
export type HotspotInfoProps = {
isHotspot: boolean;
is3dHotspot: boolean;
count?: number;
customInfo?: JSX.Element;
};
export function title(
isHotspot: boolean,
is3dHotspot: boolean,
count?: number,
customInfo?: JSX.Element
) {
const recurrentHotspot = isHotspot ? Recurrent Hotspot : null;
const maybeAnd = isHotspot && is3dHotspot ? and : null;
const clusteredHotspot = is3dHotspot ? 3D Clustered Hotspot : null;
let countInfo: JSX.Element | null = null;
if (count) {
const sample = count > 1 ? 'samples' : 'sample';
countInfo = (
{count} {sample} with
);
}
return (
{countInfo} {recurrentHotspot} {maybeAnd} {clusteredHotspot}{' '}
{customInfo}
);
}
export function publication(isHotspot: boolean, is3dHotspot: boolean) {
const recurrentHotspot = isHotspot
? 'a recurrent hotspot (statistically significant)'
: '';
const maybeAnd = isHotspot && is3dHotspot ? 'and' : '';
const clusteredHotspot = is3dHotspot ? 'a 3D clustered hotspot' : '';
const recurrentPublication = isHotspot ? (
Chang et al., Nat Biotechnol, 2016
) : (
''
);
const clusteredPublication = is3dHotspot ? (
Gao et al., Genome Medicine, 2017
) : (
''
);
return (
This mutated amino acid was identified as {recurrentHotspot}{' '}
{maybeAnd} {clusteredHotspot} in a population-scale cohort of tumor
samples of various cancer types using methodology based in part on{' '}
{recurrentPublication} {maybeAnd} {clusteredPublication}.
);
}
export function link(isHotspot: boolean, is3dHotspot: boolean) {
const recurrentLink = isHotspot ? (
https://cancerhotspots.org/
) : (
''
);
const maybeAnd = isHotspot && is3dHotspot ? 'and' : '';
const clusteredLink = is3dHotspot ? (
https://3dhotspots.org/
) : (
''
);
return (
Explore all mutations at {recurrentLink} {maybeAnd} {clusteredLink}.
);
}
export const HotspotInfo: React.FunctionComponent = props => {
const { isHotspot, is3dHotspot, count, customInfo } = props;
return (
{title(isHotspot, is3dHotspot, count, customInfo)}
{publication(isHotspot, is3dHotspot)}
{link(isHotspot, is3dHotspot)}
);
};