From 0a22cb1049e2e9492091b319c7bca3aef31db21b Mon Sep 17 00:00:00 2001 From: Katie Stahl Date: Wed, 25 Sep 2024 14:51:05 -0400 Subject: [PATCH 1/6] fix: unable to construct tx segment when genomic coordinate between exons --- .../TxSegmentElementInput.tsx | 26 ++++++++----------- server/src/curfu/routers/constructors.py | 1 + server/src/curfu/routers/utilities.py | 1 + 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx b/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx index e83895e1..220b4ba1 100644 --- a/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx +++ b/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx @@ -33,7 +33,6 @@ interface TxSegmentElementInputProps extends StructuralElementInputProps { const TxSegmentCompInput: React.FC = ({ element, - index, handleSave, handleDelete, icon, @@ -44,7 +43,7 @@ const TxSegmentCompInput: React.FC = ({ const [genomicInputType, setGenomicInputType] = useState( - element.inputGene + element.inputGene || element.gene ? GenomicInputType.GENE : element.inputTx ? GenomicInputType.TRANSCRIPT @@ -54,7 +53,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(""); @@ -88,9 +87,6 @@ const TxSegmentCompInput: React.FC = ({ const [endingExonOffsetText, setEndingExonOffsetText] = useState(""); const [geneTranscripts, setGeneTranscripts] = useState([]); - const [selectedTranscript, setSelectedTranscript] = useState( - element.inputTx || "" - ); const [pendingResponse, setPendingResponse] = useState(false); @@ -99,7 +95,7 @@ const TxSegmentCompInput: React.FC = ({ const genomicInputComplete = genomicInputType === GenomicInputType.GENE - ? txGene !== "" && selectedTranscript !== "" + ? txGene !== "" && txAc !== "" : txAc !== ""; // programming horror @@ -116,7 +112,7 @@ const TxSegmentCompInput: React.FC = ({ inputComplete && hasRequiredEnds && txGeneText === "" && - txAcText === "" && + txAcHelperText === "" && txStartingGenomicText === "" && txEndingGenomicText === "" && startingExonText === "" && @@ -171,7 +167,6 @@ const TxSegmentCompInput: React.FC = ({ }; const handleTranscriptSelect = (event: any) => { - setSelectedTranscript(event.target.value as string); setTxAc(event.target.value as string); }; @@ -226,7 +221,7 @@ const TxSegmentCompInput: React.FC = ({ getTxSegmentElementGC( txGene, txChrom, - selectedTranscript, + txAc, txStartingGenomic, txEndingGenomic ).then((txSegmentResponse) => { @@ -240,6 +235,7 @@ const TxSegmentCompInput: React.FC = ({ inputType: txInputType, inputStrand: txStrand, inputGene: txGene, + inputTx: txAc, inputChr: txChrom, inputGenomicStart: txStartingGenomic, inputGenomicEnd: txEndingGenomic, @@ -263,7 +259,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) { @@ -279,7 +275,7 @@ const TxSegmentCompInput: React.FC = ({ } } } else { - setTxAcText(""); + setTxAcHelperText(""); setStartingExonText(""); setEndingExonText(""); const inputParams = { @@ -388,7 +384,7 @@ const TxSegmentCompInput: React.FC = ({ @@ -430,7 +426,7 @@ const TxSegmentCompInput: React.FC = ({ setChromosome={setTxChrom} setStrand={setTxStrand} setTranscripts={setGeneTranscripts} - setDefaultTranscript={setSelectedTranscript} + setDefaultTranscript={setTxAc} /> @@ -439,7 +435,7 @@ const TxSegmentCompInput: React.FC = ({