diff --git a/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx b/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx index 471e7b9a..b21ba103 100644 --- a/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx +++ b/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx @@ -11,10 +11,7 @@ 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"; @@ -101,10 +98,6 @@ 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); @@ -132,7 +125,6 @@ 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 new file mode 100644 index 00000000..7985ef78 --- /dev/null +++ b/client/src/components/main/shared/TranscriptField/TranscriptField.tsx @@ -0,0 +1,51 @@ +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 ed1f4f6e..59bba801 100644 --- a/server/curfu/routers/utilities.py +++ b/server/curfu/routers/utilities.py @@ -68,40 +68,17 @@ 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 """ -<<<<<<< HEAD -<<<<<<< HEAD normalized = request.app.state.fusor.gene_normalizer.normalize(gene) symbol = normalized.gene_descriptor.label 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")) -======= - transcripts = await request.app.state.fusor.cool_seq_tool.uta_db.get_transcripts(gene) ->>>>>>> c11b094 (feat!: adding transcript lookup for genes) -======= - 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) - transcripts_dict = transcripts.to_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", @@ -311,13 +288,9 @@ 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 931a0087..c5e41159 100644 --- a/server/curfu/schemas.py +++ b/server/curfu/schemas.py @@ -1,7 +1,6 @@ """Provide schemas for FastAPI responses.""" from enum import Enum from typing import Dict, List, Literal, Optional, Tuple, Union -import polars as pl from cool_seq_tool.schemas import GenomicData from fusor.models import ( @@ -253,27 +252,12 @@ 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 -======= - transcripts: Optional[pl.DataFrame] ->>>>>>> c11b094 (feat!: adding transcript lookup for genes) -======= - 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):