Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter gene variant queries to exons consistently #1667

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading