import * as React from 'react'; import { DefaultTooltip } from 'cbioportal-frontend-commons'; import annotationStyles from './../styles/annotation.module.scss'; import classNames from 'classnames'; import tooltipStyles from './styles/polyPhen2Tooltip.module.scss'; export interface IPolyPhen2Props { polyPhenPrediction: string | undefined; // benign, possibly_damaging, probably_damging polyPhenScore: number | undefined; } export function hideArrow(tooltipEl: any) { const arrowEl = tooltipEl.querySelector('.rc-tooltip-arrow'); arrowEl.style.display = 'none'; } export default class PolyPhen2 extends React.Component { static POLYPHEN2_URL: string = 'http://genetics.bwh.harvard.edu/pph2/'; constructor(props: IPolyPhen2Props) { super(props); this.tooltipContent = this.tooltipContent.bind(this); } public static download( polyPhenScore: number | undefined, polyPhenPrediction: string | undefined ): string { if (polyPhenScore || polyPhenPrediction) { return `impact: ${polyPhenPrediction}, score: ${polyPhenScore}`; } else { return 'NA'; } } public render() { let content: JSX.Element = ( ); if ( this.props.polyPhenPrediction && this.props.polyPhenPrediction.length > 0 ) { content = ( ); const arrowContent =
; content = ( {content} ); } return content; } private tooltipContent() { const impact = this.props.polyPhenPrediction ? (
{(this.props.polyPhenScore || this.props.polyPhenScore === 0) && ( )}
Source PolyPhen-2
Impact {this.props.polyPhenPrediction}
Score {this.props.polyPhenScore.toFixed(2)}
) : null; return {impact}; } }