Skip to content

Commit cf33d8c

Browse files
Add transcript link below mito constraint table
1 parent 5c52b3c commit cf33d8c

File tree

3 files changed

+5244
-4601
lines changed

3 files changed

+5244
-4601
lines changed

browser/src/ConstraintTable/ConstraintTable.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ const ConstraintTable = ({ datasetId, geneOrTranscript }: Props) => {
6868

6969
if (geneOrTranscript.chrom === 'M') {
7070
if (isGene(geneOrTranscript)) {
71-
return <MitochondrialConstraintTable constraint={geneOrTranscript.mitochondrial_constraint} />
71+
return (
72+
<MitochondrialConstraintTable
73+
constraint={geneOrTranscript.mitochondrial_constraint}
74+
transcript={geneOrTranscript.transcripts[0]}
75+
/>
76+
)
7277
}
7378
return <p>Constraint is not available for mitochondrial transcripts</p>
7479
}

browser/src/ConstraintTable/MitochondrialConstraintTable.tsx

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import {
33
MitochondrialGeneConstraint,
44
ProteinMitochondrialGeneConstraint,
55
RNAMitochondrialGeneConstraint,
6+
GeneTranscript,
67
} from '../GenePage/GenePage'
78
import { BaseTable, TooltipAnchor } from '@gnomad/ui'
9+
import Link from '../Link'
810
import { ConstraintHighlight } from './constraintMetrics'
911

1012
const isProteinMitochondrialGeneConstraint = (
@@ -138,45 +140,57 @@ const RNAConstraintMetrics = ({ constraint }: { constraint: RNAMitochondrialGene
138140

139141
const MitochondrialConstraintTable = ({
140142
constraint,
143+
transcript,
141144
}: {
142145
constraint: MitochondrialGeneConstraint | null
146+
transcript: GeneTranscript | null
143147
}) => {
144148
if (constraint === null) {
145149
return <p>Constraint is not available on this gene</p>
146150
}
147151

148152
return (
149-
// @ts-expect-error
150-
<BaseTable>
151-
<thead>
152-
<tr>
153-
<th scope="col">Category</th>
154-
<th scope="col">
155-
{' '}
156-
<>
157-
{/* @ts-expect-error */}
158-
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of expected SNVs in gene">
159-
<span>Expected</span>
160-
</TooltipAnchor>
161-
</>
162-
</th>
163-
<th scope="col">
164-
<>
165-
{/* @ts-expect-error */}
166-
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of observed SNVs in gene">
167-
<span>Observed</span>
168-
</TooltipAnchor>
169-
</>
170-
</th>
171-
<th scope="col">Constraint metrics</th>
172-
</tr>
173-
</thead>{' '}
174-
{isProteinMitochondrialGeneConstraint(constraint) ? (
175-
<ProteinConstraintMetrics constraint={constraint} />
176-
) : (
177-
<RNAConstraintMetrics constraint={constraint} />
153+
<>
154+
{/* @ts-expect-error */}
155+
<BaseTable>
156+
<thead>
157+
<tr>
158+
<th scope="col">Category</th>
159+
<th scope="col">
160+
{' '}
161+
<>
162+
{/* @ts-expect-error */}
163+
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of expected SNVs in gene">
164+
<span>Expected</span>
165+
</TooltipAnchor>
166+
</>
167+
</th>
168+
<th scope="col">
169+
<>
170+
{/* @ts-expect-error */}
171+
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of observed SNVs in gene">
172+
<span>Observed</span>
173+
</TooltipAnchor>
174+
</>
175+
</th>
176+
<th scope="col">Constraint metrics</th>
177+
</tr>
178+
</thead>
179+
{isProteinMitochondrialGeneConstraint(constraint) ? (
180+
<ProteinConstraintMetrics constraint={constraint} />
181+
) : (
182+
<RNAConstraintMetrics constraint={constraint} />
183+
)}
184+
</BaseTable>
185+
{transcript !== null && (
186+
<>
187+
Constraint metrics based on transcript{' '}
188+
<Link to={`/transcript/${transcript.transcript_id}`}>
189+
{transcript.transcript_id}.{transcript.transcript_version}
190+
</Link>
191+
</>
178192
)}
179-
</BaseTable>
193+
</>
180194
)
181195
}
182196

0 commit comments

Comments
 (0)