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 Aug 14, 2024
1 parent 0e86c17 commit 0ec7af6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
7 changes: 6 additions & 1 deletion graphql-api/src/graphql/resolvers/va.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ describe('resolveVACohortAlleleFrequency', () => {
faf95: { popmax: 0.123, popmax_population: 'afr' },
ancestry_groups: [],
filters: ['AC0'],
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 variantESDocument = {
Expand Down Expand Up @@ -103,7 +108,7 @@ describe('resolveVACohortAlleleFrequency', () => {
lowComplexityRegion: true,
lowConfidenceLossOfFunctionError: true,
lossOfFunctionWarning: true,
heterozygousSkewedAlleleCount: null,
heterozygousSkewedAlleleCount: 37,
},
},
]
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 @@ -371,6 +371,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]
}

export const resolveVACohortAlleleFrequencies = async (
obj: any,
args: any,
Expand All @@ -393,7 +412,7 @@ export 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 0ec7af6

Please sign in to comment.