Skip to content

Commit a6f4fe8

Browse files
Add q-score and quality description filters to STR readviz
1 parent 9797f78 commit a6f4fe8

File tree

11 files changed

+264
-88
lines changed

11 files changed

+264
-88
lines changed

browser/src/ShortTandemRepeatPage/ShortTandemRepeatAlleleSizeDistributionPlot.tsx

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import { LegendOrdinal } from '@visx/legend'
1111
import { TooltipAnchor } from '@gnomad/ui'
1212
import { GNOMAD_POPULATION_NAMES, PopulationId } from '@gnomad/dataset-metadata/gnomadPopulations'
1313
import { colorByLabels } from './ShortTandemRepeatColorBySelect'
14+
import {
15+
genotypeQualityKeys,
16+
GenotypeQuality,
17+
qualityDescriptionLabels,
18+
} from './qualityDescription'
19+
import { qScoreLabels, QScoreBin, qScoreKeys } from './qScore'
1420

1521
// The 100% width/height container is necessary the component
1622
// to size to fit its container vs staying at its initial size.
@@ -35,32 +41,6 @@ export type ScaleType =
3541
| 'linear-truncated-1000'
3642
| 'log'
3743

38-
export const genotypeQualityKeys = [
39-
'low',
40-
'medium-low',
41-
'medium',
42-
'medium-high',
43-
'high',
44-
'not-reviewed',
45-
] as const
46-
47-
export type GenotypeQuality = (typeof genotypeQualityKeys)[number]
48-
49-
export const qScoreKeys = [
50-
'0',
51-
'0.1',
52-
'0.2',
53-
'0.3',
54-
'0.4',
55-
'0.5',
56-
'0.6',
57-
'0.7',
58-
'0.8',
59-
'0.9',
60-
'1',
61-
] as const
62-
63-
export type QScoreBin = (typeof qScoreKeys)[number]
6444
export type ColorByValue = GenotypeQuality | QScoreBin | Sex | PopulationId | ''
6545

6646
export type AlleleSizeDistributionItem = {
@@ -117,29 +97,6 @@ const colorMap: Record<ColorBy | '', Record<string, string>> = {
11797
},
11898
} as const
11999

120-
const qualityDescriptionLabels: Record<GenotypeQuality, string> = {
121-
low: 'Low',
122-
'medium-low': 'Medium-low',
123-
medium: 'Medium',
124-
'medium-high': 'Medium-high',
125-
high: 'High',
126-
'not-reviewed': 'Not reviewed',
127-
}
128-
129-
const qScoreLabels: Record<QScoreBin, string> = {
130-
'0': '0 to 0.05',
131-
'0.1': '0.05 to 0.15',
132-
'0.2': '0.15 to 0.25',
133-
'0.3': '0.25 to 0.35',
134-
'0.4': '0.35 to 0.45',
135-
'0.5': '0.45 to 0.55',
136-
'0.6': '0.55 to 0.65',
137-
'0.7': '0.65 to 0.75',
138-
'0.8': '0.75 to 0.85',
139-
'0.9': '0.85 to 0.95',
140-
'1': '0.95 to 1',
141-
}
142-
143100
const fixedLegendLabels: Partial<Record<ColorBy, Record<string, string>>> = {
144101
quality_description: qualityDescriptionLabels,
145102
q_score: qScoreLabels,

browser/src/ShortTandemRepeatPage/ShortTandemRepeatColorBySelect.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ const ShortTandemRepeatColorBySelect = ({
4141
}
4242
}}
4343
>
44-
<option value="">None</option>
44+
<option key="" value="">
45+
None
46+
</option>
4547
{Object.entries(colorByLabels).map(([key, label]) => (
46-
<option value={key}>{label}</option>
48+
<option key={key} value={key}>
49+
{label}
50+
</option>
4751
))}
4852
</Select>
4953
</Label>

browser/src/ShortTandemRepeatPage/ShortTandemRepeatPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import ShortTandemRepeatPopulationOptions from './ShortTandemRepeatPopulationOpt
1616
import ShortTandemRepeatColorBySelect from './ShortTandemRepeatColorBySelect'
1717
import ShortTandemRepeatAlleleSizeDistributionPlot, {
1818
ColorBy,
19-
GenotypeQuality,
20-
QScoreBin,
2119
Sex,
2220
ScaleType,
2321
AlleleSizeDistributionItem,
@@ -38,6 +36,8 @@ import {
3836
} from './shortTandemRepeatHelpers'
3937
import ShortTandemRepeatAdjacentRepeatSection from './ShortTandemRepeatAdjacentRepeatSection'
4038
import { PopulationId } from '@gnomad/dataset-metadata/gnomadPopulations'
39+
import { GenotypeQuality } from './qualityDescription'
40+
import { QScoreBin } from './qScore'
4141

4242
type ShortTandemRepeatReferenceRegion = {
4343
chrom: string

0 commit comments

Comments
 (0)