Skip to content

Commit

Permalink
Add transcript link below mito constraint table
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky-broad committed Feb 26, 2025
1 parent 5c52b3c commit cf33d8c
Show file tree
Hide file tree
Showing 3 changed files with 5,244 additions and 4,601 deletions.
7 changes: 6 additions & 1 deletion browser/src/ConstraintTable/ConstraintTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ const ConstraintTable = ({ datasetId, geneOrTranscript }: Props) => {

if (geneOrTranscript.chrom === 'M') {
if (isGene(geneOrTranscript)) {
return <MitochondrialConstraintTable constraint={geneOrTranscript.mitochondrial_constraint} />
return (
<MitochondrialConstraintTable
constraint={geneOrTranscript.mitochondrial_constraint}
transcript={geneOrTranscript.transcripts[0]}
/>
)
}
return <p>Constraint is not available for mitochondrial transcripts</p>
}
Expand Down
74 changes: 44 additions & 30 deletions browser/src/ConstraintTable/MitochondrialConstraintTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import {
MitochondrialGeneConstraint,
ProteinMitochondrialGeneConstraint,
RNAMitochondrialGeneConstraint,
GeneTranscript,
} from '../GenePage/GenePage'
import { BaseTable, TooltipAnchor } from '@gnomad/ui'
import Link from '../Link'
import { ConstraintHighlight } from './constraintMetrics'

const isProteinMitochondrialGeneConstraint = (
Expand Down Expand Up @@ -138,45 +140,57 @@ const RNAConstraintMetrics = ({ constraint }: { constraint: RNAMitochondrialGene

const MitochondrialConstraintTable = ({
constraint,
transcript,
}: {
constraint: MitochondrialGeneConstraint | null
transcript: GeneTranscript | null
}) => {
if (constraint === null) {
return <p>Constraint is not available on this gene</p>
}

return (
// @ts-expect-error
<BaseTable>
<thead>
<tr>
<th scope="col">Category</th>
<th scope="col">
{' '}
<>
{/* @ts-expect-error */}
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of expected SNVs in gene">
<span>Expected</span>
</TooltipAnchor>
</>
</th>
<th scope="col">
<>
{/* @ts-expect-error */}
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of observed SNVs in gene">
<span>Observed</span>
</TooltipAnchor>
</>
</th>
<th scope="col">Constraint metrics</th>
</tr>
</thead>{' '}
{isProteinMitochondrialGeneConstraint(constraint) ? (
<ProteinConstraintMetrics constraint={constraint} />
) : (
<RNAConstraintMetrics constraint={constraint} />
<>
{/* @ts-expect-error */}
<BaseTable>
<thead>
<tr>
<th scope="col">Category</th>
<th scope="col">
{' '}
<>
{/* @ts-expect-error */}
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of expected SNVs in gene">
<span>Expected</span>
</TooltipAnchor>
</>
</th>
<th scope="col">
<>
{/* @ts-expect-error */}
<TooltipAnchor tooltip="Sum of maximum heteroplasmy of observed SNVs in gene">
<span>Observed</span>
</TooltipAnchor>
</>
</th>
<th scope="col">Constraint metrics</th>
</tr>
</thead>
{isProteinMitochondrialGeneConstraint(constraint) ? (
<ProteinConstraintMetrics constraint={constraint} />
) : (
<RNAConstraintMetrics constraint={constraint} />
)}
</BaseTable>
{transcript !== null && (
<>
Constraint metrics based on transcript{' '}
<Link to={`/transcript/${transcript.transcript_id}`}>
{transcript.transcript_id}.{transcript.transcript_version}
</Link>
</>
)}
</BaseTable>
</>
)
}

Expand Down
Loading

0 comments on commit cf33d8c

Please sign in to comment.