Skip to content

Commit 8a566e5

Browse files
committed
fix(frontend): add additional guard clauses in gene transcript track
1 parent 1a7eb6b commit 8a566e5

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

browser/src/GenePage/GeneTranscriptsTrack.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,30 @@ const GeneTranscriptsTrack = ({
164164
}
165165
)
166166

167+
if (displayedGtexTissues.length === 0) {
168+
return null
169+
}
170+
167171
const meanExpression = mean(
168172
displayedGtexTissues.map((tissueExpression) => tissueExpression.value)
169-
)!
173+
)
174+
170175
const maxExpression = max(
171176
displayedGtexTissues.map((tissueExpression) => tissueExpression.value)
172-
)!
173-
const tissueMostExpressedIn = displayedGtexTissues.find(
177+
)
178+
179+
if (!meanExpression || !maxExpression) {
180+
return null
181+
}
182+
183+
const tissueMostExpressedInObj = displayedGtexTissues.find(
174184
(tissue) => tissue.value === maxExpression
175-
)!.tissue
185+
)
186+
const tissueMostExpressedIn = tissueMostExpressedInObj?.tissue
187+
188+
if (!tissueMostExpressedIn) {
189+
return null
190+
}
176191

177192
const circleRadiusMeanContribution = meanExpression === 0 ? 0 : 0.25
178193
const circleRadiusMaxMeanContribution =

0 commit comments

Comments
 (0)