Skip to content

Commit 99641ff

Browse files
Change populations to ancestry_groups in structural variant page
1 parent a42e0e3 commit 99641ff

File tree

4 files changed

+26
-28
lines changed

4 files changed

+26
-28
lines changed

browser/src/StructuralVariantList/__snapshots__/StructuralVariants.spec.tsx.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
5353
"algorithms": [],
5454
"alts": null,
5555
"an": 345,
56+
"ancestry_groups": [],
5657
"chrom": "21",
5758
"chrom2": null,
5859
"consequence": null,
@@ -70,7 +71,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
7071
"homozygote_count": null,
7172
"length": 333,
7273
"major_consequence": null,
73-
"populations": [],
7474
"pos": 123,
7575
"pos2": null,
7676
"qual": 99,
@@ -86,6 +86,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
8686
"algorithms": [],
8787
"alts": null,
8888
"an": 345,
89+
"ancestry_groups": [],
8990
"chrom": "21",
9091
"chrom2": null,
9192
"consequence": null,
@@ -103,7 +104,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
103104
"homozygote_count": null,
104105
"length": 333,
105106
"major_consequence": null,
106-
"populations": [],
107107
"pos": 123,
108108
"pos2": null,
109109
"qual": 99,
@@ -119,6 +119,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
119119
"algorithms": [],
120120
"alts": null,
121121
"an": 345,
122+
"ancestry_groups": [],
122123
"chrom": "21",
123124
"chrom2": null,
124125
"consequence": null,
@@ -136,7 +137,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
136137
"homozygote_count": null,
137138
"length": 333,
138139
"major_consequence": null,
139-
"populations": [],
140140
"pos": 123,
141141
"pos2": null,
142142
"qual": 99,
@@ -197,6 +197,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
197197
"algorithms": [],
198198
"alts": null,
199199
"an": 345,
200+
"ancestry_groups": [],
200201
"chrom": "21",
201202
"chrom2": null,
202203
"consequence": null,
@@ -214,7 +215,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
214215
"homozygote_count": null,
215216
"length": 333,
216217
"major_consequence": null,
217-
"populations": [],
218218
"pos": 123,
219219
"pos2": null,
220220
"qual": 99,
@@ -230,6 +230,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
230230
"algorithms": [],
231231
"alts": null,
232232
"an": 345,
233+
"ancestry_groups": [],
233234
"chrom": "21",
234235
"chrom2": null,
235236
"consequence": null,
@@ -247,7 +248,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
247248
"homozygote_count": null,
248249
"length": 333,
249250
"major_consequence": null,
250-
"populations": [],
251251
"pos": 123,
252252
"pos2": null,
253253
"qual": 99,
@@ -263,6 +263,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
263263
"algorithms": [],
264264
"alts": null,
265265
"an": 345,
266+
"ancestry_groups": [],
266267
"chrom": "21",
267268
"chrom2": null,
268269
"consequence": null,
@@ -280,7 +281,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
280281
"homozygote_count": null,
281282
"length": 333,
282283
"major_consequence": null,
283-
"populations": [],
284284
"pos": 123,
285285
"pos2": null,
286286
"qual": 99,
@@ -437,6 +437,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
437437
"algorithms": [],
438438
"alts": null,
439439
"an": 345,
440+
"ancestry_groups": [],
440441
"chrom": "21",
441442
"chrom2": null,
442443
"consequence": null,
@@ -454,7 +455,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
454455
"homozygote_count": null,
455456
"length": 333,
456457
"major_consequence": null,
457-
"populations": [],
458458
"pos": 123,
459459
"pos2": null,
460460
"qual": 99,
@@ -470,6 +470,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
470470
"algorithms": [],
471471
"alts": null,
472472
"an": 345,
473+
"ancestry_groups": [],
473474
"chrom": "21",
474475
"chrom2": null,
475476
"consequence": null,
@@ -487,7 +488,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
487488
"homozygote_count": null,
488489
"length": 333,
489490
"major_consequence": null,
490-
"populations": [],
491491
"pos": 123,
492492
"pos2": null,
493493
"qual": 99,
@@ -503,6 +503,7 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
503503
"algorithms": [],
504504
"alts": null,
505505
"an": 345,
506+
"ancestry_groups": [],
506507
"chrom": "21",
507508
"chrom2": null,
508509
"consequence": null,
@@ -520,7 +521,6 @@ exports[`StructuralVariants has no unexpected changes 1`] = `
520521
"homozygote_count": null,
521522
"length": 333,
522523
"major_consequence": null,
523-
"populations": [],
524524
"pos": 123,
525525
"pos2": null,
526526
"qual": 99,

browser/src/StructuralVariantPage/StructuralVariantPage.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ export type StructuralVariant = {
7272
alt: Histogram | null
7373
} | null
7474
length: number | null
75-
populations:
75+
ancestry_groups:
7676
| {
7777
id: string
7878
ac: number
7979
an: number
8080
homozygote_count: number | null
8181
hemizygote_count: number | null
82-
ac_hemi: number | null
83-
ac_hom: number | null
8482
}[]
8583
| null
8684
pos: number
@@ -243,7 +241,7 @@ const ConnectedStructuralVariantPage = ({
243241
}
244242
}
245243
length
246-
populations {
244+
ancestry_groups {
247245
id
248246
ac
249247
an

browser/src/StructuralVariantPage/StructuralVariantPopulationsTable.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { PopulationsTable } from '../VariantPage/PopulationsTable'
44
import { StructuralVariant } from './StructuralVariantPage'
55
import { populationName } from '@gnomad/dataset-metadata/gnomadPopulations'
66

7-
const nestPopulations = (populations: any) => {
7+
const nestPopulations = (ancestry_groups: any) => {
88
const popIndices = []
9-
const subpopulations = {}
9+
const subancestry_groups = {}
1010

11-
for (let i = 0; i < populations.length; i += 1) {
12-
const pop = populations[i]
11+
for (let i = 0; i < ancestry_groups.length; i += 1) {
12+
const pop = ancestry_groups[i]
1313

1414
// IDs are one of:
1515
// * pop
@@ -22,28 +22,28 @@ const nestPopulations = (populations: any) => {
2222
} else {
2323
const parentPop = divisions[0]
2424
// @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
25-
if (subpopulations[parentPop] === undefined) {
25+
if (subancestry_groups[parentPop] === undefined) {
2626
// @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
27-
subpopulations[parentPop] = [{ ...pop }]
27+
subancestry_groups[parentPop] = [{ ...pop }]
2828
} else {
2929
// @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
30-
subpopulations[parentPop].push({ ...pop })
30+
subancestry_groups[parentPop].push({ ...pop })
3131
}
3232
}
3333
}
3434

3535
return popIndices.map((index) => {
36-
const pop = populations[index]
36+
const pop = ancestry_groups[index]
3737
return {
3838
...pop,
3939
// @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
40-
subpopulations: subpopulations[pop.id],
40+
subancestry_groups: subancestry_groups[pop.id],
4141
}
4242
})
4343
}
4444

45-
const addPopulationNames = (populations: any) => {
46-
return populations.map((pop: any) => {
45+
const addPopulationNames = (ancestry_groups: any) => {
46+
return ancestry_groups.map((pop: any) => {
4747
let name
4848
if (pop.id === 'XX' || pop.id.endsWith('_XX')) {
4949
name = 'XX'
@@ -61,7 +61,7 @@ type StructuralVariantPopulationsTableProps = {
6161
}
6262

6363
const StructuralVariantPopulationsTable = ({ variant }: StructuralVariantPopulationsTableProps) => {
64-
const populations = nestPopulations(addPopulationNames((variant as any).populations))
64+
const ancestry_groups = nestPopulations(addPopulationNames(variant.ancestry_groups))
6565

6666
const columnLabels =
6767
variant.type === 'MCNV'
@@ -75,7 +75,7 @@ const StructuralVariantPopulationsTable = ({ variant }: StructuralVariantPopulat
7575
return (
7676
<PopulationsTable
7777
columnLabels={columnLabels}
78-
populations={populations}
78+
populations={ancestry_groups}
7979
showHomozygotes={variant.type !== 'MCNV' && variant.chrom !== 'Y'}
8080
showHemizygotes={variant.type !== 'MCNV' && (variant.chrom === 'X' || variant.chrom === 'Y')}
8181
/>

browser/src/__factories__/StructuralVariant.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const structuralVariantFactory = Factory.define<StructuralVariant>(
2323
filters = [],
2424
genes = [],
2525
length = 333,
26-
populations = [],
26+
ancestry_groups = [],
2727
pos = 123,
2828
pos2 = null,
2929
qual = 99,
@@ -62,7 +62,7 @@ const structuralVariantFactory = Factory.define<StructuralVariant>(
6262
genes,
6363
genotype_quality,
6464
length,
65-
populations,
65+
ancestry_groups,
6666
pos,
6767
pos2,
6868
qual,

0 commit comments

Comments
 (0)