Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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: restrictionEnzymeupstreamTopSnip = 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;
}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: restrictionEnzymedownstreamTopSnip = 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,//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,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
};}
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);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;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,//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,