How to use the ve-sequence-utils.tidyUpSequenceData 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 / redux / alignments.js View on Github external
if (payloadToUse.pairwiseAlignments) {
      if (
        payloadToUse.pairwiseAlignments[0][0].alignmentData.matchStart !==
        undefined
      ) {
        payloadToUse.pairwiseAlignments = payloadToUse.pairwiseAlignments.map(
          addDashesForMatchStartAndEndForTracks
        );
      }
      const templateSeq = payloadToUse.pairwiseAlignments[0][0];
      //we need to get all of the sequences in a single alignment (turning inserts into single BP red highlights)
      const pairwiseOverviewAlignmentTracks = [
        {
          //add the template seq as the first track in the Pairwise Alignment Overview
          ...templateSeq,
          sequenceData: tidyUpSequenceData(templateSeq.sequenceData),
          alignmentData: { sequence: templateSeq.sequenceData.sequence } //remove the gaps from the template sequence
        }
      ]; // start with just the template seq in there!

      payloadToUse.pairwiseAlignments.forEach(([template, alignedSeq]) => {
        const condensedSeq = condensePairwiseAlignmentDifferences(
          template.alignmentData.sequence,
          alignedSeq.alignmentData.sequence
        );
        let re = /r+/gi;
        let match;
        const additionalSelectionLayers = [];
        while ((match = re.exec(condensedSeq)) != null) {
          additionalSelectionLayers.push({
            start: match.index,
            end: match.index + match[0].length - 1,
github TeselaGen / openVectorEditor / src / withEditorProps / index.js View on Github external
return (
        _sequenceDataToInsert,
        _existingSequenceData,
        _caretPositionOrRange,
        _options
      ) => {
        const {
          sequenceDataToInsert,
          existingSequenceData,
          caretPositionOrRange,
          options
        } = props.beforeSequenceInsertOrDelete
          ? props.beforeSequenceInsertOrDelete(
              tidyUpSequenceData(_sequenceDataToInsert),
              tidyUpSequenceData(_existingSequenceData),
              _caretPositionOrRange,
              _options
            ) || {}
          : {};
        return [
          insertSequenceDataAtPositionOrRange(
            sequenceDataToInsert || _sequenceDataToInsert,
            existingSequenceData || _existingSequenceData,
            caretPositionOrRange || _caretPositionOrRange,
            options || _options
          ),
          options || _options || {}
        ];
      };
    },
github TeselaGen / openVectorEditor / src / updateEditor.js View on Github external
translations: true,
          primaryProteinSequence: false,
          parts: true,
          orfs: true,
          cutsites: true,
          primers: true,
          ...annotationsToSupport
        }
      };
    }
  }
  const initialValuesToUse = {
    ...toSpread,
    ...rest,
    ...(sequenceData && {
      sequenceData: tidyUpSequenceData(sequenceData, {
        convertAnnotationsFromAAIndices,
        //if we have sequence data coming in make sure to tidy it up for the user :)
        annotationsAsObjects: true
      })
    })
  };

  store.dispatch({
    type: "VECTOR_EDITOR_UPDATE",
    payload: initialValuesToUse,
    meta: {
      editorName,
      disregardUndo: true,
      ...extraMeta
    }
  });
github TeselaGen / openVectorEditor / src / VersionHistoryView / index.js View on Github external
updateSeqData = sequenceData => {
    this.activeSeqData = sequenceData;
    this.props.vectorEditorInitialize(
      {
        sequenceData:
          (sequenceData && tidyUpSequenceData(sequenceData)) ||
          tidyUpSequenceData({
            sequence: "gTAGAGACAAGA"
          })
      },
      {
        editorName: "veVersionHistoryView"
      }
    );
  };
  componentDidMount = async () => {
github TeselaGen / openVectorEditor / src / withEditorProps / index.js View on Github external
return (
        _sequenceDataToInsert,
        _existingSequenceData,
        _caretPositionOrRange,
        _options
      ) => {
        const {
          sequenceDataToInsert,
          existingSequenceData,
          caretPositionOrRange,
          options
        } = props.beforeSequenceInsertOrDelete
          ? props.beforeSequenceInsertOrDelete(
              tidyUpSequenceData(_sequenceDataToInsert),
              tidyUpSequenceData(_existingSequenceData),
              _caretPositionOrRange,
              _options
            ) || {}
          : {};
        return [
          insertSequenceDataAtPositionOrRange(
            sequenceDataToInsert || _sequenceDataToInsert,
            existingSequenceData || _existingSequenceData,
            caretPositionOrRange || _caretPositionOrRange,
            options || _options
          ),
          options || _options || {}
        ];
      };
    },
github TeselaGen / openVectorEditor / demo / src / EditorDemo / index.js View on Github external
hook: isProtein => {
                  isProtein
                    ? updateEditor(store, "DemoEditor", {
                        readOnly: false,
                        sequenceData: tidyUpSequenceData(exampleProteinData, {
                          convertAnnotationsFromAAIndices: true
                        })
                      })
                    : updateEditor(store, "DemoEditor", {
                        readOnly: false,
                        sequenceData: exampleSequenceData
                      });
                }
              })}
