diff --git a/browser/src/ClinvarVariantsTrack/ClinvarAllVariantsPlot.tsx b/browser/src/ClinvarVariantsTrack/ClinvarAllVariantsPlot.tsx index 5625d2ce0..7f8fae938 100644 --- a/browser/src/ClinvarVariantsTrack/ClinvarAllVariantsPlot.tsx +++ b/browser/src/ClinvarVariantsTrack/ClinvarAllVariantsPlot.tsx @@ -209,6 +209,8 @@ const VariantLine = ({ opacity = 0.2 } + // console.log(variant) + if (category === 'frameshift') { const transcript = transcripts.find((t) => t.transcript_id === variant.transcript_id) const [endpoint1, endpoint2] = getGlobalFrameshiftCoordinates(variant, transcript) @@ -216,15 +218,19 @@ const VariantLine = ({ const frameshiftMaxPos = Math.max(endpoint1, endpoint2) const terminationPos = transcript && transcript.strand === '+' ? frameshiftMaxPos : frameshiftMinPos - // @ts-expect-error TS(2532) FIXME: Object is possibly 'undefined'. - const frameshiftExonRegions = transcript.exons - .sort((e1, e2) => e1.start - e2.start) - .filter((e) => e.start <= frameshiftMaxPos && e.stop >= frameshiftMinPos) - .map((e) => ({ - start: Math.max(e.start, frameshiftMinPos), - stop: Math.min(e.stop, frameshiftMaxPos), - feature_type: e.feature_type, - })) + + // if a frameshift variant-consequence pair from ClinVar exists for a transcript + // that the browser doesn't recognize, use an empty array for exon information + const frameshiftExonRegions = transcript + ? transcript.exons + .sort((e1, e2) => e1.start - e2.start) + .filter((e) => e.start <= frameshiftMaxPos && e.stop >= frameshiftMinPos) + .map((e) => ({ + start: Math.max(e.start, frameshiftMinPos), + stop: Math.min(e.stop, frameshiftMaxPos), + feature_type: e.feature_type, + })) + : [] return (