Skip to content

Commit

Permalink
bugfix: removing identifier in front of chromosome on auto populate (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl authored Oct 9, 2023
1 parent b4be59a commit 3b83fa9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,7 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({
<Box className="mid-inputs">
<ChromosomeField
fieldValue={txChrom}
valueSetter={setTxChrom}
errorText={txChromText}
keyHandler={handleEnterKey}
/>
<Box mt="18px" width="125px">
<StrandSwitch setStrand={setTxStrand} selectedStrand={txStrand} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ const GetCoordinates: React.FC = () => {
<Box display="flex" justifyContent="space-between" width="100%">
<ChromosomeField
fieldValue={chromosome}
valueSetter={setChromosome}
errorText={chromosomeText}
/>
<Box mt="18px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import HelpTooltip from "../HelpTooltip/HelpTooltip";

interface Props {
fieldValue: string;
valueSetter: CallableFunction;
errorText: string;
keyHandler: KeyboardEventHandler<HTMLDivElement> | undefined;
width?: number | undefined;
}

const ChromosomeField: React.FC<Props> = ({
fieldValue,
valueSetter,
errorText,
keyHandler,
width,
}) => {
const useStyles = makeStyles(() => ({
Expand Down Expand Up @@ -42,11 +38,10 @@ const ChromosomeField: React.FC<Props> = ({
<TextField
margin="dense"
value={fieldValue}
onChange={(event) => valueSetter(event.target.value)}
error={errorText != ""}
onKeyDown={keyHandler}
label="Chromosome"
helperText={errorText != "" ? errorText : null}
contentEditable={false}
className={classes.textField}
/>
</HelpTooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface Props {
setGene: CallableFunction;
geneText: string;
setGeneText: CallableFunction;
tooltipDirection:
tooltipDirection?:
| "bottom"
| "left"
| "right"
Expand Down Expand Up @@ -89,7 +89,8 @@ export const GeneAutocomplete: React.FC<Props> = ({
setGene(selection.value);
setGeneValue(selection);
if (setChromosome) {
setChromosome(selection.chromosome);
// substring is to remove identifier from beginning of chromosome (ex: result in NC_000007.14 instead of NCBI:NC_000007.14)
setChromosome(selection.chromosome?.substring(selection.chromosome.indexOf(":") + 1));
}
if (setStrand) {
setStrand(selection.strand);
Expand Down

0 comments on commit 3b83fa9

Please sign in to comment.