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