How to use the ve-range-utils/normalizePositionByRangeLength.js function in ve-range-utils

To help you get started, we’ve selected a few ve-range-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 / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
if (downstreamBottomSnip > recognitionSiteRange.end) {
                        end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
                    end: end,
                    downstreamTopSnip: downstreamTopSnip,
                    downstreamBottomSnip: downstreamBottomSnip,
                    upstreamTopBeforeBottom: upstreamTopBeforeBottom,
                    downstreamTopBeforeBottom: downstreamTopBeforeBottom,
                    upstreamTopSnip: upstreamTopSnip,
                    upstreamBottomSnip: upstreamBottomSnip,
                    recognitionSiteRange: recognitionSiteRange,
                    forward: true,
                    restrictionEnzyme: restrictionEnzyme
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
upstreamTopSnip = recognitionSiteRange.end - restrictionEnzyme.usForward;
                upstreamBottomSnip = recognitionSiteRange.end - restrictionEnzyme.usReverse;
                if (upstreamTopSnip >= 0 && upstreamBottomSnip >= 0) {
                    fitsWithinSequence = true;
                    if (upstreamTopSnip < upstreamBottomSnip) {
                        if (start > upstreamTopSnip) {
                            start = upstreamTopSnip + 1;
                        }
                        upstreamTopBeforeBottom = true;
                    } else {
                        if (start > upstreamBottomSnip) {
                            start = upstreamBottomSnip + 1;
                        }
                    }
                    upstreamTopSnip = normalizePositionByRangeLength(upstreamTopSnip, originalSequenceLength, true);
                    upstreamBottomSnip = normalizePositionByRangeLength(upstreamBottomSnip, originalSequenceLength, true);
                } else {
                    upstreamTopSnip = null;
                    upstreamBottomSnip = null;
                }
            }


            //add downstream cutsite here
            downstreamTopSnip = recognitionSiteRange.start + restrictionEnzyme.dsForward;
            downstreamBottomSnip = recognitionSiteRange.start + restrictionEnzyme.dsReverse;
            if (downstreamBottomSnip <= currentSequenceLength && downstreamTopSnip <= currentSequenceLength) {
                fitsWithinSequence = true;
                if (downstreamTopSnip > downstreamBottomSnip) {
                    if (downstreamTopSnip > recognitionSiteRange.end) {
                        end = downstreamTopSnip - 1;
                    }
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
if (downstreamBottomSnip > recognitionSiteRange.end) {
                        end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
                    end: end,
                    downstreamTopSnip: downstreamTopSnip,
                    downstreamBottomSnip: downstreamBottomSnip,
                    upstreamTopBeforeBottom: upstreamTopBeforeBottom,
                    downstreamTopBeforeBottom: downstreamTopBeforeBottom,
                    upstreamTopSnip: upstreamTopSnip,
                    upstreamBottomSnip: upstreamBottomSnip,
                    recognitionSiteRange: recognitionSiteRange,
                    forward: true,
                    restrictionEnzyme: restrictionEnzyme
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
downstreamTopSnip = recognitionSiteRange.start + restrictionEnzyme.dsForward;
            downstreamBottomSnip = recognitionSiteRange.start + restrictionEnzyme.dsReverse;
            if (downstreamBottomSnip <= currentSequenceLength && downstreamTopSnip <= currentSequenceLength) {
                fitsWithinSequence = true;
                if (downstreamTopSnip > downstreamBottomSnip) {
                    if (downstreamTopSnip > recognitionSiteRange.end) {
                        end = downstreamTopSnip - 1;
                    }
                } else {
                    if (downstreamBottomSnip > recognitionSiteRange.end) {
                        end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
                    end: end,
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
//add downstream cutsite here
            downstreamTopSnip = recognitionSiteRange.start + restrictionEnzyme.dsForward;
            downstreamBottomSnip = recognitionSiteRange.start + restrictionEnzyme.dsReverse;
            if (downstreamBottomSnip <= currentSequenceLength && downstreamTopSnip <= currentSequenceLength) {
                fitsWithinSequence = true;
                if (downstreamTopSnip > downstreamBottomSnip) {
                    if (downstreamTopSnip > recognitionSiteRange.end) {
                        end = downstreamTopSnip - 1;
                    }
                } else {
                    if (downstreamBottomSnip > recognitionSiteRange.end) {
                        end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
                    end: end,
                    downstreamTopSnip: downstreamTopSnip,
                    downstreamBottomSnip: downstreamBottomSnip,
                    upstreamTopBeforeBottom: upstreamTopBeforeBottom,
                    downstreamTopBeforeBottom: downstreamTopBeforeBottom,
                    upstreamTopSnip: upstreamTopSnip,
                    upstreamBottomSnip: upstreamBottomSnip,
                    recognitionSiteRange: recognitionSiteRange,
                    forward: true,
                    restrictionEnzyme: restrictionEnzyme
                };
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
}
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
                    end: end,
                    downstreamTopSnip: downstreamTopSnip,
                    downstreamBottomSnip: downstreamBottomSnip,
                    upstreamTopBeforeBottom: upstreamTopBeforeBottom,
                    downstreamTopBeforeBottom: downstreamTopBeforeBottom,
                    upstreamTopSnip: upstreamTopSnip,
                    upstreamBottomSnip: upstreamBottomSnip,
                    recognitionSiteRange: recognitionSiteRange,
                    forward: true,
                    restrictionEnzyme: restrictionEnzyme
                };
                restrictionCutSites.push(restrictionCutSite);
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
if (restrictionEnzyme.cutType == 1) { //double cutter, add upstream cutsite here
                upstreamTopSnip = recognitionSiteRange.end - restrictionEnzyme.usForward;
                upstreamBottomSnip = recognitionSiteRange.end - restrictionEnzyme.usReverse;
                if (upstreamTopSnip >= 0 && upstreamBottomSnip >= 0) {
                    fitsWithinSequence = true;
                    if (upstreamTopSnip < upstreamBottomSnip) {
                        if (start > upstreamTopSnip) {
                            start = upstreamTopSnip + 1;
                        }
                        upstreamTopBeforeBottom = true;
                    } else {
                        if (start > upstreamBottomSnip) {
                            start = upstreamBottomSnip + 1;
                        }
                    }
                    upstreamTopSnip = normalizePositionByRangeLength(upstreamTopSnip, originalSequenceLength, true);
                    upstreamBottomSnip = normalizePositionByRangeLength(upstreamBottomSnip, originalSequenceLength, true);
                } else {
                    upstreamTopSnip = null;
                    upstreamBottomSnip = null;
                }
            }


            //add downstream cutsite here
            downstreamTopSnip = recognitionSiteRange.start + restrictionEnzyme.dsForward;
            downstreamBottomSnip = recognitionSiteRange.start + restrictionEnzyme.dsReverse;
            if (downstreamBottomSnip <= currentSequenceLength && downstreamTopSnip <= currentSequenceLength) {
                fitsWithinSequence = true;
                if (downstreamTopSnip > downstreamBottomSnip) {
                    if (downstreamTopSnip > recognitionSiteRange.end) {
                        end = downstreamTopSnip - 1;
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
downstreamTopSnip = recognitionSiteRange.start + restrictionEnzyme.dsForward;
            downstreamBottomSnip = recognitionSiteRange.start + restrictionEnzyme.dsReverse;
            if (downstreamBottomSnip <= currentSequenceLength && downstreamTopSnip <= currentSequenceLength) {
                fitsWithinSequence = true;
                if (downstreamTopSnip > downstreamBottomSnip) {
                    if (downstreamTopSnip > recognitionSiteRange.end) {
                        end = downstreamTopSnip - 1;
                    }
                } else {
                    if (downstreamBottomSnip > recognitionSiteRange.end) {
                        end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,
                    end: end,
github TeselaGen / openVectorEditor / app / ve-sequence-utils / cutSequenceByRestrictionEnzyme.js View on Github external
//add downstream cutsite here
            downstreamTopSnip = recognitionSiteRange.start + restrictionEnzyme.dsForward;
            downstreamBottomSnip = recognitionSiteRange.start + restrictionEnzyme.dsReverse;
            if (downstreamBottomSnip <= currentSequenceLength && downstreamTopSnip <= currentSequenceLength) {
                fitsWithinSequence = true;
                if (downstreamTopSnip > downstreamBottomSnip) {
                    if (downstreamTopSnip > recognitionSiteRange.end) {
                        end = downstreamTopSnip - 1;
                    }
                } else {
                    if (downstreamBottomSnip > recognitionSiteRange.end) {
                        end = downstreamBottomSnip - 1;
                    }
                    downstreamTopBeforeBottom = true;
                }
                downstreamTopSnip = normalizePositionByRangeLength(downstreamTopSnip, originalSequenceLength, true);
                downstreamBottomSnip = normalizePositionByRangeLength(downstreamBottomSnip, originalSequenceLength, true);
            } else {
                downstreamTopSnip = null;
                downstreamBottomSnip = null;
            }

            if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLength && end < currentSequenceLength) {
                //only push cutsites onto the array if they are fully contained within the boundaries of the sequence!
                //and they aren't duplicated
                start = normalizePositionByRangeLength(start, originalSequenceLength, false);
                end = normalizePositionByRangeLength(end, originalSequenceLength, false);
                recognitionSiteRange.start = normalizePositionByRangeLength(recognitionSiteRange.start, originalSequenceLength, false);
                recognitionSiteRange.end = normalizePositionByRangeLength(recognitionSiteRange.end, originalSequenceLength, false);

                restrictionCutSite = {
                    start: start,