-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: update tx segment element with updated cool-seq-tool structure changes #314
Changes from 16 commits
fa8c93c
9a6281d
fbe0a83
b2c6787
053843e
f314306
b58a5b7
726d7e6
6c672bd
d56bff0
7191723
09e10bd
7f56752
f26dd9f
a8833e4
c3d093c
b611f84
e5545eb
09183e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,19 @@ import { | |
TranscriptSegmentElement, | ||
TxSegmentElementResponse, | ||
} from "../../../../../services/ResponseModels"; | ||
import React, { useEffect, useState, KeyboardEvent, useContext } from "react"; | ||
import React, { | ||
useEffect, | ||
useState, | ||
KeyboardEvent, | ||
useContext, | ||
ChangeEvent, | ||
} from "react"; | ||
import { | ||
getTxSegmentElementECT, | ||
getTxSegmentElementGCG, | ||
getTxSegmentElementGCT, | ||
getTxSegmentNomenclature, | ||
TxElementInputType, | ||
} from "../../../../../services/main"; | ||
import { GeneAutocomplete } from "../../../../main/shared/GeneAutocomplete/GeneAutocomplete"; | ||
import { StructuralElementInputProps } from "../StructuralElementInputProps"; | ||
|
@@ -30,13 +37,6 @@ interface TxSegmentElementInputProps extends StructuralElementInputProps { | |
element: ClientTranscriptSegmentElement; | ||
} | ||
|
||
export enum InputType { | ||
default = "default", | ||
gcg = "genomic_coords_gene", | ||
gct = "genomic_coords_tx", | ||
ect = "exon_coords_tx", | ||
} | ||
|
||
const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | ||
element, | ||
index, | ||
|
@@ -46,8 +46,8 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
}) => { | ||
const { fusion } = useContext(FusionContext); | ||
|
||
const [txInputType, setTxInputType] = useState<InputType>( | ||
(element.inputType as InputType) || InputType.default | ||
const [txInputType, setTxInputType] = useState<TxElementInputType>( | ||
(element.inputType as TxElementInputType) || TxElementInputType.default | ||
); | ||
|
||
// "Text" variables refer to helper or warning text to set under input fields | ||
|
@@ -89,30 +89,20 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
|
||
const [pendingResponse, setPendingResponse] = useState(false); | ||
|
||
/* | ||
Depending on this element's location in the structure array, the user | ||
needs to provide some kind of coordinate input for either one or both ends | ||
of the element. This can change as the user drags the element around the structure | ||
array, or adds other elements to the array. | ||
*/ | ||
const hasRequiredEnds = | ||
index !== 0 && index < fusion.length | ||
? (txStartingGenomic && txEndingGenomic) || (startingExon && endingExon) | ||
: index === 0 | ||
? txEndingGenomic || endingExon | ||
: txStartingGenomic || startingExon; | ||
txEndingGenomic || endingExon || txStartingGenomic || startingExon; | ||
|
||
// programming horror | ||
const inputComplete = | ||
(txInputType === InputType.gcg && | ||
(txInputType === TxElementInputType.gcg && | ||
txGene !== "" && | ||
txChrom !== "" && | ||
(txStartingGenomic !== "" || txEndingGenomic !== "")) || | ||
(txInputType === InputType.gct && | ||
(txInputType === TxElementInputType.gct && | ||
txAc !== "" && | ||
txChrom !== "" && | ||
(txStartingGenomic !== "" || txEndingGenomic !== "")) || | ||
(txInputType === InputType.ect && | ||
(txInputType === TxElementInputType.ect && | ||
txAc !== "" && | ||
(startingExon !== "" || endingExon !== "")); | ||
|
||
|
@@ -233,7 +223,7 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
setPendingResponse(true); | ||
// fire constructor request | ||
switch (txInputType) { | ||
case InputType.gcg: | ||
case TxElementInputType.gcg: | ||
clearGenomicCoordWarnings(); | ||
getTxSegmentElementGCG( | ||
txGene, | ||
|
@@ -261,14 +251,13 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
} | ||
}); | ||
break; | ||
case InputType.gct: | ||
case TxElementInputType.gct: | ||
clearGenomicCoordWarnings(); | ||
getTxSegmentElementGCT( | ||
txAc, | ||
txChrom, | ||
txStartingGenomic, | ||
txEndingGenomic, | ||
txStrand | ||
txEndingGenomic | ||
).then((txSegmentResponse) => { | ||
if ( | ||
txSegmentResponse.warnings && | ||
|
@@ -290,7 +279,7 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
} | ||
}); | ||
break; | ||
case InputType.ect: | ||
case TxElementInputType.ect: | ||
getTxSegmentElementECT( | ||
txAc, | ||
startingExon as string, | ||
|
@@ -436,10 +425,18 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
</Box> | ||
); | ||
|
||
const handleChromosomeChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
setTxChrom(e.target.value); | ||
}; | ||
|
||
const genomicCoordinateInfo = ( | ||
<> | ||
<Box className="mid-inputs"> | ||
<ChromosomeField fieldValue={txChrom} errorText={txChromText} /> | ||
<ChromosomeField | ||
fieldValue={txChrom} | ||
errorText={txChromText} | ||
onChange={handleChromosomeChange} | ||
/> | ||
<Box mt="18px" width="125px"> | ||
<StrandSwitch setStrand={setTxStrand} selectedStrand={txStrand} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strand can be removed from transcript segment element. Maybe templated sequence too (not sure how this one works)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll remove the ability to change it for tx element. I think it might be fine to leave in the UI as a helpful visual tool to the user, though. what are your thoughts on that? It looks like we still require the user to put in the strand for Templated Sequence, though. That element is pretty much entirely user-made, whereas tx makes a request to cool-seq-tool. If this is something cool-seq-tool can do now, we should def make a new issue for it! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pushed a commit where the ability to change it is removed, but it'll still show the strand to the user! I can also just remove it altogether- I just wasn't sure if it was a helpful visual aid or not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @katiestahl so it makes sense for transcript segment element when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @korikuzma is it okay if I create a new ticket for that? This is not something that was working or implemented like this before, so I think it's outside of the scope of this ticket. I'll create a new issue though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we hide the strand for now so it's not confusing and back back in #321 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep! |
||
</Box> | ||
|
@@ -450,7 +447,7 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
|
||
const renderTxOptions = () => { | ||
switch (txInputType) { | ||
case InputType.gcg: | ||
case TxElementInputType.gcg: | ||
return ( | ||
<Box> | ||
<Box className="mid-inputs" minWidth="255px"> | ||
|
@@ -467,14 +464,14 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
{genomicCoordinateInfo} | ||
</Box> | ||
); | ||
case InputType.gct: | ||
case TxElementInputType.gct: | ||
return ( | ||
<Box> | ||
{txInputField} | ||
{genomicCoordinateInfo} | ||
</Box> | ||
); | ||
case InputType.ect: | ||
case TxElementInputType.ect: | ||
return ( | ||
<Box> | ||
{txInputField} | ||
|
@@ -611,7 +608,7 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
* Wrapper around input type selection to ensure unused inputs/warnings get cleared | ||
* @param selection selection from input type dropdown menu | ||
*/ | ||
const selectInputType = (selection: InputType) => { | ||
const selectInputType = (selection: TxElementInputType) => { | ||
if (txInputType !== "default") { | ||
if (selection === "exon_coords_tx") { | ||
clearGenomicCoordWarnings(); | ||
|
@@ -644,7 +641,7 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({ | |
<Select | ||
value={txInputType} | ||
onChange={(event) => | ||
selectInputType(event.target.value as InputType) | ||
selectInputType(event.target.value as TxElementInputType) | ||
} | ||
> | ||
<MenuItem value="default" disabled> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please double check me on this change! From my understanding, based on the sequence location changes, a Tx segment element only requires either a start/end, regardless of position (it looks like previously, it had to have both unless it was the first item?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes only one of start/end is required to create a TranscriptSegmentElement