import { DefaultTooltip } from 'cbioportal-frontend-commons'; import { observer } from 'mobx-react'; import * as React from 'react'; import { GnomadFrequency, HotspotAnnotation } from 'react-mutation-mapper'; import { MyVariantInfo, VariantAnnotation } from 'genome-nexus-ts-api-client'; import featureTableStyle from '../featureTable/FeatureTable.module.scss'; import { extractGenomicLocation, genomicLocationString, IHotspotIndex, is3dHotspot, isLinearClusterHotspot, Mutation, } from 'cbioportal-utils'; import { computed, makeObservable } from 'mobx'; import MskImpact from './MskImpact'; interface IGenralPopulationPrevalenceProps { myVariantInfo?: MyVariantInfo; chromosome: string | null; mutation: Mutation; variantAnnotation?: VariantAnnotation; } interface IVcf { chrom: string; ref: string; alt: string; pos: number; } @observer class GenralPopulationPrevalence extends React.Component< IGenralPopulationPrevalenceProps > { constructor(props: IGenralPopulationPrevalenceProps) { super(props); makeObservable(this); } @computed get indexedHotspots() { const indexHotspot: IHotspotIndex = {}; const genomicLocation = extractGenomicLocation(this.props.mutation); if ( genomicLocation && this.props.variantAnnotation?.hotspots?.annotation?.[0] ) { const aggregatedHotspots = { genomicLocation: genomicLocation, hotspots: this.props.variantAnnotation.hotspots.annotation[0], }; indexHotspot[ genomicLocationString(genomicLocation) ] = aggregatedHotspots; } return indexHotspot; } public gnomad( myVariantInfo: MyVariantInfo | undefined, chromosome: string | null ) { // generate gnomad url let gnomadUrl = 'https://gnomad.broadinstitute.org/'; if (myVariantInfo && myVariantInfo.vcf && chromosome) { const vcfVariant: IVcf = { chrom: chromosome, ref: myVariantInfo.vcf.ref, alt: myVariantInfo.vcf.alt, pos: Number(myVariantInfo.vcf.position), }; gnomadUrl = `https://gnomad.broadinstitute.org/variant/${vcfVariant.chrom}-${vcfVariant.pos}-${vcfVariant.ref}-${vcfVariant.alt}`; } if ( this.props.myVariantInfo && (this.props.myVariantInfo.gnomadExome || this.props.myVariantInfo.gnomadGenome) ) { return (
{this.gnomadTooltip(gnomadUrl)}
); } else { return (
{this.gnomadTooltip(gnomadUrl)}
N/A
); } } public gnomadTooltip(gnomadUrl: string) { return ( gnomAD  population allele frequencies. Overall population
allele frequency is shown. Hover over a frequency to see
the frequency for each specific population. } > gnomAD 
); } public dbsnp(myVariantInfo: MyVariantInfo | undefined) { const dbsnpUrl = myVariantInfo && myVariantInfo.dbsnp && myVariantInfo.dbsnp.rsid ? `https://www.ncbi.nlm.nih.gov/snp/${myVariantInfo.dbsnp.rsid}` : 'https://www.ncbi.nlm.nih.gov/snp/'; if ( this.props.myVariantInfo && this.props.myVariantInfo.dbsnp && this.props.myVariantInfo.dbsnp.rsid ) { return (
{this.dbsnpToolTip(dbsnpUrl)}
{this.props.myVariantInfo.dbsnp.rsid}
); } else { return (
{this.dbsnpToolTip(dbsnpUrl)}
N/A
); } } public dbsnpToolTip(dbsnpUrl: string) { return ( The Single Nucleotide Polymorphism Database ( dbSNP )
is a free public archive for genetic variation within and
across different species. } > dbSNP 
); } private hotspotToolTip() { return ( CancerHotspots.org {' '} is a resource of recurrent mutational hotspots in tumor
samples of various cancer types. } > CancerHotspots.org
); } private hotspotData() { const isCancerHotspot = isLinearClusterHotspot( this.props.mutation, this.indexedHotspots ); const is3DCancerHotspot = is3dHotspot( this.props.mutation, this.indexedHotspots ); if (isCancerHotspot || is3DCancerHotspot) { return ( ); } else { return 'N/A'; } } private hotspot() { return (
{this.hotspotToolTip()}
{this.hotspotData()}
); } public render() { return (
{this.gnomad(this.props.myVariantInfo, this.props.chromosome)} {this.dbsnp(this.props.myVariantInfo)} {this.hotspot()}
); } } export default GenralPopulationPrevalence;