Skip to content

Commit 5441f91

Browse files
committed
feat(frontend): render add'l v4.1.1 flags on Gene page
1 parent f7bb841 commit 5441f91

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

browser/src/ConstraintTable/ConstraintTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const ConstraintTable = ({ datasetId, geneOrTranscript }: Props) => {
126126
{['controls', 'non_neuro', 'non_cancer', 'non_topmed'].some((subset) =>
127127
datasetId.includes(subset)
128128
) && <p>Constraint is based on the full gnomAD dataset, not the selected subset.</p>}
129-
<GnomadConstraintTable constraint={gnomadConstraint!} />
129+
<GnomadConstraintTable geneFlags={geneOrTranscript.flags} constraint={gnomadConstraint!} />
130130
{isGene(geneOrTranscript) && (
131131
<p style={{ marginBottom: 0 }}>
132132
Constraint metrics based on {transcriptDescription} transcript (

browser/src/ConstraintTable/GnomadConstraintTable.tsx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ const CONSTRAINT_FLAG_DESCRIPTIONS = {
135135
outlier_syn: 'More or fewer synonymous variants than expected',
136136
}
137137

138+
const GENE_LEVEL_CONSTRAINT_FLAG_DESCRIPTIONS: Record<string, string> = {
139+
low_exome_coverage:
140+
'This gene is not well covered in the gnomAD v4.1.1 exomes. Allele frequency estimates in the exomes and gene constraint metrics may not be reliable.',
141+
low_exome_mapping_quality:
142+
'This gene has poor read mapping statistics in the gnomAD v4.1.1 exomes. Allele frequency estimates in the exomes and gene constraint metrics may not be reliable.',
143+
}
144+
138145
export type GnomadConstraint = {
139146
exp_lof: number | null
140147
exp_mis: number | null
@@ -165,10 +172,11 @@ type OEMetricField =
165172
| `oe_${ConstraintFieldWithOEMetrics}_upper`
166173

167174
type GnomadConstraintTableProps = {
175+
geneFlags: string[]
168176
constraint: GnomadConstraint
169177
}
170178

171-
const GnomadConstraintTable = ({ constraint }: GnomadConstraintTableProps) => {
179+
const GnomadConstraintTable = ({ geneFlags, constraint }: GnomadConstraintTableProps) => {
172180
let lofHighlightColor = null
173181
if (constraint.oe_lof_upper !== null) {
174182
if (constraint.oe_lof_upper < 0.33) {
@@ -284,6 +292,30 @@ const GnomadConstraintTable = ({ constraint }: GnomadConstraintTableProps) => {
284292
</p>
285293
</React.Fragment>
286294
)}
295+
296+
{geneFlags.length > 0 && (
297+
<React.Fragment>
298+
{geneFlags
299+
.filter((flag) => flag in GENE_LEVEL_CONSTRAINT_FLAG_DESCRIPTIONS)
300+
.map((flag) => {
301+
let flagDescription
302+
if (flag in GENE_LEVEL_CONSTRAINT_FLAG_DESCRIPTIONS) {
303+
flagDescription = GENE_LEVEL_CONSTRAINT_FLAG_DESCRIPTIONS[flag]
304+
} else {
305+
flagDescription = (
306+
<span>
307+
Gene constraint flag: <code>{flag}</code>
308+
</span>
309+
)
310+
}
311+
return (
312+
<p key={flag} style={{ maxWidth: '460px' }}>
313+
<Badge level="info">Note</Badge> {flagDescription}
314+
</p>
315+
)
316+
})}
317+
</React.Fragment>
318+
)}
287319
</div>
288320
)
289321
}

browser/src/GenePage/GeneInfo.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import InlineList from '../InlineList'
66
import Link from '../Link'
77

88
import GeneReferences from './GeneReferences'
9+
import { Badge } from '@gnomad/ui'
910

1011
type ManeSelectTranscriptIdProps = {
1112
gene: {
@@ -66,9 +67,17 @@ type GeneInfoProps = {
6667
transcript_id: string
6768
transcript_version: string
6869
}[]
70+
flags: string[]
6971
}
7072
}
7173

74+
const GENE_FLAGS_TO_RENDER: Record<string, string> = {
75+
low_exome_coverage:
76+
'This gene is not well covered in the gnomAD v4.1.1 exomes. Allele frequency estimates in the exomes and gene constraint metrics may not be reliable.',
77+
low_exome_mapping_quality:
78+
'This gene has poor read mapping statistics in the gnomAD v4.1.1 exomes. Allele frequency estimates in the exomes and gene constraint metrics may not be reliable.',
79+
}
80+
7281
const GeneInfo = ({ gene }: GeneInfoProps) => {
7382
const canonicalTranscript = gene.canonical_transcript_id
7483
? gene.transcripts.find(
@@ -152,6 +161,16 @@ const GeneInfo = ({ gene }: GeneInfoProps) => {
152161
<AttributeListItem label="External resources">
153162
<GeneReferences gene={gene} />
154163
</AttributeListItem>
164+
165+
{gene.flags
166+
.filter((flag) => flag in GENE_FLAGS_TO_RENDER)
167+
.map((flag) => {
168+
return (
169+
<p>
170+
<Badge level="warning">Warning</Badge> {GENE_FLAGS_TO_RENDER[flag]}
171+
</p>
172+
)
173+
})}
155174
</AttributeList>
156175
)
157176
}

0 commit comments

Comments
 (0)