import { DefaultTooltip } from 'cbioportal-frontend-commons'; import * as React from 'react'; import { ButtonGroup, Radio, Tab, Tabs } from 'react-bootstrap'; import ReactTable from 'react-table'; import { levelIconClassNames, normalizeLevel, oncogenicityIconClassNames, OncoKbHelper, } from 'oncokb-frontend-commons'; import classnames from 'classnames'; import { getServerConfig } from 'config/config'; // oncokb enum OncokbTabs { ONCOGENIC = 'Oncogenic', THERAPEUTIC_LEVELS = 'Therapeutic Levels', DIAGNOSTIC_LEVELS = 'Diagnostic Levels', PROFNOSTIC_LEVELS = 'Prognostic Levels', } enum OncokbOncogenicIconEnum { ONCOGENIC = 'oncogenic', NUETRAL = 'neutral', INCONCLUSIVE = 'inconclusive', VUS = 'vus', UNKNOWN = 'unknown', } const oncokbOncogenicDescription: _.Dictionary = { [OncokbOncogenicIconEnum.ONCOGENIC]: 'Oncogenic/Likely Oncogenic/Resistance', [OncokbOncogenicIconEnum.NUETRAL]: 'Likely Neutral', [OncokbOncogenicIconEnum.INCONCLUSIVE]: 'Inconclusive', [OncokbOncogenicIconEnum.VUS]: 'VUS', [OncokbOncogenicIconEnum.UNKNOWN]: 'Unknown', }; // other annotation sources export type AnnotationHeaderTooltipCardInfoProps = { sourceUrl: string; sourceName: string; sourceDescription: string; reference?: string; referenceUrl?: string; }; export type LegendDescription = { legend: JSX.Element; description: JSX.Element; }; export enum AnnotationSources { ONCOKB = 'oncokb', CIVIC = 'civic', MY_CANCER_GENOME = 'myCancerGenome', CANCER_HOTSPOTS = 'cancerHotspots', } export const sourceTooltipInfo = { [AnnotationSources.ONCOKB]: [ { sourceUrl: 'https://www.oncokb.org/', sourceName: 'OncoKB™', sourceDescription: 'a precision oncology knowledge base that contains information about the effects and treatment implications of variants in cancer', reference: 'Chakravarty et al. 2017', referenceUrl: 'https://pubmed.ncbi.nlm.nih.gov/28890946/', }, ], [AnnotationSources.CIVIC]: [ { sourceUrl: 'https://civicdb.org/', sourceName: 'CIViC', sourceDescription: 'a community knowledgebase for expert crowdsourcing the clinical interpretation of variants in cancer', reference: 'Griffith et al 2017', referenceUrl: 'https://pubmed.ncbi.nlm.nih.gov/28138153/', }, ], [AnnotationSources.MY_CANCER_GENOME]: [ { sourceUrl: 'https://www.mycancergenome.org/', sourceName: 'My Cancer Genome', sourceDescription: 'a precision cancer medicine knowledge resource (data version Mar 2016)', }, ], [AnnotationSources.CANCER_HOTSPOTS]: [ { sourceUrl: 'https://www.cancerhotspots.org/', sourceName: 'Cancer Hotspots', sourceDescription: 'a resource for statistically significant recurrent mutational hotspots in cancer', reference: 'Chang et al. 2018', referenceUrl: 'https://pubmed.ncbi.nlm.nih.gov/29247016/', }, { sourceUrl: 'https://www.3dhotspots.org/', sourceName: '3D Cancer Hotspots', sourceDescription: 'a resource for statistically significant recurrent 3D clustered hotspots in cancer', reference: 'Gao et al. 2017', referenceUrl: 'https://pubmed.ncbi.nlm.nih.gov/28115009/', }, ], }; export const civicData: LegendDescription[] = [ { legend: ( ), description: ( Is in CIViC with oncogenic activity information ), }, { legend: ( ), description: ( Is in CIViC but no oncogenic activity information ), }, { legend: , description: Not in CIViC, }, ]; export const myCancerGenomeData: LegendDescription[] = [ { legend: ( ), description: Is in My Cancer Genome, }, { legend: , description: Not in My Cancer Genome, }, ]; export const cancerHotspotsData: LegendDescription[] = [ { legend: ( ), description: Recurrent hotspot or recurrent + 3D hotspot, }, { legend: ( ), description: 3D clustered hotspot, }, { legend: , description: Not a known hotspot, }, ]; const columns = [ { Header: 'Legend', accessor: 'legend', maxWidth: 60, }, { Header: 'Description', accessor: 'description', maxWidth: 540, style: { 'white-space': 'unset' }, // allow for words wrap inside only this cell }, ]; const oncokbData: _.Dictionary = { [OncokbTabs.ONCOGENIC]: Object.values(OncokbOncogenicIconEnum).map(d => { return { legend: , description: {oncokbOncogenicDescription[d]}, }; }), [OncokbTabs.DIAGNOSTIC_LEVELS]: Object.values(OncoKbHelper.DX_LEVELS).map( d => { return { legend: ( ), description: OncoKbHelper.LEVEL_DESC[d], }; } ), [OncokbTabs.PROFNOSTIC_LEVELS]: Object.values(OncoKbHelper.PX_LEVELS).map( d => { return { legend: ( ), description: OncoKbHelper.LEVEL_DESC[d], }; } ), [OncokbTabs.THERAPEUTIC_LEVELS]: Object.values(OncoKbHelper.TX_LEVELS).map( d => { return { legend: ( ), description: OncoKbHelper.LEVEL_DESC[d], }; } ), }; function getOncokbTabContent(tab: string) { return ; } function getOncokbTabs() { return Object.values(OncokbTabs).map(tab => { return ( {getOncokbTabContent(tab)} ); }); } const OncokbLegendContent: React.FunctionComponent<{}> = props => { return ( {getOncokbTabs()} ); }; const OncoKbControls: React.FunctionComponent<{ mergeIcons?: boolean; handleChange?: (mergeIcons: boolean) => void; }> = props => { return (
OncoKB Icon Style: props.handleChange && props.handleChange(true) } inline={true} > Compact props.handleChange && props.handleChange(false) } inline={true} > Expanded
); }; const AnnotationHeaderTooltipCardInfo: React.FunctionComponent<{ infoProps: AnnotationHeaderTooltipCardInfoProps[]; }> = props => { return (
{props.infoProps.map(p => { return (
{p.sourceName} {' '} is {p.sourceDescription}{' '} {p.reference && p.referenceUrl && ( <> ( {p.reference} ) )}
); })}
); }; export const LegendTable: React.FunctionComponent<{ legendDescriptions: LegendDescription[]; }> = props => { return ( ); }; export const AnnotationHeaderTooltipCard: React.FunctionComponent<{ controls?: JSX.Element; infoProps: AnnotationHeaderTooltipCardInfoProps[]; legendDescriptions?: LegendDescription[]; overrideContent?: JSX.Element; }> = props => { const showLegendTable = !props.overrideContent && props.legendDescriptions; return (
{props.controls} {!!props.overrideContent && props.overrideContent} {showLegendTable && ( )}
); }; const AnnotationHeader: React.FunctionComponent<{ name: string; width: number; mergeOncoKbIcons?: boolean; onOncoKbIconToggle?: (mergeIcons: boolean) => void; }> = props => { return ( {props.name}
{getServerConfig().show_oncokb && ( } infoProps={ sourceTooltipInfo[AnnotationSources.ONCOKB] } legendDescriptions={civicData} overrideContent={} /> } > 0 ? props.width - 21 : 0, }} /> )} {getServerConfig().show_civic && ( } > )} {getServerConfig().mycancergenome_show && ( } > )} {getServerConfig().show_hotspot && ( } > )}
); }; export default AnnotationHeader;