@teselagen/sequence-utils 0.3.37 → 0.3.38-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DNAComplementMap.d.ts +1 -1
- package/addGapsToSeqReads.d.ts +16 -3
- package/adjustAnnotationsToInsert.d.ts +2 -1
- package/adjustBpsToReplaceOrInsert.d.ts +2 -1
- package/aliasedEnzymesByName.d.ts +37 -1
- package/aminoAcidToDegenerateDnaMap.d.ts +1 -31
- package/aminoAcidToDegenerateRnaMap.d.ts +1 -1
- package/annotateSingleSeq.d.ts +5 -4
- package/annotationTypes.d.ts +2 -2
- package/autoAnnotate.d.ts +17 -8
- package/bioData.d.ts +10 -58
- package/calculateEndStability.d.ts +1 -1
- package/calculateNebTa.d.ts +6 -1
- package/calculateNebTm.d.ts +6 -4
- package/calculatePercentGC.d.ts +1 -1
- package/calculateSantaLuciaTm.d.ts +28 -114
- package/calculateTm.d.ts +13 -1
- package/computeDigestFragments.d.ts +30 -24
- package/condensePairwiseAlignmentDifferences.d.ts +1 -1
- package/convertAACaretPositionOrRangeToDna.d.ts +2 -1
- package/convertDnaCaretPositionOrRangeToAA.d.ts +2 -1
- package/cutSequenceByRestrictionEnzyme.d.ts +2 -1
- package/defaultEnzymesByName.d.ts +2 -1
- package/degenerateDnaToAminoAcidMap.d.ts +1 -1
- package/degenerateRnaToAminoAcidMap.d.ts +1 -1
- package/deleteSequenceDataAtRange.d.ts +2 -1
- package/diffUtils.d.ts +9 -7
- package/doesEnzymeChopOutsideOfRecognitionSite.d.ts +2 -1
- package/featureTypesAndColors.d.ts +19 -6
- package/filterSequenceString.d.ts +14 -10
- package/findApproxMatches.d.ts +7 -1
- package/findNearestRangeOfSequenceOverlapToPosition.d.ts +2 -1
- package/findOrfsInPlasmid.d.ts +2 -11
- package/findSequenceMatches.d.ts +11 -1
- package/generateAnnotations.d.ts +2 -1
- package/generateSequenceData.d.ts +8 -13
- package/getAllInsertionsInSeqReads.d.ts +11 -1
- package/getAminoAcidDataForEachBaseOfDna.d.ts +6 -5
- package/getAminoAcidFromSequenceTriplet.d.ts +1 -1
- package/getAminoAcidStringFromSequenceString.d.ts +3 -1
- package/getCodonRangeForAASliver.d.ts +3 -4
- package/getComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getComplementSequenceAndAnnotations.d.ts +5 -1
- package/getComplementSequenceString.d.ts +1 -1
- package/getCutsiteType.d.ts +2 -1
- package/getCutsitesFromSequence.d.ts +2 -1
- package/getDegenerateDnaStringFromAAString.d.ts +1 -1
- package/getDegenerateRnaStringFromAAString.d.ts +1 -1
- package/getDigestFragmentsForCutsites.d.ts +4 -1
- package/getDigestFragmentsForRestrictionEnzymes.d.ts +8 -1
- package/getInsertBetweenVals.d.ts +2 -1
- package/getLeftAndRightOfSequenceInRangeGivenPosition.d.ts +2 -1
- package/getOrfsFromSequence.d.ts +17 -11
- package/getOverlapBetweenTwoSequences.d.ts +2 -1
- package/getPossiblePartsFromSequenceAndEnzymes.d.ts +18 -1
- package/getReverseAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAnnotation.d.ts +11 -1
- package/getReverseComplementSequenceAndAnnotations.d.ts +5 -1
- package/getReverseComplementSequenceString.d.ts +1 -1
- package/getReverseSequenceString.d.ts +1 -1
- package/getSequenceDataBetweenRange.d.ts +9 -1
- package/getVirtualDigest.d.ts +11 -10
- package/guessIfSequenceIsDnaAndNotProtein.d.ts +5 -1
- package/index.cjs +732 -483
- package/index.d.ts +8 -5
- package/index.js +732 -483
- package/index.umd.cjs +732 -483
- package/insertGapsIntoRefSeq.d.ts +2 -1
- package/insertSequenceDataAtPositionOrRange.d.ts +10 -1
- package/isEnzymeType2S.d.ts +2 -1
- package/mapAnnotationsToRows.d.ts +9 -1
- package/package.json +9 -6
- package/prepareCircularViewData.d.ts +2 -1
- package/prepareRowData.d.ts +7 -3
- package/proteinAlphabet.d.ts +1 -1
- package/rotateBpsToPosition.d.ts +1 -1
- package/rotateSequenceDataToPosition.d.ts +3 -1
- package/shiftAnnotationsByLen.d.ts +4 -3
- package/src/DNAComplementMap.ts +32 -0
- package/src/addGapsToSeqReads.ts +436 -0
- package/src/adjustAnnotationsToInsert.ts +20 -0
- package/src/adjustBpsToReplaceOrInsert.ts +73 -0
- package/src/aliasedEnzymesByName.ts +7366 -0
- package/src/aminoAcidToDegenerateDnaMap.ts +32 -0
- package/src/aminoAcidToDegenerateRnaMap.ts +32 -0
- package/src/annotateSingleSeq.ts +37 -0
- package/src/annotationTypes.ts +23 -0
- package/src/autoAnnotate.test.js +0 -1
- package/src/autoAnnotate.ts +290 -0
- package/src/bioData.ts +65 -0
- package/src/calculateEndStability.ts +91 -0
- package/src/calculateNebTa.ts +46 -0
- package/src/calculateNebTm.ts +132 -0
- package/src/calculatePercentGC.ts +3 -0
- package/src/calculateSantaLuciaTm.ts +184 -0
- package/src/calculateTm.ts +242 -0
- package/src/computeDigestFragments.ts +238 -0
- package/src/condensePairwiseAlignmentDifferences.ts +85 -0
- package/src/convertAACaretPositionOrRangeToDna.ts +28 -0
- package/src/convertDnaCaretPositionOrRangeToAA.ts +28 -0
- package/src/cutSequenceByRestrictionEnzyme.ts +345 -0
- package/src/defaultEnzymesByName.ts +280 -0
- package/src/degenerateDnaToAminoAcidMap.ts +5 -0
- package/src/degenerateRnaToAminoAcidMap.ts +5 -0
- package/src/deleteSequenceDataAtRange.ts +13 -0
- package/src/diffUtils.ts +80 -0
- package/src/doesEnzymeChopOutsideOfRecognitionSite.ts +16 -0
- package/src/featureTypesAndColors.ts +167 -0
- package/src/filterSequenceString.ts +153 -0
- package/src/findApproxMatches.ts +58 -0
- package/src/findNearestRangeOfSequenceOverlapToPosition.ts +43 -0
- package/src/findOrfsInPlasmid.js +6 -1
- package/src/findOrfsInPlasmid.ts +31 -0
- package/src/findSequenceMatches.ts +154 -0
- package/src/generateAnnotations.ts +39 -0
- package/src/generateSequenceData.ts +212 -0
- package/src/getAllInsertionsInSeqReads.ts +100 -0
- package/src/getAminoAcidDataForEachBaseOfDna.ts +305 -0
- package/src/getAminoAcidFromSequenceTriplet.ts +27 -0
- package/src/getAminoAcidStringFromSequenceString.ts +36 -0
- package/src/getCodonRangeForAASliver.ts +73 -0
- package/src/getComplementAminoAcidStringFromSequenceString.ts +10 -0
- package/src/getComplementSequenceAndAnnotations.ts +25 -0
- package/src/getComplementSequenceString.ts +23 -0
- package/src/getCutsiteType.ts +18 -0
- package/src/getCutsitesFromSequence.ts +22 -0
- package/src/getDegenerateDnaStringFromAAString.ts +15 -0
- package/src/getDegenerateRnaStringFromAAString.ts +15 -0
- package/src/getDigestFragmentsForCutsites.ts +126 -0
- package/src/getDigestFragmentsForRestrictionEnzymes.ts +50 -0
- package/src/getInsertBetweenVals.ts +31 -0
- package/src/getLeftAndRightOfSequenceInRangeGivenPosition.ts +40 -0
- package/src/getMassOfAaString.ts +29 -0
- package/src/getOrfsFromSequence.ts +132 -0
- package/src/getOverlapBetweenTwoSequences.ts +30 -0
- package/src/getPossiblePartsFromSequenceAndEnzymes.ts +149 -0
- package/src/getReverseAminoAcidStringFromSequenceString.ts +22 -0
- package/src/getReverseComplementAminoAcidStringFromSequenceString.ts +10 -0
- package/src/getReverseComplementAnnotation.ts +33 -0
- package/src/getReverseComplementSequenceAndAnnotations.ts +46 -0
- package/src/getReverseComplementSequenceString.ts +18 -0
- package/src/getReverseSequenceString.ts +12 -0
- package/src/getSequenceDataBetweenRange.ts +154 -0
- package/src/getVirtualDigest.ts +139 -0
- package/src/guessIfSequenceIsDnaAndNotProtein.ts +39 -0
- package/src/index.test.ts +43 -0
- package/src/index.ts +111 -0
- package/src/insertGapsIntoRefSeq.ts +43 -0
- package/src/insertSequenceDataAtPosition.ts +2 -0
- package/src/insertSequenceDataAtPositionOrRange.ts +328 -0
- package/src/isEnzymeType2S.ts +5 -0
- package/src/mapAnnotationsToRows.ts +256 -0
- package/src/prepareCircularViewData.ts +24 -0
- package/src/prepareRowData.ts +61 -0
- package/src/prepareRowData_output1.json +1 -0
- package/src/proteinAlphabet.ts +271 -0
- package/src/rotateBpsToPosition.ts +12 -0
- package/src/rotateSequenceDataToPosition.ts +54 -0
- package/src/shiftAnnotationsByLen.ts +24 -0
- package/src/threeLetterSequenceStringToAminoAcidMap.ts +198 -0
- package/src/tidyUpAnnotation.ts +205 -0
- package/src/tidyUpSequenceData.ts +213 -0
- package/src/types.ts +109 -0
- package/threeLetterSequenceStringToAminoAcidMap.d.ts +11 -921
- package/tidyUpAnnotation.d.ts +13 -11
- package/tidyUpSequenceData.d.ts +15 -1
- package/types.d.ts +105 -0
package/index.umd.cjs
CHANGED
|
@@ -2590,9 +2590,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
|
+
return null;
|
|
2593
2594
|
}
|
|
2594
2595
|
__name(getOverlapOfNonCircularRanges, "getOverlapOfNonCircularRanges");
|
|
2595
|
-
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible) {
|
|
2596
|
+
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible = false) {
|
|
2596
2597
|
const normalizedRangeA = splitRangeIntoTwoPartsIfItIsCircular(
|
|
2597
2598
|
rangeA,
|
|
2598
2599
|
maxRangeLength
|
|
@@ -2613,6 +2614,22 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
2613
2614
|
}
|
|
2614
2615
|
});
|
|
2615
2616
|
});
|
|
2617
|
+
if (joinIfPossible && normalizedRangeA.length === 2 && normalizedRangeB.length === 2 && maxRangeLength) {
|
|
2618
|
+
const joinedOverlap = {};
|
|
2619
|
+
overlaps = flatMap(overlaps, (o) => {
|
|
2620
|
+
if (o.start === 0) {
|
|
2621
|
+
joinedOverlap.end = o.end;
|
|
2622
|
+
return [];
|
|
2623
|
+
} else if (o.end === maxRangeLength - 1) {
|
|
2624
|
+
joinedOverlap.start = o.start;
|
|
2625
|
+
return [];
|
|
2626
|
+
}
|
|
2627
|
+
return [o];
|
|
2628
|
+
});
|
|
2629
|
+
if (Object.keys(joinedOverlap).length > 0) {
|
|
2630
|
+
overlaps.push(joinedOverlap);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2616
2633
|
return overlaps;
|
|
2617
2634
|
}
|
|
2618
2635
|
__name(getOverlapsOfPotentiallyCircularRanges, "getOverlapsOfPotentiallyCircularRanges");
|
|
@@ -2684,10 +2701,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
2684
2701
|
if (!overlaps.length) {
|
|
2685
2702
|
return rangeToBeTrimmed;
|
|
2686
2703
|
}
|
|
2687
|
-
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(
|
|
2688
|
-
rangeToBeTrimmed,
|
|
2689
|
-
sequenceLength
|
|
2690
|
-
);
|
|
2704
|
+
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(rangeToBeTrimmed, sequenceLength);
|
|
2691
2705
|
splitRangesToBeTrimmed.forEach(function(nonCircularRangeToBeTrimmed, index) {
|
|
2692
2706
|
overlaps.forEach(function(overlap) {
|
|
2693
2707
|
if (nonCircularRangeToBeTrimmed) {
|
|
@@ -2730,6 +2744,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
2730
2744
|
end: outputTrimmedRange.end
|
|
2731
2745
|
});
|
|
2732
2746
|
}
|
|
2747
|
+
return void 0;
|
|
2733
2748
|
}
|
|
2734
2749
|
__name(trimRangeByAnotherRange, "trimRangeByAnotherRange");
|
|
2735
2750
|
function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted, anotherRange, maxLength) {
|
|
@@ -2876,28 +2891,36 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
2876
2891
|
}
|
|
2877
2892
|
}
|
|
2878
2893
|
}
|
|
2894
|
+
return overlaps;
|
|
2879
2895
|
}
|
|
2880
2896
|
__name(collapseOverlapsGeneratedFromRangeComparisonIfPossible, "collapseOverlapsGeneratedFromRangeComparisonIfPossible");
|
|
2881
2897
|
function provideInclusiveOptions(funToWrap) {
|
|
2882
|
-
return function() {
|
|
2883
|
-
const args = Array.prototype.slice.call(arguments);
|
|
2898
|
+
return function(...args) {
|
|
2884
2899
|
const options = args[args.length - 1];
|
|
2885
2900
|
if (options && (options.inclusive1BasedEnd || options.inclusive1BasedStart)) {
|
|
2886
2901
|
args.forEach(function(arg, index) {
|
|
2887
|
-
|
|
2888
|
-
|
|
2902
|
+
const potentialRange = arg;
|
|
2903
|
+
if (potentialRange && typeof potentialRange.start === "number" && potentialRange.start > -1 && options.inclusive1BasedStart) {
|
|
2904
|
+
args[index] = assign(potentialRange, {
|
|
2905
|
+
start: potentialRange.start - 1
|
|
2906
|
+
});
|
|
2889
2907
|
}
|
|
2890
|
-
if (
|
|
2891
|
-
args[index] = assign(
|
|
2908
|
+
if (potentialRange && typeof potentialRange.end === "number" && potentialRange.end > -1 && options.inclusive1BasedEnd) {
|
|
2909
|
+
args[index] = assign(potentialRange, {
|
|
2910
|
+
end: potentialRange.end - 1
|
|
2911
|
+
});
|
|
2892
2912
|
}
|
|
2893
2913
|
});
|
|
2894
2914
|
}
|
|
2895
2915
|
let returnVal = funToWrap.apply(this, args);
|
|
2896
|
-
|
|
2897
|
-
|
|
2916
|
+
const potentialReturn = returnVal;
|
|
2917
|
+
if (potentialReturn && typeof potentialReturn.start === "number" && potentialReturn.start > -1 && options && options.inclusive1BasedStart) {
|
|
2918
|
+
returnVal = assign(potentialReturn, {
|
|
2919
|
+
start: potentialReturn.start + 1
|
|
2920
|
+
});
|
|
2898
2921
|
}
|
|
2899
|
-
if (
|
|
2900
|
-
returnVal = assign(
|
|
2922
|
+
if (potentialReturn && typeof potentialReturn.end === "number" && potentialReturn.end > -1 && options && options.inclusive1BasedEnd) {
|
|
2923
|
+
returnVal = assign(potentialReturn, { end: potentialReturn.end + 1 });
|
|
2901
2924
|
}
|
|
2902
2925
|
return returnVal;
|
|
2903
2926
|
};
|
|
@@ -2943,7 +2966,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
2943
2966
|
return positionFits;
|
|
2944
2967
|
}
|
|
2945
2968
|
__name(isPositionWithinRange, "isPositionWithinRange");
|
|
2946
|
-
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions) {
|
|
2969
|
+
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions = false) {
|
|
2947
2970
|
let position = pPosition;
|
|
2948
2971
|
if (position < 0) {
|
|
2949
2972
|
position += sequenceLength;
|
|
@@ -3123,7 +3146,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3123
3146
|
if (typeof subSequence === "string") {
|
|
3124
3147
|
subSequence += sequence.slice(0, range.end + 1);
|
|
3125
3148
|
} else {
|
|
3126
|
-
subSequence = subSequence.concat(
|
|
3149
|
+
subSequence = subSequence.concat(
|
|
3150
|
+
sequence.slice(0, range.end + 1)
|
|
3151
|
+
);
|
|
3127
3152
|
}
|
|
3128
3153
|
return subSequence;
|
|
3129
3154
|
} else {
|
|
@@ -3143,7 +3168,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3143
3168
|
}
|
|
3144
3169
|
__name(getShortestDistanceBetweenTwoPositions, "getShortestDistanceBetweenTwoPositions");
|
|
3145
3170
|
function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, assignYOffsetToRange) {
|
|
3146
|
-
let yOffset =
|
|
3171
|
+
let yOffset = 0;
|
|
3147
3172
|
const openYOffsetFound = YOffsetLevelsWithRanges.some(
|
|
3148
3173
|
function(rangesAlreadyAddedToYOffset, index) {
|
|
3149
3174
|
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
@@ -3156,6 +3181,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3156
3181
|
);
|
|
3157
3182
|
if (!rangeBlocked) {
|
|
3158
3183
|
yOffset = index;
|
|
3184
|
+
if (assignYOffsetToRange) range.yOffset = index;
|
|
3159
3185
|
rangesAlreadyAddedToYOffset.push(range);
|
|
3160
3186
|
return true;
|
|
3161
3187
|
}
|
|
@@ -3164,6 +3190,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3164
3190
|
);
|
|
3165
3191
|
if (!openYOffsetFound) {
|
|
3166
3192
|
yOffset = YOffsetLevelsWithRanges.length;
|
|
3193
|
+
if (assignYOffsetToRange) range.yOffset = YOffsetLevelsWithRanges.length;
|
|
3167
3194
|
}
|
|
3168
3195
|
return yOffset;
|
|
3169
3196
|
}
|
|
@@ -3175,7 +3202,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3175
3202
|
ranges.forEach(function(range) {
|
|
3176
3203
|
const yOffset = getYOffsetForPotentiallyCircularRange(
|
|
3177
3204
|
range,
|
|
3178
|
-
yOffsetLevels
|
|
3205
|
+
yOffsetLevels,
|
|
3206
|
+
assignYOffsetToRange
|
|
3179
3207
|
);
|
|
3180
3208
|
yOffsets.push(yOffset);
|
|
3181
3209
|
if (yOffset > maxYOffset) {
|
|
@@ -3190,21 +3218,20 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3190
3218
|
__name(getYOffsetsForPotentiallyCircularRanges, "getYOffsetsForPotentiallyCircularRanges");
|
|
3191
3219
|
const invertRange = provideInclusiveOptions(invertRange$1);
|
|
3192
3220
|
function invertRange$1(rangeOrCaret, rangeMax) {
|
|
3193
|
-
if (rangeOrCaret.start > -1) {
|
|
3221
|
+
if (typeof rangeOrCaret !== "number" && rangeOrCaret.start > -1) {
|
|
3194
3222
|
const start = rangeOrCaret.end + 1;
|
|
3195
3223
|
const end = rangeOrCaret.start - 1;
|
|
3196
3224
|
return {
|
|
3197
3225
|
start: normalizePositionByRangeLength(start, rangeMax, false),
|
|
3198
3226
|
end: normalizePositionByRangeLength(end, rangeMax, false)
|
|
3199
3227
|
};
|
|
3200
|
-
} else {
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
};
|
|
3206
|
-
}
|
|
3228
|
+
} else if (typeof rangeOrCaret === "number" && rangeOrCaret > -1) {
|
|
3229
|
+
return {
|
|
3230
|
+
start: normalizePositionByRangeLength(rangeOrCaret, rangeMax, false),
|
|
3231
|
+
end: normalizePositionByRangeLength(rangeOrCaret - 1, rangeMax, false)
|
|
3232
|
+
};
|
|
3207
3233
|
}
|
|
3234
|
+
return void 0;
|
|
3208
3235
|
}
|
|
3209
3236
|
__name(invertRange$1, "invertRange$1");
|
|
3210
3237
|
function isPositionCloserToRangeStartThanRangeEnd(position, range, maxLength) {
|
|
@@ -3258,9 +3285,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3258
3285
|
"subRange must be fully contained by containerRange! Otherwise this function does not make sense"
|
|
3259
3286
|
);
|
|
3260
3287
|
}
|
|
3261
|
-
const newSubrange = {
|
|
3262
|
-
|
|
3263
|
-
|
|
3288
|
+
const newSubrange = {
|
|
3289
|
+
start: subRange.start - containerRange.start,
|
|
3290
|
+
end: subRange.end - containerRange.start
|
|
3291
|
+
};
|
|
3264
3292
|
if (newSubrange.start < 0) {
|
|
3265
3293
|
newSubrange.start += sequenceLength;
|
|
3266
3294
|
}
|
|
@@ -3271,10 +3299,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3271
3299
|
}
|
|
3272
3300
|
__name(zeroSubrangeByContainerRange, "zeroSubrangeByContainerRange");
|
|
3273
3301
|
function adjustRangeToRotation(rangeToBeAdjusted, rotateTo = 0, rangeLength) {
|
|
3274
|
-
const mod = rangeLength ? modulo :
|
|
3302
|
+
const mod = /* @__PURE__ */ __name((n) => rangeLength ? modulo(n, rangeLength) : n, "mod");
|
|
3275
3303
|
const newRange = assign({}, rangeToBeAdjusted, {
|
|
3276
|
-
start: mod(rangeToBeAdjusted.start - (rotateTo || 0)
|
|
3277
|
-
end: mod(rangeToBeAdjusted.end - (rotateTo || 0)
|
|
3304
|
+
start: mod(rangeToBeAdjusted.start - (rotateTo || 0)),
|
|
3305
|
+
end: mod(rangeToBeAdjusted.end - (rotateTo || 0))
|
|
3278
3306
|
});
|
|
3279
3307
|
return newRange;
|
|
3280
3308
|
}
|
|
@@ -3360,7 +3388,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3360
3388
|
forEach(
|
|
3361
3389
|
omitBy(seqsToAnnotateById, (s) => !s.sequence.length),
|
|
3362
3390
|
({ circular, sequence }, id) => {
|
|
3363
|
-
function getMatches({
|
|
3391
|
+
function getMatches({
|
|
3392
|
+
seqToMatchAgainst,
|
|
3393
|
+
isReverse,
|
|
3394
|
+
seqLen: seqLen2
|
|
3395
|
+
}) {
|
|
3364
3396
|
let match;
|
|
3365
3397
|
let lastMatch;
|
|
3366
3398
|
try {
|
|
@@ -3380,13 +3412,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3380
3412
|
};
|
|
3381
3413
|
const range = {
|
|
3382
3414
|
start: matchStart,
|
|
3383
|
-
end: normalizePositionByRangeLength(matchEnd - 1, seqLen2)
|
|
3415
|
+
end: normalizePositionByRangeLength(matchEnd - 1, seqLen2, false)
|
|
3384
3416
|
};
|
|
3385
3417
|
if (!annotationsToAddBySeqId[id])
|
|
3386
3418
|
annotationsToAddBySeqId[id] = [];
|
|
3387
3419
|
annotationsToAddBySeqId[id].push(__spreadProps(__spreadValues({}, isReverse ? {
|
|
3388
|
-
start: reversePositionInRange(range.end, seqLen2),
|
|
3389
|
-
end: reversePositionInRange(range.start, seqLen2)
|
|
3420
|
+
start: reversePositionInRange(range.end, seqLen2, false),
|
|
3421
|
+
end: reversePositionInRange(range.start, seqLen2, false)
|
|
3390
3422
|
} : range), {
|
|
3391
3423
|
strand: isReverse ? -1 : 1,
|
|
3392
3424
|
id: ann.id
|
|
@@ -3417,14 +3449,22 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3417
3449
|
const origSeq = seqsToAnnotateById[id];
|
|
3418
3450
|
const alreadyExistingAnnsByStartEnd = {};
|
|
3419
3451
|
forEach(origSeq.annotations, (ann) => {
|
|
3420
|
-
alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3452
|
+
alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3453
|
+
__spreadProps(__spreadValues({}, ann), { strand: typeof ann.strand === "string" ? 1 : ann.strand }),
|
|
3454
|
+
{ compareName }
|
|
3455
|
+
)] = ann;
|
|
3421
3456
|
});
|
|
3422
3457
|
const warningCounter = {};
|
|
3423
3458
|
const toAdd = anns.filter((ann) => {
|
|
3424
|
-
const alreadyExistingAnn = alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3459
|
+
const alreadyExistingAnn = alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3460
|
+
__spreadProps(__spreadValues({}, ann), {
|
|
3461
|
+
strand: typeof ann.strand === "string" ? 1 : ann.strand
|
|
3462
|
+
}),
|
|
3463
|
+
{ compareName }
|
|
3464
|
+
)];
|
|
3425
3465
|
if (alreadyExistingAnn) return false;
|
|
3426
|
-
if (warnIfMoreThan) {
|
|
3427
|
-
warningCounter[ann.id] = (warningCounter[ann.id] || 0) + 1;
|
|
3466
|
+
if (warnIfMoreThan && ann.id !== void 0) {
|
|
3467
|
+
warningCounter[String(ann.id)] = (warningCounter[String(ann.id)] || 0) + 1;
|
|
3428
3468
|
}
|
|
3429
3469
|
return true;
|
|
3430
3470
|
}).sort((a, b) => a.start - b.start);
|
|
@@ -3433,16 +3473,23 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3433
3473
|
}
|
|
3434
3474
|
warnIfMoreThan && forEach(warningCounter, (num, annId) => {
|
|
3435
3475
|
if (num > warnIfMoreThan) {
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3476
|
+
const warnings = toReturn["__more_than_warnings"] || {};
|
|
3477
|
+
warnings[id] = warnings[id] || [];
|
|
3478
|
+
warnings[id].push(annId);
|
|
3479
|
+
toReturn["__more_than_warnings"] = warnings;
|
|
3439
3480
|
}
|
|
3440
3481
|
});
|
|
3441
3482
|
});
|
|
3442
3483
|
return toReturn;
|
|
3443
3484
|
}
|
|
3444
3485
|
__name(autoAnnotate, "autoAnnotate");
|
|
3445
|
-
function getStartEndStr({
|
|
3486
|
+
function getStartEndStr({
|
|
3487
|
+
start,
|
|
3488
|
+
end,
|
|
3489
|
+
name,
|
|
3490
|
+
strand,
|
|
3491
|
+
forward
|
|
3492
|
+
}, { compareName }) {
|
|
3446
3493
|
const isReverse = strand === -1 || forward === false;
|
|
3447
3494
|
return `${start}-${end}-${isReverse ? "rev" : "for"}-${compareName ? name : ""}`;
|
|
3448
3495
|
}
|
|
@@ -3456,13 +3503,12 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3456
3503
|
let hitLeftCaret;
|
|
3457
3504
|
let hitRightCaret;
|
|
3458
3505
|
for (const bp of regString.replace("(", "").replace(")", "")) {
|
|
3459
|
-
let maybeHandleRightCaret = function(justAdded) {
|
|
3506
|
+
let maybeHandleRightCaret = /* @__PURE__ */ __name(function(justAdded) {
|
|
3460
3507
|
if (hitRightCaret) {
|
|
3461
3508
|
rightOfCaretHolder += justAdded;
|
|
3462
3509
|
afterRightCaretHolder = `${rightOfCaretHolder}${afterRightCaretHolder.length ? "|" : ""}${afterRightCaretHolder}`;
|
|
3463
3510
|
}
|
|
3464
|
-
};
|
|
3465
|
-
__name(maybeHandleRightCaret, "maybeHandleRightCaret");
|
|
3511
|
+
}, "maybeHandleRightCaret");
|
|
3466
3512
|
const ambigVal = ambiguous_dna_values[bp.toUpperCase()];
|
|
3467
3513
|
if (ambigVal && ambigVal.length > 1) {
|
|
3468
3514
|
let valToUse;
|
|
@@ -3647,16 +3693,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3647
3693
|
})),
|
|
3648
3694
|
"name"
|
|
3649
3695
|
);
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
featureOverrides = featureOverrides.map((fo) => {
|
|
3696
|
+
const featureOverrides = typeof window !== "undefined" && get$1(window, "tg_featureTypeOverrides") || typeof global !== "undefined" && get$1(global, "tg_featureTypeOverrides") || [];
|
|
3697
|
+
const mappedOverrides = featureOverrides.map((fo) => {
|
|
3653
3698
|
const originalGenbankFeat = keyedGBFeats[fo.name];
|
|
3654
3699
|
return __spreadValues(__spreadValues(__spreadValues({}, originalGenbankFeat), fo), originalGenbankFeat ? { isOverridden: true } : { isCustomType: true });
|
|
3655
3700
|
});
|
|
3656
|
-
|
|
3657
|
-
return __spreadValues(__spreadValues({}, keyedGBFeats),
|
|
3701
|
+
const keyedOverrides = keyBy(mappedOverrides, "name");
|
|
3702
|
+
return __spreadValues(__spreadValues({}, keyedGBFeats), keyedOverrides);
|
|
3658
3703
|
}, "getMergedFeatureMap");
|
|
3659
|
-
const getFeatureToColorMap = /* @__PURE__ */ __name(({
|
|
3704
|
+
const getFeatureToColorMap = /* @__PURE__ */ __name(({
|
|
3705
|
+
includeHidden
|
|
3706
|
+
} = {}) => {
|
|
3660
3707
|
const toRet = {};
|
|
3661
3708
|
filter(
|
|
3662
3709
|
getMergedFeatureMap(),
|
|
@@ -3666,7 +3713,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3666
3713
|
});
|
|
3667
3714
|
return toRet;
|
|
3668
3715
|
}, "getFeatureToColorMap");
|
|
3669
|
-
const getFeatureTypes = /* @__PURE__ */ __name(({
|
|
3716
|
+
const getFeatureTypes = /* @__PURE__ */ __name(({
|
|
3717
|
+
includeHidden
|
|
3718
|
+
} = {}) => filter(getMergedFeatureMap(), (f) => includeHidden ? true : !f.isHidden).map(
|
|
3670
3719
|
(f) => f.name
|
|
3671
3720
|
), "getFeatureTypes");
|
|
3672
3721
|
function getDefaultExportFromCjs(x) {
|
|
@@ -3971,10 +4020,15 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3971
4020
|
var shortidExports = requireShortid();
|
|
3972
4021
|
const shortid = /* @__PURE__ */ getDefaultExportFromCjs(shortidExports);
|
|
3973
4022
|
function cutSequenceByRestrictionEnzyme(pSequence, circular, restrictionEnzyme) {
|
|
3974
|
-
if (restrictionEnzyme.forwardRegex
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
4023
|
+
if (!restrictionEnzyme.forwardRegex || // Add check for undefined
|
|
4024
|
+
!restrictionEnzyme.reverseRegex || // Add check for undefined
|
|
4025
|
+
restrictionEnzyme.forwardRegex.length === 0 || restrictionEnzyme.reverseRegex.length === 0) {
|
|
4026
|
+
console.warn(
|
|
4027
|
+
"Cannot cut sequence. Enzyme restriction site must be at least 1 bp long."
|
|
4028
|
+
);
|
|
4029
|
+
const returnVal = [];
|
|
4030
|
+
returnVal.error = "Cannot cut sequence. Enzyme restriction site must be at least 1 bp long.";
|
|
4031
|
+
return returnVal;
|
|
3978
4032
|
}
|
|
3979
4033
|
const forwardRegExpPattern = new RegExp(restrictionEnzyme.forwardRegex, "ig");
|
|
3980
4034
|
const sequence = pSequence;
|
|
@@ -3999,54 +4053,54 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3999
4053
|
}
|
|
4000
4054
|
return cutsitesForward.concat(cutsitesReverse);
|
|
4001
4055
|
function reverseAllPositionsOfCutsite(cutsite, rangeLength) {
|
|
4056
|
+
cutsite = assign({}, cutsite);
|
|
4002
4057
|
cutsite.start = reversePositionInRange(cutsite.start, rangeLength, false);
|
|
4003
4058
|
cutsite.end = reversePositionInRange(cutsite.end, rangeLength, false);
|
|
4004
|
-
cutsite.topSnipPosition = reversePositionInRange(
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4059
|
+
cutsite.topSnipPosition = cutsite.topSnipPosition != null ? reversePositionInRange(cutsite.topSnipPosition, rangeLength, true) : null;
|
|
4060
|
+
cutsite.bottomSnipPosition = cutsite.bottomSnipPosition != null ? reversePositionInRange(cutsite.bottomSnipPosition, rangeLength, true) : null;
|
|
4061
|
+
if (cutsite.cutType === 1 && cutsite.cutsTwice) {
|
|
4062
|
+
if (cutsite.upstreamTopSnip != null && cutsite.upstreamBottomSnip != null) {
|
|
4063
|
+
cutsite.upstreamTopSnip = reversePositionInRange(
|
|
4064
|
+
cutsite.upstreamTopSnip,
|
|
4065
|
+
rangeLength,
|
|
4066
|
+
true
|
|
4067
|
+
);
|
|
4068
|
+
cutsite.upstreamBottomSnip = reversePositionInRange(
|
|
4069
|
+
cutsite.upstreamBottomSnip,
|
|
4070
|
+
rangeLength,
|
|
4071
|
+
true
|
|
4072
|
+
);
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
if (cutsite.recognitionSiteRange) {
|
|
4076
|
+
cutsite.recognitionSiteRange = __spreadValues({}, cutsite.recognitionSiteRange);
|
|
4077
|
+
cutsite.recognitionSiteRange.start = reversePositionInRange(
|
|
4078
|
+
cutsite.recognitionSiteRange.start,
|
|
4017
4079
|
rangeLength,
|
|
4018
|
-
|
|
4080
|
+
false
|
|
4019
4081
|
);
|
|
4020
|
-
cutsite.
|
|
4021
|
-
cutsite.
|
|
4082
|
+
cutsite.recognitionSiteRange.end = reversePositionInRange(
|
|
4083
|
+
cutsite.recognitionSiteRange.end,
|
|
4022
4084
|
rangeLength,
|
|
4023
|
-
|
|
4085
|
+
false
|
|
4024
4086
|
);
|
|
4025
4087
|
}
|
|
4026
|
-
cutsite
|
|
4027
|
-
cutsite.recognitionSiteRange.start,
|
|
4028
|
-
rangeLength,
|
|
4029
|
-
false
|
|
4030
|
-
);
|
|
4031
|
-
cutsite.recognitionSiteRange.end = reversePositionInRange(
|
|
4032
|
-
cutsite.recognitionSiteRange.end,
|
|
4033
|
-
rangeLength,
|
|
4034
|
-
false
|
|
4035
|
-
);
|
|
4036
|
-
return assign({}, cutsite, {
|
|
4088
|
+
return __spreadProps(__spreadValues({}, cutsite), {
|
|
4037
4089
|
start: cutsite.end,
|
|
4038
4090
|
end: cutsite.start,
|
|
4039
|
-
overhangBps: getReverseComplementSequenceString(
|
|
4091
|
+
overhangBps: getReverseComplementSequenceString(
|
|
4092
|
+
cutsite.overhangBps || ""
|
|
4093
|
+
),
|
|
4040
4094
|
topSnipPosition: cutsite.bottomSnipPosition,
|
|
4041
4095
|
bottomSnipPosition: cutsite.topSnipPosition,
|
|
4042
4096
|
upstreamTopSnip: cutsite.upstreamBottomSnip,
|
|
4043
4097
|
upstreamBottomSnip: cutsite.upstreamTopSnip,
|
|
4044
4098
|
upstreamTopBeforeBottom: !!cutsite.upstreamTopBeforeBottom,
|
|
4045
4099
|
topSnipBeforeBottom: !!cutsite.topSnipBeforeBottom,
|
|
4046
|
-
recognitionSiteRange: {
|
|
4100
|
+
recognitionSiteRange: cutsite.recognitionSiteRange ? {
|
|
4047
4101
|
start: cutsite.recognitionSiteRange.end,
|
|
4048
4102
|
end: cutsite.recognitionSiteRange.start
|
|
4049
|
-
},
|
|
4103
|
+
} : void 0,
|
|
4050
4104
|
forward: false
|
|
4051
4105
|
});
|
|
4052
4106
|
}
|
|
@@ -4058,7 +4112,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4058
4112
|
let restrictionCutSite;
|
|
4059
4113
|
const recognitionSiteLength = restrictionEnzyme.site.length;
|
|
4060
4114
|
const originalSequence = sequence;
|
|
4061
|
-
const
|
|
4115
|
+
const originalSequenceLengthVal = sequence.length;
|
|
4062
4116
|
if (circular) {
|
|
4063
4117
|
sequence += sequence;
|
|
4064
4118
|
}
|
|
@@ -4067,7 +4121,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4067
4121
|
let startIndex = 0;
|
|
4068
4122
|
let subSequence = sequence;
|
|
4069
4123
|
while (matchIndex !== -1) {
|
|
4070
|
-
const recognitionSiteRange = {
|
|
4124
|
+
const recognitionSiteRange = {
|
|
4125
|
+
start: 0,
|
|
4126
|
+
end: 0
|
|
4127
|
+
};
|
|
4071
4128
|
let start;
|
|
4072
4129
|
let end;
|
|
4073
4130
|
let upstreamTopSnip = null;
|
|
@@ -4082,37 +4139,39 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4082
4139
|
recognitionSiteRange.end = matchIndex + recognitionSiteLength - 1 + startIndex;
|
|
4083
4140
|
end = recognitionSiteRange.end;
|
|
4084
4141
|
if (restrictionEnzyme.cutType === 1) {
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
if (
|
|
4091
|
-
start
|
|
4142
|
+
if (restrictionEnzyme.usForward != null && restrictionEnzyme.usReverse != null) {
|
|
4143
|
+
upstreamTopSnip = recognitionSiteRange.end - restrictionEnzyme.usForward;
|
|
4144
|
+
upstreamBottomSnip = recognitionSiteRange.end - restrictionEnzyme.usReverse;
|
|
4145
|
+
if (upstreamTopSnip >= 0 && upstreamBottomSnip >= 0) {
|
|
4146
|
+
fitsWithinSequence = true;
|
|
4147
|
+
if (upstreamTopSnip < upstreamBottomSnip) {
|
|
4148
|
+
if (start > upstreamTopSnip) {
|
|
4149
|
+
start = upstreamTopSnip + 1;
|
|
4150
|
+
}
|
|
4151
|
+
upstreamTopBeforeBottom = true;
|
|
4152
|
+
} else {
|
|
4153
|
+
if (start > upstreamBottomSnip) {
|
|
4154
|
+
start = upstreamBottomSnip + 1;
|
|
4155
|
+
}
|
|
4092
4156
|
}
|
|
4093
|
-
|
|
4157
|
+
upstreamTopSnip = normalizePositionByRangeLength(
|
|
4158
|
+
upstreamTopSnip,
|
|
4159
|
+
originalSequenceLengthVal,
|
|
4160
|
+
true
|
|
4161
|
+
);
|
|
4162
|
+
upstreamBottomSnip = normalizePositionByRangeLength(
|
|
4163
|
+
upstreamBottomSnip,
|
|
4164
|
+
originalSequenceLengthVal,
|
|
4165
|
+
true
|
|
4166
|
+
);
|
|
4094
4167
|
} else {
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
}
|
|
4168
|
+
upstreamTopSnip = null;
|
|
4169
|
+
upstreamBottomSnip = null;
|
|
4098
4170
|
}
|
|
4099
|
-
upstreamTopSnip = normalizePositionByRangeLength(
|
|
4100
|
-
upstreamTopSnip,
|
|
4101
|
-
originalSequenceLength,
|
|
4102
|
-
true
|
|
4103
|
-
);
|
|
4104
|
-
upstreamBottomSnip = normalizePositionByRangeLength(
|
|
4105
|
-
upstreamBottomSnip,
|
|
4106
|
-
originalSequenceLength,
|
|
4107
|
-
true
|
|
4108
|
-
);
|
|
4109
|
-
} else {
|
|
4110
|
-
upstreamTopSnip = null;
|
|
4111
|
-
upstreamBottomSnip = null;
|
|
4112
4171
|
}
|
|
4113
4172
|
}
|
|
4114
|
-
topSnipPosition = recognitionSiteRange.start + restrictionEnzyme.topSnipOffset;
|
|
4115
|
-
bottomSnipPosition = recognitionSiteRange.start + restrictionEnzyme.bottomSnipOffset;
|
|
4173
|
+
topSnipPosition = recognitionSiteRange.start + (restrictionEnzyme.topSnipOffset || 0);
|
|
4174
|
+
bottomSnipPosition = recognitionSiteRange.start + (restrictionEnzyme.bottomSnipOffset || 0);
|
|
4116
4175
|
if (bottomSnipPosition <= currentSequenceLength && topSnipPosition <= currentSequenceLength) {
|
|
4117
4176
|
fitsWithinSequence = true;
|
|
4118
4177
|
if (topSnipPosition > bottomSnipPosition) {
|
|
@@ -4127,61 +4186,70 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4127
4186
|
}
|
|
4128
4187
|
topSnipPosition = normalizePositionByRangeLength(
|
|
4129
4188
|
topSnipPosition,
|
|
4130
|
-
|
|
4189
|
+
originalSequenceLengthVal,
|
|
4131
4190
|
true
|
|
4132
4191
|
);
|
|
4133
4192
|
bottomSnipPosition = normalizePositionByRangeLength(
|
|
4134
4193
|
bottomSnipPosition,
|
|
4135
|
-
|
|
4194
|
+
originalSequenceLengthVal,
|
|
4136
4195
|
true
|
|
4137
4196
|
);
|
|
4138
4197
|
} else {
|
|
4139
4198
|
topSnipPosition = null;
|
|
4140
4199
|
bottomSnipPosition = null;
|
|
4141
4200
|
}
|
|
4142
|
-
if (fitsWithinSequence && start >= 0 && end >= 0 && start <
|
|
4201
|
+
if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLengthVal && end < currentSequenceLength) {
|
|
4143
4202
|
start = normalizePositionByRangeLength(
|
|
4144
4203
|
start,
|
|
4145
|
-
|
|
4204
|
+
originalSequenceLengthVal,
|
|
4205
|
+
false
|
|
4206
|
+
);
|
|
4207
|
+
end = normalizePositionByRangeLength(
|
|
4208
|
+
end,
|
|
4209
|
+
originalSequenceLengthVal,
|
|
4146
4210
|
false
|
|
4147
4211
|
);
|
|
4148
|
-
end = normalizePositionByRangeLength(end, originalSequenceLength, false);
|
|
4149
4212
|
recognitionSiteRange.start = normalizePositionByRangeLength(
|
|
4150
4213
|
recognitionSiteRange.start,
|
|
4151
|
-
|
|
4214
|
+
originalSequenceLengthVal,
|
|
4152
4215
|
false
|
|
4153
4216
|
);
|
|
4154
4217
|
recognitionSiteRange.end = normalizePositionByRangeLength(
|
|
4155
4218
|
recognitionSiteRange.end,
|
|
4156
|
-
|
|
4219
|
+
originalSequenceLengthVal,
|
|
4157
4220
|
false
|
|
4158
4221
|
);
|
|
4159
4222
|
let cutRange = {
|
|
4160
4223
|
start: -1,
|
|
4161
4224
|
end: -1
|
|
4162
4225
|
};
|
|
4163
|
-
if (topSnipPosition !== bottomSnipPosition) {
|
|
4226
|
+
if (topSnipPosition !== null && bottomSnipPosition !== null && topSnipPosition !== bottomSnipPosition) {
|
|
4164
4227
|
cutRange = topSnipBeforeBottom ? {
|
|
4165
4228
|
start: topSnipPosition,
|
|
4166
4229
|
end: normalizePositionByRangeLength(
|
|
4167
4230
|
bottomSnipPosition - 1,
|
|
4168
|
-
|
|
4231
|
+
originalSequenceLengthVal
|
|
4169
4232
|
)
|
|
4170
4233
|
} : {
|
|
4171
4234
|
start: bottomSnipPosition,
|
|
4172
4235
|
end: normalizePositionByRangeLength(
|
|
4173
4236
|
topSnipPosition - 1,
|
|
4174
|
-
|
|
4237
|
+
originalSequenceLengthVal
|
|
4175
4238
|
)
|
|
4176
4239
|
};
|
|
4177
4240
|
}
|
|
4178
|
-
const overhangBps = getSequenceWithinRange(
|
|
4241
|
+
const overhangBps = getSequenceWithinRange(
|
|
4242
|
+
cutRange,
|
|
4243
|
+
originalSequence
|
|
4244
|
+
);
|
|
4179
4245
|
restrictionCutSite = {
|
|
4180
4246
|
id: shortid(),
|
|
4181
4247
|
start,
|
|
4182
4248
|
end,
|
|
4183
4249
|
topSnipPosition,
|
|
4250
|
+
// Allow null
|
|
4184
4251
|
bottomSnipPosition,
|
|
4252
|
+
// Allow null
|
|
4185
4253
|
topSnipBeforeBottom,
|
|
4186
4254
|
overhangBps,
|
|
4187
4255
|
overhangSize: overhangBps.length,
|
|
@@ -4203,16 +4271,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4203
4271
|
return restrictionCutSites;
|
|
4204
4272
|
}
|
|
4205
4273
|
__name(cutSequence, "cutSequence");
|
|
4206
|
-
function getCutsitesFromSequence(sequence, circular,
|
|
4207
|
-
const
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4274
|
+
function getCutsitesFromSequence(sequence, circular, contextEnzymes) {
|
|
4275
|
+
const cutsites = flatMap(contextEnzymes, (enzyme) => {
|
|
4276
|
+
return cutSequenceByRestrictionEnzyme(sequence, circular, enzyme);
|
|
4277
|
+
});
|
|
4278
|
+
const cutsitesByNameMap = {};
|
|
4279
|
+
cutsites.forEach((cutsite) => {
|
|
4280
|
+
const name = cutsite.name || "";
|
|
4281
|
+
if (!cutsitesByNameMap[name]) {
|
|
4282
|
+
cutsitesByNameMap[name] = [];
|
|
4213
4283
|
}
|
|
4214
|
-
|
|
4215
|
-
|
|
4284
|
+
cutsitesByNameMap[name].push(cutsite);
|
|
4285
|
+
});
|
|
4286
|
+
return cutsitesByNameMap;
|
|
4216
4287
|
}
|
|
4217
4288
|
__name(getCutsitesFromSequence, "getCutsitesFromSequence");
|
|
4218
4289
|
function computeDigestFragments({
|
|
@@ -4230,9 +4301,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4230
4301
|
const fragments = [];
|
|
4231
4302
|
const overlappingEnzymes = [];
|
|
4232
4303
|
const pairs = [];
|
|
4233
|
-
const sortedCutsites = cutsites.
|
|
4234
|
-
|
|
4235
|
-
|
|
4304
|
+
const sortedCutsites = cutsites.filter(
|
|
4305
|
+
(c) => c.topSnipPosition != null && c.bottomSnipPosition != null
|
|
4306
|
+
);
|
|
4236
4307
|
if (!circular && cutsites.length) {
|
|
4237
4308
|
sortedCutsites.push({
|
|
4238
4309
|
id: "seqTerm_" + shortid(),
|
|
@@ -4241,6 +4312,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4241
4312
|
overhangBps: "",
|
|
4242
4313
|
topSnipPosition: 0,
|
|
4243
4314
|
bottomSnipPosition: 0,
|
|
4315
|
+
overhangSize: 0,
|
|
4316
|
+
// Added to satisfy CutSite
|
|
4244
4317
|
upstreamTopSnip: 0,
|
|
4245
4318
|
upstreamBottomSnip: 0,
|
|
4246
4319
|
upstreamTopBeforeBottom: false,
|
|
@@ -4251,26 +4324,34 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4251
4324
|
},
|
|
4252
4325
|
forward: true,
|
|
4253
4326
|
name: "Sequence_Terminus",
|
|
4327
|
+
type: "START_OR_END_OF_SEQ",
|
|
4254
4328
|
restrictionEnzyme: {
|
|
4255
|
-
name: "Sequence_Terminus"
|
|
4329
|
+
name: "Sequence_Terminus",
|
|
4330
|
+
site: "",
|
|
4331
|
+
forwardRegex: "",
|
|
4332
|
+
reverseRegex: ""
|
|
4256
4333
|
}
|
|
4257
4334
|
});
|
|
4258
4335
|
}
|
|
4336
|
+
sortedCutsites.sort((a, b) => {
|
|
4337
|
+
return a.topSnipPosition - b.topSnipPosition;
|
|
4338
|
+
});
|
|
4259
4339
|
sortedCutsites.forEach((cutsite1, index) => {
|
|
4340
|
+
if (!computeDigestDisabled) {
|
|
4341
|
+
pairs.push([
|
|
4342
|
+
cutsite1,
|
|
4343
|
+
sortedCutsites[index + 1] ? sortedCutsites[index + 1] : sortedCutsites[0]
|
|
4344
|
+
]);
|
|
4345
|
+
}
|
|
4260
4346
|
if (computePartialDigest && !computePartialDigestDisabled) {
|
|
4261
4347
|
sortedCutsites.forEach((cs, index2) => {
|
|
4262
|
-
|
|
4348
|
+
const isAdjacent = index2 === index + 1 || index === sortedCutsites.length - 1 && index2 === 0;
|
|
4349
|
+
if (isAdjacent) {
|
|
4263
4350
|
return;
|
|
4264
4351
|
}
|
|
4265
4352
|
pairs.push([cutsite1, sortedCutsites[index2]]);
|
|
4266
4353
|
});
|
|
4267
4354
|
}
|
|
4268
|
-
if (!computeDigestDisabled) {
|
|
4269
|
-
pairs.push([
|
|
4270
|
-
cutsite1,
|
|
4271
|
-
sortedCutsites[index + 1] ? sortedCutsites[index + 1] : sortedCutsites[0]
|
|
4272
|
-
]);
|
|
4273
|
-
}
|
|
4274
4355
|
});
|
|
4275
4356
|
pairs.forEach((r) => {
|
|
4276
4357
|
let [cut1, cut2] = r;
|
|
@@ -4315,12 +4396,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4315
4396
|
cut2.name = "Linear_Sequence_End";
|
|
4316
4397
|
cut2.restrictionEnzyme.name = "Linear_Sequence_End";
|
|
4317
4398
|
}
|
|
4399
|
+
cut1 = __spreadProps(__spreadValues({}, cut1), {
|
|
4400
|
+
isOverhangIncludedInFragmentSize: cut1.name !== "Linear_Sequence_Start" && cut1.name !== "Sequence_Terminus" && (cut1.overhangSize || 0) > 0 && !!cut1.topSnipBeforeBottom
|
|
4401
|
+
});
|
|
4402
|
+
cut2 = __spreadProps(__spreadValues({}, cut2), {
|
|
4403
|
+
isOverhangIncludedInFragmentSize: cut2.name !== "Linear_Sequence_End" && cut2.name !== "Sequence_Terminus" && (cut2.overhangSize || 0) > 0 && !cut2.topSnipBeforeBottom
|
|
4404
|
+
});
|
|
4318
4405
|
const id = start + "-" + end + "-" + size + "-";
|
|
4319
4406
|
const name = `${cut1.restrictionEnzyme.name} -- ${cut2.restrictionEnzyme.name} ${size} bps`;
|
|
4320
|
-
getRangeLength({ start, end }, sequenceLength);
|
|
4321
4407
|
fragments.push({
|
|
4322
4408
|
isFormedFromLinearEnd,
|
|
4323
|
-
madeFromOneCutsite: cut1 === cut2,
|
|
4409
|
+
madeFromOneCutsite: cut1.id === cut2.id,
|
|
4324
4410
|
start,
|
|
4325
4411
|
end,
|
|
4326
4412
|
size,
|
|
@@ -4361,12 +4447,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4361
4447
|
includeOverAndUnderHangs
|
|
4362
4448
|
}) {
|
|
4363
4449
|
const cutsitesByName = getCutsitesFromSequence(sequence, circular, enzymes);
|
|
4364
|
-
|
|
4450
|
+
const digest = computeDigestFragments({
|
|
4365
4451
|
includeOverAndUnderHangs,
|
|
4366
4452
|
cutsites: flatMap(cutsitesByName),
|
|
4367
4453
|
sequenceLength: sequence.length,
|
|
4368
4454
|
circular
|
|
4369
4455
|
});
|
|
4456
|
+
digest.fragments.sort((a, b) => b.size - a.size);
|
|
4457
|
+
return digest;
|
|
4370
4458
|
}
|
|
4371
4459
|
__name(getDigestFragsForSeqAndEnzymes, "getDigestFragsForSeqAndEnzymes");
|
|
4372
4460
|
function cloneRegExp(re) {
|
|
@@ -5935,7 +6023,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5935
6023
|
let allPossibleThreeLetterCodons = [""];
|
|
5936
6024
|
for (const set of picks) {
|
|
5937
6025
|
const next = [];
|
|
5938
|
-
for (const prefix of allPossibleThreeLetterCodons)
|
|
6026
|
+
for (const prefix of allPossibleThreeLetterCodons)
|
|
6027
|
+
for (const b of set) next.push(prefix + b);
|
|
5939
6028
|
allPossibleThreeLetterCodons = next;
|
|
5940
6029
|
}
|
|
5941
6030
|
let foundAminoAcid = null;
|
|
@@ -5981,10 +6070,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5981
6070
|
if (aa) {
|
|
5982
6071
|
return aa;
|
|
5983
6072
|
}
|
|
5984
|
-
const letter =
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
6073
|
+
const letter = (
|
|
6074
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6075
|
+
degenerateDnaToAminoAcidMap[
|
|
6076
|
+
sequenceString.replace("x", "n")
|
|
6077
|
+
//replace x's with n's as those are equivalent dna chars
|
|
6078
|
+
] || "x"
|
|
6079
|
+
);
|
|
5988
6080
|
return proteinAlphabet[letter.toUpperCase()];
|
|
5989
6081
|
}
|
|
5990
6082
|
__name(getAminoAcidFromSequenceTriplet, "getAminoAcidFromSequenceTriplet");
|
|
@@ -6381,25 +6473,25 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6381
6473
|
circular,
|
|
6382
6474
|
name
|
|
6383
6475
|
}) {
|
|
6384
|
-
location.start = parseInt(location.start, 10);
|
|
6385
|
-
location.end = parseInt(location.end, 10);
|
|
6476
|
+
location.start = parseInt(String(location.start), 10);
|
|
6477
|
+
location.end = parseInt(String(location.end), 10);
|
|
6386
6478
|
if (convertAnnotationsFromAAIndices) {
|
|
6387
6479
|
location.start = location.start * 3;
|
|
6388
6480
|
location.end = location.end * 3 + 2;
|
|
6389
6481
|
}
|
|
6390
|
-
if (
|
|
6482
|
+
if (size !== void 0 && (location.start < 0 || location.start > size - 1)) {
|
|
6391
6483
|
messages.push(
|
|
6392
6484
|
"Invalid annotation start: " + location.start + " detected for " + location.name + " and set to size: " + size
|
|
6393
6485
|
);
|
|
6394
6486
|
location.start = Math.max(0, size - (isProtein ? 3 : 1));
|
|
6395
6487
|
}
|
|
6396
|
-
if (
|
|
6488
|
+
if (size !== void 0 && (location.end < 0 || location.end > size - 1)) {
|
|
6397
6489
|
messages.push(
|
|
6398
6490
|
"Invalid annotation end: " + location.end + " detected for " + location.name + " and set to seq size: " + size
|
|
6399
6491
|
);
|
|
6400
6492
|
location.end = Math.max(0, size - 1);
|
|
6401
6493
|
}
|
|
6402
|
-
if (location.start > location.end && circular === false) {
|
|
6494
|
+
if (size !== void 0 && location.start > location.end && circular === false) {
|
|
6403
6495
|
messages.push(
|
|
6404
6496
|
"Invalid circular annotation detected for " + name + ". end set to 1"
|
|
6405
6497
|
);
|
|
@@ -6408,21 +6500,30 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6408
6500
|
}
|
|
6409
6501
|
__name(coerceLocation, "coerceLocation");
|
|
6410
6502
|
function getDegenerateDnaStringFromAAString(aaString) {
|
|
6411
|
-
return aaString.split("").map(
|
|
6503
|
+
return aaString.split("").map(
|
|
6504
|
+
(char) => aminoAcidToDegenerateDnaMap[char.toLowerCase()] || "nnn"
|
|
6505
|
+
).join("");
|
|
6412
6506
|
}
|
|
6413
6507
|
__name(getDegenerateDnaStringFromAAString, "getDegenerateDnaStringFromAAString");
|
|
6414
|
-
function getAminoAcidStringFromSequenceString(sequenceString,
|
|
6508
|
+
function getAminoAcidStringFromSequenceString(sequenceString, options = {}) {
|
|
6509
|
+
const { doNotExcludeAsterisk } = options;
|
|
6415
6510
|
const aminoAcidsPerBase = getAminoAcidDataForEachBaseOfDna(
|
|
6416
6511
|
sequenceString,
|
|
6417
|
-
true
|
|
6512
|
+
true,
|
|
6513
|
+
null,
|
|
6514
|
+
false
|
|
6418
6515
|
);
|
|
6419
6516
|
const aaArray = [];
|
|
6420
6517
|
let aaString = "";
|
|
6421
6518
|
aminoAcidsPerBase.forEach((aa, index) => {
|
|
6519
|
+
var _a;
|
|
6422
6520
|
if (!aa.fullCodon) {
|
|
6423
6521
|
return;
|
|
6424
6522
|
}
|
|
6425
|
-
if (!doNotExcludeAsterisk && index >= aminoAcidsPerBase.length - 3 && aa.aminoAcid.value === "*") {
|
|
6523
|
+
if (!doNotExcludeAsterisk && index >= aminoAcidsPerBase.length - 3 && ((_a = aa.aminoAcid) == null ? void 0 : _a.value) === "*") {
|
|
6524
|
+
return;
|
|
6525
|
+
}
|
|
6526
|
+
if (aa.aminoAcidIndex === null || !aa.aminoAcid) {
|
|
6426
6527
|
return;
|
|
6427
6528
|
}
|
|
6428
6529
|
aaArray[aa.aminoAcidIndex] = aa.aminoAcid.value;
|
|
@@ -6449,7 +6550,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6449
6550
|
messages: []
|
|
6450
6551
|
};
|
|
6451
6552
|
if (!seqData) {
|
|
6452
|
-
seqData = {};
|
|
6553
|
+
seqData = { sequence: "" };
|
|
6453
6554
|
}
|
|
6454
6555
|
if (!seqData.sequence) {
|
|
6455
6556
|
seqData.sequence = "";
|
|
@@ -6512,25 +6613,27 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6512
6613
|
const featureTypes = getFeatureTypes();
|
|
6513
6614
|
annotationTypes.forEach((annotationType) => {
|
|
6514
6615
|
if (!Array.isArray(seqData[annotationType])) {
|
|
6515
|
-
if (typeof seqData[annotationType] === "object") {
|
|
6516
|
-
seqData[annotationType] = Object.keys(
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
);
|
|
6616
|
+
if (seqData[annotationType] && typeof seqData[annotationType] === "object") {
|
|
6617
|
+
seqData[annotationType] = Object.keys(
|
|
6618
|
+
seqData[annotationType]
|
|
6619
|
+
).map((key) => {
|
|
6620
|
+
return seqData[annotationType][key];
|
|
6621
|
+
});
|
|
6521
6622
|
} else {
|
|
6522
6623
|
seqData[annotationType] = [];
|
|
6523
6624
|
}
|
|
6524
6625
|
}
|
|
6525
|
-
seqData[annotationType] = seqData[annotationType].filter(
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6626
|
+
seqData[annotationType] = seqData[annotationType].filter(
|
|
6627
|
+
(annotation) => {
|
|
6628
|
+
return tidyUpAnnotation(annotation, __spreadProps(__spreadValues({}, options), {
|
|
6629
|
+
featureTypes,
|
|
6630
|
+
sequenceData: seqData,
|
|
6631
|
+
convertAnnotationsFromAAIndices,
|
|
6632
|
+
mutative: true,
|
|
6633
|
+
annotationType
|
|
6634
|
+
}));
|
|
6635
|
+
}
|
|
6636
|
+
);
|
|
6534
6637
|
});
|
|
6535
6638
|
if (!noTranslationData) {
|
|
6536
6639
|
seqData.translations = flatMap(seqData.translations, (translation) => {
|
|
@@ -6538,7 +6641,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6538
6641
|
if (noCdsTranslations && translation.translationType === "CDS Feature") {
|
|
6539
6642
|
return [];
|
|
6540
6643
|
}
|
|
6541
|
-
const codonStart = ((_b = (_a = translation == null ? void 0 : translation.notes) == null ? void 0 : _a
|
|
6644
|
+
const codonStart = ((_b = (_a = translation == null ? void 0 : translation.notes) == null ? void 0 : _a["codon_start"]) == null ? void 0 : _b[0]) - 1 || 0;
|
|
6542
6645
|
const expandedRange = expandOrContractRangeByLength(
|
|
6543
6646
|
translation,
|
|
6544
6647
|
-codonStart,
|
|
@@ -6548,8 +6651,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6548
6651
|
if (!expandedRange.aminoAcids && !seqData.noSequence) {
|
|
6549
6652
|
expandedRange.aminoAcids = getAminoAcidDataForEachBaseOfDna(
|
|
6550
6653
|
seqData.sequence,
|
|
6551
|
-
expandedRange.forward,
|
|
6552
|
-
expandedRange
|
|
6654
|
+
expandedRange.forward || false,
|
|
6655
|
+
expandedRange,
|
|
6656
|
+
false
|
|
6553
6657
|
);
|
|
6554
6658
|
}
|
|
6555
6659
|
return expandedRange;
|
|
@@ -6557,19 +6661,22 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6557
6661
|
}
|
|
6558
6662
|
if (annotationsAsObjects) {
|
|
6559
6663
|
annotationTypes.forEach((name) => {
|
|
6560
|
-
seqData[name] = seqData[name].reduce(
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6664
|
+
seqData[name] = seqData[name].reduce(
|
|
6665
|
+
(acc, item) => {
|
|
6666
|
+
let itemId;
|
|
6667
|
+
if (item.id || item.id === 0) {
|
|
6668
|
+
itemId = item.id;
|
|
6669
|
+
} else {
|
|
6670
|
+
itemId = shortid();
|
|
6671
|
+
if (!doNotProvideIdsForAnnotations) {
|
|
6672
|
+
item.id = itemId;
|
|
6673
|
+
}
|
|
6568
6674
|
}
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6675
|
+
acc[itemId] = item;
|
|
6676
|
+
return acc;
|
|
6677
|
+
},
|
|
6678
|
+
{}
|
|
6679
|
+
);
|
|
6573
6680
|
});
|
|
6574
6681
|
}
|
|
6575
6682
|
if (logMessages && response.messages.length > 0) {
|
|
@@ -6579,17 +6686,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6579
6686
|
}
|
|
6580
6687
|
__name(tidyUpSequenceData, "tidyUpSequenceData");
|
|
6581
6688
|
const getDiffFromSeqs = /* @__PURE__ */ __name((oldData, newData, { ignoreKeys = [] } = {}) => {
|
|
6582
|
-
|
|
6689
|
+
const cleanedOldData = tidyUpSequenceData(oldData, {
|
|
6583
6690
|
annotationsAsObjects: true,
|
|
6584
6691
|
noTranslationData: true,
|
|
6585
6692
|
doNotRemoveInvalidChars: true
|
|
6586
6693
|
});
|
|
6587
|
-
|
|
6694
|
+
const cleanedNewData = tidyUpSequenceData(newData, {
|
|
6588
6695
|
annotationsAsObjects: true,
|
|
6589
6696
|
noTranslationData: true,
|
|
6590
6697
|
doNotRemoveInvalidChars: true
|
|
6591
6698
|
});
|
|
6592
|
-
[
|
|
6699
|
+
[cleanedOldData, cleanedNewData].forEach((d) => {
|
|
6593
6700
|
[
|
|
6594
6701
|
"cutsites",
|
|
6595
6702
|
"orfs",
|
|
@@ -6612,27 +6719,26 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6612
6719
|
});
|
|
6613
6720
|
}
|
|
6614
6721
|
});
|
|
6615
|
-
return diff(
|
|
6722
|
+
return diff(cleanedOldData, cleanedNewData);
|
|
6616
6723
|
}, "getDiffFromSeqs");
|
|
6617
|
-
const patchSeqWithDiff = /* @__PURE__ */ __name((oldData,
|
|
6724
|
+
const patchSeqWithDiff = /* @__PURE__ */ __name((oldData, diffData, { ignoreKeys = [] } = {}) => {
|
|
6618
6725
|
ignoreKeys.forEach((k) => {
|
|
6619
|
-
delete
|
|
6726
|
+
delete diffData[k];
|
|
6620
6727
|
});
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
diff2
|
|
6627
|
-
);
|
|
6728
|
+
const tidyOld = tidyUpSequenceData(cloneDeep(oldData), {
|
|
6729
|
+
annotationsAsObjects: true,
|
|
6730
|
+
doNotRemoveInvalidChars: true
|
|
6731
|
+
});
|
|
6732
|
+
return patch(tidyOld, diffData);
|
|
6628
6733
|
}, "patchSeqWithDiff");
|
|
6629
|
-
const reverseSeqDiff = /* @__PURE__ */ __name((
|
|
6630
|
-
return reverse(
|
|
6734
|
+
const reverseSeqDiff = /* @__PURE__ */ __name((diffData) => {
|
|
6735
|
+
return reverse(diffData);
|
|
6631
6736
|
}, "reverseSeqDiff");
|
|
6632
6737
|
function getAllInsertionsInSeqReads(seqReads) {
|
|
6633
6738
|
const allInsertionsInSeqReads = [];
|
|
6634
6739
|
seqReads.forEach((seqRead) => {
|
|
6635
6740
|
const splitSeqRead = seqRead.cigar.match(/([0-9]*[MDI])/g);
|
|
6741
|
+
if (!splitSeqRead) return;
|
|
6636
6742
|
for (let componentI = 0; componentI < splitSeqRead.length; componentI++) {
|
|
6637
6743
|
if (splitSeqRead[componentI].slice(-1) === "I") {
|
|
6638
6744
|
let bpPosOfInsertion = seqRead.pos;
|
|
@@ -6676,14 +6782,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6676
6782
|
return sortedInsertions;
|
|
6677
6783
|
}
|
|
6678
6784
|
__name(getAllInsertionsInSeqReads, "getAllInsertionsInSeqReads");
|
|
6679
|
-
function annotateSingleSeq({
|
|
6785
|
+
function annotateSingleSeq({
|
|
6786
|
+
fullSeq,
|
|
6787
|
+
searchSeq
|
|
6788
|
+
}) {
|
|
6680
6789
|
const fullSeqId = fullSeq.id || "fullSeqId";
|
|
6681
6790
|
const searchSeqId = searchSeq.id || "searchSeqId";
|
|
6682
6791
|
const results = autoAnnotate({
|
|
6683
6792
|
seqsToAnnotateById: {
|
|
6684
|
-
[fullSeqId]:
|
|
6685
|
-
|
|
6686
|
-
|
|
6793
|
+
[fullSeqId]: {
|
|
6794
|
+
sequence: fullSeq.sequence,
|
|
6795
|
+
circular: fullSeq.circular,
|
|
6796
|
+
annotations: fullSeq.features || []
|
|
6797
|
+
}
|
|
6687
6798
|
},
|
|
6688
6799
|
annotationsToCheckById: {
|
|
6689
6800
|
[searchSeqId]: __spreadProps(__spreadValues({}, searchSeq), {
|
|
@@ -6733,7 +6844,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6733
6844
|
z: "sar"
|
|
6734
6845
|
};
|
|
6735
6846
|
function getDegenerateRnaStringFromAAString(aaString) {
|
|
6736
|
-
return aaString.split("").map(
|
|
6847
|
+
return aaString.split("").map(
|
|
6848
|
+
(char) => aminoAcidToDegenerateRnaMap[char.toLowerCase()] || "nnn"
|
|
6849
|
+
).join("");
|
|
6737
6850
|
}
|
|
6738
6851
|
__name(getDegenerateRnaStringFromAAString, "getDegenerateRnaStringFromAAString");
|
|
6739
6852
|
function getVirtualDigest({
|
|
@@ -6748,7 +6861,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6748
6861
|
const overlappingEnzymes = [];
|
|
6749
6862
|
const pairs = [];
|
|
6750
6863
|
const sortedCutsites = cutsites.sort((a, b) => {
|
|
6751
|
-
return a.topSnipPosition - b.topSnipPosition;
|
|
6864
|
+
return (a.topSnipPosition || 0) - (b.topSnipPosition || 0);
|
|
6752
6865
|
});
|
|
6753
6866
|
sortedCutsites.forEach((cutsite1, index) => {
|
|
6754
6867
|
if (computePartialDigest && !computePartialDigestDisabled) {
|
|
@@ -6765,11 +6878,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6765
6878
|
});
|
|
6766
6879
|
pairs.forEach(([cut1, cut2]) => {
|
|
6767
6880
|
const start = normalizePositionByRangeLength(
|
|
6768
|
-
cut1.topSnipPosition,
|
|
6881
|
+
cut1.topSnipPosition || 0,
|
|
6769
6882
|
sequenceLength
|
|
6770
6883
|
);
|
|
6771
6884
|
const end = normalizePositionByRangeLength(
|
|
6772
|
-
cut2.topSnipPosition - 1,
|
|
6885
|
+
(cut2.topSnipPosition || 0) - 1,
|
|
6773
6886
|
sequenceLength
|
|
6774
6887
|
);
|
|
6775
6888
|
if (!isCircular && start > end) {
|
|
@@ -6783,6 +6896,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6783
6896
|
name: "End Of Seq"
|
|
6784
6897
|
}
|
|
6785
6898
|
}
|
|
6899
|
+
// Cast to CutSite as it's a mock
|
|
6786
6900
|
};
|
|
6787
6901
|
const frag2 = {
|
|
6788
6902
|
start: 0,
|
|
@@ -6793,6 +6907,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6793
6907
|
name: "Start Of Seq"
|
|
6794
6908
|
}
|
|
6795
6909
|
},
|
|
6910
|
+
// Cast
|
|
6796
6911
|
cut2
|
|
6797
6912
|
};
|
|
6798
6913
|
fragments.push(addSizeIdName(frag1, sequenceLength));
|
|
@@ -6895,27 +7010,18 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6895
7010
|
return matches;
|
|
6896
7011
|
}
|
|
6897
7012
|
__name(findApproxMatches, "findApproxMatches");
|
|
6898
|
-
var spliceString$1;
|
|
6899
|
-
var hasRequiredSpliceString;
|
|
6900
|
-
function requireSpliceString() {
|
|
6901
|
-
if (hasRequiredSpliceString) return spliceString$1;
|
|
6902
|
-
hasRequiredSpliceString = 1;
|
|
6903
|
-
spliceString$1 = /* @__PURE__ */ __name(function spliceSlice(str, index, count, add) {
|
|
6904
|
-
return str.slice(0, index) + (add || "") + str.slice(index + count);
|
|
6905
|
-
}, "spliceSlice");
|
|
6906
|
-
return spliceString$1;
|
|
6907
|
-
}
|
|
6908
|
-
__name(requireSpliceString, "requireSpliceString");
|
|
6909
|
-
var spliceStringExports = requireSpliceString();
|
|
6910
|
-
const spliceString = /* @__PURE__ */ getDefaultExportFromCjs(spliceStringExports);
|
|
6911
7013
|
function adjustBpsToReplaceOrInsert(bpString, insertString = "", caretPositionOrRange) {
|
|
6912
7014
|
let stringToReturn = bpString;
|
|
6913
|
-
if (caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
7015
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
6914
7016
|
if (getRangeLength(caretPositionOrRange, bpString.length) === bpString.length) {
|
|
6915
7017
|
return insertString;
|
|
6916
7018
|
}
|
|
6917
7019
|
const ranges = splitRangeIntoTwoPartsIfItIsCircular(
|
|
6918
|
-
invertRange(
|
|
7020
|
+
invertRange(
|
|
7021
|
+
caretPositionOrRange,
|
|
7022
|
+
bpString.length
|
|
7023
|
+
),
|
|
7024
|
+
bpString.length
|
|
6919
7025
|
);
|
|
6920
7026
|
stringToReturn = "";
|
|
6921
7027
|
ranges.forEach((range, index) => {
|
|
@@ -6941,6 +7047,16 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6941
7047
|
return stringToReturn;
|
|
6942
7048
|
}
|
|
6943
7049
|
__name(adjustBpsToReplaceOrInsert, "adjustBpsToReplaceOrInsert");
|
|
7050
|
+
const spliceString = /* @__PURE__ */ __name((str, index, count, add) => {
|
|
7051
|
+
let i = index;
|
|
7052
|
+
if (i < 0) {
|
|
7053
|
+
i = str.length + i;
|
|
7054
|
+
if (i < 0) {
|
|
7055
|
+
i = 0;
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
return str.slice(0, i) + (add || "") + str.slice(i + count);
|
|
7059
|
+
}, "spliceString");
|
|
6944
7060
|
function calculatePercentGC(bps) {
|
|
6945
7061
|
return (bps.match(/[cg]/gi) || []).length / bps.length * 100 || 0;
|
|
6946
7062
|
}
|
|
@@ -6966,11 +7082,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6966
7082
|
* monovalentCationConc - THe monovalent salt concentration. Defaults to 50e-3M.
|
|
6967
7083
|
* return - Temperature for the given sequence, in Celsius.
|
|
6968
7084
|
*/
|
|
6969
|
-
calculateTemperature: /* @__PURE__ */ __name(function(_sequence, {
|
|
7085
|
+
calculateTemperature: /* @__PURE__ */ __name(function(_sequence, {
|
|
7086
|
+
type,
|
|
7087
|
+
A,
|
|
7088
|
+
R,
|
|
7089
|
+
primerConc,
|
|
7090
|
+
monovalentCationConc
|
|
7091
|
+
} = {}) {
|
|
6970
7092
|
const sequence = (_sequence || "").toLowerCase();
|
|
6971
7093
|
if (typeof type === "undefined") {
|
|
6972
7094
|
type = this.TABLE_BRESLAUER;
|
|
6973
|
-
} else if (type
|
|
7095
|
+
} else if (type !== this.TABLE_BRESLAUER && type !== this.TABLE_UNIFIED && type !== this.TABLE_SUGIMOTO) {
|
|
6974
7096
|
throw new Error("Invalid table type!");
|
|
6975
7097
|
}
|
|
6976
7098
|
if (!A) {
|
|
@@ -6986,11 +7108,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6986
7108
|
monovalentCationConc = this.monovalentCationConc;
|
|
6987
7109
|
}
|
|
6988
7110
|
const sequenceLength = sequence.length;
|
|
6989
|
-
if (sequenceLength
|
|
7111
|
+
if (sequenceLength === 0) {
|
|
6990
7112
|
return 0;
|
|
6991
7113
|
}
|
|
6992
7114
|
const deltaHTable = this.getDeltaHTable(type);
|
|
6993
7115
|
const deltaSTable = this.getDeltaSTable(type);
|
|
7116
|
+
if (!deltaHTable || !deltaSTable) {
|
|
7117
|
+
return 0;
|
|
7118
|
+
}
|
|
6994
7119
|
const neighbors = [];
|
|
6995
7120
|
neighbors.push(this.calculateReps(sequence, "aa"));
|
|
6996
7121
|
neighbors.push(this.calculateNumberOfOccurrences(sequence, "at"));
|
|
@@ -7024,7 +7149,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7024
7149
|
* @return {Number[]} deltaH table for given algorithm.
|
|
7025
7150
|
*/
|
|
7026
7151
|
getDeltaHTable: /* @__PURE__ */ __name(function(type) {
|
|
7027
|
-
if (type
|
|
7152
|
+
if (type === this.TABLE_BRESLAUER) {
|
|
7028
7153
|
return [
|
|
7029
7154
|
9.1,
|
|
7030
7155
|
8.6,
|
|
@@ -7043,7 +7168,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7043
7168
|
6.5,
|
|
7044
7169
|
11.1
|
|
7045
7170
|
];
|
|
7046
|
-
} else if (type
|
|
7171
|
+
} else if (type === this.TABLE_SUGIMOTO) {
|
|
7047
7172
|
return [
|
|
7048
7173
|
8,
|
|
7049
7174
|
5.6,
|
|
@@ -7062,7 +7187,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7062
7187
|
9.4,
|
|
7063
7188
|
11.9
|
|
7064
7189
|
];
|
|
7065
|
-
} else if (type
|
|
7190
|
+
} else if (type === this.TABLE_UNIFIED) {
|
|
7066
7191
|
return [
|
|
7067
7192
|
7.9,
|
|
7068
7193
|
7.2,
|
|
@@ -7085,39 +7210,6 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7085
7210
|
return null;
|
|
7086
7211
|
}
|
|
7087
7212
|
}, "getDeltaHTable"),
|
|
7088
|
-
// "AA/TT": -7.9, 7.9
|
|
7089
|
-
// "AT/TA": -7.2, 7.2
|
|
7090
|
-
// "AC/TG": -8.4, 8.4
|
|
7091
|
-
// "AG/TC": -7.8, 7.8
|
|
7092
|
-
// "TT/AA": -7.9, 7.9
|
|
7093
|
-
// "TA/AT": -7.2, 7.2
|
|
7094
|
-
// "TG/AC": -8.5, 8.2
|
|
7095
|
-
// "TC/AG": -8.2, 8.5
|
|
7096
|
-
// "CC/GG": -8.0, 8.0
|
|
7097
|
-
// "CA/GT": -8.5, 8.5
|
|
7098
|
-
// "CT/GA": -7.8, 7.8
|
|
7099
|
-
// "CG/GC": -10.6, 10.6
|
|
7100
|
-
// "GG/CC": -8.0, 8.0
|
|
7101
|
-
// "GA/CT": -8.2, 8.2,
|
|
7102
|
-
// "GT/CA": -8.4, 8.4
|
|
7103
|
-
// "GC/CG": -9.8, 9.8
|
|
7104
|
-
// aa, at, ac, ag, tt, ta, tc, tg, cc, ca, ct, cg, gg, ga, gt, gc
|
|
7105
|
-
// "AA/TT": -22.2,22.2,
|
|
7106
|
-
// "AT/TA": -20.4,20.4,
|
|
7107
|
-
// "AC/TG": -22.4,22.4,
|
|
7108
|
-
// "AG/TC": -21.0,21.0,
|
|
7109
|
-
// "TT/AA": -22.2,22.2,
|
|
7110
|
-
// "TA/AT": -21.3,21.3,
|
|
7111
|
-
// "TC/AG": -22.2,22.2,
|
|
7112
|
-
// "TG/AC": -22.7,22.7,
|
|
7113
|
-
// "CC/GG": -19.9,19.9,
|
|
7114
|
-
// "CA/GT": -22.7,22.7,
|
|
7115
|
-
// "CT/GA": -21.0,21.0,
|
|
7116
|
-
// "CG/GC": -27.2,27.2,
|
|
7117
|
-
// "GG/CC": -19.9,19.9,
|
|
7118
|
-
// "GT/CA": -22.4,22.2,
|
|
7119
|
-
// "GA/CT": -22.2,22.4,
|
|
7120
|
-
// "GC/CG": -24.4,24.4
|
|
7121
7213
|
/**
|
|
7122
7214
|
* @private
|
|
7123
7215
|
* Function to return deltaS table for given algorithm.
|
|
@@ -7125,7 +7217,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7125
7217
|
* @return {Number[]} deltaS table for given algorithm.
|
|
7126
7218
|
*/
|
|
7127
7219
|
getDeltaSTable: /* @__PURE__ */ __name(function(type) {
|
|
7128
|
-
if (type
|
|
7220
|
+
if (type === this.TABLE_BRESLAUER) {
|
|
7129
7221
|
return [
|
|
7130
7222
|
24,
|
|
7131
7223
|
23.9,
|
|
@@ -7144,7 +7236,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7144
7236
|
17.3,
|
|
7145
7237
|
26.7
|
|
7146
7238
|
];
|
|
7147
|
-
} else if (type
|
|
7239
|
+
} else if (type === this.TABLE_SUGIMOTO) {
|
|
7148
7240
|
return [
|
|
7149
7241
|
21.9,
|
|
7150
7242
|
15.2,
|
|
@@ -7163,7 +7255,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7163
7255
|
25.5,
|
|
7164
7256
|
29
|
|
7165
7257
|
];
|
|
7166
|
-
} else if (type
|
|
7258
|
+
} else if (type === this.TABLE_UNIFIED) {
|
|
7167
7259
|
return [
|
|
7168
7260
|
22.2,
|
|
7169
7261
|
20.4,
|
|
@@ -7197,14 +7289,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7197
7289
|
*/
|
|
7198
7290
|
calculateReps: /* @__PURE__ */ __name(function(sequence, target) {
|
|
7199
7291
|
const sequenceLength = sequence.length;
|
|
7200
|
-
if (sequenceLength
|
|
7292
|
+
if (sequenceLength === 0) {
|
|
7201
7293
|
return 0;
|
|
7202
7294
|
}
|
|
7203
7295
|
let numFound = 0;
|
|
7204
7296
|
let seqOffset = 0;
|
|
7205
7297
|
while (true) {
|
|
7206
7298
|
const foundSeq = sequence.indexOf(target, seqOffset);
|
|
7207
|
-
if (foundSeq
|
|
7299
|
+
if (foundSeq === -1) {
|
|
7208
7300
|
break;
|
|
7209
7301
|
}
|
|
7210
7302
|
seqOffset = foundSeq + 1;
|
|
@@ -7224,7 +7316,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7224
7316
|
*/
|
|
7225
7317
|
calculateNumberOfOccurrences: /* @__PURE__ */ __name(function(sequence, target) {
|
|
7226
7318
|
const sequenceLength = sequence.length;
|
|
7227
|
-
if (sequenceLength
|
|
7319
|
+
if (sequenceLength === 0) {
|
|
7228
7320
|
return 0;
|
|
7229
7321
|
}
|
|
7230
7322
|
const numberFound = sequence.split(target).length - 1;
|
|
@@ -7259,11 +7351,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7259
7351
|
__name(rotateBpsToPosition, "rotateBpsToPosition");
|
|
7260
7352
|
function arrayRotate(arr, count) {
|
|
7261
7353
|
count -= arr.length * Math.floor(count / arr.length);
|
|
7262
|
-
arr.push
|
|
7354
|
+
arr.push(...arr.splice(0, count));
|
|
7263
7355
|
return arr;
|
|
7264
7356
|
}
|
|
7265
7357
|
__name(arrayRotate, "arrayRotate");
|
|
7266
|
-
function rotateSequenceDataToPosition(sequenceData, caretPosition, options) {
|
|
7358
|
+
function rotateSequenceDataToPosition(sequenceData, caretPosition, options = {}) {
|
|
7267
7359
|
const newSequenceData = tidyUpSequenceData(sequenceData, __spreadValues({
|
|
7268
7360
|
doNotRemoveInvalidChars: true
|
|
7269
7361
|
}, options));
|
|
@@ -7311,16 +7403,24 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7311
7403
|
}, options));
|
|
7312
7404
|
const newSequenceData = cloneDeep(existingSequenceData);
|
|
7313
7405
|
const insertLength = sequenceDataToInsert.isProtein && sequenceDataToInsert.proteinSequence ? sequenceDataToInsert.proteinSequence.length * 3 : sequenceDataToInsert.sequence.length;
|
|
7314
|
-
let caretPosition = caretPositionOrRange;
|
|
7315
|
-
const isInsertSameLengthAsSelection = sequenceDataToInsert.sequence.length === getRangeLength(
|
|
7316
|
-
|
|
7406
|
+
let caretPosition = typeof caretPositionOrRange === "number" ? caretPositionOrRange : caretPositionOrRange.start;
|
|
7407
|
+
const isInsertSameLengthAsSelection = typeof caretPositionOrRange !== "number" && sequenceDataToInsert.sequence.length === getRangeLength(
|
|
7408
|
+
caretPositionOrRange,
|
|
7409
|
+
existingSequenceData.sequence.length
|
|
7410
|
+
);
|
|
7411
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1 && getRangeLength(
|
|
7317
7412
|
caretPositionOrRange,
|
|
7318
7413
|
existingSequenceData.sequence.length
|
|
7319
7414
|
) === existingSequenceData.sequence.length) {
|
|
7415
|
+
const emptyAnnotations = modifiableTypes.reduce(
|
|
7416
|
+
(acc, type) => {
|
|
7417
|
+
acc[type] = [];
|
|
7418
|
+
return acc;
|
|
7419
|
+
},
|
|
7420
|
+
{}
|
|
7421
|
+
);
|
|
7320
7422
|
existingSequenceData = tidyUpSequenceData(
|
|
7321
|
-
__spreadProps(__spreadValues(__spreadValues({}, existingSequenceData),
|
|
7322
|
-
return acc[type] = [];
|
|
7323
|
-
}, {})), {
|
|
7423
|
+
__spreadProps(__spreadValues(__spreadValues({}, existingSequenceData), emptyAnnotations), {
|
|
7324
7424
|
sequence: "",
|
|
7325
7425
|
doNotRemoveInvalidChars: true,
|
|
7326
7426
|
proteinSequence: "",
|
|
@@ -7330,7 +7430,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7330
7430
|
);
|
|
7331
7431
|
newSequenceData.chromatogramData = void 0;
|
|
7332
7432
|
} else if (newSequenceData.chromatogramData && newSequenceData.chromatogramData.baseTraces) {
|
|
7333
|
-
if (caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
7433
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1) {
|
|
7334
7434
|
if (caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7335
7435
|
newSequenceData.chromatogramData = trimChromatogram({
|
|
7336
7436
|
chromatogramData: newSequenceData.chromatogramData,
|
|
@@ -7340,14 +7440,16 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7340
7440
|
},
|
|
7341
7441
|
justBaseCalls: isInsertSameLengthAsSelection
|
|
7342
7442
|
});
|
|
7343
|
-
newSequenceData.chromatogramData
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7443
|
+
if (newSequenceData.chromatogramData) {
|
|
7444
|
+
newSequenceData.chromatogramData = trimChromatogram({
|
|
7445
|
+
chromatogramData: newSequenceData.chromatogramData,
|
|
7446
|
+
range: {
|
|
7447
|
+
start: 0,
|
|
7448
|
+
end: caretPositionOrRange.end
|
|
7449
|
+
},
|
|
7450
|
+
justBaseCalls: isInsertSameLengthAsSelection
|
|
7451
|
+
});
|
|
7452
|
+
}
|
|
7351
7453
|
} else {
|
|
7352
7454
|
newSequenceData.chromatogramData = trimChromatogram({
|
|
7353
7455
|
chromatogramData: newSequenceData.chromatogramData,
|
|
@@ -7359,10 +7461,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7359
7461
|
});
|
|
7360
7462
|
}
|
|
7361
7463
|
}
|
|
7362
|
-
if (sequenceDataToInsert.sequence) {
|
|
7464
|
+
if (sequenceDataToInsert.sequence && newSequenceData.chromatogramData) {
|
|
7363
7465
|
insertIntoChromatogram({
|
|
7364
7466
|
chromatogramData: newSequenceData.chromatogramData,
|
|
7365
|
-
caretPosition: caretPositionOrRange.start > -1 ? caretPositionOrRange.start : caretPositionOrRange,
|
|
7467
|
+
caretPosition: typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1 ? caretPositionOrRange.start : caretPositionOrRange,
|
|
7366
7468
|
seqToInsert: sequenceDataToInsert.sequence,
|
|
7367
7469
|
justBaseCalls: isInsertSameLengthAsSelection
|
|
7368
7470
|
});
|
|
@@ -7375,14 +7477,15 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7375
7477
|
);
|
|
7376
7478
|
newSequenceData.size = newSequenceData.sequence.length;
|
|
7377
7479
|
newSequenceData.proteinSequence = adjustBpsToReplaceOrInsert(
|
|
7378
|
-
existingSequenceData.proteinSequence,
|
|
7379
|
-
sequenceDataToInsert.proteinSequence,
|
|
7480
|
+
existingSequenceData.proteinSequence || "",
|
|
7481
|
+
sequenceDataToInsert.proteinSequence || "",
|
|
7380
7482
|
convertDnaCaretPositionOrRangeToAA(caretPositionOrRange)
|
|
7381
7483
|
);
|
|
7382
|
-
newSequenceData.proteinSize = newSequenceData.proteinSequence.length;
|
|
7484
|
+
newSequenceData.proteinSize = (newSequenceData.proteinSequence || "").length;
|
|
7383
7485
|
modifiableTypes.forEach((annotationType) => {
|
|
7384
7486
|
let existingAnnotations = existingSequenceData[annotationType];
|
|
7385
|
-
if (
|
|
7487
|
+
if (!existingAnnotations) return;
|
|
7488
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1) {
|
|
7386
7489
|
const range = caretPositionOrRange;
|
|
7387
7490
|
caretPosition = range.start > range.end ? 0 : range.start;
|
|
7388
7491
|
existingAnnotations = adjustAnnotationsToDelete(
|
|
@@ -7392,22 +7495,23 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7392
7495
|
);
|
|
7393
7496
|
}
|
|
7394
7497
|
newSequenceData[annotationType] = [];
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7498
|
+
const annotationsToInsert = sequenceDataToInsert[annotationType];
|
|
7499
|
+
if (newSequenceData[annotationType]) {
|
|
7500
|
+
newSequenceData[annotationType] = newSequenceData[annotationType].concat(
|
|
7501
|
+
adjustAnnotationsToInsert(
|
|
7502
|
+
existingAnnotations,
|
|
7503
|
+
caretPosition,
|
|
7504
|
+
insertLength
|
|
7505
|
+
)
|
|
7506
|
+
);
|
|
7507
|
+
if (annotationsToInsert) {
|
|
7508
|
+
newSequenceData[annotationType] = newSequenceData[annotationType].concat(
|
|
7509
|
+
adjustAnnotationsToInsert(annotationsToInsert, 0, caretPosition)
|
|
7510
|
+
);
|
|
7511
|
+
}
|
|
7512
|
+
}
|
|
7409
7513
|
});
|
|
7410
|
-
if (maintainOriginSplit && caretPositionOrRange && caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7514
|
+
if (maintainOriginSplit && typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7411
7515
|
const caretPosToRotateTo = existingSequenceData.sequence.length - caretPositionOrRange.start;
|
|
7412
7516
|
return rotateSequenceDataToPosition(
|
|
7413
7517
|
newSequenceData,
|
|
@@ -7425,6 +7529,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7425
7529
|
maxLength
|
|
7426
7530
|
);
|
|
7427
7531
|
const newLocations = annotation.locations && annotation.locations.map((loc) => adjustRangeToDeletionOfAnotherRange(loc, range, maxLength)).filter((range2) => !!range2);
|
|
7532
|
+
if (!newRange) return null;
|
|
7428
7533
|
if (newLocations && newLocations.length) {
|
|
7429
7534
|
return __spreadValues(__spreadProps(__spreadValues({}, newRange), {
|
|
7430
7535
|
start: newLocations[0].start,
|
|
@@ -7443,11 +7548,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7443
7548
|
justBaseCalls
|
|
7444
7549
|
}) {
|
|
7445
7550
|
if (!seqToInsert.length) return;
|
|
7446
|
-
chromatogramData.baseCalls
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7551
|
+
if (chromatogramData.baseCalls) {
|
|
7552
|
+
chromatogramData.baseCalls.splice(
|
|
7553
|
+
caretPosition,
|
|
7554
|
+
0,
|
|
7555
|
+
...seqToInsert.split("")
|
|
7556
|
+
);
|
|
7557
|
+
}
|
|
7451
7558
|
if (justBaseCalls) {
|
|
7452
7559
|
return chromatogramData;
|
|
7453
7560
|
}
|
|
@@ -7463,8 +7570,20 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7463
7570
|
tTrace: toPush
|
|
7464
7571
|
});
|
|
7465
7572
|
}
|
|
7466
|
-
|
|
7467
|
-
|
|
7573
|
+
if (chromatogramData.baseTraces) {
|
|
7574
|
+
chromatogramData.baseTraces.splice(
|
|
7575
|
+
caretPosition,
|
|
7576
|
+
0,
|
|
7577
|
+
...baseTracesToInsert
|
|
7578
|
+
);
|
|
7579
|
+
}
|
|
7580
|
+
if (chromatogramData.qualNums) {
|
|
7581
|
+
chromatogramData.qualNums.splice(
|
|
7582
|
+
caretPosition,
|
|
7583
|
+
0,
|
|
7584
|
+
...qualNumsToInsert
|
|
7585
|
+
);
|
|
7586
|
+
}
|
|
7468
7587
|
return chromatogramData;
|
|
7469
7588
|
}
|
|
7470
7589
|
__name(insertIntoChromatogram, "insertIntoChromatogram");
|
|
@@ -7477,17 +7596,23 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7477
7596
|
"baseCalls",
|
|
7478
7597
|
...justBaseCalls ? [] : ["qualNums", "baseTraces", "basePos"]
|
|
7479
7598
|
].forEach((type) => {
|
|
7480
|
-
|
|
7599
|
+
if (chromatogramData[type]) {
|
|
7600
|
+
chromatogramData[type].splice(start, end - start + 1);
|
|
7601
|
+
}
|
|
7481
7602
|
});
|
|
7482
7603
|
return chromatogramData;
|
|
7483
7604
|
}
|
|
7484
7605
|
__name(trimChromatogram, "trimChromatogram");
|
|
7485
7606
|
function deleteSequenceDataAtRange(sequenceData, range) {
|
|
7486
|
-
return insertSequenceDataAtPositionOrRange(
|
|
7607
|
+
return insertSequenceDataAtPositionOrRange(
|
|
7608
|
+
{ sequence: "" },
|
|
7609
|
+
sequenceData,
|
|
7610
|
+
range
|
|
7611
|
+
);
|
|
7487
7612
|
}
|
|
7488
7613
|
__name(deleteSequenceDataAtRange, "deleteSequenceDataAtRange");
|
|
7489
7614
|
function doesEnzymeChopOutsideOfRecognitionSite(enzyme) {
|
|
7490
|
-
if (enzyme.topSnipOffset > enzyme.site.length || enzyme.bottomSnipOffset > enzyme.site.length) {
|
|
7615
|
+
if (enzyme.topSnipOffset && enzyme.bottomSnipOffset && (enzyme.topSnipOffset > enzyme.site.length || enzyme.bottomSnipOffset > enzyme.site.length)) {
|
|
7491
7616
|
return true;
|
|
7492
7617
|
} else {
|
|
7493
7618
|
return false;
|
|
@@ -15119,10 +15244,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15119
15244
|
defaultEnzymesByName[name] = aliasedEnzymesByName[name];
|
|
15120
15245
|
});
|
|
15121
15246
|
function generateAnnotations(numberOfAnnotationsToGenerate, start, end, maxLength) {
|
|
15122
|
-
const result =
|
|
15247
|
+
const result = [];
|
|
15123
15248
|
for (let i = 0; i < numberOfAnnotationsToGenerate; i++) {
|
|
15124
15249
|
const annotation = generateAnnotation(start, end, maxLength);
|
|
15125
|
-
result
|
|
15250
|
+
result.push(annotation);
|
|
15126
15251
|
}
|
|
15127
15252
|
return result;
|
|
15128
15253
|
}
|
|
@@ -15150,16 +15275,16 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15150
15275
|
numPrimers,
|
|
15151
15276
|
numTranslations
|
|
15152
15277
|
} = {}) {
|
|
15153
|
-
const proteinSequence = isProtein
|
|
15154
|
-
const sequence = !isProtein
|
|
15278
|
+
const proteinSequence = isProtein ? generateSequence(sequenceLength, true) : "";
|
|
15279
|
+
const sequence = !isProtein ? generateSequence(sequenceLength) : "";
|
|
15155
15280
|
return {
|
|
15156
15281
|
circular: isProtein ? false : Math.random() > 0.5,
|
|
15157
|
-
name: "p-" + Math.floor(Math.random * 100),
|
|
15282
|
+
name: "p-" + Math.floor(Math.random() * 100),
|
|
15158
15283
|
description: "",
|
|
15159
|
-
isProtein,
|
|
15284
|
+
isProtein: !!isProtein,
|
|
15160
15285
|
sequence,
|
|
15161
15286
|
proteinSequence,
|
|
15162
|
-
translations: isProtein ?
|
|
15287
|
+
translations: isProtein ? [] : generateAnnotations(
|
|
15163
15288
|
numTranslations || 5,
|
|
15164
15289
|
0,
|
|
15165
15290
|
sequenceLength - 1,
|
|
@@ -15171,7 +15296,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15171
15296
|
sequenceLength - 1,
|
|
15172
15297
|
sequenceLength / 3
|
|
15173
15298
|
),
|
|
15174
|
-
primers: isProtein ?
|
|
15299
|
+
primers: isProtein ? [] : generateAnnotations(numPrimers || 10, 0, sequenceLength - 1, 50),
|
|
15175
15300
|
parts: generateAnnotations(
|
|
15176
15301
|
numParts || 10,
|
|
15177
15302
|
0,
|
|
@@ -15183,15 +15308,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15183
15308
|
__name(generateSequenceData, "generateSequenceData");
|
|
15184
15309
|
function generateSequence(m = 9, isProtein) {
|
|
15185
15310
|
let s = "";
|
|
15186
|
-
const r = isProtein ? "" : "gatc";
|
|
15311
|
+
const r = isProtein ? "ACDEFGHIKLMNPQRSTVWY" : "gatc";
|
|
15187
15312
|
for (let i = 0; i < m; i++) {
|
|
15188
15313
|
s += r.charAt(Math.floor(Math.random() * r.length));
|
|
15189
15314
|
}
|
|
15190
15315
|
return s;
|
|
15191
15316
|
}
|
|
15192
15317
|
__name(generateSequence, "generateSequence");
|
|
15193
|
-
function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSequence, positionStart, isLinear) {
|
|
15194
|
-
if (!positionStart) positionStart = 0;
|
|
15318
|
+
function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSequence, positionStart = 0, isLinear) {
|
|
15195
15319
|
if (sequenceToSearch.length < overlapSequence.length) {
|
|
15196
15320
|
return null;
|
|
15197
15321
|
}
|
|
@@ -15209,6 +15333,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15209
15333
|
index = result.index;
|
|
15210
15334
|
distance = newDistance;
|
|
15211
15335
|
}
|
|
15336
|
+
if (index === void 0) {
|
|
15337
|
+
return null;
|
|
15338
|
+
}
|
|
15212
15339
|
return normalizeRange(
|
|
15213
15340
|
{
|
|
15214
15341
|
start: index,
|
|
@@ -15253,9 +15380,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15253
15380
|
internalStartCodonIndices: [],
|
|
15254
15381
|
frame: start % 3,
|
|
15255
15382
|
forward,
|
|
15256
|
-
annotationTypePlural: "orfs",
|
|
15383
|
+
// annotationTypePlural: "orfs",
|
|
15257
15384
|
isOrf: true,
|
|
15258
|
-
id: shortid()
|
|
15385
|
+
id: shortid(),
|
|
15386
|
+
type: "orf",
|
|
15387
|
+
name: "ORF"
|
|
15259
15388
|
});
|
|
15260
15389
|
}
|
|
15261
15390
|
}
|
|
@@ -15296,7 +15425,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15296
15425
|
return nonDuplicatedOrfRanges;
|
|
15297
15426
|
}
|
|
15298
15427
|
__name(getOrfsFromSequence, "getOrfsFromSequence");
|
|
15299
|
-
function findOrfsInPlasmid(sequence, circular, minimumOrfSize, useAdditionalOrfStartCodons) {
|
|
15428
|
+
function findOrfsInPlasmid(sequence, circular, minimumOrfSize, useAdditionalOrfStartCodons, isProteinOrOligo) {
|
|
15429
|
+
if (isProteinOrOligo) {
|
|
15430
|
+
return [];
|
|
15431
|
+
}
|
|
15300
15432
|
const forwardOrfs = getOrfsFromSequence({
|
|
15301
15433
|
sequence,
|
|
15302
15434
|
minimumOrfSize,
|
|
@@ -15356,7 +15488,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15356
15488
|
true
|
|
15357
15489
|
);
|
|
15358
15490
|
} else {
|
|
15359
|
-
searchStringToUse = convertAmbiguousStringToRegex(
|
|
15491
|
+
searchStringToUse = convertAmbiguousStringToRegex(
|
|
15492
|
+
searchStringToUse,
|
|
15493
|
+
false
|
|
15494
|
+
);
|
|
15360
15495
|
}
|
|
15361
15496
|
}
|
|
15362
15497
|
if (!searchStringToUse) return [];
|
|
@@ -15476,7 +15611,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15476
15611
|
}
|
|
15477
15612
|
__name(getCodonRangeForAASliver, "getCodonRangeForAASliver");
|
|
15478
15613
|
function getComplementAminoAcidStringFromSequenceString(sequenceString) {
|
|
15479
|
-
const aaString = getAminoAcidStringFromSequenceString(sequenceString,
|
|
15614
|
+
const aaString = getAminoAcidStringFromSequenceString(sequenceString, {
|
|
15615
|
+
doNotExcludeAsterisk: true
|
|
15616
|
+
});
|
|
15480
15617
|
return aaString.split("").reverse().join("");
|
|
15481
15618
|
}
|
|
15482
15619
|
__name(getComplementAminoAcidStringFromSequenceString, "getComplementAminoAcidStringFromSequenceString");
|
|
@@ -15514,26 +15651,30 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15514
15651
|
sequence: getSequenceWithinRange(range, seqDataToUse.sequence),
|
|
15515
15652
|
proteinSequence: getSequenceWithinRange(
|
|
15516
15653
|
convertDnaCaretPositionOrRangeToAA(range),
|
|
15517
|
-
seqDataToUse.proteinSequence
|
|
15654
|
+
seqDataToUse.proteinSequence || ""
|
|
15518
15655
|
)
|
|
15519
15656
|
},
|
|
15520
|
-
annotationTypes.reduce(
|
|
15521
|
-
|
|
15522
|
-
|
|
15657
|
+
annotationTypes.reduce(
|
|
15658
|
+
(acc, type) => {
|
|
15659
|
+
if (exclude[type]) {
|
|
15660
|
+
acc[type] = [];
|
|
15661
|
+
return acc;
|
|
15662
|
+
}
|
|
15663
|
+
acc[type] = getAnnotationsBetweenRange(
|
|
15664
|
+
seqDataToUse[type],
|
|
15665
|
+
range,
|
|
15666
|
+
seqDataToUse.sequence.length,
|
|
15667
|
+
excludePartial[type]
|
|
15668
|
+
);
|
|
15523
15669
|
return acc;
|
|
15524
|
-
}
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
range,
|
|
15528
|
-
seqDataToUse.sequence.length,
|
|
15529
|
-
excludePartial[type]
|
|
15530
|
-
);
|
|
15531
|
-
return acc;
|
|
15532
|
-
}, {})
|
|
15670
|
+
},
|
|
15671
|
+
{}
|
|
15672
|
+
)
|
|
15533
15673
|
);
|
|
15534
15674
|
if (range.overlapsSelf) {
|
|
15535
15675
|
const extendedSeqData = insertSequenceDataAtPositionOrRange(
|
|
15536
15676
|
{ sequence: seqDataToReturn.sequence },
|
|
15677
|
+
// Wrapping in object as per assumed signature
|
|
15537
15678
|
seqDataToUse,
|
|
15538
15679
|
range.start
|
|
15539
15680
|
);
|
|
@@ -15598,7 +15739,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15598
15739
|
__name(getAnnotationsBetweenRange, "getAnnotationsBetweenRange");
|
|
15599
15740
|
function getComplementSequenceAndAnnotations(pSeqObj, options = {}) {
|
|
15600
15741
|
const seqObj = tidyUpSequenceData(
|
|
15601
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
15742
|
+
getSequenceDataBetweenRange(pSeqObj, options.range || null),
|
|
15743
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15602
15744
|
options
|
|
15603
15745
|
);
|
|
15604
15746
|
const newSeqObj = Object.assign({}, seqObj, {
|
|
@@ -15613,7 +15755,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15613
15755
|
const { topSnipOffset, bottomSnipOffset } = restrictionEnzyme;
|
|
15614
15756
|
if (topSnipOffset === bottomSnipOffset) {
|
|
15615
15757
|
return "blunt";
|
|
15616
|
-
} else if (topSnipOffset < bottomSnipOffset) {
|
|
15758
|
+
} else if (topSnipOffset !== void 0 && bottomSnipOffset !== void 0 && topSnipOffset < bottomSnipOffset) {
|
|
15617
15759
|
return "5' overhang";
|
|
15618
15760
|
} else {
|
|
15619
15761
|
return "3' overhang";
|
|
@@ -15647,7 +15789,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15647
15789
|
leftHandSide: "",
|
|
15648
15790
|
rightHandSide: ""
|
|
15649
15791
|
};
|
|
15650
|
-
if (isPositionWithinRange(position, range)) {
|
|
15792
|
+
if (isPositionWithinRange(position, range, sequence.length)) {
|
|
15651
15793
|
result.leftHandSide = getSequenceWithinRange(
|
|
15652
15794
|
{
|
|
15653
15795
|
start: range.start,
|
|
@@ -15687,13 +15829,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15687
15829
|
}
|
|
15688
15830
|
}
|
|
15689
15831
|
__name(getOverlapBetweenTwoSequences, "getOverlapBetweenTwoSequences");
|
|
15690
|
-
function
|
|
15691
|
-
|
|
15832
|
+
function getPossiblePartsFromSequenceAndEnzymes(seqData, restrictionEnzymes) {
|
|
15833
|
+
const enzymes = Array.isArray(restrictionEnzymes) ? restrictionEnzymes : [restrictionEnzymes];
|
|
15692
15834
|
const bps = seqData.sequence;
|
|
15693
15835
|
const seqLen = bps.length;
|
|
15694
|
-
const circular = seqData.circular;
|
|
15836
|
+
const circular = seqData.circular || false;
|
|
15695
15837
|
let cutsites = [];
|
|
15696
|
-
|
|
15838
|
+
enzymes.forEach((enzyme) => {
|
|
15697
15839
|
const newCutsites = cutSequenceByRestrictionEnzyme(bps, circular, enzyme);
|
|
15698
15840
|
cutsites = cutsites.concat(newCutsites);
|
|
15699
15841
|
});
|
|
@@ -15734,13 +15876,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15734
15876
|
return parts;
|
|
15735
15877
|
}
|
|
15736
15878
|
}
|
|
15737
|
-
__name(
|
|
15879
|
+
__name(getPossiblePartsFromSequenceAndEnzymes, "getPossiblePartsFromSequenceAndEnzymes");
|
|
15738
15880
|
function getPartBetweenEnzymesWithInclusiveOverhangs(cut1, cut2, seqLen) {
|
|
15739
15881
|
const firstCutOffset = getEnzymeRelativeOffset(cut1.restrictionEnzyme);
|
|
15740
15882
|
const secondCutOffset = getEnzymeRelativeOffset(cut2.restrictionEnzyme);
|
|
15741
|
-
const start = cut1.topSnipBeforeBottom ? cut1.topSnipPosition : cut1.bottomSnipPosition;
|
|
15883
|
+
const start = (cut1.topSnipBeforeBottom ? cut1.topSnipPosition : cut1.bottomSnipPosition) || 0;
|
|
15742
15884
|
const end = normalizePositionByRangeLength(
|
|
15743
|
-
(cut2.topSnipBeforeBottom ? cut2.bottomSnipPosition : cut2.topSnipPosition) - 1,
|
|
15885
|
+
(cut2.topSnipBeforeBottom ? cut2.bottomSnipPosition || 0 : cut2.topSnipPosition || 0) - 1,
|
|
15744
15886
|
seqLen
|
|
15745
15887
|
);
|
|
15746
15888
|
return {
|
|
@@ -15751,20 +15893,20 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15751
15893
|
firstCut: cut1,
|
|
15752
15894
|
//the offset is always counting with 0 being at the top snip position
|
|
15753
15895
|
firstCutOffset,
|
|
15754
|
-
firstCutOverhang: cut1.overhangBps,
|
|
15755
|
-
firstCutOverhangTop: firstCutOffset > 0 ? cut1.overhangBps : "",
|
|
15756
|
-
firstCutOverhangBottom: firstCutOffset < 0 ? getComplementSequenceString(cut1.overhangBps) : "",
|
|
15896
|
+
firstCutOverhang: cut1.overhangBps || "",
|
|
15897
|
+
firstCutOverhangTop: firstCutOffset > 0 ? cut1.overhangBps || "" : "",
|
|
15898
|
+
firstCutOverhangBottom: firstCutOffset < 0 ? getComplementSequenceString(cut1.overhangBps || "") : "",
|
|
15757
15899
|
secondCut: cut2,
|
|
15758
15900
|
//the offset is always counting with 0 being at the top snip position
|
|
15759
15901
|
secondCutOffset,
|
|
15760
|
-
secondCutOverhang: cut2.overhangBps,
|
|
15761
|
-
secondCutOverhangTop: secondCutOffset < 0 ? cut2.overhangBps : "",
|
|
15762
|
-
secondCutOverhangBottom: secondCutOffset > 0 ? getComplementSequenceString(cut2.overhangBps) : ""
|
|
15902
|
+
secondCutOverhang: cut2.overhangBps || "",
|
|
15903
|
+
secondCutOverhangTop: secondCutOffset < 0 ? cut2.overhangBps || "" : "",
|
|
15904
|
+
secondCutOverhangBottom: secondCutOffset > 0 ? getComplementSequenceString(cut2.overhangBps || "") : ""
|
|
15763
15905
|
};
|
|
15764
15906
|
}
|
|
15765
15907
|
__name(getPartBetweenEnzymesWithInclusiveOverhangs, "getPartBetweenEnzymesWithInclusiveOverhangs");
|
|
15766
15908
|
function getEnzymeRelativeOffset(enzyme) {
|
|
15767
|
-
return enzyme.bottomSnipOffset - enzyme.topSnipOffset;
|
|
15909
|
+
return (enzyme.bottomSnipOffset || 0) - (enzyme.topSnipOffset || 0);
|
|
15768
15910
|
}
|
|
15769
15911
|
__name(getEnzymeRelativeOffset, "getEnzymeRelativeOffset");
|
|
15770
15912
|
function pairwise(list) {
|
|
@@ -15780,6 +15922,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15780
15922
|
function getReverseAminoAcidStringFromSequenceString(sequenceString) {
|
|
15781
15923
|
const aminoAcidsPerBase = getAminoAcidDataForEachBaseOfDna(
|
|
15782
15924
|
sequenceString,
|
|
15925
|
+
false,
|
|
15926
|
+
null,
|
|
15783
15927
|
false
|
|
15784
15928
|
);
|
|
15785
15929
|
const aaArray = [];
|
|
@@ -15818,7 +15962,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15818
15962
|
__name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
|
|
15819
15963
|
function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
|
15820
15964
|
const seqObj = tidyUpSequenceData(
|
|
15821
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
15965
|
+
getSequenceDataBetweenRange(pSeqObj, options.range || null),
|
|
15966
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15822
15967
|
__spreadValues({ doNotRemoveInvalidChars: true }, options)
|
|
15823
15968
|
);
|
|
15824
15969
|
const newSeqObj = Object.assign(
|
|
@@ -15827,17 +15972,20 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15827
15972
|
{
|
|
15828
15973
|
sequence: getReverseComplementSequenceString(seqObj.sequence)
|
|
15829
15974
|
},
|
|
15830
|
-
annotationTypes.reduce(
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15975
|
+
annotationTypes.reduce(
|
|
15976
|
+
(acc, type) => {
|
|
15977
|
+
if (seqObj[type]) {
|
|
15978
|
+
acc[type] = map(seqObj[type], (annotation) => {
|
|
15979
|
+
return getReverseComplementAnnotation(
|
|
15980
|
+
annotation,
|
|
15981
|
+
seqObj.sequence.length
|
|
15982
|
+
);
|
|
15983
|
+
});
|
|
15984
|
+
}
|
|
15985
|
+
return acc;
|
|
15986
|
+
},
|
|
15987
|
+
{}
|
|
15988
|
+
)
|
|
15841
15989
|
);
|
|
15842
15990
|
return tidyUpSequenceData(newSeqObj, __spreadValues({
|
|
15843
15991
|
doNotRemoveInvalidChars: true
|
|
@@ -15859,10 +16007,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15859
16007
|
function guessIfSequenceIsDnaAndNotProtein(seq, options = {}) {
|
|
15860
16008
|
const { threshold = 0.9, loose } = options;
|
|
15861
16009
|
const dnaLetters = options.dnaLetters || loose ? [...ambiguous_dna_letters.split(""), "U"] : ["G", "A", "T", "C", "U"];
|
|
15862
|
-
const dnaLetterMap = dnaLetters.reduce(
|
|
15863
|
-
acc
|
|
15864
|
-
|
|
15865
|
-
|
|
16010
|
+
const dnaLetterMap = dnaLetters.reduce(
|
|
16011
|
+
(acc, letter) => {
|
|
16012
|
+
acc[letter.toUpperCase()] = true;
|
|
16013
|
+
return acc;
|
|
16014
|
+
},
|
|
16015
|
+
{}
|
|
16016
|
+
);
|
|
15866
16017
|
let count = 0;
|
|
15867
16018
|
if (!seq || !seq.length) return true;
|
|
15868
16019
|
for (let index = 0; index < seq.length; index++) {
|
|
@@ -15882,15 +16033,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15882
16033
|
const yOffsetLevelMap = {};
|
|
15883
16034
|
const wrappedAnnotations = {};
|
|
15884
16035
|
forEach(annotations, (annotation) => {
|
|
16036
|
+
var _a;
|
|
15885
16037
|
const containsLocations = !!(annotation.locations && annotation.locations.length);
|
|
15886
16038
|
if (annotation.overlapsSelf) {
|
|
15887
16039
|
if (!wrappedAnnotations[annotation.id]) {
|
|
15888
16040
|
mapAnnotationToRows({
|
|
15889
|
-
annotation: {
|
|
16041
|
+
annotation: __spreadProps(__spreadValues({}, annotation), {
|
|
15890
16042
|
start: 0,
|
|
15891
16043
|
end: sequenceLength - 1,
|
|
15892
|
-
id: `__tempAnnRemoveMe__${annotation.id}
|
|
15893
|
-
|
|
16044
|
+
id: `__tempAnnRemoveMe__${annotation.id}`,
|
|
16045
|
+
overlapsSelf: false
|
|
16046
|
+
}),
|
|
15894
16047
|
sequenceLength,
|
|
15895
16048
|
bpsPerRow,
|
|
15896
16049
|
annotationsToRowsMap,
|
|
@@ -15911,7 +16064,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15911
16064
|
splitForwardReverse
|
|
15912
16065
|
});
|
|
15913
16066
|
if (containsLocations) {
|
|
15914
|
-
annotation.locations.forEach((location) => {
|
|
16067
|
+
(_a = annotation.locations) == null ? void 0 : _a.forEach((location) => {
|
|
15915
16068
|
mapAnnotationToRows({
|
|
15916
16069
|
annotation,
|
|
15917
16070
|
sequenceLength,
|
|
@@ -15927,7 +16080,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15927
16080
|
forEach(annotationsToRowsMap, (annotationsForRow, i) => {
|
|
15928
16081
|
annotationsToRowsMap[i] = filter(
|
|
15929
16082
|
annotationsForRow,
|
|
15930
|
-
(ann) => !startsWith(ann.id, "__tempAnnRemoveMe__")
|
|
16083
|
+
(ann) => !startsWith(String(ann.id), "__tempAnnRemoveMe__")
|
|
15931
16084
|
);
|
|
15932
16085
|
});
|
|
15933
16086
|
return annotationsToRowsMap;
|
|
@@ -15969,6 +16122,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15969
16122
|
yOffset = ann.yOffset;
|
|
15970
16123
|
}
|
|
15971
16124
|
});
|
|
16125
|
+
if (yOffset === void 0) {
|
|
16126
|
+
annotationsForRow.forEach((ann) => {
|
|
16127
|
+
if (ann.id === annotation.id) {
|
|
16128
|
+
yOffset = ann.yOffset;
|
|
16129
|
+
}
|
|
16130
|
+
});
|
|
16131
|
+
}
|
|
15972
16132
|
} else {
|
|
15973
16133
|
if (location) {
|
|
15974
16134
|
annotationsForRow.forEach((ann) => {
|
|
@@ -15977,32 +16137,74 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
15977
16137
|
}
|
|
15978
16138
|
});
|
|
15979
16139
|
} else {
|
|
15980
|
-
if (index > 0 &&
|
|
15981
|
-
annotationsForRow.length && //there are already annotations within the row
|
|
15982
|
-
annotationsForRow[annotationsForRow.length - 1].annotation === annotation) {
|
|
16140
|
+
if (index > 0 && annotationsForRow.length && annotationsForRow[annotationsForRow.length - 1].annotation === annotation) {
|
|
15983
16141
|
yOffset = annotationsForRow[annotationsForRow.length - 1].yOffset;
|
|
15984
16142
|
} else {
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
16143
|
+
const siblingRangesOnThisRow = ranges.slice(index + 1).filter((r) => {
|
|
16144
|
+
const rStartRow = Math.floor(r.start / bpsPerRow);
|
|
16145
|
+
const rEndRow = Math.floor(r.end / bpsPerRow);
|
|
16146
|
+
return rowNumber >= rStartRow && rowNumber <= rEndRow;
|
|
16147
|
+
});
|
|
16148
|
+
if (siblingRangesOnThisRow.length > 0) {
|
|
16149
|
+
let foundYOffset = -1;
|
|
16150
|
+
yOffsetsForRow.some((rangesAlreadyAddedToYOffset, levelIndex) => {
|
|
16151
|
+
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
16152
|
+
(comparisonRange) => {
|
|
16153
|
+
return checkIfPotentiallyCircularRangesOverlap(
|
|
16154
|
+
range,
|
|
16155
|
+
comparisonRange
|
|
16156
|
+
);
|
|
16157
|
+
}
|
|
16158
|
+
);
|
|
16159
|
+
if (rangeBlocked) return false;
|
|
16160
|
+
const siblingBlocked = siblingRangesOnThisRow.some(
|
|
16161
|
+
(siblingRange) => {
|
|
16162
|
+
return rangesAlreadyAddedToYOffset.some((comparisonRange) => {
|
|
16163
|
+
return checkIfPotentiallyCircularRangesOverlap(
|
|
16164
|
+
siblingRange,
|
|
16165
|
+
comparisonRange
|
|
16166
|
+
);
|
|
16167
|
+
});
|
|
16168
|
+
}
|
|
16169
|
+
);
|
|
16170
|
+
if (!siblingBlocked) {
|
|
16171
|
+
foundYOffset = levelIndex;
|
|
16172
|
+
return true;
|
|
16173
|
+
}
|
|
16174
|
+
return false;
|
|
16175
|
+
});
|
|
16176
|
+
if (foundYOffset > -1) {
|
|
16177
|
+
yOffset = foundYOffset;
|
|
16178
|
+
yOffsetsForRow[foundYOffset].push(range);
|
|
16179
|
+
} else {
|
|
16180
|
+
yOffset = yOffsetsForRow.length;
|
|
16181
|
+
yOffsetsForRow.push([range]);
|
|
16182
|
+
}
|
|
16183
|
+
} else {
|
|
16184
|
+
yOffset = getYOffsetForPotentiallyCircularRange(
|
|
16185
|
+
range,
|
|
16186
|
+
yOffsetsForRow,
|
|
16187
|
+
false
|
|
16188
|
+
);
|
|
16189
|
+
}
|
|
16190
|
+
}
|
|
16191
|
+
if (yOffset !== void 0) {
|
|
16192
|
+
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
16193
|
+
yOffsetsForRow[yOffset].push({
|
|
16194
|
+
start,
|
|
16195
|
+
end
|
|
16196
|
+
});
|
|
15989
16197
|
}
|
|
15990
|
-
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
15991
|
-
yOffsetsForRow[yOffset].push({
|
|
15992
|
-
start,
|
|
15993
|
-
end
|
|
15994
|
-
});
|
|
15995
16198
|
}
|
|
15996
16199
|
}
|
|
15997
|
-
annotationsForRow.push(__spreadProps(__spreadValues(__spreadValues({
|
|
16200
|
+
annotationsForRow.push(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, annotation), {
|
|
15998
16201
|
id: annotation.id,
|
|
15999
16202
|
annotation,
|
|
16000
16203
|
start,
|
|
16001
16204
|
end
|
|
16002
|
-
}, containsLocations && { containsLocations }), location && { isJoinedLocation: !!location }), {
|
|
16205
|
+
}), containsLocations && { containsLocations }), location && { isJoinedLocation: !!location }), {
|
|
16003
16206
|
yOffset,
|
|
16004
16207
|
enclosingRangeType: range.type
|
|
16005
|
-
//either "beginning", "end" or "beginningAndEnd"
|
|
16006
16208
|
}));
|
|
16007
16209
|
}
|
|
16008
16210
|
});
|
|
@@ -16012,10 +16214,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16012
16214
|
const clonedSeqData = cloneDeep(sequenceData);
|
|
16013
16215
|
annotationTypes.forEach((annotationType) => {
|
|
16014
16216
|
if (annotationType !== "cutsites") {
|
|
16015
|
-
const
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16217
|
+
const annotations = clonedSeqData[annotationType];
|
|
16218
|
+
if (annotations) {
|
|
16219
|
+
const maxYOffset = getYOffsetsForPotentiallyCircularRanges(
|
|
16220
|
+
annotations,
|
|
16221
|
+
true
|
|
16222
|
+
).maxYOffset;
|
|
16223
|
+
clonedSeqData[annotationType].maxYOffset = maxYOffset;
|
|
16224
|
+
}
|
|
16019
16225
|
}
|
|
16020
16226
|
});
|
|
16021
16227
|
return clonedSeqData;
|
|
@@ -16028,14 +16234,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16028
16234
|
const rowMap = {};
|
|
16029
16235
|
annotationTypes.forEach((type) => {
|
|
16030
16236
|
rowMap[type] = mapAnnotationsToRows(
|
|
16031
|
-
sequenceData[type],
|
|
16237
|
+
sequenceData[type] || [],
|
|
16032
16238
|
sequenceLength,
|
|
16033
16239
|
bpsPerRow,
|
|
16034
16240
|
{ splitForwardReverse: type === "primers" }
|
|
16035
16241
|
);
|
|
16036
16242
|
});
|
|
16037
16243
|
for (let rowNumber = 0; rowNumber < totalRows; rowNumber++) {
|
|
16038
|
-
const row = {
|
|
16244
|
+
const row = {
|
|
16245
|
+
rowNumber,
|
|
16246
|
+
start: 0,
|
|
16247
|
+
end: 0,
|
|
16248
|
+
sequence: ""
|
|
16249
|
+
};
|
|
16039
16250
|
row.rowNumber = rowNumber;
|
|
16040
16251
|
row.start = rowNumber * bpsPerRow;
|
|
16041
16252
|
row.end = (rowNumber + 1) * bpsPerRow - 1 < sequenceLength ? (rowNumber + 1) * bpsPerRow - 1 : sequenceLength - 1;
|
|
@@ -16096,17 +16307,16 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16096
16307
|
}
|
|
16097
16308
|
}
|
|
16098
16309
|
const refSeqWithGaps = insertGapsIntoRefSeq(refSeq.sequence, seqReads);
|
|
16099
|
-
const seqReadsWithGaps = [
|
|
16100
|
-
{ name: refSeq.name, sequence: refSeqWithGaps.toUpperCase() }
|
|
16101
|
-
];
|
|
16310
|
+
const seqReadsWithGaps = [{ name: refSeq.name, sequence: refSeqWithGaps.toUpperCase() }];
|
|
16102
16311
|
seqReads.forEach((seqRead) => {
|
|
16103
16312
|
const allInsertionsInSeqReads = [];
|
|
16104
16313
|
seqReads.forEach((seqRead2) => {
|
|
16105
16314
|
const splitSeqRead = seqRead2.cigar.match(/([0-9]*[SMDI])/g);
|
|
16315
|
+
if (!splitSeqRead) return;
|
|
16106
16316
|
let adjustedSeqReadPos2 = cloneDeep(seqRead2.pos);
|
|
16107
16317
|
if (splitSeqRead[0].slice(-1) === "S") {
|
|
16108
16318
|
const numOfBeginningSoftClipped = splitSeqRead[0].slice(0, -1);
|
|
16109
|
-
adjustedSeqReadPos2 = seqRead2.pos - numOfBeginningSoftClipped;
|
|
16319
|
+
adjustedSeqReadPos2 = seqRead2.pos - Number(numOfBeginningSoftClipped);
|
|
16110
16320
|
}
|
|
16111
16321
|
for (let componentI = 0; componentI < splitSeqRead.length; componentI++) {
|
|
16112
16322
|
if (splitSeqRead[componentI].slice(-1) === "I") {
|
|
@@ -16132,10 +16342,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16132
16342
|
}
|
|
16133
16343
|
});
|
|
16134
16344
|
const splitSeqReadChunk = seqRead.cigar.match(/([0-9]*[SMDI])/g);
|
|
16345
|
+
if (!splitSeqReadChunk) return;
|
|
16135
16346
|
let adjustedSeqReadPos = cloneDeep(seqRead.pos);
|
|
16136
16347
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16137
16348
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16138
|
-
adjustedSeqReadPos = seqRead.pos - numOfBeginningSoftClipped;
|
|
16349
|
+
adjustedSeqReadPos = seqRead.pos - Number(numOfBeginningSoftClipped);
|
|
16139
16350
|
}
|
|
16140
16351
|
let eachSeqReadWithGaps = seqRead.seq.split("");
|
|
16141
16352
|
if (adjustedSeqReadPos > 0) {
|
|
@@ -16323,10 +16534,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16323
16534
|
const seqReadLengthsBeforeRefSeqStart = [];
|
|
16324
16535
|
seqReads.forEach((seq) => {
|
|
16325
16536
|
const splitSeqReadChunk = seq.cigar.match(/([0-9]*[SMDI])/g);
|
|
16537
|
+
if (!splitSeqReadChunk) return;
|
|
16326
16538
|
let adjustedSeqReadPos = cloneDeep(seq.pos);
|
|
16327
16539
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16328
16540
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16329
|
-
adjustedSeqReadPos = seq.pos - numOfBeginningSoftClipped;
|
|
16541
|
+
adjustedSeqReadPos = seq.pos - Number(numOfBeginningSoftClipped);
|
|
16330
16542
|
if (adjustedSeqReadPos < 0) {
|
|
16331
16543
|
seqReadLengthsBeforeRefSeqStart.push(Math.abs(adjustedSeqReadPos));
|
|
16332
16544
|
}
|
|
@@ -16336,13 +16548,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16336
16548
|
for (let i = 1; i < seqReadsWithGaps.length; i++) {
|
|
16337
16549
|
const eachSeqReadWithGaps = seqReadsWithGaps[i].sequence.split("");
|
|
16338
16550
|
const splitSeqReadChunk = seqReads[i - 1].cigar.match(/([0-9]*[SMDI])/g);
|
|
16551
|
+
if (!splitSeqReadChunk) continue;
|
|
16339
16552
|
let adjustedSeqReadPos = cloneDeep(seqReads[i - 1].pos);
|
|
16340
16553
|
if (seqReadLengthsBeforeRefSeqStart.length > 0) {
|
|
16341
16554
|
longestSeqReadLength = Math.max(...seqReadLengthsBeforeRefSeqStart);
|
|
16342
16555
|
}
|
|
16343
16556
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16344
16557
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16345
|
-
adjustedSeqReadPos = seqReads[i - 1].pos - numOfBeginningSoftClipped;
|
|
16558
|
+
adjustedSeqReadPos = seqReads[i - 1].pos - Number(numOfBeginningSoftClipped);
|
|
16346
16559
|
if (adjustedSeqReadPos > 0) {
|
|
16347
16560
|
if (longestSeqReadLength > 0) {
|
|
16348
16561
|
eachSeqReadWithGaps.unshift("-".repeat(longestSeqReadLength + 1));
|
|
@@ -16456,11 +16669,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16456
16669
|
for (let i = 0; i < seq.length; i++) {
|
|
16457
16670
|
if (i === 0 || i === seq.length - 1) {
|
|
16458
16671
|
if (seq[i] === "G" || seq[i] === "C") {
|
|
16459
|
-
hi += sequenceToEnthalpyMap
|
|
16460
|
-
si += sequenceToEntropyMap
|
|
16672
|
+
hi += sequenceToEnthalpyMap["initiationWithTerminalGC"];
|
|
16673
|
+
si += sequenceToEntropyMap["initiationWithTerminalGC"];
|
|
16461
16674
|
} else if (seq[i] === "A" || seq[i] === "T") {
|
|
16462
|
-
hi += sequenceToEnthalpyMap
|
|
16463
|
-
si += sequenceToEntropyMap
|
|
16675
|
+
hi += sequenceToEnthalpyMap["initiationWithTerminalAT"];
|
|
16676
|
+
si += sequenceToEntropyMap["initiationWithTerminalAT"];
|
|
16464
16677
|
}
|
|
16465
16678
|
}
|
|
16466
16679
|
if (i < seq.length - 1) {
|
|
@@ -16503,9 +16716,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16503
16716
|
`${sequences.length} sequences received when 2 primers were expected`
|
|
16504
16717
|
);
|
|
16505
16718
|
}
|
|
16506
|
-
const meltingTemperatures = sequences.map(
|
|
16507
|
-
|
|
16508
|
-
|
|
16719
|
+
const meltingTemperatures = sequences.map((seq) => {
|
|
16720
|
+
const tm = calculateNebTm(seq, { monovalentCationConc, primerConc });
|
|
16721
|
+
if (typeof tm !== "number") {
|
|
16722
|
+
throw new Error(`Invalid Tm calculated for ${seq}: ${tm}`);
|
|
16723
|
+
}
|
|
16724
|
+
return tm;
|
|
16725
|
+
});
|
|
16509
16726
|
meltingTemperatures.sort((a, b) => a - b);
|
|
16510
16727
|
const lowerMeltingTemp = meltingTemperatures[0];
|
|
16511
16728
|
let annealingTemp;
|
|
@@ -16582,17 +16799,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16582
16799
|
__name(isValidSequence, "isValidSequence");
|
|
16583
16800
|
function calculateSantaLuciaTm(sequence) {
|
|
16584
16801
|
try {
|
|
16585
|
-
|
|
16586
|
-
if (!isValidSequence(
|
|
16802
|
+
const seq = sequence == null ? void 0 : sequence.toUpperCase().trim();
|
|
16803
|
+
if (!isValidSequence(seq)) {
|
|
16587
16804
|
throw new Error("Invalid sequence: contains non-DNA characters");
|
|
16588
16805
|
}
|
|
16589
|
-
if (
|
|
16806
|
+
if (seq.length < 2) {
|
|
16590
16807
|
throw new Error("Sequence too short: minimum length is 2 bases");
|
|
16591
16808
|
}
|
|
16592
16809
|
let deltaH = 0;
|
|
16593
16810
|
let deltaS = 0;
|
|
16594
|
-
for (let i = 0; i <
|
|
16595
|
-
const dinucleotide =
|
|
16811
|
+
for (let i = 0; i < seq.length - 1; i++) {
|
|
16812
|
+
const dinucleotide = seq.substring(i, i + 2);
|
|
16596
16813
|
if (dinucleotide.includes("N")) {
|
|
16597
16814
|
continue;
|
|
16598
16815
|
}
|
|
@@ -16602,23 +16819,23 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16602
16819
|
deltaS += params.dS;
|
|
16603
16820
|
}
|
|
16604
16821
|
}
|
|
16605
|
-
const firstBase =
|
|
16606
|
-
const lastBase =
|
|
16822
|
+
const firstBase = seq[0];
|
|
16823
|
+
const lastBase = seq[seq.length - 1];
|
|
16607
16824
|
if (firstBase === "G" || firstBase === "C") {
|
|
16608
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16609
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16825
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16826
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16610
16827
|
} else {
|
|
16611
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16612
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16828
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16829
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16613
16830
|
}
|
|
16614
16831
|
if (lastBase === "G" || lastBase === "C") {
|
|
16615
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16616
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16832
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16833
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16617
16834
|
} else {
|
|
16618
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16619
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16835
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16836
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16620
16837
|
}
|
|
16621
|
-
const nnPairs =
|
|
16838
|
+
const nnPairs = seq.length - 1;
|
|
16622
16839
|
deltaS = applySaltCorrection(deltaS, nnPairs);
|
|
16623
16840
|
const C = PRIMER3_PARAMS.dnaConc * 1e-9;
|
|
16624
16841
|
const Tm = deltaH * 1e3 / (deltaS + PRIMER3_PARAMS.R * Math.log(C / 4));
|
|
@@ -16630,16 +16847,16 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16630
16847
|
__name(calculateSantaLuciaTm, "calculateSantaLuciaTm");
|
|
16631
16848
|
function calculateEndStability(sequence) {
|
|
16632
16849
|
try {
|
|
16633
|
-
|
|
16634
|
-
if (!isValidSequence(
|
|
16850
|
+
const seq = sequence == null ? void 0 : sequence.toUpperCase().trim();
|
|
16851
|
+
if (!isValidSequence(seq)) {
|
|
16635
16852
|
throw new Error("Invalid sequence: contains non-DNA characters");
|
|
16636
16853
|
}
|
|
16637
|
-
if (
|
|
16854
|
+
if (seq.length < 5) {
|
|
16638
16855
|
throw new Error(
|
|
16639
16856
|
"Sequence too short: minimum length is 5 bases for end stability calculation"
|
|
16640
16857
|
);
|
|
16641
16858
|
}
|
|
16642
|
-
const last5Bases =
|
|
16859
|
+
const last5Bases = seq.substring(seq.length - 5);
|
|
16643
16860
|
let deltaH = 0;
|
|
16644
16861
|
let deltaS = 0;
|
|
16645
16862
|
for (let i = 0; i < 4; i++) {
|
|
@@ -16656,18 +16873,18 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16656
16873
|
const firstBase = last5Bases[0];
|
|
16657
16874
|
const lastBase = last5Bases[last5Bases.length - 1];
|
|
16658
16875
|
if (firstBase === "G" || firstBase === "C") {
|
|
16659
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16660
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16876
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16877
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16661
16878
|
} else {
|
|
16662
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16663
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16879
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16880
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16664
16881
|
}
|
|
16665
16882
|
if (lastBase === "G" || lastBase === "C") {
|
|
16666
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16667
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16883
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16884
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16668
16885
|
} else {
|
|
16669
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16670
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16886
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16887
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16671
16888
|
}
|
|
16672
16889
|
const T = 310.15;
|
|
16673
16890
|
const deltaG = deltaH - T * deltaS / 1e3;
|
|
@@ -16682,24 +16899,40 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16682
16899
|
const pairs = [];
|
|
16683
16900
|
if (!cutsites.length) return [];
|
|
16684
16901
|
let sortedCutsites = cutsites.sort((a, b) => {
|
|
16685
|
-
return a.topSnipPosition - b.topSnipPosition;
|
|
16902
|
+
return (a.topSnipPosition || 0) - (b.topSnipPosition || 0);
|
|
16686
16903
|
});
|
|
16687
16904
|
if (!circular) {
|
|
16688
16905
|
sortedCutsites = [
|
|
16689
16906
|
{
|
|
16907
|
+
start: 0,
|
|
16908
|
+
end: 0,
|
|
16690
16909
|
topSnipPosition: 0,
|
|
16691
16910
|
bottomSnipPosition: 0,
|
|
16692
16911
|
overhangSize: 0,
|
|
16693
16912
|
type: "START_OR_END_OF_SEQ",
|
|
16694
|
-
name: "START_OF_SEQ"
|
|
16913
|
+
name: "START_OF_SEQ",
|
|
16914
|
+
restrictionEnzyme: {
|
|
16915
|
+
name: "START_OF_SEQ",
|
|
16916
|
+
site: "",
|
|
16917
|
+
forwardRegex: "",
|
|
16918
|
+
reverseRegex: ""
|
|
16919
|
+
}
|
|
16695
16920
|
},
|
|
16696
16921
|
...sortedCutsites,
|
|
16697
16922
|
{
|
|
16923
|
+
start: sequenceLength,
|
|
16924
|
+
end: sequenceLength,
|
|
16698
16925
|
topSnipPosition: sequenceLength,
|
|
16699
16926
|
bottomSnipPosition: sequenceLength,
|
|
16700
16927
|
overhangSize: 0,
|
|
16701
16928
|
type: "START_OR_END_OF_SEQ",
|
|
16702
|
-
name: "END_OF_SEQ"
|
|
16929
|
+
name: "END_OF_SEQ",
|
|
16930
|
+
restrictionEnzyme: {
|
|
16931
|
+
name: "END_OF_SEQ",
|
|
16932
|
+
site: "",
|
|
16933
|
+
forwardRegex: "",
|
|
16934
|
+
reverseRegex: ""
|
|
16935
|
+
}
|
|
16703
16936
|
}
|
|
16704
16937
|
];
|
|
16705
16938
|
}
|
|
@@ -16722,11 +16955,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16722
16955
|
});
|
|
16723
16956
|
pairs.forEach(([cut1, cut2]) => {
|
|
16724
16957
|
const start = normalizePositionByRangeLength(
|
|
16725
|
-
cut1.topSnipPosition,
|
|
16958
|
+
cut1.topSnipPosition || 0,
|
|
16726
16959
|
sequenceLength
|
|
16727
16960
|
);
|
|
16728
16961
|
const end = normalizePositionByRangeLength(
|
|
16729
|
-
cut2.topSnipPosition - 1,
|
|
16962
|
+
(cut2.topSnipPosition || 0) - 1,
|
|
16730
16963
|
sequenceLength
|
|
16731
16964
|
);
|
|
16732
16965
|
const fragmentRange = { start, end };
|
|
@@ -16744,7 +16977,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16744
16977
|
})
|
|
16745
16978
|
}, fragmentRange), {
|
|
16746
16979
|
size,
|
|
16747
|
-
id
|
|
16980
|
+
id,
|
|
16981
|
+
name: `${cut1.restrictionEnzyme.name} -- ${cut2.restrictionEnzyme.name} ${size} bps`
|
|
16982
|
+
// Add missing name property
|
|
16748
16983
|
}));
|
|
16749
16984
|
});
|
|
16750
16985
|
fragments.filter((fragment) => {
|
|
@@ -16756,21 +16991,33 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16756
16991
|
return fragments;
|
|
16757
16992
|
}
|
|
16758
16993
|
__name(getDigestFragmentsForCutsites, "getDigestFragmentsForCutsites");
|
|
16759
|
-
function getDigestFragmentsForRestrictionEnzymes(sequence, circular,
|
|
16760
|
-
const
|
|
16761
|
-
|
|
16762
|
-
return cutSequenceByRestrictionEnzyme(
|
|
16763
|
-
sequence,
|
|
16764
|
-
circular,
|
|
16765
|
-
restrictionEnzyme
|
|
16766
|
-
);
|
|
16767
|
-
});
|
|
16768
|
-
return getDigestFragmentsForCutsites(
|
|
16769
|
-
sequence.length,
|
|
16994
|
+
function getDigestFragmentsForRestrictionEnzymes(sequence, circular, contextEnzymes, options) {
|
|
16995
|
+
const cutsitesByName = getCutsitesFromSequence(
|
|
16996
|
+
sequence,
|
|
16770
16997
|
circular,
|
|
16771
|
-
|
|
16772
|
-
opts
|
|
16998
|
+
Array.isArray(contextEnzymes) ? contextEnzymes : [contextEnzymes]
|
|
16773
16999
|
);
|
|
17000
|
+
const digest = computeDigestFragments(__spreadProps(__spreadValues({
|
|
17001
|
+
cutsites: flatMap(cutsitesByName),
|
|
17002
|
+
sequenceLength: sequence.length,
|
|
17003
|
+
circular
|
|
17004
|
+
}, options), {
|
|
17005
|
+
computePartialDigest: (options == null ? void 0 : options.computePartialDigest) || (options == null ? void 0 : options.computePartialDigests)
|
|
17006
|
+
}));
|
|
17007
|
+
const fragments = uniqBy(digest.fragments, (fragment) => {
|
|
17008
|
+
return `${fragment.start}-${fragment.end}-${fragment.size}`;
|
|
17009
|
+
});
|
|
17010
|
+
if (circular && ((options == null ? void 0 : options.computePartialDigest) || (options == null ? void 0 : options.computePartialDigests))) {
|
|
17011
|
+
const fullLengthFragmentIndex = fragments.findIndex(
|
|
17012
|
+
(f) => f.size === sequence.length
|
|
17013
|
+
);
|
|
17014
|
+
if (fullLengthFragmentIndex > -1) {
|
|
17015
|
+
fragments.splice(fullLengthFragmentIndex, 1);
|
|
17016
|
+
}
|
|
17017
|
+
}
|
|
17018
|
+
return fragments.sort((a, b) => {
|
|
17019
|
+
return a.start - b.start || b.size - a.size;
|
|
17020
|
+
});
|
|
16774
17021
|
}
|
|
16775
17022
|
__name(getDigestFragmentsForRestrictionEnzymes, "getDigestFragmentsForRestrictionEnzymes");
|
|
16776
17023
|
function convertAACaretPositionOrRangeToDna(rangeOrCaret) {
|
|
@@ -16816,11 +17063,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16816
17063
|
}) {
|
|
16817
17064
|
modifiableTypes.forEach((annotationType) => {
|
|
16818
17065
|
const existingAnnotations = seqData[annotationType];
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
|
|
16822
|
-
|
|
16823
|
-
|
|
17066
|
+
if (existingAnnotations) {
|
|
17067
|
+
seqData[annotationType] = adjustAnnotationsToInsert(
|
|
17068
|
+
existingAnnotations,
|
|
17069
|
+
caretPosition,
|
|
17070
|
+
insertLength
|
|
17071
|
+
);
|
|
17072
|
+
}
|
|
16824
17073
|
});
|
|
16825
17074
|
}
|
|
16826
17075
|
__name(shiftAnnotationsByLen, "shiftAnnotationsByLen");
|
|
@@ -16890,7 +17139,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
16890
17139
|
exports2.getMergedFeatureMap = getMergedFeatureMap;
|
|
16891
17140
|
exports2.getOrfsFromSequence = getOrfsFromSequence;
|
|
16892
17141
|
exports2.getOverlapBetweenTwoSequences = getOverlapBetweenTwoSequences;
|
|
16893
|
-
exports2.getPossiblePartsFromSequenceAndEnzymes =
|
|
17142
|
+
exports2.getPossiblePartsFromSequenceAndEnzymes = getPossiblePartsFromSequenceAndEnzymes;
|
|
16894
17143
|
exports2.getReverseAminoAcidStringFromSequenceString = getReverseAminoAcidStringFromSequenceString;
|
|
16895
17144
|
exports2.getReverseComplementAminoAcidStringFromSequenceString = getReverseComplementAminoAcidStringFromSequenceString;
|
|
16896
17145
|
exports2.getReverseComplementAnnotation = getReverseComplementAnnotation;
|