Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update strs bw2 20241010 #1665

Open
wants to merge 38 commits into
base: update_strs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
16cc35a
Update STR data pipeline for new data
phildarnowsky-broad Jul 15, 2024
1395bf0
DONTMERGE rig index
phildarnowsky-broad Jul 15, 2024
68b7e2c
Update GraphQL schema for STRs to reflect new ES schema
phildarnowsky-broad Jul 15, 2024
900e746
WIP pop options refactored
phildarnowsky-broad Jul 17, 2024
d514db8
WIP that should be the allele size plot
phildarnowsky-broad Jul 22, 2024
2ab3843
WIP genotype select
phildarnowsky-broad Jul 22, 2024
798e8f4
WIP age dist
phildarnowsky-broad Jul 22, 2024
83ae794
WIP more refactor
phildarnowsky-broad Jul 24, 2024
24eb72a
WIP typechecks
phildarnowsky-broad Jul 25, 2024
678272d
WIP flush any's, flush bugs
phildarnowsky-broad Jul 26, 2024
390d8bb
WIP update query in frontend
phildarnowsky-broad Jul 26, 2024
a026ed8
WIP restoring classification
phildarnowsky-broad Jul 26, 2024
006a3f3
WIP fixing query
phildarnowsky-broad Jul 26, 2024
6facef1
DONTMERGE nerf reads
phildarnowsky-broad Jul 26, 2024
246b989
fixup fix ancestry and sex selectors
phildarnowsky-broad Jul 29, 2024
72f3713
fixup: fix allele size plot when no selected repunit
phildarnowsky-broad Jul 29, 2024
a5d82fd
Merge branch 'main' into update_strs
bw2 Oct 8, 2024
c43690f
misc. updates to TR page in preparation for new release
bw2 Oct 10, 2024
3ea42d0
Merge branch 'main' into update-strs
bw2 Oct 30, 2024
c28caae
renamed 'AncestryGroup' to 'Population' and 'frequnecy' to 'count'
bw2 Oct 30, 2024
72005cf
reverted variable names to match API
bw2 Oct 30, 2024
79a92bf
finished initial implementation of adding colors to histogram
bw2 Oct 31, 2024
5a60d32
renamed ancestryGroupId to populationId to match the main branch
bw2 Oct 31, 2024
92573a3
updated shortTandemRepeatFactory
bw2 Oct 31, 2024
83d0e32
fixup: update snapshots
phildarnowsky-broad Nov 4, 2024
731713f
added 'Linear: Truncated' scale option
bw2 Nov 8, 2024
72a44b4
fixed logic for switching to 'linear-truncated' scale when color-by s…
bw2 Nov 8, 2024
638620a
Fixed STR pages for loci without a disease association
bw2 Nov 8, 2024
5e64169
Updated histogram colors
bw2 Nov 8, 2024
ead6a6b
WIP beginning of STR reads fix
phildarnowsky-broad Nov 13, 2024
c4ea442
WIP stackedbar plot
phildarnowsky-broad Dec 2, 2024
2ecd966
Prevent use of log scale with broken-down STR data
phildarnowsky-broad Dec 3, 2024
1df6ead
Add legend to allele size plot
phildarnowsky-broad Dec 3, 2024
165fb0b
WIP tooltips
phildarnowsky-broad Dec 6, 2024
0d03e64
fixup: un-rig API query location
phildarnowsky-broad Dec 9, 2024
dd7aeff
fixup: fixed order for keys
phildarnowsky-broad Dec 9, 2024
b760f0a
updated Q legend labels
bw2 Dec 10, 2024
704726f
added more options to y-scale drop down
bw2 Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ hail-*.log
# Playright test dirs
/tests/playwright/
/playwright/.cache/

