@teselagen/sequence-utils 0.3.41 → 0.3.42-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DNAComplementMap.d.ts +1 -1
- package/README.md +2 -8
- package/addGapsToSeqReads.d.ts +16 -3
- package/adjustAnnotationsToInsert.d.ts +2 -1
- package/adjustBpsToReplaceOrInsert.d.ts +2 -1
- package/aliasedEnzymesByName.d.ts +37 -1
- package/aminoAcidToDegenerateDnaMap.d.ts +1 -31
- package/aminoAcidToDegenerateRnaMap.d.ts +1 -1
- package/annotateSingleSeq.d.ts +5 -4
- package/annotationTypes.d.ts +2 -2
- package/autoAnnotate.d.ts +17 -8
- package/bioData.d.ts +10 -58
- package/calculateEndStability.d.ts +1 -1
- package/calculateNebTa.d.ts +6 -1
- package/calculateNebTm.d.ts +6 -4
- package/calculatePercentGC.d.ts +1 -1
- package/calculateSantaLuciaTm.d.ts +28 -114
- package/calculateTm.d.ts +13 -1
- package/computeDigestFragments.d.ts +30 -24
- package/condensePairwiseAlignmentDifferences.d.ts +1 -1
- package/convertAACaretPositionOrRangeToDna.d.ts +2 -1
- package/convertDnaCaretPositionOrRangeToAA.d.ts +2 -1
- package/cutSequenceByRestrictionEnzyme.d.ts +2 -1
- package/defaultEnzymesByName.d.ts +2 -1
- package/degenerateDnaToAminoAcidMap.d.ts +1 -1
- package/degenerateRnaToAminoAcidMap.d.ts +1 -1
- package/deleteSequenceDataAtRange.d.ts +2 -1
- package/diffUtils.d.ts +9 -7
- package/doesEnzymeChopOutsideOfRecognitionSite.d.ts +2 -1
- package/featureTypesAndColors.d.ts +19 -6
- package/filterSequenceString.d.ts +14 -10
- package/findApproxMatches.d.ts +7 -1
- package/findNearestRangeOfSequenceOverlapToPosition.d.ts +2 -1
- package/findOrfsInPlasmid.d.ts +2 -11
- package/findSequenceMatches.d.ts +11 -1
- package/generateAnnotations.d.ts +2 -1
- package/generateSequenceData.d.ts +8 -13
- package/getAllInsertionsInSeqReads.d.ts +11 -1
- package/getAminoAcidDataForEachBaseOfDna.d.ts +6 -5
- package/getAminoAcidFromSequenceTriplet.d.ts +1 -1
- package/getAminoAcidStringFromSequenceString.d.ts +3 -1
- package/getCodonRangeForAASliver.d.ts +3 -4
- package/getComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getComplementSequenceAndAnnotations.d.ts +5 -1
- package/getComplementSequenceString.d.ts +1 -1
- package/getCutsiteType.d.ts +2 -1
- package/getCutsitesFromSequence.d.ts +2 -1
- package/getDegenerateDnaStringFromAAString.d.ts +1 -1
- package/getDegenerateRnaStringFromAAString.d.ts +1 -1
- package/getDigestFragmentsForCutsites.d.ts +4 -1
- package/getDigestFragmentsForRestrictionEnzymes.d.ts +8 -1
- package/getInsertBetweenVals.d.ts +2 -1
- package/getLeftAndRightOfSequenceInRangeGivenPosition.d.ts +2 -1
- package/getOrfsFromSequence.d.ts +17 -11
- package/getOverlapBetweenTwoSequences.d.ts +2 -1
- package/getPossiblePartsFromSequenceAndEnzymes.d.ts +18 -1
- package/getReverseAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAnnotation.d.ts +11 -1
- package/getReverseComplementSequenceAndAnnotations.d.ts +5 -1
- package/getReverseComplementSequenceString.d.ts +1 -1
- package/getReverseSequenceString.d.ts +1 -1
- package/getSequenceDataBetweenRange.d.ts +9 -1
- package/getVirtualDigest.d.ts +11 -10
- package/guessIfSequenceIsDnaAndNotProtein.d.ts +5 -1
- package/index.cjs +765 -497
- package/index.d.ts +9 -5
- package/index.js +766 -498
- package/index.umd.cjs +765 -497
- package/insertGapsIntoRefSeq.d.ts +2 -1
- package/insertSequenceDataAtPositionOrRange.d.ts +10 -1
- package/isEnzymeType2S.d.ts +2 -1
- package/mapAnnotationsToRows.d.ts +9 -1
- package/package.json +9 -6
- package/prepareCircularViewData.d.ts +2 -1
- package/prepareRowData.d.ts +7 -3
- package/proteinAlphabet.d.ts +1 -1
- package/rotateBpsToPosition.d.ts +1 -1
- package/rotateSequenceDataToPosition.d.ts +3 -1
- package/shiftAnnotationsByLen.d.ts +4 -3
- package/src/{addGapsToSeqReads.js → addGapsToSeqReads.ts} +33 -14
- package/src/adjustAnnotationsToInsert.ts +22 -0
- package/src/{adjustBpsToReplaceOrInsert.js → adjustBpsToReplaceOrInsert.ts} +31 -8
- package/src/{aliasedEnzymesByName.js → aliasedEnzymesByName.ts} +4 -1
- package/src/{aminoAcidToDegenerateDnaMap.js → aminoAcidToDegenerateDnaMap.ts} +1 -1
- package/src/{annotateSingleSeq.js → annotateSingleSeq.ts} +11 -3
- package/src/autoAnnotate.test.js +0 -1
- package/src/{autoAnnotate.js → autoAnnotate.ts} +69 -24
- package/src/{bioData.js → bioData.ts} +2 -2
- package/src/{calculateEndStability.js → calculateEndStability.ts} +21 -16
- package/src/{calculateNebTa.js → calculateNebTa.ts} +20 -8
- package/src/{calculateNebTm.js → calculateNebTm.ts} +15 -9
- package/src/{calculatePercentGC.js → calculatePercentGC.ts} +1 -1
- package/src/{calculateSantaLuciaTm.js → calculateSantaLuciaTm.ts} +29 -22
- package/src/{calculateTm.js → calculateTm.ts} +50 -59
- package/src/{computeDigestFragments.js → computeDigestFragments.ts} +92 -36
- package/src/{condensePairwiseAlignmentDifferences.js → condensePairwiseAlignmentDifferences.ts} +4 -4
- package/src/{convertAACaretPositionOrRangeToDna.js → convertAACaretPositionOrRangeToDna.ts} +8 -4
- package/src/{convertDnaCaretPositionOrRangeToAA.js → convertDnaCaretPositionOrRangeToAA.ts} +8 -4
- package/src/cutSequenceByRestrictionEnzyme.ts +345 -0
- package/src/{defaultEnzymesByName.js → defaultEnzymesByName.ts} +2 -1
- package/src/deleteSequenceDataAtRange.ts +13 -0
- package/src/diffUtils.ts +80 -0
- package/src/doesEnzymeChopOutsideOfRecognitionSite.ts +16 -0
- package/src/{featureTypesAndColors.js → featureTypesAndColors.ts} +29 -14
- package/src/{filterSequenceString.js → filterSequenceString.ts} +51 -21
- package/src/{findApproxMatches.js → findApproxMatches.ts} +14 -6
- package/src/{findNearestRangeOfSequenceOverlapToPosition.js → findNearestRangeOfSequenceOverlapToPosition.ts} +13 -9
- package/src/{findOrfsInPlasmid.js → findOrfsInPlasmid.ts} +8 -7
- package/src/{findSequenceMatches.js → findSequenceMatches.ts} +31 -13
- package/src/{generateAnnotations.js → generateAnnotations.ts} +14 -9
- package/src/{generateSequenceData.js → generateSequenceData.ts} +19 -13
- package/src/{getAllInsertionsInSeqReads.js → getAllInsertionsInSeqReads.ts} +19 -2
- package/src/{getAminoAcidDataForEachBaseOfDna.js → getAminoAcidDataForEachBaseOfDna.ts} +36 -30
- package/src/{getAminoAcidFromSequenceTriplet.js → getAminoAcidFromSequenceTriplet.ts} +9 -4
- package/src/{getAminoAcidStringFromSequenceString.js → getAminoAcidStringFromSequenceString.ts} +14 -7
- package/src/{getCodonRangeForAASliver.js → getCodonRangeForAASliver.ts} +16 -6
- package/src/{getComplementAminoAcidStringFromSequenceString.js → getComplementAminoAcidStringFromSequenceString.ts} +5 -3
- package/src/{getComplementSequenceAndAnnotations.js → getComplementSequenceAndAnnotations.ts} +8 -6
- package/src/{getComplementSequenceString.js → getComplementSequenceString.ts} +5 -2
- package/src/getCutsiteType.ts +18 -0
- package/src/getCutsitesFromSequence.ts +22 -0
- package/src/getDegenerateDnaStringFromAAString.ts +15 -0
- package/src/getDegenerateRnaStringFromAAString.ts +15 -0
- package/src/{getDigestFragmentsForCutsites.js → getDigestFragmentsForCutsites.ts} +32 -14
- package/src/getDigestFragmentsForRestrictionEnzymes.ts +50 -0
- package/src/{getInsertBetweenVals.js → getInsertBetweenVals.ts} +8 -5
- package/src/{getLeftAndRightOfSequenceInRangeGivenPosition.js → getLeftAndRightOfSequenceInRangeGivenPosition.ts} +11 -10
- package/src/{getMassOfAaString.js → getMassOfAaString.ts} +4 -2
- package/src/{getOrfsFromSequence.js → getOrfsFromSequence.ts} +27 -7
- package/src/{getOverlapBetweenTwoSequences.js → getOverlapBetweenTwoSequences.ts} +4 -4
- package/src/{getPossiblePartsFromSequenceAndEnzymes.js → getPossiblePartsFromSequenceAndEnzymes.ts} +52 -25
- package/src/{getReverseAminoAcidStringFromSequenceString.js → getReverseAminoAcidStringFromSequenceString.ts} +4 -2
- package/src/{getReverseComplementAminoAcidStringFromSequenceString.js → getReverseComplementAminoAcidStringFromSequenceString.ts} +2 -2
- package/src/{getReverseComplementAnnotation.js → getReverseComplementAnnotation.ts} +4 -2
- package/src/getReverseComplementSequenceAndAnnotations.ts +45 -0
- package/src/{getReverseComplementSequenceString.js → getReverseComplementSequenceString.ts} +4 -4
- package/src/{getReverseSequenceString.js → getReverseSequenceString.ts} +1 -1
- package/src/getSequenceDataBetweenRange.test.js +6 -3
- package/src/{getSequenceDataBetweenRange.js → getSequenceDataBetweenRange.ts} +44 -29
- package/src/{getVirtualDigest.js → getVirtualDigest.ts} +20 -9
- package/src/{guessIfSequenceIsDnaAndNotProtein.js → guessIfSequenceIsDnaAndNotProtein.ts} +11 -5
- package/src/{index.test.js → index.test.ts} +9 -5
- package/src/{index.js → index.ts} +1 -0
- package/src/{insertGapsIntoRefSeq.js → insertGapsIntoRefSeq.ts} +7 -2
- package/src/{insertSequenceDataAtPositionOrRange.js → insertSequenceDataAtPositionOrRange.ts} +130 -56
- package/src/isEnzymeType2S.ts +8 -0
- package/src/mapAnnotationsToRows.ts +256 -0
- package/src/prepareCircularViewData.ts +24 -0
- package/src/{prepareRowData.js → prepareRowData.ts} +27 -8
- package/src/prepareRowData_output1.json +1 -0
- package/src/rotateBpsToPosition.ts +12 -0
- package/src/{rotateSequenceDataToPosition.js → rotateSequenceDataToPosition.ts} +11 -8
- package/src/shiftAnnotationsByLen.ts +24 -0
- package/src/{threeLetterSequenceStringToAminoAcidMap.js → threeLetterSequenceStringToAminoAcidMap.ts} +29 -9
- package/src/{tidyUpAnnotation.js → tidyUpAnnotation.ts} +40 -18
- package/src/{tidyUpSequenceData.js → tidyUpSequenceData.ts} +83 -39
- package/src/types.ts +99 -0
- package/threeLetterSequenceStringToAminoAcidMap.d.ts +11 -921
- package/tidyUpAnnotation.d.ts +13 -11
- package/tidyUpSequenceData.d.ts +18 -1
- package/types.d.ts +97 -0
- package/addGapsToSeqReads.test.d.ts +0 -1
- package/adjustBpsToReplaceOrInsert.test.d.ts +0 -1
- package/aminoAcidToDnaRna.test.d.ts +0 -1
- package/annotateSingleSeq.test.d.ts +0 -1
- package/autoAnnotate.test.d.ts +0 -1
- package/calculateEndStability.test.d.ts +0 -1
- package/calculateNebTa.test.d.ts +0 -1
- package/calculateNebTm.test.d.ts +0 -1
- package/calculatePercentGC.test.d.ts +0 -1
- package/calculateSantaLuciaTm.test.d.ts +0 -1
- package/calculateTm.test.d.ts +0 -1
- package/computeDigestFragments.test.d.ts +0 -1
- package/condensePairwiseAlignmentDifferences.test.d.ts +0 -1
- package/convertAACaretPositionOrRangeToDna.test.d.ts +0 -1
- package/convertDnaCaretPositionOrRangeToAA.test.d.ts +0 -1
- package/cutSequenceByRestrictionEnzyme.test.d.ts +0 -1
- package/deleteSequenceDataAtRange.test.d.ts +0 -1
- package/diffUtils.test.d.ts +0 -1
- package/doesEnzymeChopOutsideOfRecognitionSite.test.d.ts +0 -1
- package/featureTypesAndColors.test.d.ts +0 -1
- package/filterSequenceString.test.d.ts +0 -1
- package/findApproxMatches.test.d.ts +0 -1
- package/findNearestRangeOfSequenceOverlapToPosition.test.d.ts +0 -1
- package/findSequenceMatches.test.d.ts +0 -1
- package/generateSequenceData.test.d.ts +0 -1
- package/getAllInsertionsInSeqReads.test.d.ts +0 -1
- package/getAminoAcidDataForEachBaseOfDna.test.d.ts +0 -1
- package/getAminoAcidStringFromSequenceString.test.d.ts +0 -1
- package/getComplementSequenceString.test.d.ts +0 -1
- package/getDigestFragmentsForRestrictionEnzymes.test.d.ts +0 -1
- package/getInsertBetweenVals.test.d.ts +0 -1
- package/getLeftAndRightOfSequenceInRangeGivenPosition.test.d.ts +0 -1
- package/getMassofAaString.test.d.ts +0 -1
- package/getOrfsFromSequence.test.d.ts +0 -1
- package/getOverlapBetweenTwoSequences.test.d.ts +0 -1
- package/getPossiblePartsFromSequenceAndEnzymes.test.d.ts +0 -1
- package/getReverseAminoAcidStringFromSequenceString.test.d.ts +0 -1
- package/getReverseComplementAnnotation.test.d.ts +0 -1
- package/getReverseComplementSequenceAndAnnotations.test.d.ts +0 -1
- package/getReverseComplementSequenceString.test.d.ts +0 -1
- package/getReverseSequenceString.test.d.ts +0 -1
- package/getSequenceDataBetweenRange.test.d.ts +0 -1
- package/getVirtualDigest.test.d.ts +0 -1
- package/guessIfSequenceIsDnaAndNotProtein.test.d.ts +0 -1
- package/index.test.d.ts +0 -1
- package/insertGapsIntoRefSeq.test.d.ts +0 -1
- package/insertSequenceDataAtPosition.test.d.ts +0 -1
- package/insertSequenceDataAtPositionOrRange.test.d.ts +0 -1
- package/mapAnnotationsToRows.test.d.ts +0 -1
- package/prepareCircularViewData.test.d.ts +0 -1
- package/prepareRowData.test.d.ts +0 -1
- package/rotateBpsToPosition.test.d.ts +0 -1
- package/rotateSequenceDataToPosition.test.d.ts +0 -1
- package/src/adjustAnnotationsToInsert.js +0 -19
- package/src/cutSequenceByRestrictionEnzyme.js +0 -301
- package/src/deleteSequenceDataAtRange.js +0 -5
- package/src/diffUtils.js +0 -63
- package/src/doesEnzymeChopOutsideOfRecognitionSite.js +0 -10
- package/src/getCutsiteType.js +0 -10
- package/src/getCutsitesFromSequence.js +0 -17
- package/src/getDegenerateDnaStringFromAAString.js +0 -8
- package/src/getDegenerateRnaStringFromAAString.js +0 -8
- package/src/getDigestFragmentsForRestrictionEnzymes.js +0 -27
- package/src/getReverseComplementSequenceAndAnnotations.js +0 -40
- package/src/isEnzymeType2S.js +0 -3
- package/src/mapAnnotationsToRows.js +0 -174
- package/src/prepareCircularViewData.js +0 -17
- package/src/rotateBpsToPosition.js +0 -9
- package/src/shiftAnnotationsByLen.js +0 -17
- package/tidyUpSequenceData.test.d.ts +0 -1
- /package/src/{DNAComplementMap.js → DNAComplementMap.ts} +0 -0
- /package/src/{aminoAcidToDegenerateRnaMap.js → aminoAcidToDegenerateRnaMap.ts} +0 -0
- /package/src/{annotationTypes.js → annotationTypes.ts} +0 -0
- /package/src/{degenerateDnaToAminoAcidMap.js → degenerateDnaToAminoAcidMap.ts} +0 -0
- /package/src/{degenerateRnaToAminoAcidMap.js → degenerateRnaToAminoAcidMap.ts} +0 -0
- /package/src/{insertSequenceDataAtPosition.js → insertSequenceDataAtPosition.ts} +0 -0
- /package/src/{proteinAlphabet.js → proteinAlphabet.ts} +0 -0
package/index.cjs
CHANGED
|
@@ -519,9 +519,9 @@ var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
|
519
519
|
var freeProcess = moduleExports$1 && freeGlobal.process;
|
|
520
520
|
var nodeUtil = function() {
|
|
521
521
|
try {
|
|
522
|
-
var
|
|
523
|
-
if (
|
|
524
|
-
return
|
|
522
|
+
var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
|
|
523
|
+
if (types2) {
|
|
524
|
+
return types2;
|
|
525
525
|
}
|
|
526
526
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
527
527
|
} catch (e) {
|
|
@@ -2588,9 +2588,10 @@ function getOverlapOfNonCircularRanges(rangeA, rangeB) {
|
|
|
2588
2588
|
}
|
|
2589
2589
|
}
|
|
2590
2590
|
}
|
|
2591
|
+
return null;
|
|
2591
2592
|
}
|
|
2592
2593
|
__name(getOverlapOfNonCircularRanges, "getOverlapOfNonCircularRanges");
|
|
2593
|
-
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible) {
|
|
2594
|
+
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible = false) {
|
|
2594
2595
|
const normalizedRangeA = splitRangeIntoTwoPartsIfItIsCircular(
|
|
2595
2596
|
rangeA,
|
|
2596
2597
|
maxRangeLength
|
|
@@ -2611,6 +2612,22 @@ function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength,
|
|
|
2611
2612
|
}
|
|
2612
2613
|
});
|
|
2613
2614
|
});
|
|
2615
|
+
if (joinIfPossible && normalizedRangeA.length === 2 && normalizedRangeB.length === 2 && maxRangeLength) {
|
|
2616
|
+
const joinedOverlap = {};
|
|
2617
|
+
overlaps = flatMap(overlaps, (o) => {
|
|
2618
|
+
if (o.start === 0) {
|
|
2619
|
+
joinedOverlap.end = o.end;
|
|
2620
|
+
return [];
|
|
2621
|
+
} else if (o.end === maxRangeLength - 1) {
|
|
2622
|
+
joinedOverlap.start = o.start;
|
|
2623
|
+
return [];
|
|
2624
|
+
}
|
|
2625
|
+
return [o];
|
|
2626
|
+
});
|
|
2627
|
+
if (Object.keys(joinedOverlap).length > 0) {
|
|
2628
|
+
overlaps.push(joinedOverlap);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2614
2631
|
return overlaps;
|
|
2615
2632
|
}
|
|
2616
2633
|
__name(getOverlapsOfPotentiallyCircularRanges, "getOverlapsOfPotentiallyCircularRanges");
|
|
@@ -2682,10 +2699,7 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
2682
2699
|
if (!overlaps.length) {
|
|
2683
2700
|
return rangeToBeTrimmed;
|
|
2684
2701
|
}
|
|
2685
|
-
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(
|
|
2686
|
-
rangeToBeTrimmed,
|
|
2687
|
-
sequenceLength
|
|
2688
|
-
);
|
|
2702
|
+
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(rangeToBeTrimmed, sequenceLength);
|
|
2689
2703
|
splitRangesToBeTrimmed.forEach(function(nonCircularRangeToBeTrimmed, index) {
|
|
2690
2704
|
overlaps.forEach(function(overlap) {
|
|
2691
2705
|
if (nonCircularRangeToBeTrimmed) {
|
|
@@ -2728,6 +2742,7 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
2728
2742
|
end: outputTrimmedRange.end
|
|
2729
2743
|
});
|
|
2730
2744
|
}
|
|
2745
|
+
return void 0;
|
|
2731
2746
|
}
|
|
2732
2747
|
__name(trimRangeByAnotherRange, "trimRangeByAnotherRange");
|
|
2733
2748
|
function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted, anotherRange, maxLength) {
|
|
@@ -2874,28 +2889,36 @@ function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps, sequen
|
|
|
2874
2889
|
}
|
|
2875
2890
|
}
|
|
2876
2891
|
}
|
|
2892
|
+
return overlaps;
|
|
2877
2893
|
}
|
|
2878
2894
|
__name(collapseOverlapsGeneratedFromRangeComparisonIfPossible, "collapseOverlapsGeneratedFromRangeComparisonIfPossible");
|
|
2879
2895
|
function provideInclusiveOptions(funToWrap) {
|
|
2880
|
-
return function() {
|
|
2881
|
-
const args = Array.prototype.slice.call(arguments);
|
|
2896
|
+
return function(...args) {
|
|
2882
2897
|
const options = args[args.length - 1];
|
|
2883
2898
|
if (options && (options.inclusive1BasedEnd || options.inclusive1BasedStart)) {
|
|
2884
2899
|
args.forEach(function(arg, index) {
|
|
2885
|
-
|
|
2886
|
-
|
|
2900
|
+
const potentialRange = arg;
|
|
2901
|
+
if (potentialRange && typeof potentialRange.start === "number" && potentialRange.start > -1 && options.inclusive1BasedStart) {
|
|
2902
|
+
args[index] = assign(potentialRange, {
|
|
2903
|
+
start: potentialRange.start - 1
|
|
2904
|
+
});
|
|
2887
2905
|
}
|
|
2888
|
-
if (
|
|
2889
|
-
args[index] = assign(
|
|
2906
|
+
if (potentialRange && typeof potentialRange.end === "number" && potentialRange.end > -1 && options.inclusive1BasedEnd) {
|
|
2907
|
+
args[index] = assign(potentialRange, {
|
|
2908
|
+
end: potentialRange.end - 1
|
|
2909
|
+
});
|
|
2890
2910
|
}
|
|
2891
2911
|
});
|
|
2892
2912
|
}
|
|
2893
2913
|
let returnVal = funToWrap.apply(this, args);
|
|
2894
|
-
|
|
2895
|
-
|
|
2914
|
+
const potentialReturn = returnVal;
|
|
2915
|
+
if (potentialReturn && typeof potentialReturn.start === "number" && potentialReturn.start > -1 && options && options.inclusive1BasedStart) {
|
|
2916
|
+
returnVal = assign(potentialReturn, {
|
|
2917
|
+
start: potentialReturn.start + 1
|
|
2918
|
+
});
|
|
2896
2919
|
}
|
|
2897
|
-
if (
|
|
2898
|
-
returnVal = assign(
|
|
2920
|
+
if (potentialReturn && typeof potentialReturn.end === "number" && potentialReturn.end > -1 && options && options.inclusive1BasedEnd) {
|
|
2921
|
+
returnVal = assign(potentialReturn, { end: potentialReturn.end + 1 });
|
|
2899
2922
|
}
|
|
2900
2923
|
return returnVal;
|
|
2901
2924
|
};
|
|
@@ -2941,7 +2964,7 @@ function isPositionWithinRange(position, range, sequenceLength, includeStartEdge
|
|
|
2941
2964
|
return positionFits;
|
|
2942
2965
|
}
|
|
2943
2966
|
__name(isPositionWithinRange, "isPositionWithinRange");
|
|
2944
|
-
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions) {
|
|
2967
|
+
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions = false) {
|
|
2945
2968
|
let position = pPosition;
|
|
2946
2969
|
if (position < 0) {
|
|
2947
2970
|
position += sequenceLength;
|
|
@@ -3115,15 +3138,19 @@ function getRandomInt$1(min, max) {
|
|
|
3115
3138
|
}
|
|
3116
3139
|
__name(getRandomInt$1, "getRandomInt$1");
|
|
3117
3140
|
function getSequenceWithinRange(range, sequence) {
|
|
3118
|
-
if (range.start < 0 || range.end < 0)
|
|
3141
|
+
if (range.start < 0 || range.end < 0) {
|
|
3142
|
+
if (typeof sequence === "string") return "";
|
|
3143
|
+
return [];
|
|
3144
|
+
}
|
|
3119
3145
|
if (range.start > range.end) {
|
|
3120
|
-
|
|
3146
|
+
const subSequence = sequence.slice(range.start, sequence.length);
|
|
3121
3147
|
if (typeof subSequence === "string") {
|
|
3122
|
-
subSequence
|
|
3148
|
+
return subSequence + sequence.slice(0, range.end + 1);
|
|
3123
3149
|
} else {
|
|
3124
|
-
|
|
3150
|
+
return subSequence.concat(
|
|
3151
|
+
sequence.slice(0, range.end + 1)
|
|
3152
|
+
);
|
|
3125
3153
|
}
|
|
3126
|
-
return subSequence;
|
|
3127
3154
|
} else {
|
|
3128
3155
|
return sequence.slice(range.start, range.end + 1);
|
|
3129
3156
|
}
|
|
@@ -3141,7 +3168,7 @@ function getShortestDistanceBetweenTwoPositions(position1, position2, sequenceLe
|
|
|
3141
3168
|
}
|
|
3142
3169
|
__name(getShortestDistanceBetweenTwoPositions, "getShortestDistanceBetweenTwoPositions");
|
|
3143
3170
|
function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, assignYOffsetToRange) {
|
|
3144
|
-
let yOffset =
|
|
3171
|
+
let yOffset = 0;
|
|
3145
3172
|
const openYOffsetFound = YOffsetLevelsWithRanges.some(
|
|
3146
3173
|
function(rangesAlreadyAddedToYOffset, index) {
|
|
3147
3174
|
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
@@ -3154,6 +3181,7 @@ function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, a
|
|
|
3154
3181
|
);
|
|
3155
3182
|
if (!rangeBlocked) {
|
|
3156
3183
|
yOffset = index;
|
|
3184
|
+
if (assignYOffsetToRange) range.yOffset = index;
|
|
3157
3185
|
rangesAlreadyAddedToYOffset.push(range);
|
|
3158
3186
|
return true;
|
|
3159
3187
|
}
|
|
@@ -3162,6 +3190,7 @@ function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, a
|
|
|
3162
3190
|
);
|
|
3163
3191
|
if (!openYOffsetFound) {
|
|
3164
3192
|
yOffset = YOffsetLevelsWithRanges.length;
|
|
3193
|
+
if (assignYOffsetToRange) range.yOffset = YOffsetLevelsWithRanges.length;
|
|
3165
3194
|
}
|
|
3166
3195
|
return yOffset;
|
|
3167
3196
|
}
|
|
@@ -3173,7 +3202,8 @@ function getYOffsetsForPotentiallyCircularRanges(ranges, assignYOffsetToRange) {
|
|
|
3173
3202
|
ranges.forEach(function(range) {
|
|
3174
3203
|
const yOffset = getYOffsetForPotentiallyCircularRange(
|
|
3175
3204
|
range,
|
|
3176
|
-
yOffsetLevels
|
|
3205
|
+
yOffsetLevels,
|
|
3206
|
+
assignYOffsetToRange
|
|
3177
3207
|
);
|
|
3178
3208
|
yOffsets.push(yOffset);
|
|
3179
3209
|
if (yOffset > maxYOffset) {
|
|
@@ -3188,21 +3218,20 @@ function getYOffsetsForPotentiallyCircularRanges(ranges, assignYOffsetToRange) {
|
|
|
3188
3218
|
__name(getYOffsetsForPotentiallyCircularRanges, "getYOffsetsForPotentiallyCircularRanges");
|
|
3189
3219
|
const invertRange = provideInclusiveOptions(invertRange$1);
|
|
3190
3220
|
function invertRange$1(rangeOrCaret, rangeMax) {
|
|
3191
|
-
if (rangeOrCaret.start > -1) {
|
|
3221
|
+
if (typeof rangeOrCaret !== "number" && rangeOrCaret.start > -1) {
|
|
3192
3222
|
const start = rangeOrCaret.end + 1;
|
|
3193
3223
|
const end = rangeOrCaret.start - 1;
|
|
3194
3224
|
return {
|
|
3195
3225
|
start: normalizePositionByRangeLength(start, rangeMax, false),
|
|
3196
3226
|
end: normalizePositionByRangeLength(end, rangeMax, false)
|
|
3197
3227
|
};
|
|
3198
|
-
} else {
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
};
|
|
3204
|
-
}
|
|
3228
|
+
} else if (typeof rangeOrCaret === "number" && rangeOrCaret > -1) {
|
|
3229
|
+
return {
|
|
3230
|
+
start: normalizePositionByRangeLength(rangeOrCaret, rangeMax, false),
|
|
3231
|
+
end: normalizePositionByRangeLength(rangeOrCaret - 1, rangeMax, false)
|
|
3232
|
+
};
|
|
3205
3233
|
}
|
|
3234
|
+
return void 0;
|
|
3206
3235
|
}
|
|
3207
3236
|
__name(invertRange$1, "invertRange$1");
|
|
3208
3237
|
function isPositionCloserToRangeStartThanRangeEnd(position, range, maxLength) {
|
|
@@ -3256,9 +3285,10 @@ function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength)
|
|
|
3256
3285
|
"subRange must be fully contained by containerRange! Otherwise this function does not make sense"
|
|
3257
3286
|
);
|
|
3258
3287
|
}
|
|
3259
|
-
const newSubrange = {
|
|
3260
|
-
|
|
3261
|
-
|
|
3288
|
+
const newSubrange = {
|
|
3289
|
+
start: subRange.start - containerRange.start,
|
|
3290
|
+
end: subRange.end - containerRange.start
|
|
3291
|
+
};
|
|
3262
3292
|
if (newSubrange.start < 0) {
|
|
3263
3293
|
newSubrange.start += sequenceLength;
|
|
3264
3294
|
}
|
|
@@ -3269,10 +3299,10 @@ function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength)
|
|
|
3269
3299
|
}
|
|
3270
3300
|
__name(zeroSubrangeByContainerRange, "zeroSubrangeByContainerRange");
|
|
3271
3301
|
function adjustRangeToRotation(rangeToBeAdjusted, rotateTo = 0, rangeLength) {
|
|
3272
|
-
const mod = rangeLength ? modulo :
|
|
3302
|
+
const mod = /* @__PURE__ */ __name((n) => rangeLength ? modulo(n, rangeLength) : n, "mod");
|
|
3273
3303
|
const newRange = assign({}, rangeToBeAdjusted, {
|
|
3274
|
-
start: mod(rangeToBeAdjusted.start - (rotateTo || 0)
|
|
3275
|
-
end: mod(rangeToBeAdjusted.end - (rotateTo || 0)
|
|
3304
|
+
start: mod(rangeToBeAdjusted.start - (rotateTo || 0)),
|
|
3305
|
+
end: mod(rangeToBeAdjusted.end - (rotateTo || 0))
|
|
3276
3306
|
});
|
|
3277
3307
|
return newRange;
|
|
3278
3308
|
}
|
|
@@ -3358,7 +3388,11 @@ function autoAnnotate({
|
|
|
3358
3388
|
forEach(
|
|
3359
3389
|
omitBy(seqsToAnnotateById, (s) => !s.sequence.length),
|
|
3360
3390
|
({ circular, sequence }, id) => {
|
|
3361
|
-
function getMatches({
|
|
3391
|
+
function getMatches({
|
|
3392
|
+
seqToMatchAgainst,
|
|
3393
|
+
isReverse,
|
|
3394
|
+
seqLen: seqLen2
|
|
3395
|
+
}) {
|
|
3362
3396
|
let match;
|
|
3363
3397
|
let lastMatch;
|
|
3364
3398
|
try {
|
|
@@ -3378,13 +3412,13 @@ function autoAnnotate({
|
|
|
3378
3412
|
};
|
|
3379
3413
|
const range = {
|
|
3380
3414
|
start: matchStart,
|
|
3381
|
-
end: normalizePositionByRangeLength(matchEnd - 1, seqLen2)
|
|
3415
|
+
end: normalizePositionByRangeLength(matchEnd - 1, seqLen2, false)
|
|
3382
3416
|
};
|
|
3383
3417
|
if (!annotationsToAddBySeqId[id])
|
|
3384
3418
|
annotationsToAddBySeqId[id] = [];
|
|
3385
3419
|
annotationsToAddBySeqId[id].push(__spreadProps(__spreadValues({}, isReverse ? {
|
|
3386
|
-
start: reversePositionInRange(range.end, seqLen2),
|
|
3387
|
-
end: reversePositionInRange(range.start, seqLen2)
|
|
3420
|
+
start: reversePositionInRange(range.end, seqLen2, false),
|
|
3421
|
+
end: reversePositionInRange(range.start, seqLen2, false)
|
|
3388
3422
|
} : range), {
|
|
3389
3423
|
strand: isReverse ? -1 : 1,
|
|
3390
3424
|
id: ann.id
|
|
@@ -3415,14 +3449,22 @@ function autoAnnotate({
|
|
|
3415
3449
|
const origSeq = seqsToAnnotateById[id];
|
|
3416
3450
|
const alreadyExistingAnnsByStartEnd = {};
|
|
3417
3451
|
forEach(origSeq.annotations, (ann) => {
|
|
3418
|
-
alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3452
|
+
alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3453
|
+
__spreadProps(__spreadValues({}, ann), { strand: typeof ann.strand === "string" ? 1 : ann.strand }),
|
|
3454
|
+
{ compareName }
|
|
3455
|
+
)] = ann;
|
|
3419
3456
|
});
|
|
3420
3457
|
const warningCounter = {};
|
|
3421
3458
|
const toAdd = anns.filter((ann) => {
|
|
3422
|
-
const alreadyExistingAnn = alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3459
|
+
const alreadyExistingAnn = alreadyExistingAnnsByStartEnd[getStartEndStr(
|
|
3460
|
+
__spreadProps(__spreadValues({}, ann), {
|
|
3461
|
+
strand: typeof ann.strand === "string" ? 1 : ann.strand
|
|
3462
|
+
}),
|
|
3463
|
+
{ compareName }
|
|
3464
|
+
)];
|
|
3423
3465
|
if (alreadyExistingAnn) return false;
|
|
3424
|
-
if (warnIfMoreThan) {
|
|
3425
|
-
warningCounter[ann.id] = (warningCounter[ann.id] || 0) + 1;
|
|
3466
|
+
if (warnIfMoreThan && ann.id !== void 0) {
|
|
3467
|
+
warningCounter[String(ann.id)] = (warningCounter[String(ann.id)] || 0) + 1;
|
|
3426
3468
|
}
|
|
3427
3469
|
return true;
|
|
3428
3470
|
}).sort((a, b) => a.start - b.start);
|
|
@@ -3431,16 +3473,23 @@ function autoAnnotate({
|
|
|
3431
3473
|
}
|
|
3432
3474
|
warnIfMoreThan && forEach(warningCounter, (num, annId) => {
|
|
3433
3475
|
if (num > warnIfMoreThan) {
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3476
|
+
const warnings = toReturn["__more_than_warnings"] || {};
|
|
3477
|
+
warnings[id] = warnings[id] || [];
|
|
3478
|
+
warnings[id].push(annId);
|
|
3479
|
+
toReturn["__more_than_warnings"] = warnings;
|
|
3437
3480
|
}
|
|
3438
3481
|
});
|
|
3439
3482
|
});
|
|
3440
3483
|
return toReturn;
|
|
3441
3484
|
}
|
|
3442
3485
|
__name(autoAnnotate, "autoAnnotate");
|
|
3443
|
-
function getStartEndStr({
|
|
3486
|
+
function getStartEndStr({
|
|
3487
|
+
start,
|
|
3488
|
+
end,
|
|
3489
|
+
name,
|
|
3490
|
+
strand,
|
|
3491
|
+
forward
|
|
3492
|
+
}, { compareName }) {
|
|
3444
3493
|
const isReverse = strand === -1 || forward === false;
|
|
3445
3494
|
return `${start}-${end}-${isReverse ? "rev" : "for"}-${compareName ? name : ""}`;
|
|
3446
3495
|
}
|
|
@@ -3454,13 +3503,12 @@ function convertApELikeRegexToRegex(regString = "") {
|
|
|
3454
3503
|
let hitLeftCaret;
|
|
3455
3504
|
let hitRightCaret;
|
|
3456
3505
|
for (const bp of regString.replace("(", "").replace(")", "")) {
|
|
3457
|
-
let maybeHandleRightCaret = function(justAdded) {
|
|
3506
|
+
let maybeHandleRightCaret = /* @__PURE__ */ __name(function(justAdded) {
|
|
3458
3507
|
if (hitRightCaret) {
|
|
3459
3508
|
rightOfCaretHolder += justAdded;
|
|
3460
3509
|
afterRightCaretHolder = `${rightOfCaretHolder}${afterRightCaretHolder.length ? "|" : ""}${afterRightCaretHolder}`;
|
|
3461
3510
|
}
|
|
3462
|
-
};
|
|
3463
|
-
__name(maybeHandleRightCaret, "maybeHandleRightCaret");
|
|
3511
|
+
}, "maybeHandleRightCaret");
|
|
3464
3512
|
const ambigVal = ambiguous_dna_values[bp.toUpperCase()];
|
|
3465
3513
|
if (ambigVal && ambigVal.length > 1) {
|
|
3466
3514
|
let valToUse;
|
|
@@ -3645,16 +3693,17 @@ const getMergedFeatureMap = /* @__PURE__ */ __name(() => {
|
|
|
3645
3693
|
})),
|
|
3646
3694
|
"name"
|
|
3647
3695
|
);
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
featureOverrides = featureOverrides.map((fo) => {
|
|
3696
|
+
const featureOverrides = typeof window !== "undefined" && get$1(window, "tg_featureTypeOverrides") || typeof global !== "undefined" && get$1(global, "tg_featureTypeOverrides") || [];
|
|
3697
|
+
const mappedOverrides = featureOverrides.map((fo) => {
|
|
3651
3698
|
const originalGenbankFeat = keyedGBFeats[fo.name];
|
|
3652
3699
|
return __spreadValues(__spreadValues(__spreadValues({}, originalGenbankFeat), fo), originalGenbankFeat ? { isOverridden: true } : { isCustomType: true });
|
|
3653
3700
|
});
|
|
3654
|
-
|
|
3655
|
-
return __spreadValues(__spreadValues({}, keyedGBFeats),
|
|
3701
|
+
const keyedOverrides = keyBy(mappedOverrides, "name");
|
|
3702
|
+
return __spreadValues(__spreadValues({}, keyedGBFeats), keyedOverrides);
|
|
3656
3703
|
}, "getMergedFeatureMap");
|
|
3657
|
-
const getFeatureToColorMap = /* @__PURE__ */ __name(({
|
|
3704
|
+
const getFeatureToColorMap = /* @__PURE__ */ __name(({
|
|
3705
|
+
includeHidden
|
|
3706
|
+
} = {}) => {
|
|
3658
3707
|
const toRet = {};
|
|
3659
3708
|
filter(
|
|
3660
3709
|
getMergedFeatureMap(),
|
|
@@ -3664,7 +3713,9 @@ const getFeatureToColorMap = /* @__PURE__ */ __name(({ includeHidden } = {}) =>
|
|
|
3664
3713
|
});
|
|
3665
3714
|
return toRet;
|
|
3666
3715
|
}, "getFeatureToColorMap");
|
|
3667
|
-
const getFeatureTypes = /* @__PURE__ */ __name(({
|
|
3716
|
+
const getFeatureTypes = /* @__PURE__ */ __name(({
|
|
3717
|
+
includeHidden
|
|
3718
|
+
} = {}) => filter(getMergedFeatureMap(), (f) => includeHidden ? true : !f.isHidden).map(
|
|
3668
3719
|
(f) => f.name
|
|
3669
3720
|
), "getFeatureTypes");
|
|
3670
3721
|
function getDefaultExportFromCjs(x) {
|
|
@@ -3969,10 +4020,15 @@ __name(requireShortid, "requireShortid");
|
|
|
3969
4020
|
var shortidExports = requireShortid();
|
|
3970
4021
|
const shortid = /* @__PURE__ */ getDefaultExportFromCjs(shortidExports);
|
|
3971
4022
|
function cutSequenceByRestrictionEnzyme(pSequence, circular, restrictionEnzyme) {
|
|
3972
|
-
if (restrictionEnzyme.forwardRegex
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
4023
|
+
if (!restrictionEnzyme.forwardRegex || // Add check for undefined
|
|
4024
|
+
!restrictionEnzyme.reverseRegex || // Add check for undefined
|
|
4025
|
+
restrictionEnzyme.forwardRegex.length === 0 || restrictionEnzyme.reverseRegex.length === 0) {
|
|
4026
|
+
console.warn(
|
|
4027
|
+
"Cannot cut sequence. Enzyme restriction site must be at least 1 bp long."
|
|
4028
|
+
);
|
|
4029
|
+
const returnVal = [];
|
|
4030
|
+
returnVal.error = "Cannot cut sequence. Enzyme restriction site must be at least 1 bp long.";
|
|
4031
|
+
return returnVal;
|
|
3976
4032
|
}
|
|
3977
4033
|
const forwardRegExpPattern = new RegExp(restrictionEnzyme.forwardRegex, "ig");
|
|
3978
4034
|
const sequence = pSequence;
|
|
@@ -3997,54 +4053,54 @@ function cutSequenceByRestrictionEnzyme(pSequence, circular, restrictionEnzyme)
|
|
|
3997
4053
|
}
|
|
3998
4054
|
return cutsitesForward.concat(cutsitesReverse);
|
|
3999
4055
|
function reverseAllPositionsOfCutsite(cutsite, rangeLength) {
|
|
4056
|
+
cutsite = assign({}, cutsite);
|
|
4000
4057
|
cutsite.start = reversePositionInRange(cutsite.start, rangeLength, false);
|
|
4001
4058
|
cutsite.end = reversePositionInRange(cutsite.end, rangeLength, false);
|
|
4002
|
-
cutsite.topSnipPosition = reversePositionInRange(
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4059
|
+
cutsite.topSnipPosition = cutsite.topSnipPosition != null ? reversePositionInRange(cutsite.topSnipPosition, rangeLength, true) : null;
|
|
4060
|
+
cutsite.bottomSnipPosition = cutsite.bottomSnipPosition != null ? reversePositionInRange(cutsite.bottomSnipPosition, rangeLength, true) : null;
|
|
4061
|
+
if (cutsite.cutType === 1 && cutsite.cutsTwice) {
|
|
4062
|
+
if (cutsite.upstreamTopSnip != null && cutsite.upstreamBottomSnip != null) {
|
|
4063
|
+
cutsite.upstreamTopSnip = reversePositionInRange(
|
|
4064
|
+
cutsite.upstreamTopSnip,
|
|
4065
|
+
rangeLength,
|
|
4066
|
+
true
|
|
4067
|
+
);
|
|
4068
|
+
cutsite.upstreamBottomSnip = reversePositionInRange(
|
|
4069
|
+
cutsite.upstreamBottomSnip,
|
|
4070
|
+
rangeLength,
|
|
4071
|
+
true
|
|
4072
|
+
);
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
if (cutsite.recognitionSiteRange) {
|
|
4076
|
+
cutsite.recognitionSiteRange = __spreadValues({}, cutsite.recognitionSiteRange);
|
|
4077
|
+
cutsite.recognitionSiteRange.start = reversePositionInRange(
|
|
4078
|
+
cutsite.recognitionSiteRange.start,
|
|
4015
4079
|
rangeLength,
|
|
4016
|
-
|
|
4080
|
+
false
|
|
4017
4081
|
);
|
|
4018
|
-
cutsite.
|
|
4019
|
-
cutsite.
|
|
4082
|
+
cutsite.recognitionSiteRange.end = reversePositionInRange(
|
|
4083
|
+
cutsite.recognitionSiteRange.end,
|
|
4020
4084
|
rangeLength,
|
|
4021
|
-
|
|
4085
|
+
false
|
|
4022
4086
|
);
|
|
4023
4087
|
}
|
|
4024
|
-
cutsite
|
|
4025
|
-
cutsite.recognitionSiteRange.start,
|
|
4026
|
-
rangeLength,
|
|
4027
|
-
false
|
|
4028
|
-
);
|
|
4029
|
-
cutsite.recognitionSiteRange.end = reversePositionInRange(
|
|
4030
|
-
cutsite.recognitionSiteRange.end,
|
|
4031
|
-
rangeLength,
|
|
4032
|
-
false
|
|
4033
|
-
);
|
|
4034
|
-
return assign({}, cutsite, {
|
|
4088
|
+
return __spreadProps(__spreadValues({}, cutsite), {
|
|
4035
4089
|
start: cutsite.end,
|
|
4036
4090
|
end: cutsite.start,
|
|
4037
|
-
overhangBps: getReverseComplementSequenceString(
|
|
4091
|
+
overhangBps: getReverseComplementSequenceString(
|
|
4092
|
+
cutsite.overhangBps || ""
|
|
4093
|
+
),
|
|
4038
4094
|
topSnipPosition: cutsite.bottomSnipPosition,
|
|
4039
4095
|
bottomSnipPosition: cutsite.topSnipPosition,
|
|
4040
4096
|
upstreamTopSnip: cutsite.upstreamBottomSnip,
|
|
4041
4097
|
upstreamBottomSnip: cutsite.upstreamTopSnip,
|
|
4042
4098
|
upstreamTopBeforeBottom: !!cutsite.upstreamTopBeforeBottom,
|
|
4043
4099
|
topSnipBeforeBottom: !!cutsite.topSnipBeforeBottom,
|
|
4044
|
-
recognitionSiteRange: {
|
|
4100
|
+
recognitionSiteRange: cutsite.recognitionSiteRange ? {
|
|
4045
4101
|
start: cutsite.recognitionSiteRange.end,
|
|
4046
4102
|
end: cutsite.recognitionSiteRange.start
|
|
4047
|
-
},
|
|
4103
|
+
} : void 0,
|
|
4048
4104
|
forward: false
|
|
4049
4105
|
});
|
|
4050
4106
|
}
|
|
@@ -4056,7 +4112,7 @@ function cutSequence(forwardRegExpPattern, restrictionEnzyme, sequence, circular
|
|
|
4056
4112
|
let restrictionCutSite;
|
|
4057
4113
|
const recognitionSiteLength = restrictionEnzyme.site.length;
|
|
4058
4114
|
const originalSequence = sequence;
|
|
4059
|
-
const
|
|
4115
|
+
const originalSequenceLengthVal = sequence.length;
|
|
4060
4116
|
if (circular) {
|
|
4061
4117
|
sequence += sequence;
|
|
4062
4118
|
}
|
|
@@ -4065,7 +4121,10 @@ function cutSequence(forwardRegExpPattern, restrictionEnzyme, sequence, circular
|
|
|
4065
4121
|
let startIndex = 0;
|
|
4066
4122
|
let subSequence = sequence;
|
|
4067
4123
|
while (matchIndex !== -1) {
|
|
4068
|
-
const recognitionSiteRange = {
|
|
4124
|
+
const recognitionSiteRange = {
|
|
4125
|
+
start: 0,
|
|
4126
|
+
end: 0
|
|
4127
|
+
};
|
|
4069
4128
|
let start;
|
|
4070
4129
|
let end;
|
|
4071
4130
|
let upstreamTopSnip = null;
|
|
@@ -4080,37 +4139,39 @@ function cutSequence(forwardRegExpPattern, restrictionEnzyme, sequence, circular
|
|
|
4080
4139
|
recognitionSiteRange.end = matchIndex + recognitionSiteLength - 1 + startIndex;
|
|
4081
4140
|
end = recognitionSiteRange.end;
|
|
4082
4141
|
if (restrictionEnzyme.cutType === 1) {
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
if (
|
|
4089
|
-
start
|
|
4142
|
+
if (restrictionEnzyme.usForward != null && restrictionEnzyme.usReverse != null) {
|
|
4143
|
+
upstreamTopSnip = recognitionSiteRange.end - restrictionEnzyme.usForward;
|
|
4144
|
+
upstreamBottomSnip = recognitionSiteRange.end - restrictionEnzyme.usReverse;
|
|
4145
|
+
if (upstreamTopSnip >= 0 && upstreamBottomSnip >= 0) {
|
|
4146
|
+
fitsWithinSequence = true;
|
|
4147
|
+
if (upstreamTopSnip < upstreamBottomSnip) {
|
|
4148
|
+
if (start > upstreamTopSnip) {
|
|
4149
|
+
start = upstreamTopSnip + 1;
|
|
4150
|
+
}
|
|
4151
|
+
upstreamTopBeforeBottom = true;
|
|
4152
|
+
} else {
|
|
4153
|
+
if (start > upstreamBottomSnip) {
|
|
4154
|
+
start = upstreamBottomSnip + 1;
|
|
4155
|
+
}
|
|
4090
4156
|
}
|
|
4091
|
-
|
|
4157
|
+
upstreamTopSnip = normalizePositionByRangeLength(
|
|
4158
|
+
upstreamTopSnip,
|
|
4159
|
+
originalSequenceLengthVal,
|
|
4160
|
+
true
|
|
4161
|
+
);
|
|
4162
|
+
upstreamBottomSnip = normalizePositionByRangeLength(
|
|
4163
|
+
upstreamBottomSnip,
|
|
4164
|
+
originalSequenceLengthVal,
|
|
4165
|
+
true
|
|
4166
|
+
);
|
|
4092
4167
|
} else {
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
}
|
|
4168
|
+
upstreamTopSnip = null;
|
|
4169
|
+
upstreamBottomSnip = null;
|
|
4096
4170
|
}
|
|
4097
|
-
upstreamTopSnip = normalizePositionByRangeLength(
|
|
4098
|
-
upstreamTopSnip,
|
|
4099
|
-
originalSequenceLength,
|
|
4100
|
-
true
|
|
4101
|
-
);
|
|
4102
|
-
upstreamBottomSnip = normalizePositionByRangeLength(
|
|
4103
|
-
upstreamBottomSnip,
|
|
4104
|
-
originalSequenceLength,
|
|
4105
|
-
true
|
|
4106
|
-
);
|
|
4107
|
-
} else {
|
|
4108
|
-
upstreamTopSnip = null;
|
|
4109
|
-
upstreamBottomSnip = null;
|
|
4110
4171
|
}
|
|
4111
4172
|
}
|
|
4112
|
-
topSnipPosition = recognitionSiteRange.start + restrictionEnzyme.topSnipOffset;
|
|
4113
|
-
bottomSnipPosition = recognitionSiteRange.start + restrictionEnzyme.bottomSnipOffset;
|
|
4173
|
+
topSnipPosition = recognitionSiteRange.start + (restrictionEnzyme.topSnipOffset || 0);
|
|
4174
|
+
bottomSnipPosition = recognitionSiteRange.start + (restrictionEnzyme.bottomSnipOffset || 0);
|
|
4114
4175
|
if (bottomSnipPosition <= currentSequenceLength && topSnipPosition <= currentSequenceLength) {
|
|
4115
4176
|
fitsWithinSequence = true;
|
|
4116
4177
|
if (topSnipPosition > bottomSnipPosition) {
|
|
@@ -4125,61 +4186,70 @@ function cutSequence(forwardRegExpPattern, restrictionEnzyme, sequence, circular
|
|
|
4125
4186
|
}
|
|
4126
4187
|
topSnipPosition = normalizePositionByRangeLength(
|
|
4127
4188
|
topSnipPosition,
|
|
4128
|
-
|
|
4189
|
+
originalSequenceLengthVal,
|
|
4129
4190
|
true
|
|
4130
4191
|
);
|
|
4131
4192
|
bottomSnipPosition = normalizePositionByRangeLength(
|
|
4132
4193
|
bottomSnipPosition,
|
|
4133
|
-
|
|
4194
|
+
originalSequenceLengthVal,
|
|
4134
4195
|
true
|
|
4135
4196
|
);
|
|
4136
4197
|
} else {
|
|
4137
4198
|
topSnipPosition = null;
|
|
4138
4199
|
bottomSnipPosition = null;
|
|
4139
4200
|
}
|
|
4140
|
-
if (fitsWithinSequence && start >= 0 && end >= 0 && start <
|
|
4201
|
+
if (fitsWithinSequence && start >= 0 && end >= 0 && start < originalSequenceLengthVal && end < currentSequenceLength) {
|
|
4141
4202
|
start = normalizePositionByRangeLength(
|
|
4142
4203
|
start,
|
|
4143
|
-
|
|
4204
|
+
originalSequenceLengthVal,
|
|
4205
|
+
false
|
|
4206
|
+
);
|
|
4207
|
+
end = normalizePositionByRangeLength(
|
|
4208
|
+
end,
|
|
4209
|
+
originalSequenceLengthVal,
|
|
4144
4210
|
false
|
|
4145
4211
|
);
|
|
4146
|
-
end = normalizePositionByRangeLength(end, originalSequenceLength, false);
|
|
4147
4212
|
recognitionSiteRange.start = normalizePositionByRangeLength(
|
|
4148
4213
|
recognitionSiteRange.start,
|
|
4149
|
-
|
|
4214
|
+
originalSequenceLengthVal,
|
|
4150
4215
|
false
|
|
4151
4216
|
);
|
|
4152
4217
|
recognitionSiteRange.end = normalizePositionByRangeLength(
|
|
4153
4218
|
recognitionSiteRange.end,
|
|
4154
|
-
|
|
4219
|
+
originalSequenceLengthVal,
|
|
4155
4220
|
false
|
|
4156
4221
|
);
|
|
4157
4222
|
let cutRange = {
|
|
4158
4223
|
start: -1,
|
|
4159
4224
|
end: -1
|
|
4160
4225
|
};
|
|
4161
|
-
if (topSnipPosition !== bottomSnipPosition) {
|
|
4226
|
+
if (topSnipPosition !== null && bottomSnipPosition !== null && topSnipPosition !== bottomSnipPosition) {
|
|
4162
4227
|
cutRange = topSnipBeforeBottom ? {
|
|
4163
4228
|
start: topSnipPosition,
|
|
4164
4229
|
end: normalizePositionByRangeLength(
|
|
4165
4230
|
bottomSnipPosition - 1,
|
|
4166
|
-
|
|
4231
|
+
originalSequenceLengthVal
|
|
4167
4232
|
)
|
|
4168
4233
|
} : {
|
|
4169
4234
|
start: bottomSnipPosition,
|
|
4170
4235
|
end: normalizePositionByRangeLength(
|
|
4171
4236
|
topSnipPosition - 1,
|
|
4172
|
-
|
|
4237
|
+
originalSequenceLengthVal
|
|
4173
4238
|
)
|
|
4174
4239
|
};
|
|
4175
4240
|
}
|
|
4176
|
-
const overhangBps = getSequenceWithinRange(
|
|
4241
|
+
const overhangBps = getSequenceWithinRange(
|
|
4242
|
+
cutRange,
|
|
4243
|
+
originalSequence
|
|
4244
|
+
);
|
|
4177
4245
|
restrictionCutSite = {
|
|
4178
4246
|
id: shortid(),
|
|
4179
4247
|
start,
|
|
4180
4248
|
end,
|
|
4181
4249
|
topSnipPosition,
|
|
4250
|
+
// Allow null
|
|
4182
4251
|
bottomSnipPosition,
|
|
4252
|
+
// Allow null
|
|
4183
4253
|
topSnipBeforeBottom,
|
|
4184
4254
|
overhangBps,
|
|
4185
4255
|
overhangSize: overhangBps.length,
|
|
@@ -4201,16 +4271,19 @@ function cutSequence(forwardRegExpPattern, restrictionEnzyme, sequence, circular
|
|
|
4201
4271
|
return restrictionCutSites;
|
|
4202
4272
|
}
|
|
4203
4273
|
__name(cutSequence, "cutSequence");
|
|
4204
|
-
function getCutsitesFromSequence(sequence, circular,
|
|
4205
|
-
const
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4274
|
+
function getCutsitesFromSequence(sequence, circular, contextEnzymes) {
|
|
4275
|
+
const cutsites = flatMap(contextEnzymes, (enzyme) => {
|
|
4276
|
+
return cutSequenceByRestrictionEnzyme(sequence, circular, enzyme);
|
|
4277
|
+
});
|
|
4278
|
+
const cutsitesByNameMap = {};
|
|
4279
|
+
cutsites.forEach((cutsite) => {
|
|
4280
|
+
const name = cutsite.name || "";
|
|
4281
|
+
if (!cutsitesByNameMap[name]) {
|
|
4282
|
+
cutsitesByNameMap[name] = [];
|
|
4211
4283
|
}
|
|
4212
|
-
|
|
4213
|
-
|
|
4284
|
+
cutsitesByNameMap[name].push(cutsite);
|
|
4285
|
+
});
|
|
4286
|
+
return cutsitesByNameMap;
|
|
4214
4287
|
}
|
|
4215
4288
|
__name(getCutsitesFromSequence, "getCutsitesFromSequence");
|
|
4216
4289
|
function computeDigestFragments({
|
|
@@ -4228,9 +4301,9 @@ function computeDigestFragments({
|
|
|
4228
4301
|
const fragments = [];
|
|
4229
4302
|
const overlappingEnzymes = [];
|
|
4230
4303
|
const pairs = [];
|
|
4231
|
-
const sortedCutsites = cutsites.
|
|
4232
|
-
|
|
4233
|
-
|
|
4304
|
+
const sortedCutsites = cutsites.filter(
|
|
4305
|
+
(c) => c.topSnipPosition != null && c.bottomSnipPosition != null
|
|
4306
|
+
);
|
|
4234
4307
|
if (!circular && cutsites.length) {
|
|
4235
4308
|
sortedCutsites.push({
|
|
4236
4309
|
id: "seqTerm_" + shortid(),
|
|
@@ -4239,6 +4312,8 @@ function computeDigestFragments({
|
|
|
4239
4312
|
overhangBps: "",
|
|
4240
4313
|
topSnipPosition: 0,
|
|
4241
4314
|
bottomSnipPosition: 0,
|
|
4315
|
+
overhangSize: 0,
|
|
4316
|
+
// Added to satisfy CutSite
|
|
4242
4317
|
upstreamTopSnip: 0,
|
|
4243
4318
|
upstreamBottomSnip: 0,
|
|
4244
4319
|
upstreamTopBeforeBottom: false,
|
|
@@ -4249,26 +4324,34 @@ function computeDigestFragments({
|
|
|
4249
4324
|
},
|
|
4250
4325
|
forward: true,
|
|
4251
4326
|
name: "Sequence_Terminus",
|
|
4327
|
+
type: "START_OR_END_OF_SEQ",
|
|
4252
4328
|
restrictionEnzyme: {
|
|
4253
|
-
name: "Sequence_Terminus"
|
|
4329
|
+
name: "Sequence_Terminus",
|
|
4330
|
+
site: "",
|
|
4331
|
+
forwardRegex: "",
|
|
4332
|
+
reverseRegex: ""
|
|
4254
4333
|
}
|
|
4255
4334
|
});
|
|
4256
4335
|
}
|
|
4336
|
+
sortedCutsites.sort((a, b) => {
|
|
4337
|
+
return a.topSnipPosition - b.topSnipPosition;
|
|
4338
|
+
});
|
|
4257
4339
|
sortedCutsites.forEach((cutsite1, index) => {
|
|
4340
|
+
if (!computeDigestDisabled) {
|
|
4341
|
+
pairs.push([
|
|
4342
|
+
cutsite1,
|
|
4343
|
+
sortedCutsites[index + 1] ? sortedCutsites[index + 1] : sortedCutsites[0]
|
|
4344
|
+
]);
|
|
4345
|
+
}
|
|
4258
4346
|
if (computePartialDigest && !computePartialDigestDisabled) {
|
|
4259
4347
|
sortedCutsites.forEach((cs, index2) => {
|
|
4260
|
-
|
|
4348
|
+
const isAdjacent = index2 === index + 1 || index === sortedCutsites.length - 1 && index2 === 0;
|
|
4349
|
+
if (isAdjacent) {
|
|
4261
4350
|
return;
|
|
4262
4351
|
}
|
|
4263
4352
|
pairs.push([cutsite1, sortedCutsites[index2]]);
|
|
4264
4353
|
});
|
|
4265
4354
|
}
|
|
4266
|
-
if (!computeDigestDisabled) {
|
|
4267
|
-
pairs.push([
|
|
4268
|
-
cutsite1,
|
|
4269
|
-
sortedCutsites[index + 1] ? sortedCutsites[index + 1] : sortedCutsites[0]
|
|
4270
|
-
]);
|
|
4271
|
-
}
|
|
4272
4355
|
});
|
|
4273
4356
|
pairs.forEach((r) => {
|
|
4274
4357
|
let [cut1, cut2] = r;
|
|
@@ -4313,12 +4396,17 @@ function computeDigestFragments({
|
|
|
4313
4396
|
cut2.name = "Linear_Sequence_End";
|
|
4314
4397
|
cut2.restrictionEnzyme.name = "Linear_Sequence_End";
|
|
4315
4398
|
}
|
|
4399
|
+
cut1 = __spreadProps(__spreadValues({}, cut1), {
|
|
4400
|
+
isOverhangIncludedInFragmentSize: cut1.name !== "Linear_Sequence_Start" && cut1.name !== "Sequence_Terminus" && (cut1.overhangSize || 0) > 0 && !!cut1.topSnipBeforeBottom
|
|
4401
|
+
});
|
|
4402
|
+
cut2 = __spreadProps(__spreadValues({}, cut2), {
|
|
4403
|
+
isOverhangIncludedInFragmentSize: cut2.name !== "Linear_Sequence_End" && cut2.name !== "Sequence_Terminus" && (cut2.overhangSize || 0) > 0 && !cut2.topSnipBeforeBottom
|
|
4404
|
+
});
|
|
4316
4405
|
const id = start + "-" + end + "-" + size + "-";
|
|
4317
4406
|
const name = `${cut1.restrictionEnzyme.name} -- ${cut2.restrictionEnzyme.name} ${size} bps`;
|
|
4318
|
-
getRangeLength({ start, end }, sequenceLength);
|
|
4319
4407
|
fragments.push({
|
|
4320
4408
|
isFormedFromLinearEnd,
|
|
4321
|
-
madeFromOneCutsite: cut1 === cut2,
|
|
4409
|
+
madeFromOneCutsite: cut1.id === cut2.id,
|
|
4322
4410
|
start,
|
|
4323
4411
|
end,
|
|
4324
4412
|
size,
|
|
@@ -4359,12 +4447,14 @@ function getDigestFragsForSeqAndEnzymes({
|
|
|
4359
4447
|
includeOverAndUnderHangs
|
|
4360
4448
|
}) {
|
|
4361
4449
|
const cutsitesByName = getCutsitesFromSequence(sequence, circular, enzymes);
|
|
4362
|
-
|
|
4450
|
+
const digest = computeDigestFragments({
|
|
4363
4451
|
includeOverAndUnderHangs,
|
|
4364
4452
|
cutsites: flatMap(cutsitesByName),
|
|
4365
4453
|
sequenceLength: sequence.length,
|
|
4366
4454
|
circular
|
|
4367
4455
|
});
|
|
4456
|
+
digest.fragments.sort((a, b) => b.size - a.size);
|
|
4457
|
+
return digest;
|
|
4368
4458
|
}
|
|
4369
4459
|
__name(getDigestFragsForSeqAndEnzymes, "getDigestFragsForSeqAndEnzymes");
|
|
4370
4460
|
function cloneRegExp(re) {
|
|
@@ -5933,7 +6023,8 @@ function expandAndResolve(threeLetterCodon) {
|
|
|
5933
6023
|
let allPossibleThreeLetterCodons = [""];
|
|
5934
6024
|
for (const set of picks) {
|
|
5935
6025
|
const next = [];
|
|
5936
|
-
for (const prefix of allPossibleThreeLetterCodons)
|
|
6026
|
+
for (const prefix of allPossibleThreeLetterCodons)
|
|
6027
|
+
for (const b of set) next.push(prefix + b);
|
|
5937
6028
|
allPossibleThreeLetterCodons = next;
|
|
5938
6029
|
}
|
|
5939
6030
|
let foundAminoAcid = null;
|
|
@@ -5979,10 +6070,13 @@ function getAminoAcidFromSequenceTriplet(sequenceString) {
|
|
|
5979
6070
|
if (aa) {
|
|
5980
6071
|
return aa;
|
|
5981
6072
|
}
|
|
5982
|
-
const letter =
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
6073
|
+
const letter = (
|
|
6074
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6075
|
+
degenerateDnaToAminoAcidMap[
|
|
6076
|
+
sequenceString.replace("x", "n")
|
|
6077
|
+
//replace x's with n's as those are equivalent dna chars
|
|
6078
|
+
] || "x"
|
|
6079
|
+
);
|
|
5986
6080
|
return proteinAlphabet[letter.toUpperCase()];
|
|
5987
6081
|
}
|
|
5988
6082
|
__name(getAminoAcidFromSequenceTriplet, "getAminoAcidFromSequenceTriplet");
|
|
@@ -6196,9 +6290,15 @@ function filterSequenceString(sequenceString = "", {
|
|
|
6196
6290
|
name,
|
|
6197
6291
|
isProtein,
|
|
6198
6292
|
isRna,
|
|
6293
|
+
getAcceptedInsertChars,
|
|
6199
6294
|
isMixedRnaAndDna
|
|
6200
6295
|
} = {}) {
|
|
6201
|
-
const acceptedChars =
|
|
6296
|
+
const acceptedChars = isFunction(getAcceptedInsertChars) ? getAcceptedInsertChars({
|
|
6297
|
+
isOligo,
|
|
6298
|
+
isProtein,
|
|
6299
|
+
isRna,
|
|
6300
|
+
isMixedRnaAndDna
|
|
6301
|
+
}) : getAcceptedChars({
|
|
6202
6302
|
isOligo,
|
|
6203
6303
|
isProtein,
|
|
6204
6304
|
isRna,
|
|
@@ -6379,25 +6479,25 @@ function coerceLocation({
|
|
|
6379
6479
|
circular,
|
|
6380
6480
|
name
|
|
6381
6481
|
}) {
|
|
6382
|
-
location.start = parseInt(location.start, 10);
|
|
6383
|
-
location.end = parseInt(location.end, 10);
|
|
6482
|
+
location.start = parseInt(String(location.start), 10);
|
|
6483
|
+
location.end = parseInt(String(location.end), 10);
|
|
6384
6484
|
if (convertAnnotationsFromAAIndices) {
|
|
6385
6485
|
location.start = location.start * 3;
|
|
6386
6486
|
location.end = location.end * 3 + 2;
|
|
6387
6487
|
}
|
|
6388
|
-
if (
|
|
6488
|
+
if (size !== void 0 && (location.start < 0 || location.start > size - 1)) {
|
|
6389
6489
|
messages.push(
|
|
6390
6490
|
"Invalid annotation start: " + location.start + " detected for " + location.name + " and set to size: " + size
|
|
6391
6491
|
);
|
|
6392
6492
|
location.start = Math.max(0, size - (isProtein ? 3 : 1));
|
|
6393
6493
|
}
|
|
6394
|
-
if (
|
|
6494
|
+
if (size !== void 0 && (location.end < 0 || location.end > size - 1)) {
|
|
6395
6495
|
messages.push(
|
|
6396
6496
|
"Invalid annotation end: " + location.end + " detected for " + location.name + " and set to seq size: " + size
|
|
6397
6497
|
);
|
|
6398
6498
|
location.end = Math.max(0, size - 1);
|
|
6399
6499
|
}
|
|
6400
|
-
if (location.start > location.end && circular === false) {
|
|
6500
|
+
if (size !== void 0 && location.start > location.end && circular === false) {
|
|
6401
6501
|
messages.push(
|
|
6402
6502
|
"Invalid circular annotation detected for " + name + ". end set to 1"
|
|
6403
6503
|
);
|
|
@@ -6406,21 +6506,30 @@ function coerceLocation({
|
|
|
6406
6506
|
}
|
|
6407
6507
|
__name(coerceLocation, "coerceLocation");
|
|
6408
6508
|
function getDegenerateDnaStringFromAAString(aaString) {
|
|
6409
|
-
return aaString.split("").map(
|
|
6509
|
+
return aaString.split("").map(
|
|
6510
|
+
(char) => aminoAcidToDegenerateDnaMap[char.toLowerCase()] || "nnn"
|
|
6511
|
+
).join("");
|
|
6410
6512
|
}
|
|
6411
6513
|
__name(getDegenerateDnaStringFromAAString, "getDegenerateDnaStringFromAAString");
|
|
6412
|
-
function getAminoAcidStringFromSequenceString(sequenceString,
|
|
6514
|
+
function getAminoAcidStringFromSequenceString(sequenceString, options = {}) {
|
|
6515
|
+
const { doNotExcludeAsterisk } = options;
|
|
6413
6516
|
const aminoAcidsPerBase = getAminoAcidDataForEachBaseOfDna(
|
|
6414
6517
|
sequenceString,
|
|
6415
|
-
true
|
|
6518
|
+
true,
|
|
6519
|
+
null,
|
|
6520
|
+
false
|
|
6416
6521
|
);
|
|
6417
6522
|
const aaArray = [];
|
|
6418
6523
|
let aaString = "";
|
|
6419
6524
|
aminoAcidsPerBase.forEach((aa, index) => {
|
|
6525
|
+
var _a;
|
|
6420
6526
|
if (!aa.fullCodon) {
|
|
6421
6527
|
return;
|
|
6422
6528
|
}
|
|
6423
|
-
if (!doNotExcludeAsterisk && index >= aminoAcidsPerBase.length - 3 && aa.aminoAcid.value === "*") {
|
|
6529
|
+
if (!doNotExcludeAsterisk && index >= aminoAcidsPerBase.length - 3 && ((_a = aa.aminoAcid) == null ? void 0 : _a.value) === "*") {
|
|
6530
|
+
return;
|
|
6531
|
+
}
|
|
6532
|
+
if (aa.aminoAcidIndex === null || !aa.aminoAcid) {
|
|
6424
6533
|
return;
|
|
6425
6534
|
}
|
|
6426
6535
|
aaArray[aa.aminoAcidIndex] = aa.aminoAcid.value;
|
|
@@ -6440,6 +6549,8 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6440
6549
|
doNotProvideIdsForAnnotations,
|
|
6441
6550
|
noCdsTranslations,
|
|
6442
6551
|
convertAnnotationsFromAAIndices,
|
|
6552
|
+
isMixedRnaAndDna,
|
|
6553
|
+
getAcceptedInsertChars,
|
|
6443
6554
|
topLevelSeqData
|
|
6444
6555
|
} = options;
|
|
6445
6556
|
let seqData = cloneDeep(pSeqData);
|
|
@@ -6447,7 +6558,7 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6447
6558
|
messages: []
|
|
6448
6559
|
};
|
|
6449
6560
|
if (!seqData) {
|
|
6450
|
-
seqData = {};
|
|
6561
|
+
seqData = { sequence: "" };
|
|
6451
6562
|
}
|
|
6452
6563
|
if (!seqData.sequence) {
|
|
6453
6564
|
seqData.sequence = "";
|
|
@@ -6470,14 +6581,21 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6470
6581
|
}
|
|
6471
6582
|
if (!doNotRemoveInvalidChars) {
|
|
6472
6583
|
if (seqData.isProtein) {
|
|
6473
|
-
const [newSeq] = filterSequenceString(seqData.proteinSequence, __spreadProps(__spreadValues({
|
|
6474
|
-
|
|
6584
|
+
const [newSeq] = filterSequenceString(seqData.proteinSequence, __spreadProps(__spreadValues({
|
|
6585
|
+
isMixedRnaAndDna,
|
|
6586
|
+
additionalValidChars
|
|
6587
|
+
}, topLevelSeqData || seqData), {
|
|
6588
|
+
isProtein: true,
|
|
6589
|
+
getAcceptedInsertChars
|
|
6475
6590
|
}));
|
|
6476
6591
|
seqData.proteinSequence = newSeq;
|
|
6477
6592
|
} else {
|
|
6478
|
-
const [newSeq] = filterSequenceString(seqData.sequence, __spreadValues({
|
|
6479
|
-
additionalValidChars
|
|
6480
|
-
|
|
6593
|
+
const [newSeq] = filterSequenceString(seqData.sequence, __spreadProps(__spreadValues({
|
|
6594
|
+
additionalValidChars,
|
|
6595
|
+
isMixedRnaAndDna
|
|
6596
|
+
}, topLevelSeqData || seqData), {
|
|
6597
|
+
getAcceptedInsertChars
|
|
6598
|
+
}));
|
|
6481
6599
|
seqData.sequence = newSeq;
|
|
6482
6600
|
}
|
|
6483
6601
|
}
|
|
@@ -6510,25 +6628,27 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6510
6628
|
const featureTypes = getFeatureTypes();
|
|
6511
6629
|
annotationTypes.forEach((annotationType) => {
|
|
6512
6630
|
if (!Array.isArray(seqData[annotationType])) {
|
|
6513
|
-
if (typeof seqData[annotationType] === "object") {
|
|
6514
|
-
seqData[annotationType] = Object.keys(
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
);
|
|
6631
|
+
if (seqData[annotationType] && typeof seqData[annotationType] === "object") {
|
|
6632
|
+
seqData[annotationType] = Object.keys(
|
|
6633
|
+
seqData[annotationType]
|
|
6634
|
+
).map((key) => {
|
|
6635
|
+
return seqData[annotationType][key];
|
|
6636
|
+
});
|
|
6519
6637
|
} else {
|
|
6520
6638
|
seqData[annotationType] = [];
|
|
6521
6639
|
}
|
|
6522
6640
|
}
|
|
6523
|
-
seqData[annotationType] = seqData[annotationType].filter(
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6641
|
+
seqData[annotationType] = seqData[annotationType].filter(
|
|
6642
|
+
(annotation) => {
|
|
6643
|
+
return tidyUpAnnotation(annotation, __spreadProps(__spreadValues({}, options), {
|
|
6644
|
+
featureTypes,
|
|
6645
|
+
sequenceData: seqData,
|
|
6646
|
+
convertAnnotationsFromAAIndices,
|
|
6647
|
+
mutative: true,
|
|
6648
|
+
annotationType
|
|
6649
|
+
}));
|
|
6650
|
+
}
|
|
6651
|
+
);
|
|
6532
6652
|
});
|
|
6533
6653
|
if (!noTranslationData) {
|
|
6534
6654
|
seqData.translations = flatMap(seqData.translations, (translation) => {
|
|
@@ -6536,7 +6656,7 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6536
6656
|
if (noCdsTranslations && translation.translationType === "CDS Feature") {
|
|
6537
6657
|
return [];
|
|
6538
6658
|
}
|
|
6539
|
-
const codonStart = ((_b = (_a = translation == null ? void 0 : translation.notes) == null ? void 0 : _a
|
|
6659
|
+
const codonStart = ((_b = (_a = translation == null ? void 0 : translation.notes) == null ? void 0 : _a["codon_start"]) == null ? void 0 : _b[0]) - 1 || 0;
|
|
6540
6660
|
const expandedRange = expandOrContractRangeByLength(
|
|
6541
6661
|
translation,
|
|
6542
6662
|
-codonStart,
|
|
@@ -6546,8 +6666,9 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6546
6666
|
if (!expandedRange.aminoAcids && !seqData.noSequence) {
|
|
6547
6667
|
expandedRange.aminoAcids = getAminoAcidDataForEachBaseOfDna(
|
|
6548
6668
|
seqData.sequence,
|
|
6549
|
-
expandedRange.forward,
|
|
6550
|
-
expandedRange
|
|
6669
|
+
expandedRange.forward || false,
|
|
6670
|
+
expandedRange,
|
|
6671
|
+
false
|
|
6551
6672
|
);
|
|
6552
6673
|
}
|
|
6553
6674
|
return expandedRange;
|
|
@@ -6555,19 +6676,22 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6555
6676
|
}
|
|
6556
6677
|
if (annotationsAsObjects) {
|
|
6557
6678
|
annotationTypes.forEach((name) => {
|
|
6558
|
-
seqData[name] = seqData[name].reduce(
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6679
|
+
seqData[name] = seqData[name].reduce(
|
|
6680
|
+
(acc, item) => {
|
|
6681
|
+
let itemId;
|
|
6682
|
+
if (item.id || item.id === 0) {
|
|
6683
|
+
itemId = item.id;
|
|
6684
|
+
} else {
|
|
6685
|
+
itemId = shortid();
|
|
6686
|
+
if (!doNotProvideIdsForAnnotations) {
|
|
6687
|
+
item.id = itemId;
|
|
6688
|
+
}
|
|
6566
6689
|
}
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6690
|
+
acc[itemId] = item;
|
|
6691
|
+
return acc;
|
|
6692
|
+
},
|
|
6693
|
+
{}
|
|
6694
|
+
);
|
|
6571
6695
|
});
|
|
6572
6696
|
}
|
|
6573
6697
|
if (logMessages && response.messages.length > 0) {
|
|
@@ -6577,17 +6701,17 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
6577
6701
|
}
|
|
6578
6702
|
__name(tidyUpSequenceData, "tidyUpSequenceData");
|
|
6579
6703
|
const getDiffFromSeqs = /* @__PURE__ */ __name((oldData, newData, { ignoreKeys = [] } = {}) => {
|
|
6580
|
-
|
|
6704
|
+
const cleanedOldData = tidyUpSequenceData(oldData, {
|
|
6581
6705
|
annotationsAsObjects: true,
|
|
6582
6706
|
noTranslationData: true,
|
|
6583
6707
|
doNotRemoveInvalidChars: true
|
|
6584
6708
|
});
|
|
6585
|
-
|
|
6709
|
+
const cleanedNewData = tidyUpSequenceData(newData, {
|
|
6586
6710
|
annotationsAsObjects: true,
|
|
6587
6711
|
noTranslationData: true,
|
|
6588
6712
|
doNotRemoveInvalidChars: true
|
|
6589
6713
|
});
|
|
6590
|
-
[
|
|
6714
|
+
[cleanedOldData, cleanedNewData].forEach((d) => {
|
|
6591
6715
|
[
|
|
6592
6716
|
"cutsites",
|
|
6593
6717
|
"orfs",
|
|
@@ -6610,27 +6734,29 @@ const getDiffFromSeqs = /* @__PURE__ */ __name((oldData, newData, { ignoreKeys =
|
|
|
6610
6734
|
});
|
|
6611
6735
|
}
|
|
6612
6736
|
});
|
|
6613
|
-
return diff(
|
|
6737
|
+
return diff(cleanedOldData, cleanedNewData);
|
|
6614
6738
|
}, "getDiffFromSeqs");
|
|
6615
|
-
const patchSeqWithDiff = /* @__PURE__ */ __name((oldData,
|
|
6739
|
+
const patchSeqWithDiff = /* @__PURE__ */ __name((oldData, diffData, { ignoreKeys = [] } = {}) => {
|
|
6616
6740
|
ignoreKeys.forEach((k) => {
|
|
6617
|
-
delete
|
|
6741
|
+
delete diffData[k];
|
|
6618
6742
|
});
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
diff2
|
|
6625
|
-
);
|
|
6743
|
+
const tidyOld = tidyUpSequenceData(cloneDeep(oldData), {
|
|
6744
|
+
annotationsAsObjects: true,
|
|
6745
|
+
doNotRemoveInvalidChars: true
|
|
6746
|
+
});
|
|
6747
|
+
return patch(tidyOld, diffData);
|
|
6626
6748
|
}, "patchSeqWithDiff");
|
|
6627
|
-
const reverseSeqDiff = /* @__PURE__ */ __name((
|
|
6628
|
-
return reverse(
|
|
6749
|
+
const reverseSeqDiff = /* @__PURE__ */ __name((diffData) => {
|
|
6750
|
+
return reverse(diffData);
|
|
6629
6751
|
}, "reverseSeqDiff");
|
|
6752
|
+
const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6753
|
+
__proto__: null
|
|
6754
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6630
6755
|
function getAllInsertionsInSeqReads(seqReads) {
|
|
6631
6756
|
const allInsertionsInSeqReads = [];
|
|
6632
6757
|
seqReads.forEach((seqRead) => {
|
|
6633
6758
|
const splitSeqRead = seqRead.cigar.match(/([0-9]*[MDI])/g);
|
|
6759
|
+
if (!splitSeqRead) return;
|
|
6634
6760
|
for (let componentI = 0; componentI < splitSeqRead.length; componentI++) {
|
|
6635
6761
|
if (splitSeqRead[componentI].slice(-1) === "I") {
|
|
6636
6762
|
let bpPosOfInsertion = seqRead.pos;
|
|
@@ -6674,14 +6800,19 @@ function getAllInsertionsInSeqReads(seqReads) {
|
|
|
6674
6800
|
return sortedInsertions;
|
|
6675
6801
|
}
|
|
6676
6802
|
__name(getAllInsertionsInSeqReads, "getAllInsertionsInSeqReads");
|
|
6677
|
-
function annotateSingleSeq({
|
|
6803
|
+
function annotateSingleSeq({
|
|
6804
|
+
fullSeq,
|
|
6805
|
+
searchSeq
|
|
6806
|
+
}) {
|
|
6678
6807
|
const fullSeqId = fullSeq.id || "fullSeqId";
|
|
6679
6808
|
const searchSeqId = searchSeq.id || "searchSeqId";
|
|
6680
6809
|
const results = autoAnnotate({
|
|
6681
6810
|
seqsToAnnotateById: {
|
|
6682
|
-
[fullSeqId]:
|
|
6683
|
-
|
|
6684
|
-
|
|
6811
|
+
[fullSeqId]: {
|
|
6812
|
+
sequence: fullSeq.sequence,
|
|
6813
|
+
circular: fullSeq.circular,
|
|
6814
|
+
annotations: fullSeq.features || []
|
|
6815
|
+
}
|
|
6685
6816
|
},
|
|
6686
6817
|
annotationsToCheckById: {
|
|
6687
6818
|
[searchSeqId]: __spreadProps(__spreadValues({}, searchSeq), {
|
|
@@ -6731,7 +6862,9 @@ const aminoAcidToDegenerateRnaMap = {
|
|
|
6731
6862
|
z: "sar"
|
|
6732
6863
|
};
|
|
6733
6864
|
function getDegenerateRnaStringFromAAString(aaString) {
|
|
6734
|
-
return aaString.split("").map(
|
|
6865
|
+
return aaString.split("").map(
|
|
6866
|
+
(char) => aminoAcidToDegenerateRnaMap[char.toLowerCase()] || "nnn"
|
|
6867
|
+
).join("");
|
|
6735
6868
|
}
|
|
6736
6869
|
__name(getDegenerateRnaStringFromAAString, "getDegenerateRnaStringFromAAString");
|
|
6737
6870
|
function getVirtualDigest({
|
|
@@ -6746,7 +6879,7 @@ function getVirtualDigest({
|
|
|
6746
6879
|
const overlappingEnzymes = [];
|
|
6747
6880
|
const pairs = [];
|
|
6748
6881
|
const sortedCutsites = cutsites.sort((a, b) => {
|
|
6749
|
-
return a.topSnipPosition - b.topSnipPosition;
|
|
6882
|
+
return (a.topSnipPosition || 0) - (b.topSnipPosition || 0);
|
|
6750
6883
|
});
|
|
6751
6884
|
sortedCutsites.forEach((cutsite1, index) => {
|
|
6752
6885
|
if (computePartialDigest && !computePartialDigestDisabled) {
|
|
@@ -6763,11 +6896,11 @@ function getVirtualDigest({
|
|
|
6763
6896
|
});
|
|
6764
6897
|
pairs.forEach(([cut1, cut2]) => {
|
|
6765
6898
|
const start = normalizePositionByRangeLength(
|
|
6766
|
-
cut1.topSnipPosition,
|
|
6899
|
+
cut1.topSnipPosition || 0,
|
|
6767
6900
|
sequenceLength
|
|
6768
6901
|
);
|
|
6769
6902
|
const end = normalizePositionByRangeLength(
|
|
6770
|
-
cut2.topSnipPosition - 1,
|
|
6903
|
+
(cut2.topSnipPosition || 0) - 1,
|
|
6771
6904
|
sequenceLength
|
|
6772
6905
|
);
|
|
6773
6906
|
if (!isCircular && start > end) {
|
|
@@ -6781,6 +6914,7 @@ function getVirtualDigest({
|
|
|
6781
6914
|
name: "End Of Seq"
|
|
6782
6915
|
}
|
|
6783
6916
|
}
|
|
6917
|
+
// Cast to CutSite as it's a mock
|
|
6784
6918
|
};
|
|
6785
6919
|
const frag2 = {
|
|
6786
6920
|
start: 0,
|
|
@@ -6791,6 +6925,7 @@ function getVirtualDigest({
|
|
|
6791
6925
|
name: "Start Of Seq"
|
|
6792
6926
|
}
|
|
6793
6927
|
},
|
|
6928
|
+
// Cast
|
|
6794
6929
|
cut2
|
|
6795
6930
|
};
|
|
6796
6931
|
fragments.push(addSizeIdName(frag1, sequenceLength));
|
|
@@ -6842,7 +6977,7 @@ function addSizeIdName(frag, sequenceLength) {
|
|
|
6842
6977
|
}
|
|
6843
6978
|
__name(addSizeIdName, "addSizeIdName");
|
|
6844
6979
|
function isEnzymeType2S(e) {
|
|
6845
|
-
return e.site.length < e.topSnipOffset || e.site.length < e.bottomSnipOffset;
|
|
6980
|
+
return e.site.length < (e.topSnipOffset || 0) || e.site.length < (e.bottomSnipOffset || 0);
|
|
6846
6981
|
}
|
|
6847
6982
|
__name(isEnzymeType2S, "isEnzymeType2S");
|
|
6848
6983
|
function insertGapsIntoRefSeq(refSeq, seqReads) {
|
|
@@ -6893,27 +7028,18 @@ function findApproxMatches(searchSeq, targetSeq, maxMismatches, circular = false
|
|
|
6893
7028
|
return matches;
|
|
6894
7029
|
}
|
|
6895
7030
|
__name(findApproxMatches, "findApproxMatches");
|
|
6896
|
-
var spliceString$1;
|
|
6897
|
-
var hasRequiredSpliceString;
|
|
6898
|
-
function requireSpliceString() {
|
|
6899
|
-
if (hasRequiredSpliceString) return spliceString$1;
|
|
6900
|
-
hasRequiredSpliceString = 1;
|
|
6901
|
-
spliceString$1 = /* @__PURE__ */ __name(function spliceSlice(str, index, count, add) {
|
|
6902
|
-
return str.slice(0, index) + (add || "") + str.slice(index + count);
|
|
6903
|
-
}, "spliceSlice");
|
|
6904
|
-
return spliceString$1;
|
|
6905
|
-
}
|
|
6906
|
-
__name(requireSpliceString, "requireSpliceString");
|
|
6907
|
-
var spliceStringExports = requireSpliceString();
|
|
6908
|
-
const spliceString = /* @__PURE__ */ getDefaultExportFromCjs(spliceStringExports);
|
|
6909
7031
|
function adjustBpsToReplaceOrInsert(bpString, insertString = "", caretPositionOrRange) {
|
|
6910
7032
|
let stringToReturn = bpString;
|
|
6911
|
-
if (caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
7033
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
6912
7034
|
if (getRangeLength(caretPositionOrRange, bpString.length) === bpString.length) {
|
|
6913
7035
|
return insertString;
|
|
6914
7036
|
}
|
|
6915
7037
|
const ranges = splitRangeIntoTwoPartsIfItIsCircular(
|
|
6916
|
-
invertRange(
|
|
7038
|
+
invertRange(
|
|
7039
|
+
caretPositionOrRange,
|
|
7040
|
+
bpString.length
|
|
7041
|
+
),
|
|
7042
|
+
bpString.length
|
|
6917
7043
|
);
|
|
6918
7044
|
stringToReturn = "";
|
|
6919
7045
|
ranges.forEach((range, index) => {
|
|
@@ -6939,6 +7065,16 @@ function adjustBpsToReplaceOrInsert(bpString, insertString = "", caretPositionOr
|
|
|
6939
7065
|
return stringToReturn;
|
|
6940
7066
|
}
|
|
6941
7067
|
__name(adjustBpsToReplaceOrInsert, "adjustBpsToReplaceOrInsert");
|
|
7068
|
+
const spliceString = /* @__PURE__ */ __name((str, index, count, add) => {
|
|
7069
|
+
let i = index;
|
|
7070
|
+
if (i < 0) {
|
|
7071
|
+
i = str.length + i;
|
|
7072
|
+
if (i < 0) {
|
|
7073
|
+
i = 0;
|
|
7074
|
+
}
|
|
7075
|
+
}
|
|
7076
|
+
return str.slice(0, i) + (add || "") + str.slice(i + count);
|
|
7077
|
+
}, "spliceString");
|
|
6942
7078
|
function calculatePercentGC(bps) {
|
|
6943
7079
|
return (bps.match(/[cg]/gi) || []).length / bps.length * 100 || 0;
|
|
6944
7080
|
}
|
|
@@ -6964,11 +7100,17 @@ const calcTmMethods = {
|
|
|
6964
7100
|
* monovalentCationConc - THe monovalent salt concentration. Defaults to 50e-3M.
|
|
6965
7101
|
* return - Temperature for the given sequence, in Celsius.
|
|
6966
7102
|
*/
|
|
6967
|
-
calculateTemperature: /* @__PURE__ */ __name(function(_sequence, {
|
|
7103
|
+
calculateTemperature: /* @__PURE__ */ __name(function(_sequence, {
|
|
7104
|
+
type,
|
|
7105
|
+
A,
|
|
7106
|
+
R,
|
|
7107
|
+
primerConc,
|
|
7108
|
+
monovalentCationConc
|
|
7109
|
+
} = {}) {
|
|
6968
7110
|
const sequence = (_sequence || "").toLowerCase();
|
|
6969
7111
|
if (typeof type === "undefined") {
|
|
6970
7112
|
type = this.TABLE_BRESLAUER;
|
|
6971
|
-
} else if (type
|
|
7113
|
+
} else if (type !== this.TABLE_BRESLAUER && type !== this.TABLE_UNIFIED && type !== this.TABLE_SUGIMOTO) {
|
|
6972
7114
|
throw new Error("Invalid table type!");
|
|
6973
7115
|
}
|
|
6974
7116
|
if (!A) {
|
|
@@ -6984,11 +7126,14 @@ const calcTmMethods = {
|
|
|
6984
7126
|
monovalentCationConc = this.monovalentCationConc;
|
|
6985
7127
|
}
|
|
6986
7128
|
const sequenceLength = sequence.length;
|
|
6987
|
-
if (sequenceLength
|
|
7129
|
+
if (sequenceLength === 0) {
|
|
6988
7130
|
return 0;
|
|
6989
7131
|
}
|
|
6990
7132
|
const deltaHTable = this.getDeltaHTable(type);
|
|
6991
7133
|
const deltaSTable = this.getDeltaSTable(type);
|
|
7134
|
+
if (!deltaHTable || !deltaSTable) {
|
|
7135
|
+
return 0;
|
|
7136
|
+
}
|
|
6992
7137
|
const neighbors = [];
|
|
6993
7138
|
neighbors.push(this.calculateReps(sequence, "aa"));
|
|
6994
7139
|
neighbors.push(this.calculateNumberOfOccurrences(sequence, "at"));
|
|
@@ -7022,7 +7167,7 @@ const calcTmMethods = {
|
|
|
7022
7167
|
* @return {Number[]} deltaH table for given algorithm.
|
|
7023
7168
|
*/
|
|
7024
7169
|
getDeltaHTable: /* @__PURE__ */ __name(function(type) {
|
|
7025
|
-
if (type
|
|
7170
|
+
if (type === this.TABLE_BRESLAUER) {
|
|
7026
7171
|
return [
|
|
7027
7172
|
9.1,
|
|
7028
7173
|
8.6,
|
|
@@ -7041,7 +7186,7 @@ const calcTmMethods = {
|
|
|
7041
7186
|
6.5,
|
|
7042
7187
|
11.1
|
|
7043
7188
|
];
|
|
7044
|
-
} else if (type
|
|
7189
|
+
} else if (type === this.TABLE_SUGIMOTO) {
|
|
7045
7190
|
return [
|
|
7046
7191
|
8,
|
|
7047
7192
|
5.6,
|
|
@@ -7060,7 +7205,7 @@ const calcTmMethods = {
|
|
|
7060
7205
|
9.4,
|
|
7061
7206
|
11.9
|
|
7062
7207
|
];
|
|
7063
|
-
} else if (type
|
|
7208
|
+
} else if (type === this.TABLE_UNIFIED) {
|
|
7064
7209
|
return [
|
|
7065
7210
|
7.9,
|
|
7066
7211
|
7.2,
|
|
@@ -7083,39 +7228,6 @@ const calcTmMethods = {
|
|
|
7083
7228
|
return null;
|
|
7084
7229
|
}
|
|
7085
7230
|
}, "getDeltaHTable"),
|
|
7086
|
-
// "AA/TT": -7.9, 7.9
|
|
7087
|
-
// "AT/TA": -7.2, 7.2
|
|
7088
|
-
// "AC/TG": -8.4, 8.4
|
|
7089
|
-
// "AG/TC": -7.8, 7.8
|
|
7090
|
-
// "TT/AA": -7.9, 7.9
|
|
7091
|
-
// "TA/AT": -7.2, 7.2
|
|
7092
|
-
// "TG/AC": -8.5, 8.2
|
|
7093
|
-
// "TC/AG": -8.2, 8.5
|
|
7094
|
-
// "CC/GG": -8.0, 8.0
|
|
7095
|
-
// "CA/GT": -8.5, 8.5
|
|
7096
|
-
// "CT/GA": -7.8, 7.8
|
|
7097
|
-
// "CG/GC": -10.6, 10.6
|
|
7098
|
-
// "GG/CC": -8.0, 8.0
|
|
7099
|
-
// "GA/CT": -8.2, 8.2,
|
|
7100
|
-
// "GT/CA": -8.4, 8.4
|
|
7101
|
-
// "GC/CG": -9.8, 9.8
|
|
7102
|
-
// aa, at, ac, ag, tt, ta, tc, tg, cc, ca, ct, cg, gg, ga, gt, gc
|
|
7103
|
-
// "AA/TT": -22.2,22.2,
|
|
7104
|
-
// "AT/TA": -20.4,20.4,
|
|
7105
|
-
// "AC/TG": -22.4,22.4,
|
|
7106
|
-
// "AG/TC": -21.0,21.0,
|
|
7107
|
-
// "TT/AA": -22.2,22.2,
|
|
7108
|
-
// "TA/AT": -21.3,21.3,
|
|
7109
|
-
// "TC/AG": -22.2,22.2,
|
|
7110
|
-
// "TG/AC": -22.7,22.7,
|
|
7111
|
-
// "CC/GG": -19.9,19.9,
|
|
7112
|
-
// "CA/GT": -22.7,22.7,
|
|
7113
|
-
// "CT/GA": -21.0,21.0,
|
|
7114
|
-
// "CG/GC": -27.2,27.2,
|
|
7115
|
-
// "GG/CC": -19.9,19.9,
|
|
7116
|
-
// "GT/CA": -22.4,22.2,
|
|
7117
|
-
// "GA/CT": -22.2,22.4,
|
|
7118
|
-
// "GC/CG": -24.4,24.4
|
|
7119
7231
|
/**
|
|
7120
7232
|
* @private
|
|
7121
7233
|
* Function to return deltaS table for given algorithm.
|
|
@@ -7123,7 +7235,7 @@ const calcTmMethods = {
|
|
|
7123
7235
|
* @return {Number[]} deltaS table for given algorithm.
|
|
7124
7236
|
*/
|
|
7125
7237
|
getDeltaSTable: /* @__PURE__ */ __name(function(type) {
|
|
7126
|
-
if (type
|
|
7238
|
+
if (type === this.TABLE_BRESLAUER) {
|
|
7127
7239
|
return [
|
|
7128
7240
|
24,
|
|
7129
7241
|
23.9,
|
|
@@ -7142,7 +7254,7 @@ const calcTmMethods = {
|
|
|
7142
7254
|
17.3,
|
|
7143
7255
|
26.7
|
|
7144
7256
|
];
|
|
7145
|
-
} else if (type
|
|
7257
|
+
} else if (type === this.TABLE_SUGIMOTO) {
|
|
7146
7258
|
return [
|
|
7147
7259
|
21.9,
|
|
7148
7260
|
15.2,
|
|
@@ -7161,7 +7273,7 @@ const calcTmMethods = {
|
|
|
7161
7273
|
25.5,
|
|
7162
7274
|
29
|
|
7163
7275
|
];
|
|
7164
|
-
} else if (type
|
|
7276
|
+
} else if (type === this.TABLE_UNIFIED) {
|
|
7165
7277
|
return [
|
|
7166
7278
|
22.2,
|
|
7167
7279
|
20.4,
|
|
@@ -7195,14 +7307,14 @@ const calcTmMethods = {
|
|
|
7195
7307
|
*/
|
|
7196
7308
|
calculateReps: /* @__PURE__ */ __name(function(sequence, target) {
|
|
7197
7309
|
const sequenceLength = sequence.length;
|
|
7198
|
-
if (sequenceLength
|
|
7310
|
+
if (sequenceLength === 0) {
|
|
7199
7311
|
return 0;
|
|
7200
7312
|
}
|
|
7201
7313
|
let numFound = 0;
|
|
7202
7314
|
let seqOffset = 0;
|
|
7203
7315
|
while (true) {
|
|
7204
7316
|
const foundSeq = sequence.indexOf(target, seqOffset);
|
|
7205
|
-
if (foundSeq
|
|
7317
|
+
if (foundSeq === -1) {
|
|
7206
7318
|
break;
|
|
7207
7319
|
}
|
|
7208
7320
|
seqOffset = foundSeq + 1;
|
|
@@ -7222,7 +7334,7 @@ const calcTmMethods = {
|
|
|
7222
7334
|
*/
|
|
7223
7335
|
calculateNumberOfOccurrences: /* @__PURE__ */ __name(function(sequence, target) {
|
|
7224
7336
|
const sequenceLength = sequence.length;
|
|
7225
|
-
if (sequenceLength
|
|
7337
|
+
if (sequenceLength === 0) {
|
|
7226
7338
|
return 0;
|
|
7227
7339
|
}
|
|
7228
7340
|
const numberFound = sequence.split(target).length - 1;
|
|
@@ -7257,11 +7369,11 @@ function rotateBpsToPosition(bps, caretPosition) {
|
|
|
7257
7369
|
__name(rotateBpsToPosition, "rotateBpsToPosition");
|
|
7258
7370
|
function arrayRotate(arr, count) {
|
|
7259
7371
|
count -= arr.length * Math.floor(count / arr.length);
|
|
7260
|
-
arr.push
|
|
7372
|
+
arr.push(...arr.splice(0, count));
|
|
7261
7373
|
return arr;
|
|
7262
7374
|
}
|
|
7263
7375
|
__name(arrayRotate, "arrayRotate");
|
|
7264
|
-
function rotateSequenceDataToPosition(sequenceData, caretPosition, options) {
|
|
7376
|
+
function rotateSequenceDataToPosition(sequenceData, caretPosition, options = {}) {
|
|
7265
7377
|
const newSequenceData = tidyUpSequenceData(sequenceData, __spreadValues({
|
|
7266
7378
|
doNotRemoveInvalidChars: true
|
|
7267
7379
|
}, options));
|
|
@@ -7290,7 +7402,8 @@ function adjustAnnotationsToRotation(annotationsToBeAdjusted, positionToRotateTo
|
|
|
7290
7402
|
}
|
|
7291
7403
|
__name(adjustAnnotationsToRotation, "adjustAnnotationsToRotation");
|
|
7292
7404
|
function adjustAnnotationsToInsert(annotationsToBeAdjusted, insertStart, insertLength) {
|
|
7293
|
-
|
|
7405
|
+
const annotations = Array.isArray(annotationsToBeAdjusted) ? annotationsToBeAdjusted : Object.values(annotationsToBeAdjusted);
|
|
7406
|
+
return annotations.map((annotation) => {
|
|
7294
7407
|
return __spreadValues(__spreadValues({}, adjustRangeToInsert(annotation, insertStart, insertLength)), annotation.locations && {
|
|
7295
7408
|
locations: annotation.locations.map(
|
|
7296
7409
|
(loc) => adjustRangeToInsert(loc, insertStart, insertLength)
|
|
@@ -7309,16 +7422,24 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7309
7422
|
}, options));
|
|
7310
7423
|
const newSequenceData = cloneDeep(existingSequenceData);
|
|
7311
7424
|
const insertLength = sequenceDataToInsert.isProtein && sequenceDataToInsert.proteinSequence ? sequenceDataToInsert.proteinSequence.length * 3 : sequenceDataToInsert.sequence.length;
|
|
7312
|
-
let caretPosition = caretPositionOrRange;
|
|
7313
|
-
const isInsertSameLengthAsSelection = sequenceDataToInsert.sequence.length === getRangeLength(
|
|
7314
|
-
|
|
7425
|
+
let caretPosition = typeof caretPositionOrRange === "number" ? caretPositionOrRange : caretPositionOrRange.start;
|
|
7426
|
+
const isInsertSameLengthAsSelection = typeof caretPositionOrRange !== "number" && sequenceDataToInsert.sequence.length === getRangeLength(
|
|
7427
|
+
caretPositionOrRange,
|
|
7428
|
+
existingSequenceData.sequence.length
|
|
7429
|
+
);
|
|
7430
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1 && getRangeLength(
|
|
7315
7431
|
caretPositionOrRange,
|
|
7316
7432
|
existingSequenceData.sequence.length
|
|
7317
7433
|
) === existingSequenceData.sequence.length) {
|
|
7434
|
+
const emptyAnnotations = modifiableTypes.reduce(
|
|
7435
|
+
(acc, type) => {
|
|
7436
|
+
acc[type] = [];
|
|
7437
|
+
return acc;
|
|
7438
|
+
},
|
|
7439
|
+
{}
|
|
7440
|
+
);
|
|
7318
7441
|
existingSequenceData = tidyUpSequenceData(
|
|
7319
|
-
__spreadProps(__spreadValues(__spreadValues({}, existingSequenceData),
|
|
7320
|
-
return acc[type] = [];
|
|
7321
|
-
}, {})), {
|
|
7442
|
+
__spreadProps(__spreadValues(__spreadValues({}, existingSequenceData), emptyAnnotations), {
|
|
7322
7443
|
sequence: "",
|
|
7323
7444
|
doNotRemoveInvalidChars: true,
|
|
7324
7445
|
proteinSequence: "",
|
|
@@ -7328,7 +7449,7 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7328
7449
|
);
|
|
7329
7450
|
newSequenceData.chromatogramData = void 0;
|
|
7330
7451
|
} else if (newSequenceData.chromatogramData && newSequenceData.chromatogramData.baseTraces) {
|
|
7331
|
-
if (caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
7452
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1) {
|
|
7332
7453
|
if (caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7333
7454
|
newSequenceData.chromatogramData = trimChromatogram({
|
|
7334
7455
|
chromatogramData: newSequenceData.chromatogramData,
|
|
@@ -7338,14 +7459,16 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7338
7459
|
},
|
|
7339
7460
|
justBaseCalls: isInsertSameLengthAsSelection
|
|
7340
7461
|
});
|
|
7341
|
-
newSequenceData.chromatogramData
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7462
|
+
if (newSequenceData.chromatogramData) {
|
|
7463
|
+
newSequenceData.chromatogramData = trimChromatogram({
|
|
7464
|
+
chromatogramData: newSequenceData.chromatogramData,
|
|
7465
|
+
range: {
|
|
7466
|
+
start: 0,
|
|
7467
|
+
end: caretPositionOrRange.end
|
|
7468
|
+
},
|
|
7469
|
+
justBaseCalls: isInsertSameLengthAsSelection
|
|
7470
|
+
});
|
|
7471
|
+
}
|
|
7349
7472
|
} else {
|
|
7350
7473
|
newSequenceData.chromatogramData = trimChromatogram({
|
|
7351
7474
|
chromatogramData: newSequenceData.chromatogramData,
|
|
@@ -7357,10 +7480,10 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7357
7480
|
});
|
|
7358
7481
|
}
|
|
7359
7482
|
}
|
|
7360
|
-
if (sequenceDataToInsert.sequence) {
|
|
7483
|
+
if (sequenceDataToInsert.sequence && newSequenceData.chromatogramData) {
|
|
7361
7484
|
insertIntoChromatogram({
|
|
7362
7485
|
chromatogramData: newSequenceData.chromatogramData,
|
|
7363
|
-
caretPosition: caretPositionOrRange.start > -1 ? caretPositionOrRange.start : caretPositionOrRange,
|
|
7486
|
+
caretPosition: typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1 ? caretPositionOrRange.start : caretPositionOrRange,
|
|
7364
7487
|
seqToInsert: sequenceDataToInsert.sequence,
|
|
7365
7488
|
justBaseCalls: isInsertSameLengthAsSelection
|
|
7366
7489
|
});
|
|
@@ -7373,14 +7496,15 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7373
7496
|
);
|
|
7374
7497
|
newSequenceData.size = newSequenceData.sequence.length;
|
|
7375
7498
|
newSequenceData.proteinSequence = adjustBpsToReplaceOrInsert(
|
|
7376
|
-
existingSequenceData.proteinSequence,
|
|
7377
|
-
sequenceDataToInsert.proteinSequence,
|
|
7499
|
+
existingSequenceData.proteinSequence || "",
|
|
7500
|
+
sequenceDataToInsert.proteinSequence || "",
|
|
7378
7501
|
convertDnaCaretPositionOrRangeToAA(caretPositionOrRange)
|
|
7379
7502
|
);
|
|
7380
|
-
newSequenceData.proteinSize = newSequenceData.proteinSequence.length;
|
|
7503
|
+
newSequenceData.proteinSize = (newSequenceData.proteinSequence || "").length;
|
|
7381
7504
|
modifiableTypes.forEach((annotationType) => {
|
|
7382
7505
|
let existingAnnotations = existingSequenceData[annotationType];
|
|
7383
|
-
if (
|
|
7506
|
+
if (!existingAnnotations) return;
|
|
7507
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1) {
|
|
7384
7508
|
const range = caretPositionOrRange;
|
|
7385
7509
|
caretPosition = range.start > range.end ? 0 : range.start;
|
|
7386
7510
|
existingAnnotations = adjustAnnotationsToDelete(
|
|
@@ -7390,22 +7514,23 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7390
7514
|
);
|
|
7391
7515
|
}
|
|
7392
7516
|
newSequenceData[annotationType] = [];
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7517
|
+
const annotationsToInsert = sequenceDataToInsert[annotationType];
|
|
7518
|
+
if (newSequenceData[annotationType]) {
|
|
7519
|
+
newSequenceData[annotationType] = newSequenceData[annotationType].concat(
|
|
7520
|
+
adjustAnnotationsToInsert(
|
|
7521
|
+
existingAnnotations,
|
|
7522
|
+
caretPosition,
|
|
7523
|
+
insertLength
|
|
7524
|
+
)
|
|
7525
|
+
);
|
|
7526
|
+
if (annotationsToInsert) {
|
|
7527
|
+
newSequenceData[annotationType] = newSequenceData[annotationType].concat(
|
|
7528
|
+
adjustAnnotationsToInsert(annotationsToInsert, 0, caretPosition)
|
|
7529
|
+
);
|
|
7530
|
+
}
|
|
7531
|
+
}
|
|
7407
7532
|
});
|
|
7408
|
-
if (maintainOriginSplit && caretPositionOrRange && caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7533
|
+
if (maintainOriginSplit && typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7409
7534
|
const caretPosToRotateTo = existingSequenceData.sequence.length - caretPositionOrRange.start;
|
|
7410
7535
|
return rotateSequenceDataToPosition(
|
|
7411
7536
|
newSequenceData,
|
|
@@ -7423,6 +7548,7 @@ function adjustAnnotationsToDelete(annotationsToBeAdjusted, range, maxLength) {
|
|
|
7423
7548
|
maxLength
|
|
7424
7549
|
);
|
|
7425
7550
|
const newLocations = annotation.locations && annotation.locations.map((loc) => adjustRangeToDeletionOfAnotherRange(loc, range, maxLength)).filter((range2) => !!range2);
|
|
7551
|
+
if (!newRange) return null;
|
|
7426
7552
|
if (newLocations && newLocations.length) {
|
|
7427
7553
|
return __spreadValues(__spreadProps(__spreadValues({}, newRange), {
|
|
7428
7554
|
start: newLocations[0].start,
|
|
@@ -7441,11 +7567,13 @@ function insertIntoChromatogram({
|
|
|
7441
7567
|
justBaseCalls
|
|
7442
7568
|
}) {
|
|
7443
7569
|
if (!seqToInsert.length) return;
|
|
7444
|
-
chromatogramData.baseCalls
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7570
|
+
if (chromatogramData.baseCalls) {
|
|
7571
|
+
chromatogramData.baseCalls.splice(
|
|
7572
|
+
caretPosition,
|
|
7573
|
+
0,
|
|
7574
|
+
...seqToInsert.split("")
|
|
7575
|
+
);
|
|
7576
|
+
}
|
|
7449
7577
|
if (justBaseCalls) {
|
|
7450
7578
|
return chromatogramData;
|
|
7451
7579
|
}
|
|
@@ -7461,8 +7589,20 @@ function insertIntoChromatogram({
|
|
|
7461
7589
|
tTrace: toPush
|
|
7462
7590
|
});
|
|
7463
7591
|
}
|
|
7464
|
-
|
|
7465
|
-
|
|
7592
|
+
if (chromatogramData.baseTraces) {
|
|
7593
|
+
chromatogramData.baseTraces.splice(
|
|
7594
|
+
caretPosition,
|
|
7595
|
+
0,
|
|
7596
|
+
...baseTracesToInsert
|
|
7597
|
+
);
|
|
7598
|
+
}
|
|
7599
|
+
if (chromatogramData.qualNums) {
|
|
7600
|
+
chromatogramData.qualNums.splice(
|
|
7601
|
+
caretPosition,
|
|
7602
|
+
0,
|
|
7603
|
+
...qualNumsToInsert
|
|
7604
|
+
);
|
|
7605
|
+
}
|
|
7466
7606
|
return chromatogramData;
|
|
7467
7607
|
}
|
|
7468
7608
|
__name(insertIntoChromatogram, "insertIntoChromatogram");
|
|
@@ -7475,17 +7615,23 @@ function trimChromatogram({
|
|
|
7475
7615
|
"baseCalls",
|
|
7476
7616
|
...justBaseCalls ? [] : ["qualNums", "baseTraces", "basePos"]
|
|
7477
7617
|
].forEach((type) => {
|
|
7478
|
-
|
|
7618
|
+
if (chromatogramData[type]) {
|
|
7619
|
+
chromatogramData[type].splice(start, end - start + 1);
|
|
7620
|
+
}
|
|
7479
7621
|
});
|
|
7480
7622
|
return chromatogramData;
|
|
7481
7623
|
}
|
|
7482
7624
|
__name(trimChromatogram, "trimChromatogram");
|
|
7483
7625
|
function deleteSequenceDataAtRange(sequenceData, range) {
|
|
7484
|
-
return insertSequenceDataAtPositionOrRange(
|
|
7626
|
+
return insertSequenceDataAtPositionOrRange(
|
|
7627
|
+
{ sequence: "" },
|
|
7628
|
+
sequenceData,
|
|
7629
|
+
range
|
|
7630
|
+
);
|
|
7485
7631
|
}
|
|
7486
7632
|
__name(deleteSequenceDataAtRange, "deleteSequenceDataAtRange");
|
|
7487
7633
|
function doesEnzymeChopOutsideOfRecognitionSite(enzyme) {
|
|
7488
|
-
if (enzyme.topSnipOffset > enzyme.site.length || enzyme.bottomSnipOffset > enzyme.site.length) {
|
|
7634
|
+
if (enzyme.topSnipOffset && enzyme.bottomSnipOffset && (enzyme.topSnipOffset > enzyme.site.length || enzyme.bottomSnipOffset > enzyme.site.length)) {
|
|
7489
7635
|
return true;
|
|
7490
7636
|
} else {
|
|
7491
7637
|
return false;
|
|
@@ -15117,10 +15263,10 @@ defaultEnzymes.forEach((name) => {
|
|
|
15117
15263
|
defaultEnzymesByName[name] = aliasedEnzymesByName[name];
|
|
15118
15264
|
});
|
|
15119
15265
|
function generateAnnotations(numberOfAnnotationsToGenerate, start, end, maxLength) {
|
|
15120
|
-
const result =
|
|
15266
|
+
const result = [];
|
|
15121
15267
|
for (let i = 0; i < numberOfAnnotationsToGenerate; i++) {
|
|
15122
15268
|
const annotation = generateAnnotation(start, end, maxLength);
|
|
15123
|
-
result
|
|
15269
|
+
result.push(annotation);
|
|
15124
15270
|
}
|
|
15125
15271
|
return result;
|
|
15126
15272
|
}
|
|
@@ -15148,16 +15294,16 @@ function generateSequenceData({
|
|
|
15148
15294
|
numPrimers,
|
|
15149
15295
|
numTranslations
|
|
15150
15296
|
} = {}) {
|
|
15151
|
-
const proteinSequence = isProtein
|
|
15152
|
-
const sequence = !isProtein
|
|
15297
|
+
const proteinSequence = isProtein ? generateSequence(sequenceLength, true) : "";
|
|
15298
|
+
const sequence = !isProtein ? generateSequence(sequenceLength) : "";
|
|
15153
15299
|
return {
|
|
15154
15300
|
circular: isProtein ? false : Math.random() > 0.5,
|
|
15155
|
-
name: "p-" + Math.floor(Math.random * 100),
|
|
15301
|
+
name: "p-" + Math.floor(Math.random() * 100),
|
|
15156
15302
|
description: "",
|
|
15157
|
-
isProtein,
|
|
15303
|
+
isProtein: !!isProtein,
|
|
15158
15304
|
sequence,
|
|
15159
15305
|
proteinSequence,
|
|
15160
|
-
translations: isProtein ?
|
|
15306
|
+
translations: isProtein ? [] : generateAnnotations(
|
|
15161
15307
|
numTranslations || 5,
|
|
15162
15308
|
0,
|
|
15163
15309
|
sequenceLength - 1,
|
|
@@ -15169,7 +15315,7 @@ function generateSequenceData({
|
|
|
15169
15315
|
sequenceLength - 1,
|
|
15170
15316
|
sequenceLength / 3
|
|
15171
15317
|
),
|
|
15172
|
-
primers: isProtein ?
|
|
15318
|
+
primers: isProtein ? [] : generateAnnotations(numPrimers || 10, 0, sequenceLength - 1, 50),
|
|
15173
15319
|
parts: generateAnnotations(
|
|
15174
15320
|
numParts || 10,
|
|
15175
15321
|
0,
|
|
@@ -15181,15 +15327,14 @@ function generateSequenceData({
|
|
|
15181
15327
|
__name(generateSequenceData, "generateSequenceData");
|
|
15182
15328
|
function generateSequence(m = 9, isProtein) {
|
|
15183
15329
|
let s = "";
|
|
15184
|
-
const r = isProtein ? "" : "gatc";
|
|
15330
|
+
const r = isProtein ? "ACDEFGHIKLMNPQRSTVWY" : "gatc";
|
|
15185
15331
|
for (let i = 0; i < m; i++) {
|
|
15186
15332
|
s += r.charAt(Math.floor(Math.random() * r.length));
|
|
15187
15333
|
}
|
|
15188
15334
|
return s;
|
|
15189
15335
|
}
|
|
15190
15336
|
__name(generateSequence, "generateSequence");
|
|
15191
|
-
function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSequence, positionStart, isLinear) {
|
|
15192
|
-
if (!positionStart) positionStart = 0;
|
|
15337
|
+
function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSequence, positionStart = 0, isLinear) {
|
|
15193
15338
|
if (sequenceToSearch.length < overlapSequence.length) {
|
|
15194
15339
|
return null;
|
|
15195
15340
|
}
|
|
@@ -15207,6 +15352,9 @@ function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSe
|
|
|
15207
15352
|
index = result.index;
|
|
15208
15353
|
distance = newDistance;
|
|
15209
15354
|
}
|
|
15355
|
+
if (index === void 0) {
|
|
15356
|
+
return null;
|
|
15357
|
+
}
|
|
15210
15358
|
return normalizeRange(
|
|
15211
15359
|
{
|
|
15212
15360
|
start: index,
|
|
@@ -15251,9 +15399,11 @@ function getOrfsFromSequence(options) {
|
|
|
15251
15399
|
internalStartCodonIndices: [],
|
|
15252
15400
|
frame: start % 3,
|
|
15253
15401
|
forward,
|
|
15254
|
-
annotationTypePlural: "orfs",
|
|
15402
|
+
// annotationTypePlural: "orfs",
|
|
15255
15403
|
isOrf: true,
|
|
15256
|
-
id: shortid()
|
|
15404
|
+
id: shortid(),
|
|
15405
|
+
type: "orf",
|
|
15406
|
+
name: "ORF"
|
|
15257
15407
|
});
|
|
15258
15408
|
}
|
|
15259
15409
|
}
|
|
@@ -15357,7 +15507,10 @@ function findSequenceMatchesTopStrand(sequence, searchString, options = {}) {
|
|
|
15357
15507
|
true
|
|
15358
15508
|
);
|
|
15359
15509
|
} else {
|
|
15360
|
-
searchStringToUse = convertAmbiguousStringToRegex(
|
|
15510
|
+
searchStringToUse = convertAmbiguousStringToRegex(
|
|
15511
|
+
searchStringToUse,
|
|
15512
|
+
false
|
|
15513
|
+
);
|
|
15361
15514
|
}
|
|
15362
15515
|
}
|
|
15363
15516
|
if (!searchStringToUse) return [];
|
|
@@ -15477,7 +15630,9 @@ function getCodonRangeForAASliver(aminoAcidPositionInSequence, aminoAcidSliver,
|
|
|
15477
15630
|
}
|
|
15478
15631
|
__name(getCodonRangeForAASliver, "getCodonRangeForAASliver");
|
|
15479
15632
|
function getComplementAminoAcidStringFromSequenceString(sequenceString) {
|
|
15480
|
-
const aaString = getAminoAcidStringFromSequenceString(sequenceString,
|
|
15633
|
+
const aaString = getAminoAcidStringFromSequenceString(sequenceString, {
|
|
15634
|
+
doNotExcludeAsterisk: true
|
|
15635
|
+
});
|
|
15481
15636
|
return aaString.split("").reverse().join("");
|
|
15482
15637
|
}
|
|
15483
15638
|
__name(getComplementAminoAcidStringFromSequenceString, "getComplementAminoAcidStringFromSequenceString");
|
|
@@ -15515,26 +15670,30 @@ function getSequenceDataBetweenRange(seqData, range, options = {}) {
|
|
|
15515
15670
|
sequence: getSequenceWithinRange(range, seqDataToUse.sequence),
|
|
15516
15671
|
proteinSequence: getSequenceWithinRange(
|
|
15517
15672
|
convertDnaCaretPositionOrRangeToAA(range),
|
|
15518
|
-
seqDataToUse.proteinSequence
|
|
15673
|
+
seqDataToUse.proteinSequence || ""
|
|
15519
15674
|
)
|
|
15520
15675
|
},
|
|
15521
|
-
annotationTypes.reduce(
|
|
15522
|
-
|
|
15523
|
-
|
|
15676
|
+
annotationTypes.reduce(
|
|
15677
|
+
(acc, type) => {
|
|
15678
|
+
if (exclude[type]) {
|
|
15679
|
+
acc[type] = [];
|
|
15680
|
+
return acc;
|
|
15681
|
+
}
|
|
15682
|
+
acc[type] = getAnnotationsBetweenRange(
|
|
15683
|
+
seqDataToUse[type],
|
|
15684
|
+
range,
|
|
15685
|
+
seqDataToUse.sequence.length,
|
|
15686
|
+
excludePartial[type]
|
|
15687
|
+
);
|
|
15524
15688
|
return acc;
|
|
15525
|
-
}
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
range,
|
|
15529
|
-
seqDataToUse.sequence.length,
|
|
15530
|
-
excludePartial[type]
|
|
15531
|
-
);
|
|
15532
|
-
return acc;
|
|
15533
|
-
}, {})
|
|
15689
|
+
},
|
|
15690
|
+
{}
|
|
15691
|
+
)
|
|
15534
15692
|
);
|
|
15535
15693
|
if (range.overlapsSelf) {
|
|
15536
15694
|
const extendedSeqData = insertSequenceDataAtPositionOrRange(
|
|
15537
15695
|
{ sequence: seqDataToReturn.sequence },
|
|
15696
|
+
// Wrapping in object as per assumed signature
|
|
15538
15697
|
seqDataToUse,
|
|
15539
15698
|
range.start
|
|
15540
15699
|
);
|
|
@@ -15608,7 +15767,8 @@ function getAnnotationsBetweenRange(annotationsToBeAdjusted, range, maxLength, s
|
|
|
15608
15767
|
__name(getAnnotationsBetweenRange, "getAnnotationsBetweenRange");
|
|
15609
15768
|
function getComplementSequenceAndAnnotations(pSeqObj, options = {}) {
|
|
15610
15769
|
const seqObj = tidyUpSequenceData(
|
|
15611
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
15770
|
+
getSequenceDataBetweenRange(pSeqObj, options.range || null),
|
|
15771
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15612
15772
|
options
|
|
15613
15773
|
);
|
|
15614
15774
|
const newSeqObj = Object.assign({}, seqObj, {
|
|
@@ -15623,7 +15783,7 @@ function getCutsiteType(restrictionEnzyme) {
|
|
|
15623
15783
|
const { topSnipOffset, bottomSnipOffset } = restrictionEnzyme;
|
|
15624
15784
|
if (topSnipOffset === bottomSnipOffset) {
|
|
15625
15785
|
return "blunt";
|
|
15626
|
-
} else if (topSnipOffset < bottomSnipOffset) {
|
|
15786
|
+
} else if (topSnipOffset !== void 0 && bottomSnipOffset !== void 0 && topSnipOffset < bottomSnipOffset) {
|
|
15627
15787
|
return "5' overhang";
|
|
15628
15788
|
} else {
|
|
15629
15789
|
return "3' overhang";
|
|
@@ -15657,7 +15817,7 @@ function getLeftAndRightOfSequenceInRangeGivenPosition(range, position, sequence
|
|
|
15657
15817
|
leftHandSide: "",
|
|
15658
15818
|
rightHandSide: ""
|
|
15659
15819
|
};
|
|
15660
|
-
if (isPositionWithinRange(position, range)) {
|
|
15820
|
+
if (isPositionWithinRange(position, range, sequence.length)) {
|
|
15661
15821
|
result.leftHandSide = getSequenceWithinRange(
|
|
15662
15822
|
{
|
|
15663
15823
|
start: range.start,
|
|
@@ -15697,13 +15857,13 @@ function getOverlapBetweenTwoSequences(sequenceToFind, sequenceToSearchIn) {
|
|
|
15697
15857
|
}
|
|
15698
15858
|
}
|
|
15699
15859
|
__name(getOverlapBetweenTwoSequences, "getOverlapBetweenTwoSequences");
|
|
15700
|
-
function
|
|
15701
|
-
|
|
15860
|
+
function getPossiblePartsFromSequenceAndEnzymes(seqData, restrictionEnzymes) {
|
|
15861
|
+
const enzymes = Array.isArray(restrictionEnzymes) ? restrictionEnzymes : [restrictionEnzymes];
|
|
15702
15862
|
const bps = seqData.sequence;
|
|
15703
15863
|
const seqLen = bps.length;
|
|
15704
|
-
const circular = seqData.circular;
|
|
15864
|
+
const circular = seqData.circular || false;
|
|
15705
15865
|
let cutsites = [];
|
|
15706
|
-
|
|
15866
|
+
enzymes.forEach((enzyme) => {
|
|
15707
15867
|
const newCutsites = cutSequenceByRestrictionEnzyme(bps, circular, enzyme);
|
|
15708
15868
|
cutsites = cutsites.concat(newCutsites);
|
|
15709
15869
|
});
|
|
@@ -15744,13 +15904,13 @@ function getPossiblePartsFromSequenceAndEnzyme(seqData, restrictionEnzymes) {
|
|
|
15744
15904
|
return parts;
|
|
15745
15905
|
}
|
|
15746
15906
|
}
|
|
15747
|
-
__name(
|
|
15907
|
+
__name(getPossiblePartsFromSequenceAndEnzymes, "getPossiblePartsFromSequenceAndEnzymes");
|
|
15748
15908
|
function getPartBetweenEnzymesWithInclusiveOverhangs(cut1, cut2, seqLen) {
|
|
15749
15909
|
const firstCutOffset = getEnzymeRelativeOffset(cut1.restrictionEnzyme);
|
|
15750
15910
|
const secondCutOffset = getEnzymeRelativeOffset(cut2.restrictionEnzyme);
|
|
15751
|
-
const start = cut1.topSnipBeforeBottom ? cut1.topSnipPosition : cut1.bottomSnipPosition;
|
|
15911
|
+
const start = (cut1.topSnipBeforeBottom ? cut1.topSnipPosition : cut1.bottomSnipPosition) || 0;
|
|
15752
15912
|
const end = normalizePositionByRangeLength(
|
|
15753
|
-
(cut2.topSnipBeforeBottom ? cut2.bottomSnipPosition : cut2.topSnipPosition) - 1,
|
|
15913
|
+
(cut2.topSnipBeforeBottom ? cut2.bottomSnipPosition || 0 : cut2.topSnipPosition || 0) - 1,
|
|
15754
15914
|
seqLen
|
|
15755
15915
|
);
|
|
15756
15916
|
return {
|
|
@@ -15761,20 +15921,20 @@ function getPartBetweenEnzymesWithInclusiveOverhangs(cut1, cut2, seqLen) {
|
|
|
15761
15921
|
firstCut: cut1,
|
|
15762
15922
|
//the offset is always counting with 0 being at the top snip position
|
|
15763
15923
|
firstCutOffset,
|
|
15764
|
-
firstCutOverhang: cut1.overhangBps,
|
|
15765
|
-
firstCutOverhangTop: firstCutOffset > 0 ? cut1.overhangBps : "",
|
|
15766
|
-
firstCutOverhangBottom: firstCutOffset < 0 ? getComplementSequenceString(cut1.overhangBps) : "",
|
|
15924
|
+
firstCutOverhang: cut1.overhangBps || "",
|
|
15925
|
+
firstCutOverhangTop: firstCutOffset > 0 ? cut1.overhangBps || "" : "",
|
|
15926
|
+
firstCutOverhangBottom: firstCutOffset < 0 ? getComplementSequenceString(cut1.overhangBps || "") : "",
|
|
15767
15927
|
secondCut: cut2,
|
|
15768
15928
|
//the offset is always counting with 0 being at the top snip position
|
|
15769
15929
|
secondCutOffset,
|
|
15770
|
-
secondCutOverhang: cut2.overhangBps,
|
|
15771
|
-
secondCutOverhangTop: secondCutOffset < 0 ? cut2.overhangBps : "",
|
|
15772
|
-
secondCutOverhangBottom: secondCutOffset > 0 ? getComplementSequenceString(cut2.overhangBps) : ""
|
|
15930
|
+
secondCutOverhang: cut2.overhangBps || "",
|
|
15931
|
+
secondCutOverhangTop: secondCutOffset < 0 ? cut2.overhangBps || "" : "",
|
|
15932
|
+
secondCutOverhangBottom: secondCutOffset > 0 ? getComplementSequenceString(cut2.overhangBps || "") : ""
|
|
15773
15933
|
};
|
|
15774
15934
|
}
|
|
15775
15935
|
__name(getPartBetweenEnzymesWithInclusiveOverhangs, "getPartBetweenEnzymesWithInclusiveOverhangs");
|
|
15776
15936
|
function getEnzymeRelativeOffset(enzyme) {
|
|
15777
|
-
return enzyme.bottomSnipOffset - enzyme.topSnipOffset;
|
|
15937
|
+
return (enzyme.bottomSnipOffset || 0) - (enzyme.topSnipOffset || 0);
|
|
15778
15938
|
}
|
|
15779
15939
|
__name(getEnzymeRelativeOffset, "getEnzymeRelativeOffset");
|
|
15780
15940
|
function pairwise(list) {
|
|
@@ -15790,6 +15950,8 @@ __name(pairwise, "pairwise");
|
|
|
15790
15950
|
function getReverseAminoAcidStringFromSequenceString(sequenceString) {
|
|
15791
15951
|
const aminoAcidsPerBase = getAminoAcidDataForEachBaseOfDna(
|
|
15792
15952
|
sequenceString,
|
|
15953
|
+
false,
|
|
15954
|
+
null,
|
|
15793
15955
|
false
|
|
15794
15956
|
);
|
|
15795
15957
|
const aaArray = [];
|
|
@@ -15828,7 +15990,8 @@ function getReverseComplementAnnotation(annotation, sequenceLength) {
|
|
|
15828
15990
|
__name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
|
|
15829
15991
|
function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
|
15830
15992
|
const seqObj = tidyUpSequenceData(
|
|
15831
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
15993
|
+
getSequenceDataBetweenRange(pSeqObj, options.range || null),
|
|
15994
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15832
15995
|
__spreadValues({ doNotRemoveInvalidChars: true }, options)
|
|
15833
15996
|
);
|
|
15834
15997
|
const newSeqObj = Object.assign(
|
|
@@ -15837,17 +16000,20 @@ function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
|
|
15837
16000
|
{
|
|
15838
16001
|
sequence: getReverseComplementSequenceString(seqObj.sequence)
|
|
15839
16002
|
},
|
|
15840
|
-
annotationTypes.reduce(
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
16003
|
+
annotationTypes.reduce(
|
|
16004
|
+
(acc, type) => {
|
|
16005
|
+
if (seqObj[type]) {
|
|
16006
|
+
acc[type] = map(seqObj[type], (annotation) => {
|
|
16007
|
+
return getReverseComplementAnnotation(
|
|
16008
|
+
annotation,
|
|
16009
|
+
seqObj.sequence.length
|
|
16010
|
+
);
|
|
16011
|
+
});
|
|
16012
|
+
}
|
|
16013
|
+
return acc;
|
|
16014
|
+
},
|
|
16015
|
+
{}
|
|
16016
|
+
)
|
|
15851
16017
|
);
|
|
15852
16018
|
return tidyUpSequenceData(newSeqObj, __spreadValues({
|
|
15853
16019
|
doNotRemoveInvalidChars: true
|
|
@@ -15869,10 +16035,13 @@ __name(getReverseSequenceString, "getReverseSequenceString");
|
|
|
15869
16035
|
function guessIfSequenceIsDnaAndNotProtein(seq, options = {}) {
|
|
15870
16036
|
const { threshold = 0.9, loose } = options;
|
|
15871
16037
|
const dnaLetters = options.dnaLetters || loose ? [...ambiguous_dna_letters.split(""), "U"] : ["G", "A", "T", "C", "U"];
|
|
15872
|
-
const dnaLetterMap = dnaLetters.reduce(
|
|
15873
|
-
acc
|
|
15874
|
-
|
|
15875
|
-
|
|
16038
|
+
const dnaLetterMap = dnaLetters.reduce(
|
|
16039
|
+
(acc, letter) => {
|
|
16040
|
+
acc[letter.toUpperCase()] = true;
|
|
16041
|
+
return acc;
|
|
16042
|
+
},
|
|
16043
|
+
{}
|
|
16044
|
+
);
|
|
15876
16045
|
let count = 0;
|
|
15877
16046
|
if (!seq || !seq.length) return true;
|
|
15878
16047
|
for (let index = 0; index < seq.length; index++) {
|
|
@@ -15892,15 +16061,17 @@ function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow, { splitFor
|
|
|
15892
16061
|
const yOffsetLevelMap = {};
|
|
15893
16062
|
const wrappedAnnotations = {};
|
|
15894
16063
|
forEach(annotations, (annotation) => {
|
|
16064
|
+
var _a;
|
|
15895
16065
|
const containsLocations = !!(annotation.locations && annotation.locations.length);
|
|
15896
16066
|
if (annotation.overlapsSelf) {
|
|
15897
16067
|
if (!wrappedAnnotations[annotation.id]) {
|
|
15898
16068
|
mapAnnotationToRows({
|
|
15899
|
-
annotation: {
|
|
16069
|
+
annotation: __spreadProps(__spreadValues({}, annotation), {
|
|
15900
16070
|
start: 0,
|
|
15901
16071
|
end: sequenceLength - 1,
|
|
15902
|
-
id: `__tempAnnRemoveMe__${annotation.id}
|
|
15903
|
-
|
|
16072
|
+
id: `__tempAnnRemoveMe__${annotation.id}`,
|
|
16073
|
+
overlapsSelf: false
|
|
16074
|
+
}),
|
|
15904
16075
|
sequenceLength,
|
|
15905
16076
|
bpsPerRow,
|
|
15906
16077
|
annotationsToRowsMap,
|
|
@@ -15921,7 +16092,7 @@ function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow, { splitFor
|
|
|
15921
16092
|
splitForwardReverse
|
|
15922
16093
|
});
|
|
15923
16094
|
if (containsLocations) {
|
|
15924
|
-
annotation.locations.forEach((location) => {
|
|
16095
|
+
(_a = annotation.locations) == null ? void 0 : _a.forEach((location) => {
|
|
15925
16096
|
mapAnnotationToRows({
|
|
15926
16097
|
annotation,
|
|
15927
16098
|
sequenceLength,
|
|
@@ -15937,7 +16108,7 @@ function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow, { splitFor
|
|
|
15937
16108
|
forEach(annotationsToRowsMap, (annotationsForRow, i) => {
|
|
15938
16109
|
annotationsToRowsMap[i] = filter(
|
|
15939
16110
|
annotationsForRow,
|
|
15940
|
-
(ann) => !startsWith(ann.id, "__tempAnnRemoveMe__")
|
|
16111
|
+
(ann) => !startsWith(String(ann.id), "__tempAnnRemoveMe__")
|
|
15941
16112
|
);
|
|
15942
16113
|
});
|
|
15943
16114
|
return annotationsToRowsMap;
|
|
@@ -15979,6 +16150,13 @@ function mapAnnotationToRows({
|
|
|
15979
16150
|
yOffset = ann.yOffset;
|
|
15980
16151
|
}
|
|
15981
16152
|
});
|
|
16153
|
+
if (yOffset === void 0) {
|
|
16154
|
+
annotationsForRow.forEach((ann) => {
|
|
16155
|
+
if (ann.id === annotation.id) {
|
|
16156
|
+
yOffset = ann.yOffset;
|
|
16157
|
+
}
|
|
16158
|
+
});
|
|
16159
|
+
}
|
|
15982
16160
|
} else {
|
|
15983
16161
|
if (location) {
|
|
15984
16162
|
annotationsForRow.forEach((ann) => {
|
|
@@ -15987,32 +16165,74 @@ function mapAnnotationToRows({
|
|
|
15987
16165
|
}
|
|
15988
16166
|
});
|
|
15989
16167
|
} else {
|
|
15990
|
-
if (index > 0 &&
|
|
15991
|
-
annotationsForRow.length && //there are already annotations within the row
|
|
15992
|
-
annotationsForRow[annotationsForRow.length - 1].annotation === annotation) {
|
|
16168
|
+
if (index > 0 && annotationsForRow.length && annotationsForRow[annotationsForRow.length - 1].annotation === annotation) {
|
|
15993
16169
|
yOffset = annotationsForRow[annotationsForRow.length - 1].yOffset;
|
|
15994
16170
|
} else {
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
16171
|
+
const siblingRangesOnThisRow = ranges.slice(index + 1).filter((r) => {
|
|
16172
|
+
const rStartRow = Math.floor(r.start / bpsPerRow);
|
|
16173
|
+
const rEndRow = Math.floor(r.end / bpsPerRow);
|
|
16174
|
+
return rowNumber >= rStartRow && rowNumber <= rEndRow;
|
|
16175
|
+
});
|
|
16176
|
+
if (siblingRangesOnThisRow.length > 0) {
|
|
16177
|
+
let foundYOffset = -1;
|
|
16178
|
+
yOffsetsForRow.some((rangesAlreadyAddedToYOffset, levelIndex) => {
|
|
16179
|
+
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
16180
|
+
(comparisonRange) => {
|
|
16181
|
+
return checkIfPotentiallyCircularRangesOverlap(
|
|
16182
|
+
range,
|
|
16183
|
+
comparisonRange
|
|
16184
|
+
);
|
|
16185
|
+
}
|
|
16186
|
+
);
|
|
16187
|
+
if (rangeBlocked) return false;
|
|
16188
|
+
const siblingBlocked = siblingRangesOnThisRow.some(
|
|
16189
|
+
(siblingRange) => {
|
|
16190
|
+
return rangesAlreadyAddedToYOffset.some((comparisonRange) => {
|
|
16191
|
+
return checkIfPotentiallyCircularRangesOverlap(
|
|
16192
|
+
siblingRange,
|
|
16193
|
+
comparisonRange
|
|
16194
|
+
);
|
|
16195
|
+
});
|
|
16196
|
+
}
|
|
16197
|
+
);
|
|
16198
|
+
if (!siblingBlocked) {
|
|
16199
|
+
foundYOffset = levelIndex;
|
|
16200
|
+
return true;
|
|
16201
|
+
}
|
|
16202
|
+
return false;
|
|
16203
|
+
});
|
|
16204
|
+
if (foundYOffset > -1) {
|
|
16205
|
+
yOffset = foundYOffset;
|
|
16206
|
+
yOffsetsForRow[foundYOffset].push(range);
|
|
16207
|
+
} else {
|
|
16208
|
+
yOffset = yOffsetsForRow.length;
|
|
16209
|
+
yOffsetsForRow.push([range]);
|
|
16210
|
+
}
|
|
16211
|
+
} else {
|
|
16212
|
+
yOffset = getYOffsetForPotentiallyCircularRange(
|
|
16213
|
+
range,
|
|
16214
|
+
yOffsetsForRow,
|
|
16215
|
+
false
|
|
16216
|
+
);
|
|
16217
|
+
}
|
|
16218
|
+
}
|
|
16219
|
+
if (yOffset !== void 0) {
|
|
16220
|
+
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
16221
|
+
yOffsetsForRow[yOffset].push({
|
|
16222
|
+
start,
|
|
16223
|
+
end
|
|
16224
|
+
});
|
|
15999
16225
|
}
|
|
16000
|
-
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
16001
|
-
yOffsetsForRow[yOffset].push({
|
|
16002
|
-
start,
|
|
16003
|
-
end
|
|
16004
|
-
});
|
|
16005
16226
|
}
|
|
16006
16227
|
}
|
|
16007
|
-
annotationsForRow.push(__spreadProps(__spreadValues(__spreadValues({
|
|
16228
|
+
annotationsForRow.push(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, annotation), {
|
|
16008
16229
|
id: annotation.id,
|
|
16009
16230
|
annotation,
|
|
16010
16231
|
start,
|
|
16011
16232
|
end
|
|
16012
|
-
}, containsLocations && { containsLocations }), location && { isJoinedLocation: !!location }), {
|
|
16233
|
+
}), containsLocations && { containsLocations }), location && { isJoinedLocation: !!location }), {
|
|
16013
16234
|
yOffset,
|
|
16014
16235
|
enclosingRangeType: range.type
|
|
16015
|
-
//either "beginning", "end" or "beginningAndEnd"
|
|
16016
16236
|
}));
|
|
16017
16237
|
}
|
|
16018
16238
|
});
|
|
@@ -16022,10 +16242,14 @@ function prepareCircularViewData(sequenceData) {
|
|
|
16022
16242
|
const clonedSeqData = cloneDeep(sequenceData);
|
|
16023
16243
|
annotationTypes.forEach((annotationType) => {
|
|
16024
16244
|
if (annotationType !== "cutsites") {
|
|
16025
|
-
const
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16245
|
+
const annotations = clonedSeqData[annotationType];
|
|
16246
|
+
if (annotations) {
|
|
16247
|
+
const maxYOffset = getYOffsetsForPotentiallyCircularRanges(
|
|
16248
|
+
annotations,
|
|
16249
|
+
true
|
|
16250
|
+
).maxYOffset;
|
|
16251
|
+
clonedSeqData[annotationType].maxYOffset = maxYOffset;
|
|
16252
|
+
}
|
|
16029
16253
|
}
|
|
16030
16254
|
});
|
|
16031
16255
|
return clonedSeqData;
|
|
@@ -16038,14 +16262,19 @@ function prepareRowData(sequenceData, bpsPerRow) {
|
|
|
16038
16262
|
const rowMap = {};
|
|
16039
16263
|
annotationTypes.forEach((type) => {
|
|
16040
16264
|
rowMap[type] = mapAnnotationsToRows(
|
|
16041
|
-
sequenceData[type],
|
|
16265
|
+
sequenceData[type] || [],
|
|
16042
16266
|
sequenceLength,
|
|
16043
16267
|
bpsPerRow,
|
|
16044
16268
|
{ splitForwardReverse: type === "primers" }
|
|
16045
16269
|
);
|
|
16046
16270
|
});
|
|
16047
16271
|
for (let rowNumber = 0; rowNumber < totalRows; rowNumber++) {
|
|
16048
|
-
const row = {
|
|
16272
|
+
const row = {
|
|
16273
|
+
rowNumber,
|
|
16274
|
+
start: 0,
|
|
16275
|
+
end: 0,
|
|
16276
|
+
sequence: ""
|
|
16277
|
+
};
|
|
16049
16278
|
row.rowNumber = rowNumber;
|
|
16050
16279
|
row.start = rowNumber * bpsPerRow;
|
|
16051
16280
|
row.end = (rowNumber + 1) * bpsPerRow - 1 < sequenceLength ? (rowNumber + 1) * bpsPerRow - 1 : sequenceLength - 1;
|
|
@@ -16106,17 +16335,16 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16106
16335
|
}
|
|
16107
16336
|
}
|
|
16108
16337
|
const refSeqWithGaps = insertGapsIntoRefSeq(refSeq.sequence, seqReads);
|
|
16109
|
-
const seqReadsWithGaps = [
|
|
16110
|
-
{ name: refSeq.name, sequence: refSeqWithGaps.toUpperCase() }
|
|
16111
|
-
];
|
|
16338
|
+
const seqReadsWithGaps = [{ name: refSeq.name, sequence: refSeqWithGaps.toUpperCase() }];
|
|
16112
16339
|
seqReads.forEach((seqRead) => {
|
|
16113
16340
|
const allInsertionsInSeqReads = [];
|
|
16114
16341
|
seqReads.forEach((seqRead2) => {
|
|
16115
16342
|
const splitSeqRead = seqRead2.cigar.match(/([0-9]*[SMDI])/g);
|
|
16343
|
+
if (!splitSeqRead) return;
|
|
16116
16344
|
let adjustedSeqReadPos2 = cloneDeep(seqRead2.pos);
|
|
16117
16345
|
if (splitSeqRead[0].slice(-1) === "S") {
|
|
16118
16346
|
const numOfBeginningSoftClipped = splitSeqRead[0].slice(0, -1);
|
|
16119
|
-
adjustedSeqReadPos2 = seqRead2.pos - numOfBeginningSoftClipped;
|
|
16347
|
+
adjustedSeqReadPos2 = seqRead2.pos - Number(numOfBeginningSoftClipped);
|
|
16120
16348
|
}
|
|
16121
16349
|
for (let componentI = 0; componentI < splitSeqRead.length; componentI++) {
|
|
16122
16350
|
if (splitSeqRead[componentI].slice(-1) === "I") {
|
|
@@ -16142,10 +16370,11 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16142
16370
|
}
|
|
16143
16371
|
});
|
|
16144
16372
|
const splitSeqReadChunk = seqRead.cigar.match(/([0-9]*[SMDI])/g);
|
|
16373
|
+
if (!splitSeqReadChunk) return;
|
|
16145
16374
|
let adjustedSeqReadPos = cloneDeep(seqRead.pos);
|
|
16146
16375
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16147
16376
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16148
|
-
adjustedSeqReadPos = seqRead.pos - numOfBeginningSoftClipped;
|
|
16377
|
+
adjustedSeqReadPos = seqRead.pos - Number(numOfBeginningSoftClipped);
|
|
16149
16378
|
}
|
|
16150
16379
|
let eachSeqReadWithGaps = seqRead.seq.split("");
|
|
16151
16380
|
if (adjustedSeqReadPos > 0) {
|
|
@@ -16333,10 +16562,11 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16333
16562
|
const seqReadLengthsBeforeRefSeqStart = [];
|
|
16334
16563
|
seqReads.forEach((seq) => {
|
|
16335
16564
|
const splitSeqReadChunk = seq.cigar.match(/([0-9]*[SMDI])/g);
|
|
16565
|
+
if (!splitSeqReadChunk) return;
|
|
16336
16566
|
let adjustedSeqReadPos = cloneDeep(seq.pos);
|
|
16337
16567
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16338
16568
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16339
|
-
adjustedSeqReadPos = seq.pos - numOfBeginningSoftClipped;
|
|
16569
|
+
adjustedSeqReadPos = seq.pos - Number(numOfBeginningSoftClipped);
|
|
16340
16570
|
if (adjustedSeqReadPos < 0) {
|
|
16341
16571
|
seqReadLengthsBeforeRefSeqStart.push(Math.abs(adjustedSeqReadPos));
|
|
16342
16572
|
}
|
|
@@ -16346,13 +16576,14 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16346
16576
|
for (let i = 1; i < seqReadsWithGaps.length; i++) {
|
|
16347
16577
|
const eachSeqReadWithGaps = seqReadsWithGaps[i].sequence.split("");
|
|
16348
16578
|
const splitSeqReadChunk = seqReads[i - 1].cigar.match(/([0-9]*[SMDI])/g);
|
|
16579
|
+
if (!splitSeqReadChunk) continue;
|
|
16349
16580
|
let adjustedSeqReadPos = cloneDeep(seqReads[i - 1].pos);
|
|
16350
16581
|
if (seqReadLengthsBeforeRefSeqStart.length > 0) {
|
|
16351
16582
|
longestSeqReadLength = Math.max(...seqReadLengthsBeforeRefSeqStart);
|
|
16352
16583
|
}
|
|
16353
16584
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16354
16585
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16355
|
-
adjustedSeqReadPos = seqReads[i - 1].pos - numOfBeginningSoftClipped;
|
|
16586
|
+
adjustedSeqReadPos = seqReads[i - 1].pos - Number(numOfBeginningSoftClipped);
|
|
16356
16587
|
if (adjustedSeqReadPos > 0) {
|
|
16357
16588
|
if (longestSeqReadLength > 0) {
|
|
16358
16589
|
eachSeqReadWithGaps.unshift("-".repeat(longestSeqReadLength + 1));
|
|
@@ -16466,11 +16697,11 @@ function calculateNebTm(sequence, { monovalentCationConc = 0.05, primerConc = 5e
|
|
|
16466
16697
|
for (let i = 0; i < seq.length; i++) {
|
|
16467
16698
|
if (i === 0 || i === seq.length - 1) {
|
|
16468
16699
|
if (seq[i] === "G" || seq[i] === "C") {
|
|
16469
|
-
hi += sequenceToEnthalpyMap
|
|
16470
|
-
si += sequenceToEntropyMap
|
|
16700
|
+
hi += sequenceToEnthalpyMap["initiationWithTerminalGC"];
|
|
16701
|
+
si += sequenceToEntropyMap["initiationWithTerminalGC"];
|
|
16471
16702
|
} else if (seq[i] === "A" || seq[i] === "T") {
|
|
16472
|
-
hi += sequenceToEnthalpyMap
|
|
16473
|
-
si += sequenceToEntropyMap
|
|
16703
|
+
hi += sequenceToEnthalpyMap["initiationWithTerminalAT"];
|
|
16704
|
+
si += sequenceToEntropyMap["initiationWithTerminalAT"];
|
|
16474
16705
|
}
|
|
16475
16706
|
}
|
|
16476
16707
|
if (i < seq.length - 1) {
|
|
@@ -16513,9 +16744,13 @@ function calculateNebTa(sequences, primerConc, { monovalentCationConc, polymeras
|
|
|
16513
16744
|
`${sequences.length} sequences received when 2 primers were expected`
|
|
16514
16745
|
);
|
|
16515
16746
|
}
|
|
16516
|
-
const meltingTemperatures = sequences.map(
|
|
16517
|
-
|
|
16518
|
-
|
|
16747
|
+
const meltingTemperatures = sequences.map((seq) => {
|
|
16748
|
+
const tm = calculateNebTm(seq, { monovalentCationConc, primerConc });
|
|
16749
|
+
if (typeof tm !== "number") {
|
|
16750
|
+
throw new Error(`Invalid Tm calculated for ${seq}: ${tm}`);
|
|
16751
|
+
}
|
|
16752
|
+
return tm;
|
|
16753
|
+
});
|
|
16519
16754
|
meltingTemperatures.sort((a, b) => a - b);
|
|
16520
16755
|
const lowerMeltingTemp = meltingTemperatures[0];
|
|
16521
16756
|
let annealingTemp;
|
|
@@ -16592,17 +16827,17 @@ function isValidSequence(sequence) {
|
|
|
16592
16827
|
__name(isValidSequence, "isValidSequence");
|
|
16593
16828
|
function calculateSantaLuciaTm(sequence) {
|
|
16594
16829
|
try {
|
|
16595
|
-
|
|
16596
|
-
if (!isValidSequence(
|
|
16830
|
+
const seq = sequence == null ? void 0 : sequence.toUpperCase().trim();
|
|
16831
|
+
if (!isValidSequence(seq)) {
|
|
16597
16832
|
throw new Error("Invalid sequence: contains non-DNA characters");
|
|
16598
16833
|
}
|
|
16599
|
-
if (
|
|
16834
|
+
if (seq.length < 2) {
|
|
16600
16835
|
throw new Error("Sequence too short: minimum length is 2 bases");
|
|
16601
16836
|
}
|
|
16602
16837
|
let deltaH = 0;
|
|
16603
16838
|
let deltaS = 0;
|
|
16604
|
-
for (let i = 0; i <
|
|
16605
|
-
const dinucleotide =
|
|
16839
|
+
for (let i = 0; i < seq.length - 1; i++) {
|
|
16840
|
+
const dinucleotide = seq.substring(i, i + 2);
|
|
16606
16841
|
if (dinucleotide.includes("N")) {
|
|
16607
16842
|
continue;
|
|
16608
16843
|
}
|
|
@@ -16612,23 +16847,23 @@ function calculateSantaLuciaTm(sequence) {
|
|
|
16612
16847
|
deltaS += params.dS;
|
|
16613
16848
|
}
|
|
16614
16849
|
}
|
|
16615
|
-
const firstBase =
|
|
16616
|
-
const lastBase =
|
|
16850
|
+
const firstBase = seq[0];
|
|
16851
|
+
const lastBase = seq[seq.length - 1];
|
|
16617
16852
|
if (firstBase === "G" || firstBase === "C") {
|
|
16618
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16619
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16853
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16854
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16620
16855
|
} else {
|
|
16621
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16622
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16856
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16857
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16623
16858
|
}
|
|
16624
16859
|
if (lastBase === "G" || lastBase === "C") {
|
|
16625
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16626
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16860
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16861
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16627
16862
|
} else {
|
|
16628
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16629
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16863
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16864
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16630
16865
|
}
|
|
16631
|
-
const nnPairs =
|
|
16866
|
+
const nnPairs = seq.length - 1;
|
|
16632
16867
|
deltaS = applySaltCorrection(deltaS, nnPairs);
|
|
16633
16868
|
const C = PRIMER3_PARAMS.dnaConc * 1e-9;
|
|
16634
16869
|
const Tm = deltaH * 1e3 / (deltaS + PRIMER3_PARAMS.R * Math.log(C / 4));
|
|
@@ -16640,16 +16875,16 @@ function calculateSantaLuciaTm(sequence) {
|
|
|
16640
16875
|
__name(calculateSantaLuciaTm, "calculateSantaLuciaTm");
|
|
16641
16876
|
function calculateEndStability(sequence) {
|
|
16642
16877
|
try {
|
|
16643
|
-
|
|
16644
|
-
if (!isValidSequence(
|
|
16878
|
+
const seq = sequence == null ? void 0 : sequence.toUpperCase().trim();
|
|
16879
|
+
if (!isValidSequence(seq)) {
|
|
16645
16880
|
throw new Error("Invalid sequence: contains non-DNA characters");
|
|
16646
16881
|
}
|
|
16647
|
-
if (
|
|
16882
|
+
if (seq.length < 5) {
|
|
16648
16883
|
throw new Error(
|
|
16649
16884
|
"Sequence too short: minimum length is 5 bases for end stability calculation"
|
|
16650
16885
|
);
|
|
16651
16886
|
}
|
|
16652
|
-
const last5Bases =
|
|
16887
|
+
const last5Bases = seq.substring(seq.length - 5);
|
|
16653
16888
|
let deltaH = 0;
|
|
16654
16889
|
let deltaS = 0;
|
|
16655
16890
|
for (let i = 0; i < 4; i++) {
|
|
@@ -16666,18 +16901,18 @@ function calculateEndStability(sequence) {
|
|
|
16666
16901
|
const firstBase = last5Bases[0];
|
|
16667
16902
|
const lastBase = last5Bases[last5Bases.length - 1];
|
|
16668
16903
|
if (firstBase === "G" || firstBase === "C") {
|
|
16669
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16670
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16904
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16905
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16671
16906
|
} else {
|
|
16672
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16673
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16907
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16908
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16674
16909
|
}
|
|
16675
16910
|
if (lastBase === "G" || lastBase === "C") {
|
|
16676
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16677
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16911
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16912
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16678
16913
|
} else {
|
|
16679
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16680
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16914
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16915
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16681
16916
|
}
|
|
16682
16917
|
const T = 310.15;
|
|
16683
16918
|
const deltaG = deltaH - T * deltaS / 1e3;
|
|
@@ -16692,24 +16927,40 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16692
16927
|
const pairs = [];
|
|
16693
16928
|
if (!cutsites.length) return [];
|
|
16694
16929
|
let sortedCutsites = cutsites.sort((a, b) => {
|
|
16695
|
-
return a.topSnipPosition - b.topSnipPosition;
|
|
16930
|
+
return (a.topSnipPosition || 0) - (b.topSnipPosition || 0);
|
|
16696
16931
|
});
|
|
16697
16932
|
if (!circular) {
|
|
16698
16933
|
sortedCutsites = [
|
|
16699
16934
|
{
|
|
16935
|
+
start: 0,
|
|
16936
|
+
end: 0,
|
|
16700
16937
|
topSnipPosition: 0,
|
|
16701
16938
|
bottomSnipPosition: 0,
|
|
16702
16939
|
overhangSize: 0,
|
|
16703
16940
|
type: "START_OR_END_OF_SEQ",
|
|
16704
|
-
name: "START_OF_SEQ"
|
|
16941
|
+
name: "START_OF_SEQ",
|
|
16942
|
+
restrictionEnzyme: {
|
|
16943
|
+
name: "START_OF_SEQ",
|
|
16944
|
+
site: "",
|
|
16945
|
+
forwardRegex: "",
|
|
16946
|
+
reverseRegex: ""
|
|
16947
|
+
}
|
|
16705
16948
|
},
|
|
16706
16949
|
...sortedCutsites,
|
|
16707
16950
|
{
|
|
16951
|
+
start: sequenceLength,
|
|
16952
|
+
end: sequenceLength,
|
|
16708
16953
|
topSnipPosition: sequenceLength,
|
|
16709
16954
|
bottomSnipPosition: sequenceLength,
|
|
16710
16955
|
overhangSize: 0,
|
|
16711
16956
|
type: "START_OR_END_OF_SEQ",
|
|
16712
|
-
name: "END_OF_SEQ"
|
|
16957
|
+
name: "END_OF_SEQ",
|
|
16958
|
+
restrictionEnzyme: {
|
|
16959
|
+
name: "END_OF_SEQ",
|
|
16960
|
+
site: "",
|
|
16961
|
+
forwardRegex: "",
|
|
16962
|
+
reverseRegex: ""
|
|
16963
|
+
}
|
|
16713
16964
|
}
|
|
16714
16965
|
];
|
|
16715
16966
|
}
|
|
@@ -16732,11 +16983,11 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16732
16983
|
});
|
|
16733
16984
|
pairs.forEach(([cut1, cut2]) => {
|
|
16734
16985
|
const start = normalizePositionByRangeLength(
|
|
16735
|
-
cut1.topSnipPosition,
|
|
16986
|
+
cut1.topSnipPosition || 0,
|
|
16736
16987
|
sequenceLength
|
|
16737
16988
|
);
|
|
16738
16989
|
const end = normalizePositionByRangeLength(
|
|
16739
|
-
cut2.topSnipPosition - 1,
|
|
16990
|
+
(cut2.topSnipPosition || 0) - 1,
|
|
16740
16991
|
sequenceLength
|
|
16741
16992
|
);
|
|
16742
16993
|
const fragmentRange = { start, end };
|
|
@@ -16754,7 +17005,9 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16754
17005
|
})
|
|
16755
17006
|
}, fragmentRange), {
|
|
16756
17007
|
size,
|
|
16757
|
-
id
|
|
17008
|
+
id,
|
|
17009
|
+
name: `${cut1.restrictionEnzyme.name} -- ${cut2.restrictionEnzyme.name} ${size} bps`
|
|
17010
|
+
// Add missing name property
|
|
16758
17011
|
}));
|
|
16759
17012
|
});
|
|
16760
17013
|
fragments.filter((fragment) => {
|
|
@@ -16766,21 +17019,33 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16766
17019
|
return fragments;
|
|
16767
17020
|
}
|
|
16768
17021
|
__name(getDigestFragmentsForCutsites, "getDigestFragmentsForCutsites");
|
|
16769
|
-
function getDigestFragmentsForRestrictionEnzymes(sequence, circular,
|
|
16770
|
-
const
|
|
16771
|
-
|
|
16772
|
-
return cutSequenceByRestrictionEnzyme(
|
|
16773
|
-
sequence,
|
|
16774
|
-
circular,
|
|
16775
|
-
restrictionEnzyme
|
|
16776
|
-
);
|
|
16777
|
-
});
|
|
16778
|
-
return getDigestFragmentsForCutsites(
|
|
16779
|
-
sequence.length,
|
|
17022
|
+
function getDigestFragmentsForRestrictionEnzymes(sequence, circular, contextEnzymes, options) {
|
|
17023
|
+
const cutsitesByName = getCutsitesFromSequence(
|
|
17024
|
+
sequence,
|
|
16780
17025
|
circular,
|
|
16781
|
-
|
|
16782
|
-
opts
|
|
17026
|
+
Array.isArray(contextEnzymes) ? contextEnzymes : [contextEnzymes]
|
|
16783
17027
|
);
|
|
17028
|
+
const digest = computeDigestFragments(__spreadProps(__spreadValues({
|
|
17029
|
+
cutsites: flatMap(cutsitesByName),
|
|
17030
|
+
sequenceLength: sequence.length,
|
|
17031
|
+
circular
|
|
17032
|
+
}, options), {
|
|
17033
|
+
computePartialDigest: (options == null ? void 0 : options.computePartialDigest) || (options == null ? void 0 : options.computePartialDigests)
|
|
17034
|
+
}));
|
|
17035
|
+
const fragments = uniqBy(digest.fragments, (fragment) => {
|
|
17036
|
+
return `${fragment.start}-${fragment.end}-${fragment.size}`;
|
|
17037
|
+
});
|
|
17038
|
+
if (circular && ((options == null ? void 0 : options.computePartialDigest) || (options == null ? void 0 : options.computePartialDigests))) {
|
|
17039
|
+
const fullLengthFragmentIndex = fragments.findIndex(
|
|
17040
|
+
(f) => f.size === sequence.length
|
|
17041
|
+
);
|
|
17042
|
+
if (fullLengthFragmentIndex > -1) {
|
|
17043
|
+
fragments.splice(fullLengthFragmentIndex, 1);
|
|
17044
|
+
}
|
|
17045
|
+
}
|
|
17046
|
+
return fragments.sort((a, b) => {
|
|
17047
|
+
return a.start - b.start || b.size - a.size;
|
|
17048
|
+
});
|
|
16784
17049
|
}
|
|
16785
17050
|
__name(getDigestFragmentsForRestrictionEnzymes, "getDigestFragmentsForRestrictionEnzymes");
|
|
16786
17051
|
function convertAACaretPositionOrRangeToDna(rangeOrCaret) {
|
|
@@ -16826,11 +17091,13 @@ function shiftAnnotationsByLen({
|
|
|
16826
17091
|
}) {
|
|
16827
17092
|
modifiableTypes.forEach((annotationType) => {
|
|
16828
17093
|
const existingAnnotations = seqData[annotationType];
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
17094
|
+
if (existingAnnotations) {
|
|
17095
|
+
seqData[annotationType] = adjustAnnotationsToInsert(
|
|
17096
|
+
existingAnnotations,
|
|
17097
|
+
caretPosition,
|
|
17098
|
+
insertLength
|
|
17099
|
+
);
|
|
17100
|
+
}
|
|
16834
17101
|
});
|
|
16835
17102
|
}
|
|
16836
17103
|
__name(shiftAnnotationsByLen, "shiftAnnotationsByLen");
|
|
@@ -16900,7 +17167,7 @@ exports.getMassOfAaString = getMassOfAaString;
|
|
|
16900
17167
|
exports.getMergedFeatureMap = getMergedFeatureMap;
|
|
16901
17168
|
exports.getOrfsFromSequence = getOrfsFromSequence;
|
|
16902
17169
|
exports.getOverlapBetweenTwoSequences = getOverlapBetweenTwoSequences;
|
|
16903
|
-
exports.getPossiblePartsFromSequenceAndEnzymes =
|
|
17170
|
+
exports.getPossiblePartsFromSequenceAndEnzymes = getPossiblePartsFromSequenceAndEnzymes;
|
|
16904
17171
|
exports.getReverseAminoAcidStringFromSequenceString = getReverseAminoAcidStringFromSequenceString;
|
|
16905
17172
|
exports.getReverseComplementAminoAcidStringFromSequenceString = getReverseComplementAminoAcidStringFromSequenceString;
|
|
16906
17173
|
exports.getReverseComplementAnnotation = getReverseComplementAnnotation;
|
|
@@ -16927,3 +17194,4 @@ exports.shiftAnnotationsByLen = shiftAnnotationsByLen;
|
|
|
16927
17194
|
exports.threeLetterSequenceStringToAminoAcidMap = threeLetterSequenceStringToAminoAcidMap;
|
|
16928
17195
|
exports.tidyUpAnnotation = tidyUpAnnotation;
|
|
16929
17196
|
exports.tidyUpSequenceData = tidyUpSequenceData;
|
|
17197
|
+
exports.types = types;
|