How to use the ve-sequence-utils.getInsertBetweenVals function in ve-sequence-utils

To help you get started, we’ve selected a few ve-sequence-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeselaGen / openVectorEditor / src / withEditorInteractions / createSequenceInputPopup.js View on Github external
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>
github TeselaGen / openVectorEditor / src / utils / editorUtils.js View on Github external
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";
  }