From 81696da089545e61c7dc1a0c8c27bbe91b573ca4 Mon Sep 17 00:00:00 2001 From: gromdimon Date: Tue, 10 Oct 2023 17:10:29 +0200 Subject: [PATCH] feat: implementation of ACMG CNV criteria --- backend/app/api/internal/endpoints/remote.py | 27 + .../src/components/SvDetails/AcmgRating.vue | 218 +++ frontend/src/components/SvDetails/SvGenes.vue | 2 +- frontend/src/lib/acmgCNV.ts | 1581 ++++++++++------- frontend/src/lib/utils.ts | 2 +- frontend/src/stores/svAcmgRating.ts | 125 ++ frontend/src/stores/svInfo.ts | 6 +- frontend/src/views/SvDetailView.vue | 13 +- 8 files changed, 1353 insertions(+), 621 deletions(-) create mode 100644 frontend/src/components/SvDetails/AcmgRating.vue create mode 100644 frontend/src/stores/svAcmgRating.ts diff --git a/backend/app/api/internal/endpoints/remote.py b/backend/app/api/internal/endpoints/remote.py index 316ec044..f9e09c51 100644 --- a/backend/app/api/internal/endpoints/remote.py +++ b/backend/app/api/internal/endpoints/remote.py @@ -99,3 +99,30 @@ async def acmg(request: Request): if key.lower() in acmg_rating: acmg_rating[key.lower()] = value == 1 return JSONResponse(acmg_rating) + + +@router.get("/cnv/acmg/{path:path}") +async def cnv_acmg(request: Request): + """Implement searching for ACMG classification for CNVs.""" + query_params = request.query_params + chromosome = query_params.get("chromosome") + start = query_params.get("start") + end = query_params.get("end") + func = query_params.get("func") + + if not chromosome or not start or not end or not func: + return Response(status_code=400, content="Missing query parameters") + + url = "https://phoenix.bgi.com/api/acit/jobs/" + client = httpx.AsyncClient() + backend_req = client.build_request( + method="POST", + url=url, + data={"chromosome": chromosome, "start": start, "end": end, "func": func, "error": 0}, + ) + backend_resp = await client.send(backend_req) + if backend_resp.status_code != 200: + return Response(status_code=backend_resp.status_code, content=backend_resp.content) + + print(backend_resp.json()) + return JSONResponse(backend_resp.json()) diff --git a/frontend/src/components/SvDetails/AcmgRating.vue b/frontend/src/components/SvDetails/AcmgRating.vue new file mode 100644 index 00000000..45143333 --- /dev/null +++ b/frontend/src/components/SvDetails/AcmgRating.vue @@ -0,0 +1,218 @@ + + + + + diff --git a/frontend/src/components/SvDetails/SvGenes.vue b/frontend/src/components/SvDetails/SvGenes.vue index 54a0a050..aa95de1c 100644 --- a/frontend/src/components/SvDetails/SvGenes.vue +++ b/frontend/src/components/SvDetails/SvGenes.vue @@ -133,7 +133,7 @@ const onRowClicked = (event: Event, { item }: { item: GeneInfo }): void => {