1- const GNOMAD_V2_LOF_CURATION_RESULTS_INDEX = 'gnomad_v2_lof_curation_results'
1+ type GnomadVersion = 'ExAC' | 'v2'
2+
3+ const GNOMAD_LOF_CURATION_RESULTS_INDICES = {
4+ ExAC : 'gnomad_v2_lof_curation_results' ,
5+ v2 : 'gnomad_v2_lof_curation_results' ,
6+ }
27
38// ================================================================================================
49// Variant query
510// ================================================================================================
611
7- export const fetchLofCurationResultsByVariant = async ( esClient : any , variantId : any ) => {
12+ export const fetchLofCurationResultsByVariant = async (
13+ esClient : any ,
14+ gnomadVersion : GnomadVersion ,
15+ variantId : any
16+ ) => {
817 const response = await esClient . search ( {
9- index : GNOMAD_V2_LOF_CURATION_RESULTS_INDEX ,
18+ index : GNOMAD_LOF_CURATION_RESULTS_INDICES [ gnomadVersion ] ,
1019 type : '_doc' ,
1120 body : {
1221 query : {
@@ -29,9 +38,13 @@ export const fetchLofCurationResultsByVariant = async (esClient: any, variantId:
2938// Gene query
3039// ================================================================================================
3140
32- export const fetchLofCurationResultsByGene = async ( esClient : any , gene : any ) => {
41+ export const fetchLofCurationResultsByGene = async (
42+ esClient : any ,
43+ gnomadVersion : GnomadVersion ,
44+ gene : any
45+ ) => {
3346 const response = await esClient . search ( {
34- index : GNOMAD_V2_LOF_CURATION_RESULTS_INDEX ,
47+ index : GNOMAD_LOF_CURATION_RESULTS_INDICES [ gnomadVersion ] ,
3548 type : '_doc' ,
3649 size : 1000 ,
3750 body : {
@@ -54,9 +67,13 @@ export const fetchLofCurationResultsByGene = async (esClient: any, gene: any) =>
5467// Region query
5568// ================================================================================================
5669
57- export const fetchLofCurationResultsByRegion = async ( esClient : any , region : any ) => {
70+ export const fetchLofCurationResultsByRegion = async (
71+ esClient : any ,
72+ gnomadVersion : GnomadVersion ,
73+ region : any
74+ ) => {
5875 const response = await esClient . search ( {
59- index : GNOMAD_V2_LOF_CURATION_RESULTS_INDEX ,
76+ index : GNOMAD_LOF_CURATION_RESULTS_INDICES [ gnomadVersion ] ,
6077 type : '_doc' ,
6178 size : 1000 ,
6279 body : {
0 commit comments