Skip to content

Commit

Permalink
SJIP-1091 & SJIP-1090 (#220)
Browse files Browse the repository at this point in the history
* fix: SJIP-1091 convert gene list to upper case

* fix: SJIP-1090 lower case sample id list
  • Loading branch information
celinepelletier authored Nov 14, 2024
1 parent 48c4330 commit 4b4416b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/endpoints/transcriptomics/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ export const fetchFacets = async (): Promise<Facets> => {
};
};

export const checkSampleIdsAndGene = async (sample_ids: string[], ensembl_gene_id?: string): Promise<string[]> => {
export const checkSampleIdsAndGene = async (sampleIds: string[], ensembl_gene_id?: string): Promise<string[]> => {
const client = EsInstance.getInstance();
const sampleIdsLowerCase = sampleIds.map(id => id.toLowerCase());

const filter: unknown[] = [
{
terms: {
sample_id: sample_ids,
sample_id: sampleIdsLowerCase,
},
},
];
Expand All @@ -214,7 +215,7 @@ export const checkSampleIdsAndGene = async (sample_ids: string[], ensembl_gene_i
by_sample: {
terms: {
field: 'sample_id',
size: sample_ids.length,
size: sampleIds.length,
},
},
},
Expand All @@ -228,6 +229,7 @@ export const checkSampleIdsAndGene = async (sample_ids: string[], ensembl_gene_i

export const checkGenesExist = async (genes: string[]): Promise<MatchedGene[]> => {
const client = EsInstance.getInstance();
const genesUpperCase = genes.map(gene => gene.toUpperCase());

const { body } = await client.search({
index: esDiffGeneExpIndex,
Expand All @@ -237,12 +239,12 @@ export const checkGenesExist = async (genes: string[]): Promise<MatchedGene[]> =
should: [
{
terms: {
gene_symbol: genes,
gene_symbol: genesUpperCase,
},
},
{
terms: {
ensembl_gene_id: genes,
ensembl_gene_id: genesUpperCase,
},
},
],
Expand Down

0 comments on commit 4b4416b

Please sign in to comment.