Skip to content

Commit

Permalink
feat: integration of meahri 0.8.0 (#56)
Browse files Browse the repository at this point in the history
This provides access to all affected genes in a SV. Note that
this also changes keys from kebab-case to snake_case.
  • Loading branch information
holtgrewe committed Oct 2, 2023
1 parent 85275d9 commit a97ed39
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions frontend/src/api/__tests__/common.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'

import {
API_INTERNALBASE_PREFIX_MEHARI,
API_INTERNAL_BASE_PREFIX_MEHARI,
API_INTERNAL_BASE_PREFIX,
API_INTERNAL_BASE_PREFIX_ANNONARS,
API_INTERNAL_BASE_PREFIX_NGINX
Expand All @@ -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
})

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/api/mehari.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,9 +19,9 @@ export class MehariClient {
alternative: string,
hgnc_id?: string
): Promise<any> {
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}`

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/assets/__tests__/BRCA1TxInfo.json
Git LFS file not shown
10 changes: 5 additions & 5 deletions frontend/src/stores/__tests__/variantInfo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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 }))
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stores/variantAcmgRating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stores/variantInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down

0 comments on commit a97ed39

Please sign in to comment.