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/siftTooltip.module.scss'; export interface ISiftProps { siftPrediction: string | undefined; // deleterious, deleterious_low_confidence, tolerated, tolerated_low_confidence siftScore: number | undefined; } export function hideArrow(tooltipEl: any) { const arrowEl = tooltipEl.querySelector('.rc-tooltip-arrow'); arrowEl.style.display = 'none'; } export default class Sift extends React.Component { static SIFT_URL: string = 'http://sift.bii.a-star.edu.sg/'; constructor(props: ISiftProps) { super(props); this.tooltipContent = this.tooltipContent.bind(this); } public static download( siftScore: number | undefined, siftPrediction: string | undefined ): string { if (siftScore || siftPrediction) { return `impact: ${siftPrediction}, score: ${siftScore}`; } else { return 'NA'; } } public render() { let siftContent: JSX.Element = ( ); if (this.props.siftPrediction && this.props.siftPrediction.length > 0) { siftContent = ( ); const arrowContent =
; siftContent = ( {siftContent} ); } return siftContent; } private tooltipContent() { const impact = this.props.siftPrediction ? (
{(this.props.siftScore || this.props.siftScore === 0) && ( )}
Source SIFT
Impact {this.props.siftPrediction}
Score {this.props.siftScore.toFixed(2)}
) : null; return {impact}; } }