Skip to content

Commit

Permalink
Add heterozygous skewed allele count to VA
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky-broad committed Sep 17, 2024
1 parent 759148c commit 41e50f4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
19 changes: 17 additions & 2 deletions graphql-api/src/graphql/resolvers/va.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ describe('resolveVACohortAlleleFrequency', () => {
ancestry_groups: [],
filters: ['AC0'],
flags: ['monoallelic'],
quality_metrics: {
allele_balance: {
alt: { bin_freq: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] },
},
},
}

const genomeEsDocument = {
Expand All @@ -72,6 +77,16 @@ describe('resolveVACohortAlleleFrequency', () => {
filters: ['AC0'],
ancestry_groups: [],
flags: ['monoallelic'],
quality_metrics: {
allele_balance: {
alt: {
bin_freq: [
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119,
],
},
},
},
}

const variantESDocument = {
Expand Down Expand Up @@ -117,7 +132,7 @@ describe('resolveVACohortAlleleFrequency', () => {
lowComplexityRegion: true,
lowConfidenceLossOfFunctionError: true,
lossOfFunctionWarning: true,
heterozygousSkewedAlleleCount: null,
heterozygousSkewedAlleleCount: 37,
},
},
]
Expand Down Expand Up @@ -158,7 +173,7 @@ describe('resolveVACohortAlleleFrequency', () => {
lowComplexityRegion: true,
lowConfidenceLossOfFunctionError: true,
lossOfFunctionWarning: true,
heterozygousSkewedAlleleCount: null,
heterozygousSkewedAlleleCount: 237,
},
},
]
Expand Down
21 changes: 20 additions & 1 deletion graphql-api/src/graphql/resolvers/va.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,25 @@ const addSubcohorts = (
return Object.values(subcohortMap)
}

type ESFrequencies = {
quality_metrics: {
allele_balance: {
alt?: {
bin_freq: number[]
}
}
}
}

const calculateHeterozygousSkewedAlleleCount = (frequencies: ESFrequencies): number | null => {
const { alt } = frequencies.quality_metrics.allele_balance
if (!alt) {
return null
}

return alt.bin_freq[18] + alt.bin_freq[19]
}

const resolveVACohortAlleleFrequencies = async (
obj: any,
args: any,
Expand All @@ -406,7 +425,7 @@ const resolveVACohortAlleleFrequencies = async (
lowComplexityRegion: obj.flags.includes('lcr'),
lowConfidenceLossOfFunctionError: obj.flags.includes('lc_lof'),
lossOfFunctionWarning: obj.flags.includes('lof_flag'),
heterozygousSkewedAlleleCount: null,
heterozygousSkewedAlleleCount: calculateHeterozygousSkewedAlleleCount(frequencies),
}

const fullSet: Subset = {
Expand Down

0 comments on commit 41e50f4

Please sign in to comment.