From 04a14b05b4dbbfd701432b2e01c944d071b26930 Mon Sep 17 00:00:00 2001 From: Katie Stahl Date: Mon, 20 Nov 2023 14:03:13 -0500 Subject: [PATCH] feat: add transcript lookup for genes --- .../GetCoordinates/GetCoordinates.tsx | 8 +++ .../TranscriptField/TranscriptField.tsx | 51 ------------------- server/curfu/routers/utilities.py | 12 +++++ server/curfu/schemas.py | 7 +++ 4 files changed, 27 insertions(+), 51 deletions(-) delete mode 100644 client/src/components/main/shared/TranscriptField/TranscriptField.tsx diff --git a/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx b/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx index b21ba103..471e7b9a 100644 --- a/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx +++ b/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx @@ -11,7 +11,10 @@ import { Link, InputLabel, FormControl, +<<<<<<< HEAD CircularProgress, +======= +>>>>>>> 005823a (feat: add transcript lookup for genes) } from "@material-ui/core"; import React, { useEffect, useState } from "react"; import { GeneAutocomplete } from "../../main/shared/GeneAutocomplete/GeneAutocomplete"; @@ -98,6 +101,10 @@ const GetCoordinates: React.FC = () => { const [exonEndOffset, setExonEndOffset] = useState(""); const [geneTranscripts, setGeneTranscripts] = useState([]); +<<<<<<< HEAD +======= + const [geneTxWarnings, setGeneTxWarnings] = useState(); +>>>>>>> 005823a (feat: add transcript lookup for genes) const [selectedTranscript, setSelectedTranscript] = useState(""); const [results, setResults] = useState(null); @@ -125,6 +132,7 @@ const GetCoordinates: React.FC = () => { !exonEndText; useEffect(() => { + console.log(inputComplete) if (inputComplete) { fetchResults(); } diff --git a/client/src/components/main/shared/TranscriptField/TranscriptField.tsx b/client/src/components/main/shared/TranscriptField/TranscriptField.tsx deleted file mode 100644 index 7985ef78..00000000 --- a/client/src/components/main/shared/TranscriptField/TranscriptField.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { makeStyles, TextField, Typography } from "@material-ui/core"; -import React, { KeyboardEventHandler } from "react"; -import HelpTooltip from "../HelpTooltip/HelpTooltip"; - -interface Props { - fieldValue: string; - valueSetter: CallableFunction; - errorText: string; - keyHandler?: KeyboardEventHandler | undefined; - width?: number | undefined; -} - -const TranscriptField: React.FC = ({ - fieldValue, - valueSetter, - errorText, - keyHandler, - width, -}) => { - const useStyles = makeStyles(() => ({ - textField: { - width: width ? width : 125, - }, - })); - const classes = useStyles(); - - return ( - - RefSeq transcript identifier, e.g.{" "} - NM_002529.3. - - } - > - valueSetter(event.target.value)} - error={errorText != ""} - onKeyDown={keyHandler} - label="Transcript" - helperText={errorText != "" ? errorText : null} - className={classes.textField} - /> - - ); -}; - -export default TranscriptField; diff --git a/server/curfu/routers/utilities.py b/server/curfu/routers/utilities.py index af06d6d6..ed1f4f6e 100644 --- a/server/curfu/routers/utilities.py +++ b/server/curfu/routers/utilities.py @@ -82,6 +82,7 @@ async def get_transcripts_for_gene(request: Request, gene: str) -> Dict: ======= normalized = request.app.state.fusor.gene_normalizer.normalize(gene) symbol = normalized.gene_descriptor.label +<<<<<<< HEAD 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) @@ -89,11 +90,18 @@ async def get_transcripts_for_gene(request: Request, gene: str) -> Dict: tx_for_gene = transcripts_dict["tx_ac"] print(transcripts.glimpse()) >>>>>>> 047cc77 (feat: add transcript lookup for genes) +======= + transcripts = await request.app.state.fusor.cool_seq_tool.uta_db.get_transcripts(gene=symbol) + tx_for_gene = list(transcripts.rows_by_key("tx_ac")) +>>>>>>> 005823a (feat: add transcript lookup for genes) if transcripts.is_empty(): return {"warnings": [f"No matching transcripts: {gene}"], "transcripts": []} else: return {"transcripts": tx_for_gene} +<<<<<<< HEAD +======= +>>>>>>> 005823a (feat: add transcript lookup for genes) @router.get( "/api/utilities/get_genomic", @@ -303,9 +311,13 @@ async def get_sequence( """ _, path = tempfile.mkstemp(suffix=".fasta") try: +<<<<<<< HEAD request.app.state.fusor.cool_seq_tool.seqrepo_access.get_fasta_file( sequence_id, Path(path) ) +======= + request.app.state.fusor.cool_seq_tool.seqrepo_access.get_fasta_file(sequence_id, Path(path)) +>>>>>>> 005823a (feat: add transcript lookup for genes) except KeyError: resp = request.app.state.fusor.cool_seq_tool.seqrepo_access.translate_identifier( # noqa: E501 sequence_id, "refseq" diff --git a/server/curfu/schemas.py b/server/curfu/schemas.py index a30145d5..931a0087 100644 --- a/server/curfu/schemas.py +++ b/server/curfu/schemas.py @@ -253,11 +253,15 @@ class GetTranscriptsResponse(Response): """Response model for MANE transcript retrieval endpoint.""" transcripts: Optional[List[ManeGeneTranscript]] = None +<<<<<<< HEAD +======= +>>>>>>> 005823a (feat: add transcript lookup for genes) class GetGeneTranscriptsResponse(Response): """Response model for MANE transcript retrieval endpoint.""" +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD transcripts: Optional[List[str]] = None @@ -267,6 +271,9 @@ class GetGeneTranscriptsResponse(Response): ======= transcripts: Optional[Dict] >>>>>>> 047cc77 (feat: add transcript lookup for genes) +======= + transcripts: Optional[List[str]] = None +>>>>>>> 005823a (feat: add transcript lookup for genes) class ServiceInfoResponse(Response):