From b2411a638592b5b1eb618e5e8d685bccdd9f30ac Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Mon, 2 Oct 2023 16:27:33 +0200 Subject: [PATCH] feat: integration of meahri 0.8.0 (#56) (#103) --- frontend/src/api/__tests__/common.spec.ts | 4 ++-- frontend/src/api/common.ts | 2 +- frontend/src/api/mehari.ts | 8 ++++---- frontend/src/assets/__tests__/BRCA1TxInfo.json | 4 ++-- frontend/src/stores/__tests__/variantInfo.spec.ts | 10 +++++----- frontend/src/stores/variantAcmgRating.ts | 2 +- frontend/src/stores/variantInfo.ts | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/api/__tests__/common.spec.ts b/frontend/src/api/__tests__/common.spec.ts index 4507576d..64e5b05c 100644 --- a/frontend/src/api/__tests__/common.spec.ts +++ b/frontend/src/api/__tests__/common.spec.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest' import { - API_INTERNALBASE_PREFIX_MEHARI, API_INTERNAL_BASE_PREFIX, API_INTERNAL_BASE_PREFIX_ANNONARS, + API_INTERNAL_BASE_PREFIX_MEHARI, API_INTERNAL_BASE_PREFIX_NGINX } from '@/api/common' @@ -22,7 +22,7 @@ describe.concurrent('API_BASE_PREFIX constants', () => { it('returns the correct API base prefix for mehari in production mode', () => { const originalMode = import.meta.env.MODE - expect(API_INTERNALBASE_PREFIX_MEHARI).toBe('/internal/proxy/mehari') + expect(API_INTERNAL_BASE_PREFIX_MEHARI).toBe('/internal/proxy/mehari') import.meta.env.MODE = originalMode }) diff --git a/frontend/src/api/common.ts b/frontend/src/api/common.ts index 599befa0..f1f65bf8 100644 --- a/frontend/src/api/common.ts +++ b/frontend/src/api/common.ts @@ -6,7 +6,7 @@ export const API_INTERNAL_BASE_PREFIX_ANNONARS = '/internal/proxy/annonars' // ? `//localhost:8080/internal/proxy/annonars` // : '/internal/proxy/annonars' -export const API_INTERNALBASE_PREFIX_MEHARI = '/internal/proxy/mehari' +export const API_INTERNAL_BASE_PREFIX_MEHARI = '/internal/proxy/mehari' // import.meta.env.MODE == 'development' // ? '//localhost:8080/internal/proxy/mehari' // : '/internal/proxy/mehari' diff --git a/frontend/src/api/mehari.ts b/frontend/src/api/mehari.ts index 22e20291..3bb6a04a 100644 --- a/frontend/src/api/mehari.ts +++ b/frontend/src/api/mehari.ts @@ -1,6 +1,6 @@ -import { API_INTERNALBASE_PREFIX_MEHARI } from '@/api/common' +import { API_INTERNAL_BASE_PREFIX_MEHARI } from '@/api/common' -const API_BASE_URL = `${API_INTERNALBASE_PREFIX_MEHARI}/` +const API_BASE_URL = `${API_INTERNAL_BASE_PREFIX_MEHARI}/` export class MehariClient { private apiBaseUrl: string @@ -19,9 +19,9 @@ export class MehariClient { alternative: string, hgnc_id?: string ): Promise { - const hgncSuffix = hgnc_id ? `&hgnc-id=${hgnc_id}` : '' + const hgncSuffix = hgnc_id ? `&hgnc_id=${hgnc_id}` : '' const url = - `${this.apiBaseUrl}tx/csq?genome-release=${genomeRelease}&` + + `${this.apiBaseUrl}seqvars/csq?genome_release=${genomeRelease}&` + `chromosome=${chromosome}&position=${pos}&reference=${reference}&` + `alternative=${alternative}${hgncSuffix}` diff --git a/frontend/src/assets/__tests__/BRCA1TxInfo.json b/frontend/src/assets/__tests__/BRCA1TxInfo.json index 03f9e16d..fbffd4c3 100644 --- a/frontend/src/assets/__tests__/BRCA1TxInfo.json +++ b/frontend/src/assets/__tests__/BRCA1TxInfo.json @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1076fda8fd2bccd3d4ef2af3bb96acf1fa252bfa55efa982e9651f3ada0f0f6 -size 3710 +oid sha256:6b9995d77d5738941dfb7693b3f55111932fbec15422aab9de02378544af2a88 +size 3122 diff --git a/frontend/src/stores/__tests__/variantInfo.spec.ts b/frontend/src/stores/__tests__/variantInfo.spec.ts index 6aef0dcc..1a08670a 100644 --- a/frontend/src/stores/__tests__/variantInfo.spec.ts +++ b/frontend/src/stores/__tests__/variantInfo.spec.ts @@ -64,7 +64,7 @@ describe.concurrent('geneInfo Store', () => { fetchMocker.mockResponse((req) => { if (req.url.includes('annos/variant')) { return Promise.resolve(JSON.stringify(BRCA1VariantInfo)) - } else if (req.url.includes('tx/csq')) { + } else if (req.url.includes('seqvars/csq')) { return Promise.resolve(JSON.stringify(BRCA1TxInfo)) } else if (req.url.includes('genes/info')) { return Promise.resolve(JSON.stringify(BRCA1GeneInfo)) @@ -110,7 +110,7 @@ describe.concurrent('geneInfo Store', () => { return Promise.resolve( JSON.stringify({ result: { cadd: null, dbnsfp: null, dbscsnv: null } }) ) - } else if (req.url.includes('tx/csq')) { + } else if (req.url.includes('seqvars/csq')) { return Promise.resolve(JSON.stringify(BRCA1TxInfo)) } else if (req.url.includes('genes/info')) { return Promise.resolve(JSON.stringify(BRCA1GeneInfo)) @@ -143,7 +143,7 @@ describe.concurrent('geneInfo Store', () => { fetchMocker.mockResponse((req) => { if (req.url.includes('annos/variant')) { return Promise.resolve(JSON.stringify(BRCA1VariantInfo)) - } else if (req.url.includes('tx/csq')) { + } else if (req.url.includes('seqvars/csq')) { return Promise.resolve(JSON.stringify({ result: [] })) } else if (req.url.includes('genes/info')) { return Promise.resolve(JSON.stringify(BRCA1GeneInfo)) @@ -176,7 +176,7 @@ describe.concurrent('geneInfo Store', () => { fetchMocker.mockResponse((req) => { if (req.url.includes('annos/variant')) { return Promise.resolve(JSON.stringify(BRCA1VariantInfo)) - } else if (req.url.includes('tx/csq')) { + } else if (req.url.includes('seqvars/csq')) { return Promise.resolve(JSON.stringify(BRCA1TxInfo)) } else if (req.url.includes('genes/info')) { return Promise.resolve(JSON.stringify({ genes: null })) @@ -207,7 +207,7 @@ describe.concurrent('geneInfo Store', () => { fetchMocker.mockResponse((req) => { if (req.url.includes('annos/variant')) { return Promise.resolve(JSON.stringify(BRCA1VariantInfo)) - } else if (req.url.includes('tx/csq')) { + } else if (req.url.includes('seqvars/csq')) { return Promise.resolve(JSON.stringify(BRCA1TxInfo)) } else if (req.url.includes('genes/info')) { return Promise.resolve(JSON.stringify(BRCA1GeneInfo)) diff --git a/frontend/src/stores/variantAcmgRating.ts b/frontend/src/stores/variantAcmgRating.ts index 983a3c50..4b3dea33 100644 --- a/frontend/src/stores/variantAcmgRating.ts +++ b/frontend/src/stores/variantAcmgRating.ts @@ -64,7 +64,7 @@ export const useVariantAcmgRatingStore = defineStore('variantAcmgRating', () => const ref = smallVar.reference const alt = smallVar.alternative const response = await fetch( - `${API_BASE_URL}internal/remote/acmg/?release=${release}&chromosome=${chromosome}` + + `${API_BASE_URL}remote/acmg/?release=${release}&chromosome=${chromosome}` + `&position=${pos}&reference=${ref}&alternative=${alt}`, { method: 'GET' } ) diff --git a/frontend/src/stores/variantInfo.ts b/frontend/src/stores/variantInfo.ts index ecff5bfa..79619ee3 100644 --- a/frontend/src/stores/variantInfo.ts +++ b/frontend/src/stores/variantInfo.ts @@ -101,7 +101,7 @@ export const useVariantInfoStore = defineStore('variantInfo', () => { txCsq.value = txCsqData.result } - const hgncId: string = txCsqData.result[0]['gene-id'] + const hgncId: string = txCsqData.result[0]['gene_id'] const geneData = await annonarsClient.fetchGeneInfo(hgncId) if (geneData?.genes === null) { throw new Error('No gene data found.')