github TeselaGen / openVectorEditor / src / VersionHistoryView / index.js View on Github external
updateSeqData = sequenceData => {
    this.activeSeqData = sequenceData;
    this.props.vectorEditorInitialize(
      {
        sequenceData:
          (sequenceData && tidyUpSequenceData(sequenceData)) ||
          tidyUpSequenceData({
            sequence: "gTAGAGACAAGA"
          })
      },
      {
        editorName: "veVersionHistoryView"
      }
    );
  };
  componentDidMount = async () => {
github TeselaGen / openVectorEditor / src / redux / sequenceData / index.js View on Github external
export const updateSequenceData = function(seqData, type, ...rest) {
  //tnrtodo: currently we're not using that type variable for anything
  return _updateSequenceData(
    tidyUpSequenceData(seqData, { annotationsAsObjects: true }),
    ...rest
  );
};
github TeselaGen / openVectorEditor / src / withEditorProps / index.js View on Github external
readOnly,
    alwaysAllowSave,
    sequenceData,
    lastSavedIdUpdate
  } = props;
  const saveHandler = opts.isSaveAs ? onSaveAs || onSave : onSave;

  const updateLastSavedIdToCurrent = () => {
    lastSavedIdUpdate(sequenceData.stateTrackingId);
  };
  const promiseOrVal =
    (!readOnly || alwaysAllowSave || opts.isSaveAs) &&
    saveHandler &&
    saveHandler(
      opts,
      tidyUpSequenceData(sequenceData, { annotationsAsObjects: true }),
      props,
      updateLastSavedIdToCurrent
    );

  if (promiseOrVal && promiseOrVal.then) {
    return promiseOrVal.then(updateLastSavedIdToCurrent);
  }
};
github TeselaGen / openVectorEditor / src / withEditorInteractions / index.js View on Github external
handleCutOrCopy = isCut => e => {
      const {
        onCopy = () => {},
        sequenceData,
        selectionLayer,
        copyOptions
      } = this.props;
      const onCut = this.props.onCut || this.props.onCopy || (() => {});

      const seqData = tidyUpSequenceData(
        this.sequenceDataToCopy ||
          getSequenceDataBetweenRange(sequenceData, selectionLayer, {
            excludePartial: {
              features: !copyOptions.partialFeatures,
              parts: !copyOptions.partialParts
            },
            exclude: {
              features: !copyOptions.features,
              parts: !copyOptions.parts
            }
          }),
        { annotationsAsObjects: true }
      );
      if (!seqData.sequence.length)
        return window.toastr.warning(
          `No Sequence Selected To ${isCut ? "Cut" : "Copy"}`