# Reads metadata databases
reads/*.db
3 changes: 3 additions & 0 deletions browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"@gnomad/ui": "2.0.0",
"@hot-loader/react-dom": "^17.0.0",
"@visx/axis": "^3.0.0",
"@visx/legend": "^3.12.0",
"@visx/scale": "^3.12.0",
"@visx/shape": "^3.12.0",
"core-js": "3.5.0",
"css-loader": "^6.7.3",
"d3-array": "^1.2.4",
Expand Down
2 changes: 1 addition & 1 deletion browser/src/GenePage/GenePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {
<Link to={`/short-tandem-repeat/${gene.short_tandem_repeats[0].id}`}>
tandem repeat locus
</Link>{' '}
in this gene.
in this gene
</p>
)}
</GeneInfoColumn>
Expand Down
1 change: 0 additions & 1 deletion browser/src/GenePage/GenePageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ query ${operationName}($geneId: String, $geneSymbol: String, $referenceGenome: R
}
}
`

type Props = {
datasetId: DatasetId
geneIdOrSymbol: string
Expand Down
1 change: 1 addition & 0 deletions browser/src/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
loadData() {
const { operationName, query, url, variables } = this.props

console.log('Loading url:', url)

Check warning on line 87 in browser/src/Query.tsx

View workflow job for this annotation

GitHub Actions / Checks

Unexpected console statement
this.setState({
loading: true,
error: null,
Expand Down
1 change: 0 additions & 1 deletion browser/src/RegionPage/RegionPageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const query = `
}
}
`

type Props = {
datasetId: DatasetId
regionId: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { max, min } from 'd3-array'
import React, { useState } from 'react'
import React, { SetStateAction, useState, Dispatch } from 'react'

import { Modal, Select } from '@gnomad/ui'

import ControlSection from '../VariantPage/ControlSection'

import ShortTandemRepeatPopulationOptions from './ShortTandemRepeatPopulationOptions'
import { ShortTandemRepeatAdjacentRepeat } from './ShortTandemRepeatPage'
import { ScaleType, Sex, ColorBy } from './ShortTandemRepeatAlleleSizeDistributionPlot'

Check failure on line 9 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

'./ShortTandemRepeatAlleleSizeDistributionPlot' imported multiple times
import ShortTandemRepeatAlleleSizeDistributionPlot from './ShortTandemRepeatAlleleSizeDistributionPlot'

Check failure on line 10 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

'./ShortTandemRepeatAlleleSizeDistributionPlot' imported multiple times
import ShortTandemRepeatGenotypeDistributionPlot from './ShortTandemRepeatGenotypeDistributionPlot'

Check failure on line 11 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

'./ShortTandemRepeatGenotypeDistributionPlot' imported multiple times
import ShortTandemRepeatGenotypeDistributionBinDetails from './ShortTandemRepeatGenotypeDistributionBinDetails'
import ShortTandemRepeatGenotypeDistributionRepeatUnitsSelect from './ShortTandemRepeatGenotypeDistributionRepeatUnitsSelect'
import ShortTandemRepeatAdjacentRepeatAttributes from './ShortTandemRepeatAdjacentRepeatAttributes'
Expand All @@ -16,37 +16,52 @@
getSelectedAlleleSizeDistribution,
getSelectedGenotypeDistribution,
getGenotypeDistributionPlotAxisLabels,
genotypeRepunitPairs,
maxAlleleSizeDistributionRepeats,
maxGenotypeDistributionRepeats,
} from './shortTandemRepeatHelpers'
import { PopulationId } from '@gnomad/dataset-metadata/gnomadPopulations'
import { Bin as GenotypeBin } from './ShortTandemRepeatGenotypeDistributionPlot'

Check failure on line 24 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

'./ShortTandemRepeatGenotypeDistributionPlot' imported multiple times

type Props = {
adjacentRepeat: ShortTandemRepeatAdjacentRepeat
populationIds: string[]
selectedPopulationId: string
onSelectPopulationId: (...args: any[]) => any
selectedScaleType: string
onSelectScaleType: (...args: any[]) => any
selectedScaleType: ScaleType
selectedPopulation: PopulationId | ''
selectedSex: Sex | ''
selectedColorBy: ColorBy | ''
populations: PopulationId[]
selectedGenotypeDistributionBin: GenotypeBin | null
setSelectedGenotypeDistributionBin: Dispatch<SetStateAction<GenotypeBin | null>>
setSelectedScaleType: Dispatch<SetStateAction<ScaleType>>
setSelectedPopulation: Dispatch<SetStateAction<PopulationId | ''>>
setSelectedSex: Dispatch<SetStateAction<Sex | ''>>
setSelectedColorBy: (newColorBy: ColorBy | '') => void
}

const ShortTandemRepeatAdjacentRepeatSection = ({
adjacentRepeat,
populationIds,
selectedPopulationId,
onSelectPopulationId,
populations,
selectedScaleType,
onSelectScaleType,
selectedPopulation,
selectedSex,
selectedColorBy,
setSelectedScaleType,
setSelectedPopulation,
setSelectedSex,
setSelectedColorBy,

Check failure on line 51 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

'setSelectedColorBy' is defined but never used. Allowed unused args must match /^_/u
}: Props) => {
const [selectedRepeatUnit, setSelectedRepeatUnit] = useState(
adjacentRepeat.repeat_units.length === 1 ? adjacentRepeat.repeat_units[0] : ''
)

const genotypeDistributionPairs = genotypeRepunitPairs(adjacentRepeat)
const defaultGenotypeDistributionRepeatUnits =
genotypeDistributionPairs.length === 1 ? genotypeDistributionPairs[0] : ''
const [selectedGenotypeDistributionRepeatUnits, setSelectedGenotypeDistributionRepeatUnits] =
useState(
adjacentRepeat.genotype_distribution.repeat_units.length === 1
? adjacentRepeat.genotype_distribution.repeat_units[0].repeat_units.join(' / ')
: ''
)
useState<string[] | ''>(defaultGenotypeDistributionRepeatUnits)

const [selectedGenotypeDistributionBin, setSelectedGenotypeDistributionBin] = useState(null)
const [selectedGenotypeDistributionBin, setSelectedGenotypeDistributionBin] =
useState<GenotypeBin | null>(null)

return (
<section style={{ marginBottom: '3em' }}>
Expand All @@ -55,33 +70,33 @@

<h4 style={{ marginBottom: '0.66em' }}>Allele Size Distribution</h4>
<ShortTandemRepeatAlleleSizeDistributionPlot
// @ts-expect-error TS(2322) FIXME: Type '{ maxRepeats: number; alleleSizeDistribution... Remove this comment to see the full error message
maxRepeats={
adjacentRepeat.allele_size_distribution.distribution[
adjacentRepeat.allele_size_distribution.distribution.length - 1
][0]
}
maxRepeats={maxAlleleSizeDistributionRepeats(adjacentRepeat)}
alleleSizeDistribution={getSelectedAlleleSizeDistribution(adjacentRepeat, {
selectedPopulationId,
selectedPopulation,
selectedSex,
selectedColorBy,
selectedRepeatUnit,
})}
colorBy={selectedColorBy}
repeatUnitLength={selectedRepeatUnit ? selectedRepeatUnit.length : null}
scaleType={selectedScaleType}
/>
<ControlSection>
<ShortTandemRepeatPopulationOptions
id={`${adjacentRepeat.id}-repeat-counts`}
populationIds={populationIds}
selectedPopulationId={selectedPopulationId}
onSelectPopulationId={onSelectPopulationId}
populations={populations}
selectedPopulation={selectedPopulation}
selectedSex={selectedSex}
setSelectedPopulation={setSelectedPopulation}
setSelectedSex={setSelectedSex}
/>

<label htmlFor={`short-tandem-repeat-${adjacentRepeat.id}-repeat-unit`}>
Repeat unit: {/* @ts-expect-error TS(2769) FIXME: No overload matches this call. */}
<Select
id={`short-tandem-repeat-${adjacentRepeat.id}-repeat-unit`}
value={selectedRepeatUnit}
onChange={(e: any) => {
onChange={(e: { target: { value: string } }) => {
setSelectedRepeatUnit(e.target.value)
}}
>
Expand All @@ -98,59 +113,63 @@
</label>

<label htmlFor={`short-tandem-repeat-${adjacentRepeat.id}-repeat-counts-scale`}>
Scale: {/* @ts-expect-error TS(2769) FIXME: No overload matches this call. */}
y-scale: {/* @ts-expect-error TS(2769) FIXME: No overload matches this call. */}
<Select
id={`short-tandem-repeat-${adjacentRepeat.id}-repeat-counts-scale`}
value={selectedScaleType}
onChange={(e: any) => {
onSelectScaleType(e.target.value)
onChange={(e: { target: { value: ScaleType } }) => {
setSelectedScaleType(e.target.value)
}}
>
<option value="linear">Linear</option>
<option value="log">Log</option>
<option value="linear-truncated-50">Linear: Truncated at 50</option>
<option value="linear-truncated-200">Linear: Truncated at 200</option>
<option value="linear-truncated-1000">Linear: Truncated at 1000</option>
</Select>
</label>
</ControlSection>

<h4 style={{ marginBottom: '0.66em' }}>Genotype Distribution</h4>
<ShortTandemRepeatGenotypeDistributionPlot
// @ts-expect-error TS(2322) FIXME: Type '{ axisLabels: any; maxRepeats: (string | und... Remove this comment to see the full error message
axisLabels={getGenotypeDistributionPlotAxisLabels(adjacentRepeat, {
selectedRepeatUnits: selectedGenotypeDistributionRepeatUnits,
})}
maxRepeats={[
max(adjacentRepeat.genotype_distribution.distribution, (d: any) => max(d.slice(0, 2))),
max(adjacentRepeat.genotype_distribution.distribution, (d: any) => min(d.slice(0, 2))),
]}
maxRepeats={maxGenotypeDistributionRepeats(adjacentRepeat)}
genotypeDistribution={getSelectedGenotypeDistribution(adjacentRepeat, {
selectedRepeatUnits: selectedGenotypeDistributionRepeatUnits,
selectedPopulationId,
selectedPopulation: selectedPopulation,

Check failure on line 141 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

Expected property shorthand
selectedSex: selectedSex,

Check failure on line 142 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAdjacentRepeatSection.tsx

View workflow job for this annotation

GitHub Actions / Checks

Expected property shorthand
})}
onSelectBin={(bin: any) => {
onSelectBin={(bin: GenotypeBin) => {
if (bin.xRange[0] !== bin.xRange[1] || bin.yRange[0] !== bin.yRange[1]) {
setSelectedGenotypeDistributionBin(bin)
}
}}
xRanges={[]}
yRanges={[]}
/>

<ControlSection>
<ShortTandemRepeatPopulationOptions
id={`${adjacentRepeat.id}-genotype-distribution`}
populationIds={populationIds}
selectedPopulationId={selectedPopulationId}
onSelectPopulationId={onSelectPopulationId}
populations={populations}
selectedPopulation={selectedPopulation}
selectedSex={selectedSex}
setSelectedPopulation={setSelectedPopulation}
setSelectedSex={setSelectedSex}
/>

<ShortTandemRepeatGenotypeDistributionRepeatUnitsSelect
shortTandemRepeatOrAdjacentRepeat={adjacentRepeat}
value={selectedGenotypeDistributionRepeatUnits}
onChange={setSelectedGenotypeDistributionRepeatUnits}
selectedRepeatUnits={selectedGenotypeDistributionRepeatUnits}
setSelectedRepeatUnits={setSelectedGenotypeDistributionRepeatUnits}
/>
</ControlSection>

{selectedGenotypeDistributionBin && (
<Modal
title={(selectedGenotypeDistributionBin as any).label}
title={selectedGenotypeDistributionBin.label}
size="large"
// @ts-expect-error TS(2322) FIXME: Type '{ children: Element; title: any; size: "larg... Remove this comment to see the full error message
initialFocusOnButton={false}
Expand All @@ -160,9 +179,11 @@
>
<ShortTandemRepeatGenotypeDistributionBinDetails
shortTandemRepeatOrAdjacentRepeat={adjacentRepeat}
selectedPopulationId={selectedPopulationId}
selectedRepeatUnits={selectedGenotypeDistributionRepeatUnits}
bin={selectedGenotypeDistributionBin}
selectedPopulation={selectedPopulation}
selectedSex={selectedSex}
repeatUnitPairs={genotypeDistributionPairs}
/>
</Modal>
)}
Expand Down
Loading
Loading