Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
const {
isReplace,
selectionLayer,
sequenceLength,
isProtein,
caretPosition,
acceptedChars,
maxInsertSize
} = this.props;
const { charsToInsert, hasTempError } = this.state;
let message;
if (isReplace) {
let betweenVals = getInsertBetweenVals(
-1,
selectionLayer,
sequenceLength
);
message = (
<span>
Press <span style="{{">ENTER</span> to replace{" "}
{divideBy3(getRangeLength(selectionLayer, sequenceLength), isProtein)}{" "}
{isProtein ? "AAs" : "base pairs"} between{" "}
{isProtein
? convertDnaCaretPositionOrRangeToAA(betweenVals[0])
: betweenVals[0]}{" "}
and{" "}
{isProtein
? convertDnaCaretPositionOrRangeToAA(betweenVals[1] + 2)</span>
let length = getRangeLength(selectionLayer, sequenceLength);
const GCContent = (numDecimalDigits = 0) =>
calculatePercentGC(
getSequenceDataBetweenRange(sequenceData, selectionLayer).sequence
).toFixed(numDecimalDigits);
const seqLen = divideBy3(length, isProtein);
return `${customTitle || "Selecting"} ${seqLen} ${(isProtein
? "AA"
: "bp") + (seqLen === 1 ? "" : "s")} from ${divideBy3(
selectionLayer.start,
isProtein
) + 1} to ${divideBy3(selectionLayer.end + 1, isProtein)}${
showGCContent && !isProtein ? ` (${GCContent(GCDecimalDigits)}% GC)` : ""
}`;
} else if (caretPosition > -1) {
let insertBetween = getInsertBetweenVals(
caretPosition,
selectionLayer,
sequenceLength
);
return (
`Caret Between ` +
(isProtein
? `AAs ${divideBy3(insertBetween[0], true)} and ${divideBy3(
insertBetween[1] + 2,
true
)}`
: `Bases ${insertBetween[0]} and ${insertBetween[1]}`)
);
} else {
return "No Selection";
}