Skip to content

Commit

Permalink
feat: SJIP-1070 add sex and age at biospecimen collection years in sa…
Browse files Browse the repository at this point in the history
…mple point
  • Loading branch information
celinepelletier committed Nov 5, 2024
1 parent d95ea83 commit 45d232f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,16 +629,26 @@ describe('Express app (without Arranger)', () => {
it('should return 200 if Authorization header contains valid token and no error occurs', async () => {
const sampleGeneExp: SampleGeneExpVolcano = {
data: [
{ sample_id: 'bs-aa000aaa', x: 1, y: 2.4399124042981217 },
{
sample_id: 'bs-aa000aaa',
x: 1,
y: 2.4399124042981217,
age_at_biospecimen_collection_years: 1.6,
sex: 'Female',
},
{
sample_id: 'bs-bbbb11b1',
x: 0,
y: 0.90884870449667,
age_at_biospecimen_collection_years: 2.7,
sex: 'Male',
},
{
sample_id: 'bs-ccc22cc2',
x: 1,
y: 0.909129052666039,
age_at_biospecimen_collection_years: 3.9,
sex: 'Female',
},
],
ensembl_gene_id: 'ENSG00000272368.2',
Expand Down
15 changes: 14 additions & 1 deletion src/endpoints/transcriptomics/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ describe('Transcriptomics', () => {
x: 1,
y: 2.4399124042981217,
age_at_biospecimen_collection_years: 1.6,
sex: 'Female',
},
},
{
Expand All @@ -281,6 +282,7 @@ describe('Transcriptomics', () => {
x: 0,
y: 0.90884870449667,
age_at_biospecimen_collection_years: 2.7,
sex: 'Male',
},
},
{
Expand All @@ -293,6 +295,7 @@ describe('Transcriptomics', () => {
x: 1,
y: 0.909129052666039,
age_at_biospecimen_collection_years: 3.9,
sex: 'Female',
},
},
],
Expand All @@ -301,16 +304,26 @@ describe('Transcriptomics', () => {

const expectedResponse: SampleGeneExpVolcano = {
data: [
{ sample_id: 'bs-aa000aaa', x: 1, y: 2.4399124042981217 },
{
sample_id: 'bs-aa000aaa',
x: 1,
y: 2.4399124042981217,
age_at_biospecimen_collection_years: 1.6,
sex: 'Female',
},
{
sample_id: 'bs-bbbb11b1',
x: 0,
y: 0.90884870449667,
age_at_biospecimen_collection_years: 2.7,
sex: 'Male',
},
{
sample_id: 'bs-ccc22cc2',
x: 1,
y: 0.909129052666039,
age_at_biospecimen_collection_years: 3.9,
sex: 'Female',
},
],
ensembl_gene_id: 'ENSG00000272368.2',
Expand Down
4 changes: 3 additions & 1 deletion src/endpoints/transcriptomics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const fetchSampleGeneExp = async (ensembl_gene_id: string): Promise<Sampl
ensembl_gene_id,
},
},
_source: ['sample_id', 'x', 'y', 'age_at_biospecimen_collection_years'],
_source: ['sample_id', 'x', 'y', 'age_at_biospecimen_collection_years', 'sex'],
},
});

Expand All @@ -100,6 +100,8 @@ export const fetchSampleGeneExp = async (ensembl_gene_id: string): Promise<Sampl
sample_id: hit._source.sample_id,
x: hit._source.x,
y: hit._source.y,
sex: hit._source.sex,
age_at_biospecimen_collection_years: hit._source.age_at_biospecimen_collection_years,
});

// Add point to nT21 or nControl depending on x
Expand Down
2 changes: 2 additions & 0 deletions src/endpoints/transcriptomics/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export type SampleGeneExpPoint = {
sample_id: string;
x: number;
y: number;
age_at_biospecimen_collection_years: number;
sex: string;
};

export type SampleGeneExpVolcano = {
Expand Down

0 comments on commit 45d232f

Please sign in to comment.