Skip to content

Commit 1c390b2

Browse files
Change populations to ancestry_groups in variant cooccurrence page
1 parent 99641ff commit 1c390b2

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

browser/src/VariantCooccurrencePage/VariantCooccurrencePage.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const baseApiResponse = {
3232
haplotype_counts: [10, 11, 12, 13],
3333
p_compound_heterozygous: 0.123, // TK calculate in real value
3434

35-
populations: [],
35+
ancestry_groups: [],
3636
},
3737
variant1: {
3838
exome: { ac: 999, an: 101010 },

browser/src/VariantCooccurrencePage/VariantCooccurrencePage.tsx

+11-10
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type CooccurrenceData = {
4444
genotype_counts: GenotypeCounts
4545
haplotype_counts: HaplotypeCounts
4646
p_compound_heterozygous: number | null
47-
populations: {
47+
ancestry_groups: {
4848
id: string
4949
genotype_counts: GenotypeCounts
5050
haplotype_counts: HaplotypeCounts
@@ -193,7 +193,7 @@ const VariantCoocurrence = ({ cooccurrenceData }: VariantCoocurrenceProps) => {
193193
const cooccurrenceInSelectedPopulation =
194194
selectedPopulation === 'All'
195195
? cooccurrenceData
196-
: cooccurrenceData.populations!.find((pop: any) => pop.id === selectedPopulation)!
196+
: cooccurrenceData.ancestry_groups!.find((pop) => pop.id === selectedPopulation)!
197197

198198
const prediction = makePrediction(cooccurrenceInSelectedPopulation)
199199

@@ -206,9 +206,10 @@ const VariantCoocurrence = ({ cooccurrenceData }: VariantCoocurrenceProps) => {
206206
cooccurrenceData.genotype_counts.hom_hom >
207207
0
208208

209-
const anyPopulationWithoutPrediction = [cooccurrenceData, ...cooccurrenceData.populations].some(
210-
noPredictionPossible
211-
)
209+
const anyPopulationWithoutPrediction = [
210+
cooccurrenceData,
211+
...cooccurrenceData.ancestry_groups,
212+
].some(noPredictionPossible)
212213

213214
const isDistantCis =
214215
prediction === 'in_cis' && variantDistance(cooccurrenceData) > distantCisThreshold
@@ -325,7 +326,7 @@ query ${operationName}($variants: [String!]!, $variant1: String!, $variant2: Str
325326
genotype_counts
326327
haplotype_counts
327328
p_compound_heterozygous
328-
populations {
329+
ancestry_groups {
329330
id
330331
genotype_counts
331332
haplotype_counts
@@ -444,12 +445,12 @@ const structureCounts = (population: ArrayCountPopulation): ObjectCountPopulatio
444445
}
445446

446447
const normalizeCooccurrenceData = (cooccurrenceData: any): CooccurrenceData => {
447-
const populations = cooccurrenceData.populations
448-
? cooccurrenceData.populations.map(structureCounts)
449-
: cooccurrenceData.populations
448+
const ancestry_groups = cooccurrenceData.ancestry_groups
449+
? cooccurrenceData.ancestry_groups.map(structureCounts)
450+
: cooccurrenceData.ancestry_groups
450451

451452
const topLevel = structureCounts(cooccurrenceData)
452-
return { ...topLevel, populations } as CooccurrenceData
453+
return { ...topLevel, ancestry_groups } as CooccurrenceData
453454
}
454455

455456
const VariantCoocurrenceContainer = ({

browser/src/VariantCooccurrencePage/VariantCooccurrenceSummaryTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const VariantCooccurrenceSummaryTable = ({
8080
</tr>
8181
</thead>
8282
<tbody>
83-
{cooccurrenceData.populations.map((pop) => (
83+
{cooccurrenceData.ancestry_groups.map((pop) => (
8484
<tr
8585
key={pop.id}
8686
style={pop.id === selectedPopulation ? { background: '#eee' } : undefined}

0 commit comments

Comments
 (0)