Skip to content

Commit

Permalink
feat(graphql-api): filter to non coding genes padded exons
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhgrant committed Jan 6, 2025
1 parent 978671a commit a58eefe
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ const getMultiVariantSourceFields = (
// Gene query
// ================================================================================================

export const getFilteredRegions = (gene: any) => {
const hasCDS = gene.exons.some((exon: any) => exon.feature_type === 'CDS')
const filteredRegions = hasCDS
? gene.exons.filter((exon: any) => exon.feature_type === 'CDS')
: gene.exons.filter((exon: any) => exon.feature_type === 'exon')
return filteredRegions
}

const fetchVariantsByGene = async (esClient: any, gene: any, subset: Subset) => {
const exomeSubset = subset
const genomeSubset = 'all'
Expand All @@ -404,7 +412,7 @@ const fetchVariantsByGene = async (esClient: any, gene: any, subset: Subset) =>
const pageSize = isLargeGene ? 500 : 10000

try {
const filteredRegions = gene.exons.filter((exon: any) => exon.feature_type === 'CDS')
const filteredRegions = getFilteredRegions(gene)
const sortedRegions = filteredRegions.sort((r1: any, r2: any) => r1.xstart - r2.xstart)
const padding = 75
const paddedRegions = sortedRegions.map((r: any) => ({
Expand Down

0 comments on commit a58eefe

Please sign in to comment.