How to use ve-sequence-utils - 10 common examples

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 / commands / index.js View on Github external
handler: props => {
      props.onCreateNewFromSubsequence(
        getSequenceDataBetweenRange(props.sequenceData, props.selectionLayer),
        props
      );
    }
    // hotkey: "mod+x"
github TeselaGen / openVectorEditor / src / withEditorProps / index.js View on Github external
handleComplementSequence: props => () => {
      const { sequenceData, updateSequenceData } = props;
      updateSequenceData(getComplementSequenceAndAnnotations(sequenceData));
      window.toastr.success("Complemented Sequence Successfully");
    },
    /* eslint-enable no-unused-vars */
github TeselaGen / openVectorEditor / src / redux / alignments.js View on Github external
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,
            ...highlightRangeProps
          });
        }
        re = /g+/gi;
        // let match;
        while ((match = re.exec(condensedSeq)) != null) {
github TeselaGen / openVectorEditor / src / helperComponents / AddOrEditAnnotationDialog / index.js View on Github external
onClick={handleSubmit(data => {
              let updatedData;
              if (data.forward === true && data.strand !== 1) {
                updatedData = { ...data, strand: 1 };
              } else if (data.forward === false && data.strand !== -1) {
                updatedData = { ...data, strand: -1 };
              } else {
                updatedData = data;
              }
              const hasJoinedLocations =
                updatedData.locations && updatedData.locations.length > 1;

              const newFeat = tidyUpAnnotation(
                convertRangeTo0Based({
                  ...updatedData,
                  ...(annotationTypePlural === "primers" //if we're making a primer it should automatically have a type of primer
                    ? { type: "primer" }
                    : {}),
                  locations: undefined, //by default clear locations
                  ...(hasJoinedLocations && {
                    //only add locations if there are locations
                    start: updatedData.locations[0].start, //override the start and end to use the start and end of the joined locations
                    end:
                      updatedData.locations[updatedData.locations.length - 1]
                        .end,
                    locations: updatedData.locations.map(convertRangeTo0Based)
                  })
                }),
                {
github TeselaGen / openVectorEditor / demo / src / EditorDemo / AddEditFeatureOverrideExample.js View on Github external
onClick={handleSubmit(data => {
              let updatedData;
              if (data.forward === true && data.strand !== 1) {
                updatedData = { ...data, strand: 1 };
              } else if (data.forward === false && data.strand !== -1) {
                updatedData = { ...data, strand: -1 };
              } else {
                updatedData = data;
              }
              const hasJoinedLocations =
                updatedData.locations && updatedData.locations.length > 1;

              const newFeat = tidyUpAnnotation(
                convertRangeTo0Based({
                  ...updatedData,
                  locations: undefined, //by default clear locations
                  ...(hasJoinedLocations && {
                    //only add locations if there are locations
                    start: updatedData.locations[0].start, //override the start and end to use the start and end of the joined locations
                    end:
                      updatedData.locations[updatedData.locations.length - 1]
                        .end,
                    locations: updatedData.locations.map(convertRangeTo0Based)
                  })
                }),
                {
                  sequenceData,
                  annotationType: "features"
                }
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 || {}
        ];
      };
    },