Skip to content

Commit 12ea76e

Browse files
Add mean depth VA quality measure
1 parent 4b35f35 commit 12ea76e

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

graphql-api/src/graphql/resolvers/va.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ describe('resolveVACohortAlleleFrequency', () => {
7676
exome: exomeEsDocument,
7777
genome: genomeEsDocument,
7878
joint: { fafmax: { faf95_max: 0.234, faf95_max_gen_anc: 'amr' } },
79+
coverage: { exome: { mean: 0.345 }, genome: { mean: 0.456 } },
7980
}
8081

8182
test('parses a single CohortAlleleFrequency exome correctly', async () => {
@@ -103,6 +104,16 @@ describe('resolveVACohortAlleleFrequency', () => {
103104
hemizygotes: 2,
104105
},
105106
subcohortFrequency: [],
107+
qualityMeasures: {
108+
meanDepth: 0.345,
109+
fractionCoverage20x: null,
110+
monoallelic: null,
111+
qcFilters: null,
112+
lowComplexityRegion: null,
113+
lowConfidenceLossOfFunctionError: null,
114+
lossOfFunctionWarning: null,
115+
heterozygousSkewedAlleleCount: null,
116+
},
106117
},
107118
]
108119

@@ -134,6 +145,16 @@ describe('resolveVACohortAlleleFrequency', () => {
134145
hemizygotes: 4,
135146
},
136147
subcohortFrequency: [],
148+
qualityMeasures: {
149+
meanDepth: 0.456,
150+
fractionCoverage20x: null,
151+
monoallelic: null,
152+
qcFilters: null,
153+
lowComplexityRegion: null,
154+
lowConfidenceLossOfFunctionError: null,
155+
lossOfFunctionWarning: null,
156+
heterozygousSkewedAlleleCount: null,
157+
},
137158
},
138159
]
139160

graphql-api/src/graphql/resolvers/va.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ type AncillaryResults = {
9393
hemizygotes: number | null
9494
}
9595

96+
type QualityMeasures = {
97+
meanDepth: number | null
98+
fractionCoverage20x: number | null
99+
qcFilters: string[] | null
100+
monoallelic: boolean | null
101+
lowComplexityRegion: boolean | null
102+
lowConfidenceLossOfFunctionError: boolean | null
103+
lossOfFunctionWarning: boolean | null
104+
heterozygousSkewedAlleleCount: number | null
105+
}
106+
96107
export type CohortAlleleFrequency = {
97108
id: string
98109
type: string
@@ -104,6 +115,7 @@ export type CohortAlleleFrequency = {
104115
alleleFrequency: number
105116
cohort: Cohort
106117
ancillaryResults: AncillaryResults | null
118+
qualityMeasures: QualityMeasures | null
107119
subcohortFrequency: CohortAlleleFrequency[]
108120
}
109121

@@ -187,6 +199,7 @@ type Subset = {
187199
homozygote_count: number
188200
grpMax?: GrpMaxFAF95
189201
jointGrpMax?: GrpMaxFAF95
202+
meanDepth: number
190203
}
191204

192205
const GNOMAD_V4_DERIVATION = {
@@ -268,6 +281,18 @@ const resolveVACohortAlleleFrequency = (
268281
hemizygotes: subset.hemizygote_count !== undefined ? subset.hemizygote_count : null,
269282
}
270283

284+
// const coverage = obj.coverage.exome && obj.coverage.exome
285+
const qualityMeasures = {
286+
meanDepth: subset.meanDepth,
287+
fractionCoverage20x: null, // TK
288+
qcFilters: null, // TK
289+
monoallelic: null, // TK
290+
lowComplexityRegion: null, // TK
291+
lowConfidenceLossOfFunctionError: null, // TK
292+
lossOfFunctionWarning: null, // TK
293+
heterozygousSkewedAlleleCount: null, // TK
294+
}
295+
271296
return {
272297
id,
273298
label,
@@ -279,6 +304,7 @@ const resolveVACohortAlleleFrequency = (
279304
alleleFrequency: subset.ac / subset.an,
280305
cohort,
281306
ancillaryResults,
307+
qualityMeasures,
282308
}
283309
}
284310

@@ -382,6 +408,7 @@ const resolveVACohortAlleleFrequencies = async (
382408
if (!frequencies) {
383409
return null
384410
}
411+
const coverage = obj.coverage[frequencyField]
385412

386413
const fullSet: Subset = {
387414
ac: frequencies.ac,
@@ -401,6 +428,7 @@ const resolveVACohortAlleleFrequencies = async (
401428
confidenceInterval: 0.95,
402429
}
403430
: undefined,
431+
meanDepth: coverage && coverage.mean ? coverage.mean : null,
404432
}
405433
const subsets = [fullSet, ...(frequencies.ancestry_groups as Subset[])]
406434
const cohortsWithoutSubcohorts = subsets.map((subset) =>

graphql-api/src/graphql/types/va.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ type VACohortAlleleFrequencyData {
117117
cohort: VACohort!
118118
"Ancillary results that may be associated with the CohortAlleleFrequency, providing additional context or information."
119119
ancillaryResults: VAAncillaryResults
120+
"Metrics of quality of, or confidence in, the CohortAlleleFrequency."
121+
qualityMeasures: VAQualityMeasures
120122
"""
121123
A list of CohortAlleleFrequency objects describing subcohorts of the cohort currently being described.
122124
This creates a recursive relationship and subcohorts can be further subdivided into more subcohorts.

0 commit comments

Comments
 (0)