From c6b72f8016a7afc86c2749b185cf37ae3f80d7e8 Mon Sep 17 00:00:00 2001 From: gromdimon Date: Wed, 4 Oct 2023 12:57:12 +0200 Subject: [PATCH] feat: Retrieval of affected genes in SV from mehari --- frontend/src/api/__tests__/mehari.spec.ts | 13 +- frontend/src/api/mehari.ts | 18 +- .../components/SvDetails/SvDetailsClinvar.vue | 1 + frontend/src/components/SvDetails/SvGenes.vue | 193 ++++++------------ frontend/src/main.ts | 8 +- .../src/stores/__tests__/variantInfo.spec.ts | 2 +- frontend/src/stores/svInfo.ts | 38 ++-- frontend/src/stores/variantInfo.ts | 2 +- frontend/src/views/SvDetailView.vue | 14 +- 9 files changed, 133 insertions(+), 156 deletions(-) diff --git a/frontend/src/api/__tests__/mehari.spec.ts b/frontend/src/api/__tests__/mehari.spec.ts index c54ba8a2..71e37c3f 100644 --- a/frontend/src/api/__tests__/mehari.spec.ts +++ b/frontend/src/api/__tests__/mehari.spec.ts @@ -16,7 +16,14 @@ describe.concurrent('Mehari Client', () => { fetchMocker.mockResponseOnce(JSON.stringify(BRCA1TxInfo)) const client = new MehariClient() - const result = await client.retrieveTxCsq('grch37', 'chr17', 43044295, 'A', 'G', 'HGNC:1100') + const result = await client.retrieveSeqvarsCsq( + 'grch37', + 'chr17', + 43044295, + 'A', + 'G', + 'HGNC:1100' + ) expect(JSON.stringify(result)).toEqual(JSON.stringify(BRCA1TxInfo)) }) @@ -24,7 +31,7 @@ describe.concurrent('Mehari Client', () => { fetchMocker.mockResponseOnce(JSON.stringify(BRCA1TxInfo)) const client = new MehariClient() - const result = await client.retrieveTxCsq('grch37', 'chr17', 43044295, 'A', 'G') + const result = await client.retrieveSeqvarsCsq('grch37', 'chr17', 43044295, 'A', 'G') expect(JSON.stringify(result)).toEqual(JSON.stringify(BRCA1TxInfo)) }) @@ -37,7 +44,7 @@ describe.concurrent('Mehari Client', () => { }) const client = new MehariClient() - const result = await client.retrieveTxCsq('grch37', 'chr17', 43044295, 'A', 'T') + const result = await client.retrieveSeqvarsCsq('grch37', 'chr17', 43044295, 'A', 'T') expect(JSON.stringify(result)).toEqual(JSON.stringify({ status: 400 })) }) }) diff --git a/frontend/src/api/mehari.ts b/frontend/src/api/mehari.ts index 3bb6a04a..349086d8 100644 --- a/frontend/src/api/mehari.ts +++ b/frontend/src/api/mehari.ts @@ -11,7 +11,7 @@ export class MehariClient { this.csrfToken = csrfToken ?? null } - async retrieveTxCsq( + async retrieveSeqvarsCsq( genomeRelease: string, chromosome: string, pos: number, @@ -30,4 +30,20 @@ export class MehariClient { }) return await response.json() } + + async retrieveStrucvarsCsq( + genomeRelease: string, + chromosome: string, + start: number, + stop: number, + sv_type: string + ): Promise { + const url = + `${this.apiBaseUrl}strucvars/csq?genome_release=${genomeRelease}&` + + `chromosome=${chromosome}&start=${start}&stop=${stop}&sv_type=${sv_type}` + const response = await fetch(url, { + method: 'GET' + }) + return await response.json() + } } diff --git a/frontend/src/components/SvDetails/SvDetailsClinvar.vue b/frontend/src/components/SvDetails/SvDetailsClinvar.vue index b9a0c111..895dba4b 100644 --- a/frontend/src/components/SvDetails/SvDetailsClinvar.vue +++ b/frontend/src/components/SvDetails/SvDetailsClinvar.vue @@ -11,6 +11,7 @@ const vcvUrl = (vcv: string): string => {