Skip to content

Commit

Permalink
fixup: quality description in readviz
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky-broad committed Jan 15, 2025
1 parent 8213175 commit ba1892e
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { TooltipAnchor } from '@gnomad/ui'
import { GNOMAD_POPULATION_NAMES } from '@gnomad/dataset-metadata/gnomadPopulations'

Check failure on line 12 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAlleleSizeDistributionPlot.tsx

View workflow job for this annotation

GitHub Actions / Checks

'@gnomad/dataset-metadata/gnomadPopulations' imported multiple times
import { PopulationId } from '@gnomad/dataset-metadata/gnomadPopulations'

Check failure on line 13 in browser/src/ShortTandemRepeatPage/ShortTandemRepeatAlleleSizeDistributionPlot.tsx

View workflow job for this annotation

GitHub Actions / Checks

'@gnomad/dataset-metadata/gnomadPopulations' imported multiple times
import { colorByLabels } from './ShortTandemRepeatColorBySelect'
import {
genotypeQualityKeys,
GenotypeQuality,
qualityDescriptionLabels,
} from './qualityDescription'

// The 100% width/height container is necessary the component
// to size to fit its container vs staying at its initial size.
Expand All @@ -36,17 +41,6 @@ export type ScaleType =
| 'linear-truncated-1000'
| 'log'

export const genotypeQualityKeys = [
'low',
'medium-low',
'medium',
'medium-high',
'high',
'not-reviewed',
] as const

export type GenotypeQuality = (typeof genotypeQualityKeys)[number]

export const qScoreKeys = [
'0',
'0.1',
Expand Down Expand Up @@ -118,15 +112,6 @@ const colorMap: Record<ColorBy | '', Record<string, string>> = {
},
} as const

const qualityDescriptionLabels: Record<GenotypeQuality, string> = {
low: 'Low',
'medium-low': 'Medium-low',
medium: 'Medium',
'medium-high': 'Medium-high',
high: 'High',
'not-reviewed': 'Not reviewed',
}

const qScoreLabels: Record<QScoreBin, string> = {
'0': '0 to 0.05',
'0.1': '0.05 to 0.15',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import ShortTandemRepeatPopulationOptions from './ShortTandemRepeatPopulationOpt
import ShortTandemRepeatColorBySelect from './ShortTandemRepeatColorBySelect'
import ShortTandemRepeatAlleleSizeDistributionPlot, {
ColorBy,
GenotypeQuality,
QScoreBin,
Sex,
ScaleType,
Expand All @@ -38,6 +37,7 @@ import {
} from './shortTandemRepeatHelpers'
import ShortTandemRepeatAdjacentRepeatSection from './ShortTandemRepeatAdjacentRepeatSection'
import { PopulationId } from '@gnomad/dataset-metadata/gnomadPopulations'
import { GenotypeQuality } from './qualityDescription'

type ShortTandemRepeatReferenceRegion = {
chrom: string
Expand Down
7 changes: 6 additions & 1 deletion browser/src/ShortTandemRepeatPage/ShortTandemRepeatReads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Delayed from '../Delayed'
import StatusMessage from '../StatusMessage'
import useRequest from '../useRequest'
import ControlSection from '../VariantPage/ControlSection'

import { ShortTandemRepeat } from './ShortTandemRepeatPage'
import { GenotypeQuality, qualityDescriptionLabels } from './qualityDescription'

const ShortTandemRepeatReadImageWrapper = styled.div`
width: 100%;
Expand Down Expand Up @@ -48,6 +48,7 @@ type ShortTandemRepeatReadProps = {
age?: string
pcr_protocol: string
path: string
quality_description: GenotypeQuality
}
}

Expand Down Expand Up @@ -83,6 +84,9 @@ const ShortTandemRepeatRead = ({ read }: ShortTandemRepeatReadProps) => {
'None'
)}
</AttributeListItem>
<AttributeListItem label="Genotype quality: manual review">
{qualityDescriptionLabels[read.quality_description]}
</AttributeListItem>
</AttributeList>
<ShortTandemRepeatReadImageWrapper>
<ShortTandemRepeatReadImage
Expand Down Expand Up @@ -168,6 +172,7 @@ const fetchReads = ({ datasetId, shortTandemRepeatId, filter, limit, offset }: a
age
pcr_protocol
path
quality_description
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions browser/src/ShortTandemRepeatPage/qualityDescription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const genotypeQualityKeys = [
'low',
'medium-low',
'medium',
'medium-high',
'high',
'not-reviewed',
] as const

export type GenotypeQuality = (typeof genotypeQualityKeys)[number]

export const qualityDescriptionLabels: Record<GenotypeQuality, string> = {
low: 'Low',
'medium-low': 'Medium-low',
medium: 'Medium',
'medium-high': 'Medium-high',
high: 'High',
'not-reviewed': 'Not reviewed',
}
3 changes: 2 additions & 1 deletion reads/reads-data/create_short_tandem_repeat_reads_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def _format_read(read, index, locus):
"pcr_protocol": read["PcrProtocol"],
"filename": read["ReadvizFilename"] or None,
"q": read["Q"],
"quality_description": read["ManualReviewGenotypeQualitySummary"],
# some quality_description values in the raw data have odd capitalization, so we lowercase it
"quality_description": read["ManualReviewGenotypeQualitySummary"].lower(),
}


Expand Down
4 changes: 3 additions & 1 deletion reads/src/resolveShortTandemRepeatReads.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ const resolveShortTandemRepeatReads = async (
\`sex\`,
\`age\`,
\`pcr_protocol\`,
\`filename\`
\`filename\`,
\`quality_description\`
FROM
\`reads\`
WHERE
Expand Down Expand Up @@ -207,6 +208,7 @@ const resolveShortTandemRepeatReads = async (
age: row.age,
pcr_protocol: row.pcr_protocol,
path: `${publicPath}/${id}/${row.filename}`,
quality_description: row.quality_description,
}
})
}
Expand Down
1 change: 1 addition & 0 deletions reads/src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const ShortTandemRepeatReadType = new GraphQLObjectType({
age: { type: GraphQLString },
pcr_protocol: { type: new GraphQLNonNull(GraphQLString) },
path: { type: new GraphQLNonNull(GraphQLString) },
quality_description: { type: new GraphQLNonNull(GraphQLString) },
},
})

Expand Down
1 change: 1 addition & 0 deletions reads/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ DEFAULT_PORT="8000"
export PORT=${PORT:-$DEFAULT_PORT}

pnpm nodemon ./src/server.js
#pnpm node -r ts-node/register --inspect ./src/server.js

0 comments on commit ba1892e

Please sign in to comment.