From bda641b3c5815b58ddca747047ca18cc99c3db0f Mon Sep 17 00:00:00 2001 From: Katie Stahl Date: Fri, 27 Sep 2024 11:59:38 -0400 Subject: [PATCH] fix: unable to construct tx segment when genomic coordinate between exons (#336) * fix: unable to construct tx segment when genomic coordinate between exons * build: update cool-seq-tool and fusor versions * test: add test case for get exon coordinates where genomic coord occurs between exons * test: remove test case for now * Update server/tests/integration/test_utilities.py Co-authored-by: Kori Kuzma * styling --------- Co-authored-by: Kori Kuzma --- .../TxSegmentElementInput.tsx | 25 ++++++++----------- requirements.txt | 4 +-- server/pyproject.toml | 4 +-- server/src/curfu/routers/constructors.py | 1 + server/src/curfu/routers/utilities.py | 1 + server/tests/integration/test_utilities.py | 24 ++++++++++++++++-- 6 files changed, 39 insertions(+), 20 deletions(-) diff --git a/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx b/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx index 0b531e04..613b854c 100644 --- a/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx +++ b/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx @@ -43,7 +43,7 @@ const TxSegmentCompInput: React.FC = ({ const [genomicInputType, setGenomicInputType] = useState( - element.inputGene + element.inputGene || element.gene ? GenomicInputType.GENE : element.inputTx ? GenomicInputType.TRANSCRIPT @@ -55,7 +55,7 @@ const TxSegmentCompInput: React.FC = ({ // "Text" variables refer to helper or warning text to set under input fields // TODO: this needs refactored so badly const [txAc, setTxAc] = useState(element.inputTx || ""); - const [txAcText, setTxAcText] = useState(""); + const [txAcHelperText, setTxAcHelperText] = useState(""); const [txGene, setTxGene] = useState(element.inputGene || ""); const [txGeneText, setTxGeneText] = useState(""); @@ -89,9 +89,6 @@ const TxSegmentCompInput: React.FC = ({ const [endingExonOffsetText, setEndingExonOffsetText] = useState(""); const [geneTranscripts, setGeneTranscripts] = useState([]); - const [selectedTranscript, setSelectedTranscript] = useState( - element.inputTx || "" - ); const [pendingResponse, setPendingResponse] = useState(false); @@ -100,7 +97,7 @@ const TxSegmentCompInput: React.FC = ({ const genomicInputComplete = genomicInputType === GenomicInputType.GENE - ? txGene !== "" && selectedTranscript !== "" + ? txGene !== "" && txAc !== "" : txAc !== ""; // programming horror @@ -117,7 +114,7 @@ const TxSegmentCompInput: React.FC = ({ inputComplete && hasRequiredEnds && txGeneText === "" && - txAcText === "" && + txAcHelperText === "" && txStartingGenomicText === "" && txEndingGenomicText === "" && startingExonText === "" && @@ -172,7 +169,6 @@ const TxSegmentCompInput: React.FC = ({ }; const handleTranscriptSelect = (event: any) => { - setSelectedTranscript(event.target.value as string); setTxAc(event.target.value as string); }; @@ -227,7 +223,7 @@ const TxSegmentCompInput: React.FC = ({ getTxSegmentElementGC( txGene, txChrom, - selectedTranscript, + txAc, txStartingGenomic, txEndingGenomic ).then((txSegmentResponse) => { @@ -242,6 +238,7 @@ const TxSegmentCompInput: React.FC = ({ inputType: txInputType, inputStrand: txStrand, inputGene: txGene, + inputTx: txAc, inputChr: txChrom, inputGenomicStart: txStartingGenomic, inputGenomicEnd: txEndingGenomic, @@ -266,7 +263,7 @@ const TxSegmentCompInput: React.FC = ({ // transcript invalid const txWarning = `Unable to get exons for ${txAc}`; if (txSegmentResponse.warnings.includes(txWarning)) { - setTxAcText("Unrecognized value"); + setTxAcHelperText("Unrecognized value"); } // exon(s) invalid if (startingExon !== undefined) { @@ -284,7 +281,7 @@ const TxSegmentCompInput: React.FC = ({ setPendingResponse(false); setErrors(txSegmentResponse.warnings); } else { - setTxAcText(""); + setTxAcHelperText(""); setStartingExonText(""); setEndingExonText(""); setErrors([]); @@ -394,7 +391,7 @@ const TxSegmentCompInput: React.FC = ({ @@ -436,7 +433,7 @@ const TxSegmentCompInput: React.FC = ({ setChromosome={setTxChrom} setStrand={setTxStrand} setTranscripts={setGeneTranscripts} - setDefaultTranscript={setSelectedTranscript} + setDefaultTranscript={setTxAc} /> @@ -445,7 +442,7 @@ const TxSegmentCompInput: React.FC = ({