Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Sep 18, 2024
1 parent b024383 commit 968c176
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
1 change: 1 addition & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jupyterlab = "*"
pytest-mock = "*"
gevent = "*"
tomli = "*"
exceptiongroup = "*"

[requires]
python_version = "3.10"
15 changes: 12 additions & 3 deletions backend/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions frontend/src/api/autoacmg/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ConfigError } from "@bihealth/reev-frontend-lib/api/common"
import { urlConfig } from "@bihealth/reev-frontend-lib/lib"
import { Seqvar } from "@bihealth/reev-frontend-lib/lib/genomicVars"
// Add this import
import { SeqVarClassificationResult } from "./types"
import { ConfigError } from '@bihealth/reev-frontend-lib/api/common'
import { Seqvar } from '@bihealth/reev-frontend-lib/lib/genomicVars'

import { API_INTERNAL_BASE_PREFIX } from '../common'

//: URL to the AutoACMG API
const API_BASE_URL = `${API_INTERNAL_BASE_PREFIX}proxy/autoacmg/api/v1`

export class AutoACMGClient {
private apiBaseUrl: string
Expand All @@ -14,10 +16,9 @@ export class AutoACMGClient {
* @throws ConfigError if the API base URL is not configured.
*/
constructor(apiBaseUrl?: string) {
// Change this line
if (apiBaseUrl !== undefined || urlConfig.baseUrlAutoAcmg !== undefined) {
if (apiBaseUrl !== undefined || API_BASE_URL !== undefined) {
// @ts-ignore
this.apiBaseUrl = apiBaseUrl ?? urlConfig.baseUrlAutoAcmg
this.apiBaseUrl = apiBaseUrl ?? API_BASE_URL
} else {
throw new ConfigError('Configuration error: API base URL not configured')
}
Expand All @@ -31,26 +32,24 @@ export class AutoACMGClient {
* @throws StatusCodeNotOk if the request fails.
* @throws InvalidResponseContent if the response is not valid JSON.
*/
async classifyVariant(seqvar: Seqvar): Promise<any> {
const seqvarName = seqvar.toString()
console.log(seqvarName)
async classifySequenceVariant(seqvar: Seqvar): Promise<any> {
const seqvarName = `chr${seqvar.chrom}:${seqvar.pos}:${seqvar.del}:${seqvar.ins}`

const url =
`${this.apiBaseUrl}/predict/seqvar?variant_name=${seqvarName}` +
`&genome_release=${seqvar.genomeBuild}`

const response = await fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
'Content-Type': 'application/json'
}
})

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
console.log(data)
console.log('data: ', data)
return data
}
}
2 changes: 1 addition & 1 deletion frontend/src/ext/reev-frontend-lib
5 changes: 5 additions & 0 deletions frontend/src/stores/seqvarAcmgRating/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import equal from 'fast-deep-equal'
import { defineStore } from 'pinia'
import { ref } from 'vue'

import { AcmgSeqVarClient } from '@/api/acmgSeqvar'
import { AutoACMGClient } from '@/api/autoacmg'
import { InterVarClient } from '@/api/intervar'
import {
ALL_ACMG_CRITERIA,
Expand Down Expand Up @@ -103,6 +105,9 @@ export const useSeqvarAcmgRatingStore = defineStore('seqvarAcmgRating', () => {

// Fetch the ACMG rating from InterVar
try {
const aa_client = new AutoACMGClient()
const aa_data = await aa_client.classifySequenceVariant(seqvar$)
console.log('aa_data: ', aa_data)
const client = new InterVarClient()
const acmgRatingInterVarData = await client.fetchAcmgRating(seqvar$)
// Go through the data and setPresense for each criteria
Expand Down

0 comments on commit 968c176

Please sign in to comment.