Skip to content

Commit

Permalink
fix(browser): use joint data in variant page ancestry table
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhgrant committed May 8, 2024
1 parent 9998780 commit 34ccbc5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 14 additions & 3 deletions browser/src/VariantPage/GnomadPopulationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type OwnGnomadPopulationsTableProps = {
datasetId: DatasetId
exomePopulations: Population[]
genomePopulations: Population[]
jointPopulations: Population[] | null
showHemizygotes?: boolean
showHomozygotes?: boolean
}
Expand Down Expand Up @@ -102,14 +103,24 @@ export class GnomadPopulationsTable extends Component<
}

render() {
const { datasetId, exomePopulations, genomePopulations, showHemizygotes, showHomozygotes } =
this.props
const {
datasetId,
exomePopulations,
genomePopulations,
jointPopulations,
showHemizygotes,
showHomozygotes,
} = this.props
const { includeExomes, includeGenomes } = this.state

const mergedPopulations = mergeExomeGenomeAndJointPopulationData({
exomePopulations: includeExomes ? exomePopulations : [],
genomePopulations: includeGenomes ? genomePopulations : [],
})
jointPopulations,
// @ts-expect-error: silence TS's warning -- there is no legitimate "" id in
// PopulationId, but the source array from joint population has a summary value
// with an id of "", filter it out here to display the correct values
}).filter((mergedAncestry) => mergedAncestry.id !== '')

const mergedPopulationsWithNames = addPopulationNames(mergedPopulations)
const mergedNestedPopulationsWithNames = nestPopulations(mergedPopulationsWithNames)
Expand Down
2 changes: 2 additions & 0 deletions browser/src/VariantPage/VariantPopulationFrequencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const VariantPopulationFrequencies = ({ datasetId, variant }: Props) => {
datasetId={datasetId}
exomePopulations={exomePopulations}
genomePopulations={genomePopulations}
jointPopulations={variant.joint ? variant.joint.populations : null}
showHemizygotes={variant.chrom === 'X' || variant.chrom === 'Y'}
/>
</TableWrapper>
Expand Down Expand Up @@ -143,6 +144,7 @@ const VariantPopulationFrequencies = ({ datasetId, variant }: Props) => {
datasetId={datasetId}
exomePopulations={variant.exome ? variant.exome.populations : []}
genomePopulations={variant.genome ? variant.genome.populations : []}
jointPopulations={variant.joint ? variant.joint.populations : null}
showHemizygotes={variant.chrom === 'X' || variant.chrom === 'Y'}
/>
</TableWrapper>
Expand Down

0 comments on commit 34ccbc5

Please sign in to comment.