diff --git a/browser/src/VariantList/ExportVariantsButton.tsx b/browser/src/VariantList/ExportVariantsButton.tsx index 7f79c239f..3a9e93bba 100644 --- a/browser/src/VariantList/ExportVariantsButton.tsx +++ b/browser/src/VariantList/ExportVariantsButton.tsx @@ -22,8 +22,8 @@ const getValueGivenProperty = ( variant: VariantTableVariant, property: Property ) => { - return variant.populations.filter((v) => v.id === popId)[0] - ? JSON.stringify(variant.populations.filter((v) => v.id === popId)[0][property]) + return variant.ancestry_groups.filter((v) => v.id === popId)[0] + ? JSON.stringify(variant.ancestry_groups.filter((v) => v.id === popId)[0][property]) : '' } @@ -342,7 +342,7 @@ export type VariantTableVariant = { hgvs?: string hgvsc?: string hgvsp?: string - populations: Population[] + ancestry_groups: Population[] pos: number rsids?: string[] transcript_id: string diff --git a/browser/src/VariantList/mergeExomeAndGenomeData.spec.ts b/browser/src/VariantList/mergeExomeAndGenomeData.spec.ts index 7bef38bd1..58e859e74 100644 --- a/browser/src/VariantList/mergeExomeAndGenomeData.spec.ts +++ b/browser/src/VariantList/mergeExomeAndGenomeData.spec.ts @@ -26,7 +26,7 @@ const createAncestryGroupObjects = (shorthands: AncestryGroupShorthand[]) => { } describe('mergeExomeAndGenomePopulationData', () => { - it('returns expected values when exomes and genomes have the same populations', () => { + it('returns expected values when exomes and genomes have the same ancestry_groups', () => { const geneticAncestryGroupObjects = createAncestryGroupObjects([ { id: 'afr', value: 1 }, { id: 'remaining', value: 2 }, @@ -35,8 +35,8 @@ describe('mergeExomeAndGenomePopulationData', () => { const testVariant = variantFactory.build({ variant_id: 'test_variant', - exome: { populations: geneticAncestryGroupObjects }, - genome: { populations: geneticAncestryGroupObjects }, + exome: { ancestry_groups: geneticAncestryGroupObjects }, + genome: { ancestry_groups: geneticAncestryGroupObjects }, }) const result = mergeExomeAndGenomePopulationData(testVariant.exome!, testVariant.genome!) @@ -50,7 +50,7 @@ describe('mergeExomeAndGenomePopulationData', () => { expect(result).toStrictEqual(expected) }) - it('returns expected values when exomes have less populations than genomes', () => { + it('returns expected values when exomes have less ancestry_groups than genomes', () => { const exomeGeneticAncestryGroupObjects = createAncestryGroupObjects([ { id: 'afr', value: 1 }, { id: 'remaining', value: 2 }, @@ -66,8 +66,8 @@ describe('mergeExomeAndGenomePopulationData', () => { const testVariant = variantFactory.build({ variant_id: 'test_variant', - exome: { populations: exomeGeneticAncestryGroupObjects }, - genome: { populations: genomeGeneticAncestryGroupObjects }, + exome: { ancestry_groups: exomeGeneticAncestryGroupObjects }, + genome: { ancestry_groups: genomeGeneticAncestryGroupObjects }, }) const result = mergeExomeAndGenomePopulationData(testVariant.exome!, testVariant.genome!) @@ -82,7 +82,7 @@ describe('mergeExomeAndGenomePopulationData', () => { expect(result).toStrictEqual(expected) }) - it('returns expected values exomes have more populations than genomes', () => { + it('returns expected values exomes have more ancestry_groups than genomes', () => { const exomeGeneticAncestryGroupObjects = createAncestryGroupObjects([ { id: 'afr', value: 1 }, { id: 'remaining', value: 2 }, @@ -98,8 +98,8 @@ describe('mergeExomeAndGenomePopulationData', () => { const testVariant = variantFactory.build({ variant_id: 'test_variant', - exome: { populations: exomeGeneticAncestryGroupObjects }, - genome: { populations: genomeGeneticAncestryGroupObjects }, + exome: { ancestry_groups: exomeGeneticAncestryGroupObjects }, + genome: { ancestry_groups: genomeGeneticAncestryGroupObjects }, }) const result = mergeExomeAndGenomePopulationData(testVariant.exome!, testVariant.genome!) @@ -114,7 +114,7 @@ describe('mergeExomeAndGenomePopulationData', () => { expect(result).toStrictEqual(expected) }) - it('returns expected values when exome and genome populations are in a different order', () => { + it('returns expected values when exome and genome ancestry_groups are in a different order', () => { const exomeGeneticAncestryGroupObjects = createAncestryGroupObjects([ { id: 'eur', value: 1 }, { id: 'afr', value: 2 }, @@ -129,8 +129,8 @@ describe('mergeExomeAndGenomePopulationData', () => { const testVariant = variantFactory.build({ variant_id: 'test_variant', - exome: { populations: exomeGeneticAncestryGroupObjects }, - genome: { populations: genomeGeneticAncestryGroupObjects }, + exome: { ancestry_groups: exomeGeneticAncestryGroupObjects }, + genome: { ancestry_groups: genomeGeneticAncestryGroupObjects }, }) const result = mergeExomeAndGenomePopulationData(testVariant.exome!, testVariant.genome!) diff --git a/browser/src/VariantList/mergeExomeAndGenomeData.ts b/browser/src/VariantList/mergeExomeAndGenomeData.ts index 64f00fa43..203649671 100644 --- a/browser/src/VariantList/mergeExomeAndGenomeData.ts +++ b/browser/src/VariantList/mergeExomeAndGenomeData.ts @@ -7,10 +7,10 @@ export const mergeExomeAndGenomePopulationData = ( exome: SequencingType, genome: SequencingType ) => { - const populations: { [key: string]: Population } = {} + const ancestry_groups: { [key: string]: Population } = {} - exome.populations.forEach((exomePopulation: Population) => { - populations[exomePopulation.id] = { + exome.ancestry_groups.forEach((exomePopulation: Population) => { + ancestry_groups[exomePopulation.id] = { id: exomePopulation.id, ac: exomePopulation.ac, an: exomePopulation.an, @@ -19,10 +19,10 @@ export const mergeExomeAndGenomePopulationData = ( } }) - genome.populations.forEach((genomePopulation: Population) => { - if (genomePopulation.id in populations) { - const entry = populations[genomePopulation.id] - populations[genomePopulation.id] = { + genome.ancestry_groups.forEach((genomePopulation: Population) => { + if (genomePopulation.id in ancestry_groups) { + const entry = ancestry_groups[genomePopulation.id] + ancestry_groups[genomePopulation.id] = { id: genomePopulation.id, ac: add(entry.ac, genomePopulation.ac), an: add(entry.an, genomePopulation.an), @@ -30,7 +30,7 @@ export const mergeExomeAndGenomePopulationData = ( ac_hom: add(entry.ac_hom, genomePopulation.ac_hom), } } else { - populations[genomePopulation.id] = { + ancestry_groups[genomePopulation.id] = { id: genomePopulation.id, ac: genomePopulation.ac, an: genomePopulation.an, @@ -40,7 +40,7 @@ export const mergeExomeAndGenomePopulationData = ( } }) - return Object.values(populations) + return Object.values(ancestry_groups) } const mergeExomeAndGenomeData = (variants: any) => @@ -74,7 +74,7 @@ const mergeExomeAndGenomeData = (variants: any) => ac_hemi: add(exome.ac_hemi, genome.ac_hemi), ac_hom: add(exome.ac_hom, genome.ac_hom), filters: exome.filters.concat(genome.filters), - populations: mergeExomeAndGenomePopulationData(exome!, genome!), + ancestry_groups: mergeExomeAndGenomePopulationData(exome!, genome!), } }) diff --git a/browser/src/VariantPage/VariantPage.tsx b/browser/src/VariantPage/VariantPage.tsx index 9e3e63820..ec2eca357 100644 --- a/browser/src/VariantPage/VariantPage.tsx +++ b/browser/src/VariantPage/VariantPage.tsx @@ -194,8 +194,8 @@ export type SequencingType = { hemizygote_count: number | null faf95: Faf95 filters: string[] - populations: Population[] - local_ancestry_populations: LocalAncestryPopulation[] + ancestry_groups: Population[] + local_ancestry_groups: LocalAncestryPopulation[] age_distribution: AgeDistribution | null quality_metrics: VariantQualityMetrics } @@ -348,7 +348,7 @@ export const VariantPageContent = ({ datasetId, variant }: VariantPageContentPro Genetic Ancestry Group Frequencies {hasLocalAncestryPopulations(datasetId) && - ((variant.genome && variant.genome.local_ancestry_populations) || []).length > 0 && ( + ((variant.genome && variant.genome.local_ancestry_groups) || []).length > 0 && (
{ if (hasLocalAncestryPopulations(datasetId) && variant.genome) { const genome = variant.genome! - const genomePopulations = genome.populations.filter( + const genomePopulations = genome.ancestry_groups.filter( (pop) => !(pop.id.startsWith('hgdp:') || pop.id.startsWith('1kg:')) ) const exomePopulations = variant.exome - ? variant.exome.populations.filter( + ? variant.exome.ancestry_groups.filter( (pop) => !(pop.id.startsWith('hgdp:') || pop.id.startsWith('1kg:')) ) : [] - const hgdpPopulations = genome.populations + const hgdpPopulations = genome.ancestry_groups .filter((pop) => pop.id.startsWith('hgdp:')) .map((pop) => ({ ...pop, id: pop.id.slice(5) })) // Remove hgdp: prefix - const tgpPopulations = genome.populations + const tgpPopulations = genome.ancestry_groups .filter((pop) => pop.id.startsWith('1kg:')) .map((pop) => ({ ...pop, id: pop.id.slice(4) })) // Remove 1kg: prefix - const localAncestryPopulations = genome.local_ancestry_populations || [] + const localAncestryPopulations = genome.local_ancestry_groups || [] return ( // @ts-expect-error TS(2741) FIXME: Property 'onChange' is missing in type '{ tabs: { ... Remove this comment to see the full error message @@ -141,8 +141,8 @@ const VariantPopulationFrequencies = ({ datasetId, variant }: Props) => { diff --git a/browser/src/__factories__/Variant.ts b/browser/src/__factories__/Variant.ts index e52106d5b..e4b74092c 100644 --- a/browser/src/__factories__/Variant.ts +++ b/browser/src/__factories__/Variant.ts @@ -148,7 +148,7 @@ export const variantTableVariantFactory = Factory.define( hgvs = 'string', hgvsc = 'string', hgvsp = 'string', - populations = [], + ancestry_groups = [], pos = 1, rsids = [], variant_id = '', @@ -177,7 +177,7 @@ export const variantTableVariantFactory = Factory.define( hgvs, hgvsc, hgvsp, - populations, + ancestry_groups, pos, rsids, variant_id, @@ -198,8 +198,8 @@ export const sequencingFactory = Factory.define(({ params, assoc homozygote_count = null, hemizygote_count = null, filters = [], - populations = [], - local_ancestry_populations = [], + ancestry_groups = [], + local_ancestry_groups = [], ac_hemi = 1, ac_hom = 1, } = params @@ -226,8 +226,8 @@ export const sequencingFactory = Factory.define(({ params, assoc homozygote_count, hemizygote_count, filters, - populations, - local_ancestry_populations, + ancestry_groups, + local_ancestry_groups, age_distribution, quality_metrics, faf95,