From 047cc778e03715b76d99cc993dc76b0fb06c5f87 Mon Sep 17 00:00:00 2001 From: Katie Stahl Date: Fri, 10 Nov 2023 11:05:10 -0500 Subject: [PATCH] feat: add transcript lookup for genes --- server/curfu/routers/utilities.py | 9 ++++++++- server/curfu/schemas.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server/curfu/routers/utilities.py b/server/curfu/routers/utilities.py index fdb44374..720902e7 100644 --- a/server/curfu/routers/utilities.py +++ b/server/curfu/routers/utilities.py @@ -64,7 +64,14 @@ async def get_transcripts_for_gene(request: Request, gene: str) -> Dict: :param str gene: gene term provided by user :return: Dict containing transcripts if lookup succeeds, or warnings upon failure """ - transcripts = await request.app.state.fusor.cool_seq_tool.uta_db.get_transcripts(gene) + normalized = request.app.state.fusor.gene_normalizer.normalize(gene) + symbol = normalized.gene_descriptor.label + print(symbol) + print(request.app.state.fusor.cool_seq_tool.uta_db) + transcripts = await request.app.state.fusor.cool_seq_tool.uta_db.get_transcripts(symbol) + transcripts_dict = transcripts.to_dict() + tx_for_gene = transcripts_dict["tx_ac"] + print(transcripts.glimpse()) if transcripts.is_empty(): return {"warnings": [f"No matching transcripts: {gene}"], "transcripts": []} else: diff --git a/server/curfu/schemas.py b/server/curfu/schemas.py index 4acc7c52..af850193 100644 --- a/server/curfu/schemas.py +++ b/server/curfu/schemas.py @@ -256,7 +256,7 @@ class GetTranscriptsResponse(Response): class GetGeneTranscriptsResponse(Response): """Response model for MANE transcript retrieval endpoint.""" - transcripts: Optional[pl.DataFrame] + transcripts: Optional[Dict] class ServiceInfoResponse(Response):