@teselagen/sequence-utils 0.3.41 → 0.3.42-beta.1
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 +762 -495
- package/index.d.ts +9 -5
- package/index.js +763 -496
- package/index.umd.cjs +762 -495
- 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.js → adjustAnnotationsToInsert.ts} +6 -5
- 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 +5 -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.js → shiftAnnotationsByLen.ts} +12 -5
- 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 +98 -0
- package/threeLetterSequenceStringToAminoAcidMap.d.ts +11 -921
- package/tidyUpAnnotation.d.ts +13 -11
- package/tidyUpSequenceData.d.ts +18 -1
- package/types.d.ts +96 -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/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/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));
|
|
@@ -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));
|
|
@@ -7309,16 +7421,24 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7309
7421
|
}, options));
|
|
7310
7422
|
const newSequenceData = cloneDeep(existingSequenceData);
|
|
7311
7423
|
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
|
-
|
|
7424
|
+
let caretPosition = typeof caretPositionOrRange === "number" ? caretPositionOrRange : caretPositionOrRange.start;
|
|
7425
|
+
const isInsertSameLengthAsSelection = typeof caretPositionOrRange !== "number" && sequenceDataToInsert.sequence.length === getRangeLength(
|
|
7426
|
+
caretPositionOrRange,
|
|
7427
|
+
existingSequenceData.sequence.length
|
|
7428
|
+
);
|
|
7429
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1 && getRangeLength(
|
|
7315
7430
|
caretPositionOrRange,
|
|
7316
7431
|
existingSequenceData.sequence.length
|
|
7317
7432
|
) === existingSequenceData.sequence.length) {
|
|
7433
|
+
const emptyAnnotations = modifiableTypes.reduce(
|
|
7434
|
+
(acc, type) => {
|
|
7435
|
+
acc[type] = [];
|
|
7436
|
+
return acc;
|
|
7437
|
+
},
|
|
7438
|
+
{}
|
|
7439
|
+
);
|
|
7318
7440
|
existingSequenceData = tidyUpSequenceData(
|
|
7319
|
-
__spreadProps(__spreadValues(__spreadValues({}, existingSequenceData),
|
|
7320
|
-
return acc[type] = [];
|
|
7321
|
-
}, {})), {
|
|
7441
|
+
__spreadProps(__spreadValues(__spreadValues({}, existingSequenceData), emptyAnnotations), {
|
|
7322
7442
|
sequence: "",
|
|
7323
7443
|
doNotRemoveInvalidChars: true,
|
|
7324
7444
|
proteinSequence: "",
|
|
@@ -7328,7 +7448,7 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7328
7448
|
);
|
|
7329
7449
|
newSequenceData.chromatogramData = void 0;
|
|
7330
7450
|
} else if (newSequenceData.chromatogramData && newSequenceData.chromatogramData.baseTraces) {
|
|
7331
|
-
if (caretPositionOrRange && caretPositionOrRange.start > -1) {
|
|
7451
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1) {
|
|
7332
7452
|
if (caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7333
7453
|
newSequenceData.chromatogramData = trimChromatogram({
|
|
7334
7454
|
chromatogramData: newSequenceData.chromatogramData,
|
|
@@ -7338,14 +7458,16 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7338
7458
|
},
|
|
7339
7459
|
justBaseCalls: isInsertSameLengthAsSelection
|
|
7340
7460
|
});
|
|
7341
|
-
newSequenceData.chromatogramData
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7461
|
+
if (newSequenceData.chromatogramData) {
|
|
7462
|
+
newSequenceData.chromatogramData = trimChromatogram({
|
|
7463
|
+
chromatogramData: newSequenceData.chromatogramData,
|
|
7464
|
+
range: {
|
|
7465
|
+
start: 0,
|
|
7466
|
+
end: caretPositionOrRange.end
|
|
7467
|
+
},
|
|
7468
|
+
justBaseCalls: isInsertSameLengthAsSelection
|
|
7469
|
+
});
|
|
7470
|
+
}
|
|
7349
7471
|
} else {
|
|
7350
7472
|
newSequenceData.chromatogramData = trimChromatogram({
|
|
7351
7473
|
chromatogramData: newSequenceData.chromatogramData,
|
|
@@ -7357,10 +7479,10 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7357
7479
|
});
|
|
7358
7480
|
}
|
|
7359
7481
|
}
|
|
7360
|
-
if (sequenceDataToInsert.sequence) {
|
|
7482
|
+
if (sequenceDataToInsert.sequence && newSequenceData.chromatogramData) {
|
|
7361
7483
|
insertIntoChromatogram({
|
|
7362
7484
|
chromatogramData: newSequenceData.chromatogramData,
|
|
7363
|
-
caretPosition: caretPositionOrRange.start > -1 ? caretPositionOrRange.start : caretPositionOrRange,
|
|
7485
|
+
caretPosition: typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1 ? caretPositionOrRange.start : caretPositionOrRange,
|
|
7364
7486
|
seqToInsert: sequenceDataToInsert.sequence,
|
|
7365
7487
|
justBaseCalls: isInsertSameLengthAsSelection
|
|
7366
7488
|
});
|
|
@@ -7373,14 +7495,15 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7373
7495
|
);
|
|
7374
7496
|
newSequenceData.size = newSequenceData.sequence.length;
|
|
7375
7497
|
newSequenceData.proteinSequence = adjustBpsToReplaceOrInsert(
|
|
7376
|
-
existingSequenceData.proteinSequence,
|
|
7377
|
-
sequenceDataToInsert.proteinSequence,
|
|
7498
|
+
existingSequenceData.proteinSequence || "",
|
|
7499
|
+
sequenceDataToInsert.proteinSequence || "",
|
|
7378
7500
|
convertDnaCaretPositionOrRangeToAA(caretPositionOrRange)
|
|
7379
7501
|
);
|
|
7380
|
-
newSequenceData.proteinSize = newSequenceData.proteinSequence.length;
|
|
7502
|
+
newSequenceData.proteinSize = (newSequenceData.proteinSequence || "").length;
|
|
7381
7503
|
modifiableTypes.forEach((annotationType) => {
|
|
7382
7504
|
let existingAnnotations = existingSequenceData[annotationType];
|
|
7383
|
-
if (
|
|
7505
|
+
if (!existingAnnotations) return;
|
|
7506
|
+
if (typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > -1) {
|
|
7384
7507
|
const range = caretPositionOrRange;
|
|
7385
7508
|
caretPosition = range.start > range.end ? 0 : range.start;
|
|
7386
7509
|
existingAnnotations = adjustAnnotationsToDelete(
|
|
@@ -7390,22 +7513,23 @@ function insertSequenceDataAtPositionOrRange(_sequenceDataToInsert, _existingSeq
|
|
|
7390
7513
|
);
|
|
7391
7514
|
}
|
|
7392
7515
|
newSequenceData[annotationType] = [];
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7516
|
+
const annotationsToInsert = sequenceDataToInsert[annotationType];
|
|
7517
|
+
if (newSequenceData[annotationType]) {
|
|
7518
|
+
newSequenceData[annotationType] = newSequenceData[annotationType].concat(
|
|
7519
|
+
adjustAnnotationsToInsert(
|
|
7520
|
+
existingAnnotations,
|
|
7521
|
+
caretPosition,
|
|
7522
|
+
insertLength
|
|
7523
|
+
)
|
|
7524
|
+
);
|
|
7525
|
+
if (annotationsToInsert) {
|
|
7526
|
+
newSequenceData[annotationType] = newSequenceData[annotationType].concat(
|
|
7527
|
+
adjustAnnotationsToInsert(annotationsToInsert, 0, caretPosition)
|
|
7528
|
+
);
|
|
7529
|
+
}
|
|
7530
|
+
}
|
|
7407
7531
|
});
|
|
7408
|
-
if (maintainOriginSplit && caretPositionOrRange && caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7532
|
+
if (maintainOriginSplit && typeof caretPositionOrRange !== "number" && caretPositionOrRange.start > caretPositionOrRange.end) {
|
|
7409
7533
|
const caretPosToRotateTo = existingSequenceData.sequence.length - caretPositionOrRange.start;
|
|
7410
7534
|
return rotateSequenceDataToPosition(
|
|
7411
7535
|
newSequenceData,
|
|
@@ -7423,6 +7547,7 @@ function adjustAnnotationsToDelete(annotationsToBeAdjusted, range, maxLength) {
|
|
|
7423
7547
|
maxLength
|
|
7424
7548
|
);
|
|
7425
7549
|
const newLocations = annotation.locations && annotation.locations.map((loc) => adjustRangeToDeletionOfAnotherRange(loc, range, maxLength)).filter((range2) => !!range2);
|
|
7550
|
+
if (!newRange) return null;
|
|
7426
7551
|
if (newLocations && newLocations.length) {
|
|
7427
7552
|
return __spreadValues(__spreadProps(__spreadValues({}, newRange), {
|
|
7428
7553
|
start: newLocations[0].start,
|
|
@@ -7441,11 +7566,13 @@ function insertIntoChromatogram({
|
|
|
7441
7566
|
justBaseCalls
|
|
7442
7567
|
}) {
|
|
7443
7568
|
if (!seqToInsert.length) return;
|
|
7444
|
-
chromatogramData.baseCalls
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7569
|
+
if (chromatogramData.baseCalls) {
|
|
7570
|
+
chromatogramData.baseCalls.splice(
|
|
7571
|
+
caretPosition,
|
|
7572
|
+
0,
|
|
7573
|
+
...seqToInsert.split("")
|
|
7574
|
+
);
|
|
7575
|
+
}
|
|
7449
7576
|
if (justBaseCalls) {
|
|
7450
7577
|
return chromatogramData;
|
|
7451
7578
|
}
|
|
@@ -7461,8 +7588,20 @@ function insertIntoChromatogram({
|
|
|
7461
7588
|
tTrace: toPush
|
|
7462
7589
|
});
|
|
7463
7590
|
}
|
|
7464
|
-
|
|
7465
|
-
|
|
7591
|
+
if (chromatogramData.baseTraces) {
|
|
7592
|
+
chromatogramData.baseTraces.splice(
|
|
7593
|
+
caretPosition,
|
|
7594
|
+
0,
|
|
7595
|
+
...baseTracesToInsert
|
|
7596
|
+
);
|
|
7597
|
+
}
|
|
7598
|
+
if (chromatogramData.qualNums) {
|
|
7599
|
+
chromatogramData.qualNums.splice(
|
|
7600
|
+
caretPosition,
|
|
7601
|
+
0,
|
|
7602
|
+
...qualNumsToInsert
|
|
7603
|
+
);
|
|
7604
|
+
}
|
|
7466
7605
|
return chromatogramData;
|
|
7467
7606
|
}
|
|
7468
7607
|
__name(insertIntoChromatogram, "insertIntoChromatogram");
|
|
@@ -7475,17 +7614,23 @@ function trimChromatogram({
|
|
|
7475
7614
|
"baseCalls",
|
|
7476
7615
|
...justBaseCalls ? [] : ["qualNums", "baseTraces", "basePos"]
|
|
7477
7616
|
].forEach((type) => {
|
|
7478
|
-
|
|
7617
|
+
if (chromatogramData[type]) {
|
|
7618
|
+
chromatogramData[type].splice(start, end - start + 1);
|
|
7619
|
+
}
|
|
7479
7620
|
});
|
|
7480
7621
|
return chromatogramData;
|
|
7481
7622
|
}
|
|
7482
7623
|
__name(trimChromatogram, "trimChromatogram");
|
|
7483
7624
|
function deleteSequenceDataAtRange(sequenceData, range) {
|
|
7484
|
-
return insertSequenceDataAtPositionOrRange(
|
|
7625
|
+
return insertSequenceDataAtPositionOrRange(
|
|
7626
|
+
{ sequence: "" },
|
|
7627
|
+
sequenceData,
|
|
7628
|
+
range
|
|
7629
|
+
);
|
|
7485
7630
|
}
|
|
7486
7631
|
__name(deleteSequenceDataAtRange, "deleteSequenceDataAtRange");
|
|
7487
7632
|
function doesEnzymeChopOutsideOfRecognitionSite(enzyme) {
|
|
7488
|
-
if (enzyme.topSnipOffset > enzyme.site.length || enzyme.bottomSnipOffset > enzyme.site.length) {
|
|
7633
|
+
if (enzyme.topSnipOffset && enzyme.bottomSnipOffset && (enzyme.topSnipOffset > enzyme.site.length || enzyme.bottomSnipOffset > enzyme.site.length)) {
|
|
7489
7634
|
return true;
|
|
7490
7635
|
} else {
|
|
7491
7636
|
return false;
|
|
@@ -15117,10 +15262,10 @@ defaultEnzymes.forEach((name) => {
|
|
|
15117
15262
|
defaultEnzymesByName[name] = aliasedEnzymesByName[name];
|
|
15118
15263
|
});
|
|
15119
15264
|
function generateAnnotations(numberOfAnnotationsToGenerate, start, end, maxLength) {
|
|
15120
|
-
const result =
|
|
15265
|
+
const result = [];
|
|
15121
15266
|
for (let i = 0; i < numberOfAnnotationsToGenerate; i++) {
|
|
15122
15267
|
const annotation = generateAnnotation(start, end, maxLength);
|
|
15123
|
-
result
|
|
15268
|
+
result.push(annotation);
|
|
15124
15269
|
}
|
|
15125
15270
|
return result;
|
|
15126
15271
|
}
|
|
@@ -15148,16 +15293,16 @@ function generateSequenceData({
|
|
|
15148
15293
|
numPrimers,
|
|
15149
15294
|
numTranslations
|
|
15150
15295
|
} = {}) {
|
|
15151
|
-
const proteinSequence = isProtein
|
|
15152
|
-
const sequence = !isProtein
|
|
15296
|
+
const proteinSequence = isProtein ? generateSequence(sequenceLength, true) : "";
|
|
15297
|
+
const sequence = !isProtein ? generateSequence(sequenceLength) : "";
|
|
15153
15298
|
return {
|
|
15154
15299
|
circular: isProtein ? false : Math.random() > 0.5,
|
|
15155
|
-
name: "p-" + Math.floor(Math.random * 100),
|
|
15300
|
+
name: "p-" + Math.floor(Math.random() * 100),
|
|
15156
15301
|
description: "",
|
|
15157
|
-
isProtein,
|
|
15302
|
+
isProtein: !!isProtein,
|
|
15158
15303
|
sequence,
|
|
15159
15304
|
proteinSequence,
|
|
15160
|
-
translations: isProtein ?
|
|
15305
|
+
translations: isProtein ? [] : generateAnnotations(
|
|
15161
15306
|
numTranslations || 5,
|
|
15162
15307
|
0,
|
|
15163
15308
|
sequenceLength - 1,
|
|
@@ -15169,7 +15314,7 @@ function generateSequenceData({
|
|
|
15169
15314
|
sequenceLength - 1,
|
|
15170
15315
|
sequenceLength / 3
|
|
15171
15316
|
),
|
|
15172
|
-
primers: isProtein ?
|
|
15317
|
+
primers: isProtein ? [] : generateAnnotations(numPrimers || 10, 0, sequenceLength - 1, 50),
|
|
15173
15318
|
parts: generateAnnotations(
|
|
15174
15319
|
numParts || 10,
|
|
15175
15320
|
0,
|
|
@@ -15181,15 +15326,14 @@ function generateSequenceData({
|
|
|
15181
15326
|
__name(generateSequenceData, "generateSequenceData");
|
|
15182
15327
|
function generateSequence(m = 9, isProtein) {
|
|
15183
15328
|
let s = "";
|
|
15184
|
-
const r = isProtein ? "" : "gatc";
|
|
15329
|
+
const r = isProtein ? "ACDEFGHIKLMNPQRSTVWY" : "gatc";
|
|
15185
15330
|
for (let i = 0; i < m; i++) {
|
|
15186
15331
|
s += r.charAt(Math.floor(Math.random() * r.length));
|
|
15187
15332
|
}
|
|
15188
15333
|
return s;
|
|
15189
15334
|
}
|
|
15190
15335
|
__name(generateSequence, "generateSequence");
|
|
15191
|
-
function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSequence, positionStart, isLinear) {
|
|
15192
|
-
if (!positionStart) positionStart = 0;
|
|
15336
|
+
function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSequence, positionStart = 0, isLinear) {
|
|
15193
15337
|
if (sequenceToSearch.length < overlapSequence.length) {
|
|
15194
15338
|
return null;
|
|
15195
15339
|
}
|
|
@@ -15207,6 +15351,9 @@ function findNearestRangeOfSequenceOverlapToPosition(sequenceToSearch, overlapSe
|
|
|
15207
15351
|
index = result.index;
|
|
15208
15352
|
distance = newDistance;
|
|
15209
15353
|
}
|
|
15354
|
+
if (index === void 0) {
|
|
15355
|
+
return null;
|
|
15356
|
+
}
|
|
15210
15357
|
return normalizeRange(
|
|
15211
15358
|
{
|
|
15212
15359
|
start: index,
|
|
@@ -15251,9 +15398,11 @@ function getOrfsFromSequence(options) {
|
|
|
15251
15398
|
internalStartCodonIndices: [],
|
|
15252
15399
|
frame: start % 3,
|
|
15253
15400
|
forward,
|
|
15254
|
-
annotationTypePlural: "orfs",
|
|
15401
|
+
// annotationTypePlural: "orfs",
|
|
15255
15402
|
isOrf: true,
|
|
15256
|
-
id: shortid()
|
|
15403
|
+
id: shortid(),
|
|
15404
|
+
type: "orf",
|
|
15405
|
+
name: "ORF"
|
|
15257
15406
|
});
|
|
15258
15407
|
}
|
|
15259
15408
|
}
|
|
@@ -15357,7 +15506,10 @@ function findSequenceMatchesTopStrand(sequence, searchString, options = {}) {
|
|
|
15357
15506
|
true
|
|
15358
15507
|
);
|
|
15359
15508
|
} else {
|
|
15360
|
-
searchStringToUse = convertAmbiguousStringToRegex(
|
|
15509
|
+
searchStringToUse = convertAmbiguousStringToRegex(
|
|
15510
|
+
searchStringToUse,
|
|
15511
|
+
false
|
|
15512
|
+
);
|
|
15361
15513
|
}
|
|
15362
15514
|
}
|
|
15363
15515
|
if (!searchStringToUse) return [];
|
|
@@ -15477,7 +15629,9 @@ function getCodonRangeForAASliver(aminoAcidPositionInSequence, aminoAcidSliver,
|
|
|
15477
15629
|
}
|
|
15478
15630
|
__name(getCodonRangeForAASliver, "getCodonRangeForAASliver");
|
|
15479
15631
|
function getComplementAminoAcidStringFromSequenceString(sequenceString) {
|
|
15480
|
-
const aaString = getAminoAcidStringFromSequenceString(sequenceString,
|
|
15632
|
+
const aaString = getAminoAcidStringFromSequenceString(sequenceString, {
|
|
15633
|
+
doNotExcludeAsterisk: true
|
|
15634
|
+
});
|
|
15481
15635
|
return aaString.split("").reverse().join("");
|
|
15482
15636
|
}
|
|
15483
15637
|
__name(getComplementAminoAcidStringFromSequenceString, "getComplementAminoAcidStringFromSequenceString");
|
|
@@ -15515,26 +15669,30 @@ function getSequenceDataBetweenRange(seqData, range, options = {}) {
|
|
|
15515
15669
|
sequence: getSequenceWithinRange(range, seqDataToUse.sequence),
|
|
15516
15670
|
proteinSequence: getSequenceWithinRange(
|
|
15517
15671
|
convertDnaCaretPositionOrRangeToAA(range),
|
|
15518
|
-
seqDataToUse.proteinSequence
|
|
15672
|
+
seqDataToUse.proteinSequence || ""
|
|
15519
15673
|
)
|
|
15520
15674
|
},
|
|
15521
|
-
annotationTypes.reduce(
|
|
15522
|
-
|
|
15523
|
-
|
|
15675
|
+
annotationTypes.reduce(
|
|
15676
|
+
(acc, type) => {
|
|
15677
|
+
if (exclude[type]) {
|
|
15678
|
+
acc[type] = [];
|
|
15679
|
+
return acc;
|
|
15680
|
+
}
|
|
15681
|
+
acc[type] = getAnnotationsBetweenRange(
|
|
15682
|
+
seqDataToUse[type],
|
|
15683
|
+
range,
|
|
15684
|
+
seqDataToUse.sequence.length,
|
|
15685
|
+
excludePartial[type]
|
|
15686
|
+
);
|
|
15524
15687
|
return acc;
|
|
15525
|
-
}
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
range,
|
|
15529
|
-
seqDataToUse.sequence.length,
|
|
15530
|
-
excludePartial[type]
|
|
15531
|
-
);
|
|
15532
|
-
return acc;
|
|
15533
|
-
}, {})
|
|
15688
|
+
},
|
|
15689
|
+
{}
|
|
15690
|
+
)
|
|
15534
15691
|
);
|
|
15535
15692
|
if (range.overlapsSelf) {
|
|
15536
15693
|
const extendedSeqData = insertSequenceDataAtPositionOrRange(
|
|
15537
15694
|
{ sequence: seqDataToReturn.sequence },
|
|
15695
|
+
// Wrapping in object as per assumed signature
|
|
15538
15696
|
seqDataToUse,
|
|
15539
15697
|
range.start
|
|
15540
15698
|
);
|
|
@@ -15608,7 +15766,8 @@ function getAnnotationsBetweenRange(annotationsToBeAdjusted, range, maxLength, s
|
|
|
15608
15766
|
__name(getAnnotationsBetweenRange, "getAnnotationsBetweenRange");
|
|
15609
15767
|
function getComplementSequenceAndAnnotations(pSeqObj, options = {}) {
|
|
15610
15768
|
const seqObj = tidyUpSequenceData(
|
|
15611
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
15769
|
+
getSequenceDataBetweenRange(pSeqObj, options.range || null),
|
|
15770
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15612
15771
|
options
|
|
15613
15772
|
);
|
|
15614
15773
|
const newSeqObj = Object.assign({}, seqObj, {
|
|
@@ -15623,7 +15782,7 @@ function getCutsiteType(restrictionEnzyme) {
|
|
|
15623
15782
|
const { topSnipOffset, bottomSnipOffset } = restrictionEnzyme;
|
|
15624
15783
|
if (topSnipOffset === bottomSnipOffset) {
|
|
15625
15784
|
return "blunt";
|
|
15626
|
-
} else if (topSnipOffset < bottomSnipOffset) {
|
|
15785
|
+
} else if (topSnipOffset !== void 0 && bottomSnipOffset !== void 0 && topSnipOffset < bottomSnipOffset) {
|
|
15627
15786
|
return "5' overhang";
|
|
15628
15787
|
} else {
|
|
15629
15788
|
return "3' overhang";
|
|
@@ -15657,7 +15816,7 @@ function getLeftAndRightOfSequenceInRangeGivenPosition(range, position, sequence
|
|
|
15657
15816
|
leftHandSide: "",
|
|
15658
15817
|
rightHandSide: ""
|
|
15659
15818
|
};
|
|
15660
|
-
if (isPositionWithinRange(position, range)) {
|
|
15819
|
+
if (isPositionWithinRange(position, range, sequence.length)) {
|
|
15661
15820
|
result.leftHandSide = getSequenceWithinRange(
|
|
15662
15821
|
{
|
|
15663
15822
|
start: range.start,
|
|
@@ -15697,13 +15856,13 @@ function getOverlapBetweenTwoSequences(sequenceToFind, sequenceToSearchIn) {
|
|
|
15697
15856
|
}
|
|
15698
15857
|
}
|
|
15699
15858
|
__name(getOverlapBetweenTwoSequences, "getOverlapBetweenTwoSequences");
|
|
15700
|
-
function
|
|
15701
|
-
|
|
15859
|
+
function getPossiblePartsFromSequenceAndEnzymes(seqData, restrictionEnzymes) {
|
|
15860
|
+
const enzymes = Array.isArray(restrictionEnzymes) ? restrictionEnzymes : [restrictionEnzymes];
|
|
15702
15861
|
const bps = seqData.sequence;
|
|
15703
15862
|
const seqLen = bps.length;
|
|
15704
|
-
const circular = seqData.circular;
|
|
15863
|
+
const circular = seqData.circular || false;
|
|
15705
15864
|
let cutsites = [];
|
|
15706
|
-
|
|
15865
|
+
enzymes.forEach((enzyme) => {
|
|
15707
15866
|
const newCutsites = cutSequenceByRestrictionEnzyme(bps, circular, enzyme);
|
|
15708
15867
|
cutsites = cutsites.concat(newCutsites);
|
|
15709
15868
|
});
|
|
@@ -15744,13 +15903,13 @@ function getPossiblePartsFromSequenceAndEnzyme(seqData, restrictionEnzymes) {
|
|
|
15744
15903
|
return parts;
|
|
15745
15904
|
}
|
|
15746
15905
|
}
|
|
15747
|
-
__name(
|
|
15906
|
+
__name(getPossiblePartsFromSequenceAndEnzymes, "getPossiblePartsFromSequenceAndEnzymes");
|
|
15748
15907
|
function getPartBetweenEnzymesWithInclusiveOverhangs(cut1, cut2, seqLen) {
|
|
15749
15908
|
const firstCutOffset = getEnzymeRelativeOffset(cut1.restrictionEnzyme);
|
|
15750
15909
|
const secondCutOffset = getEnzymeRelativeOffset(cut2.restrictionEnzyme);
|
|
15751
|
-
const start = cut1.topSnipBeforeBottom ? cut1.topSnipPosition : cut1.bottomSnipPosition;
|
|
15910
|
+
const start = (cut1.topSnipBeforeBottom ? cut1.topSnipPosition : cut1.bottomSnipPosition) || 0;
|
|
15752
15911
|
const end = normalizePositionByRangeLength(
|
|
15753
|
-
(cut2.topSnipBeforeBottom ? cut2.bottomSnipPosition : cut2.topSnipPosition) - 1,
|
|
15912
|
+
(cut2.topSnipBeforeBottom ? cut2.bottomSnipPosition || 0 : cut2.topSnipPosition || 0) - 1,
|
|
15754
15913
|
seqLen
|
|
15755
15914
|
);
|
|
15756
15915
|
return {
|
|
@@ -15761,20 +15920,20 @@ function getPartBetweenEnzymesWithInclusiveOverhangs(cut1, cut2, seqLen) {
|
|
|
15761
15920
|
firstCut: cut1,
|
|
15762
15921
|
//the offset is always counting with 0 being at the top snip position
|
|
15763
15922
|
firstCutOffset,
|
|
15764
|
-
firstCutOverhang: cut1.overhangBps,
|
|
15765
|
-
firstCutOverhangTop: firstCutOffset > 0 ? cut1.overhangBps : "",
|
|
15766
|
-
firstCutOverhangBottom: firstCutOffset < 0 ? getComplementSequenceString(cut1.overhangBps) : "",
|
|
15923
|
+
firstCutOverhang: cut1.overhangBps || "",
|
|
15924
|
+
firstCutOverhangTop: firstCutOffset > 0 ? cut1.overhangBps || "" : "",
|
|
15925
|
+
firstCutOverhangBottom: firstCutOffset < 0 ? getComplementSequenceString(cut1.overhangBps || "") : "",
|
|
15767
15926
|
secondCut: cut2,
|
|
15768
15927
|
//the offset is always counting with 0 being at the top snip position
|
|
15769
15928
|
secondCutOffset,
|
|
15770
|
-
secondCutOverhang: cut2.overhangBps,
|
|
15771
|
-
secondCutOverhangTop: secondCutOffset < 0 ? cut2.overhangBps : "",
|
|
15772
|
-
secondCutOverhangBottom: secondCutOffset > 0 ? getComplementSequenceString(cut2.overhangBps) : ""
|
|
15929
|
+
secondCutOverhang: cut2.overhangBps || "",
|
|
15930
|
+
secondCutOverhangTop: secondCutOffset < 0 ? cut2.overhangBps || "" : "",
|
|
15931
|
+
secondCutOverhangBottom: secondCutOffset > 0 ? getComplementSequenceString(cut2.overhangBps || "") : ""
|
|
15773
15932
|
};
|
|
15774
15933
|
}
|
|
15775
15934
|
__name(getPartBetweenEnzymesWithInclusiveOverhangs, "getPartBetweenEnzymesWithInclusiveOverhangs");
|
|
15776
15935
|
function getEnzymeRelativeOffset(enzyme) {
|
|
15777
|
-
return enzyme.bottomSnipOffset - enzyme.topSnipOffset;
|
|
15936
|
+
return (enzyme.bottomSnipOffset || 0) - (enzyme.topSnipOffset || 0);
|
|
15778
15937
|
}
|
|
15779
15938
|
__name(getEnzymeRelativeOffset, "getEnzymeRelativeOffset");
|
|
15780
15939
|
function pairwise(list) {
|
|
@@ -15790,6 +15949,8 @@ __name(pairwise, "pairwise");
|
|
|
15790
15949
|
function getReverseAminoAcidStringFromSequenceString(sequenceString) {
|
|
15791
15950
|
const aminoAcidsPerBase = getAminoAcidDataForEachBaseOfDna(
|
|
15792
15951
|
sequenceString,
|
|
15952
|
+
false,
|
|
15953
|
+
null,
|
|
15793
15954
|
false
|
|
15794
15955
|
);
|
|
15795
15956
|
const aaArray = [];
|
|
@@ -15828,7 +15989,8 @@ function getReverseComplementAnnotation(annotation, sequenceLength) {
|
|
|
15828
15989
|
__name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
|
|
15829
15990
|
function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
|
15830
15991
|
const seqObj = tidyUpSequenceData(
|
|
15831
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
15992
|
+
getSequenceDataBetweenRange(pSeqObj, options.range || null),
|
|
15993
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15832
15994
|
__spreadValues({ doNotRemoveInvalidChars: true }, options)
|
|
15833
15995
|
);
|
|
15834
15996
|
const newSeqObj = Object.assign(
|
|
@@ -15837,17 +15999,20 @@ function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
|
|
15837
15999
|
{
|
|
15838
16000
|
sequence: getReverseComplementSequenceString(seqObj.sequence)
|
|
15839
16001
|
},
|
|
15840
|
-
annotationTypes.reduce(
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
16002
|
+
annotationTypes.reduce(
|
|
16003
|
+
(acc, type) => {
|
|
16004
|
+
if (seqObj[type]) {
|
|
16005
|
+
acc[type] = map(seqObj[type], (annotation) => {
|
|
16006
|
+
return getReverseComplementAnnotation(
|
|
16007
|
+
annotation,
|
|
16008
|
+
seqObj.sequence.length
|
|
16009
|
+
);
|
|
16010
|
+
});
|
|
16011
|
+
}
|
|
16012
|
+
return acc;
|
|
16013
|
+
},
|
|
16014
|
+
{}
|
|
16015
|
+
)
|
|
15851
16016
|
);
|
|
15852
16017
|
return tidyUpSequenceData(newSeqObj, __spreadValues({
|
|
15853
16018
|
doNotRemoveInvalidChars: true
|
|
@@ -15869,10 +16034,13 @@ __name(getReverseSequenceString, "getReverseSequenceString");
|
|
|
15869
16034
|
function guessIfSequenceIsDnaAndNotProtein(seq, options = {}) {
|
|
15870
16035
|
const { threshold = 0.9, loose } = options;
|
|
15871
16036
|
const dnaLetters = options.dnaLetters || loose ? [...ambiguous_dna_letters.split(""), "U"] : ["G", "A", "T", "C", "U"];
|
|
15872
|
-
const dnaLetterMap = dnaLetters.reduce(
|
|
15873
|
-
acc
|
|
15874
|
-
|
|
15875
|
-
|
|
16037
|
+
const dnaLetterMap = dnaLetters.reduce(
|
|
16038
|
+
(acc, letter) => {
|
|
16039
|
+
acc[letter.toUpperCase()] = true;
|
|
16040
|
+
return acc;
|
|
16041
|
+
},
|
|
16042
|
+
{}
|
|
16043
|
+
);
|
|
15876
16044
|
let count = 0;
|
|
15877
16045
|
if (!seq || !seq.length) return true;
|
|
15878
16046
|
for (let index = 0; index < seq.length; index++) {
|
|
@@ -15892,15 +16060,17 @@ function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow, { splitFor
|
|
|
15892
16060
|
const yOffsetLevelMap = {};
|
|
15893
16061
|
const wrappedAnnotations = {};
|
|
15894
16062
|
forEach(annotations, (annotation) => {
|
|
16063
|
+
var _a;
|
|
15895
16064
|
const containsLocations = !!(annotation.locations && annotation.locations.length);
|
|
15896
16065
|
if (annotation.overlapsSelf) {
|
|
15897
16066
|
if (!wrappedAnnotations[annotation.id]) {
|
|
15898
16067
|
mapAnnotationToRows({
|
|
15899
|
-
annotation: {
|
|
16068
|
+
annotation: __spreadProps(__spreadValues({}, annotation), {
|
|
15900
16069
|
start: 0,
|
|
15901
16070
|
end: sequenceLength - 1,
|
|
15902
|
-
id: `__tempAnnRemoveMe__${annotation.id}
|
|
15903
|
-
|
|
16071
|
+
id: `__tempAnnRemoveMe__${annotation.id}`,
|
|
16072
|
+
overlapsSelf: false
|
|
16073
|
+
}),
|
|
15904
16074
|
sequenceLength,
|
|
15905
16075
|
bpsPerRow,
|
|
15906
16076
|
annotationsToRowsMap,
|
|
@@ -15921,7 +16091,7 @@ function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow, { splitFor
|
|
|
15921
16091
|
splitForwardReverse
|
|
15922
16092
|
});
|
|
15923
16093
|
if (containsLocations) {
|
|
15924
|
-
annotation.locations.forEach((location) => {
|
|
16094
|
+
(_a = annotation.locations) == null ? void 0 : _a.forEach((location) => {
|
|
15925
16095
|
mapAnnotationToRows({
|
|
15926
16096
|
annotation,
|
|
15927
16097
|
sequenceLength,
|
|
@@ -15937,7 +16107,7 @@ function mapAnnotationsToRows(annotations, sequenceLength, bpsPerRow, { splitFor
|
|
|
15937
16107
|
forEach(annotationsToRowsMap, (annotationsForRow, i) => {
|
|
15938
16108
|
annotationsToRowsMap[i] = filter(
|
|
15939
16109
|
annotationsForRow,
|
|
15940
|
-
(ann) => !startsWith(ann.id, "__tempAnnRemoveMe__")
|
|
16110
|
+
(ann) => !startsWith(String(ann.id), "__tempAnnRemoveMe__")
|
|
15941
16111
|
);
|
|
15942
16112
|
});
|
|
15943
16113
|
return annotationsToRowsMap;
|
|
@@ -15979,6 +16149,13 @@ function mapAnnotationToRows({
|
|
|
15979
16149
|
yOffset = ann.yOffset;
|
|
15980
16150
|
}
|
|
15981
16151
|
});
|
|
16152
|
+
if (yOffset === void 0) {
|
|
16153
|
+
annotationsForRow.forEach((ann) => {
|
|
16154
|
+
if (ann.id === annotation.id) {
|
|
16155
|
+
yOffset = ann.yOffset;
|
|
16156
|
+
}
|
|
16157
|
+
});
|
|
16158
|
+
}
|
|
15982
16159
|
} else {
|
|
15983
16160
|
if (location) {
|
|
15984
16161
|
annotationsForRow.forEach((ann) => {
|
|
@@ -15987,32 +16164,74 @@ function mapAnnotationToRows({
|
|
|
15987
16164
|
}
|
|
15988
16165
|
});
|
|
15989
16166
|
} else {
|
|
15990
|
-
if (index > 0 &&
|
|
15991
|
-
annotationsForRow.length && //there are already annotations within the row
|
|
15992
|
-
annotationsForRow[annotationsForRow.length - 1].annotation === annotation) {
|
|
16167
|
+
if (index > 0 && annotationsForRow.length && annotationsForRow[annotationsForRow.length - 1].annotation === annotation) {
|
|
15993
16168
|
yOffset = annotationsForRow[annotationsForRow.length - 1].yOffset;
|
|
15994
16169
|
} else {
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
16170
|
+
const siblingRangesOnThisRow = ranges.slice(index + 1).filter((r) => {
|
|
16171
|
+
const rStartRow = Math.floor(r.start / bpsPerRow);
|
|
16172
|
+
const rEndRow = Math.floor(r.end / bpsPerRow);
|
|
16173
|
+
return rowNumber >= rStartRow && rowNumber <= rEndRow;
|
|
16174
|
+
});
|
|
16175
|
+
if (siblingRangesOnThisRow.length > 0) {
|
|
16176
|
+
let foundYOffset = -1;
|
|
16177
|
+
yOffsetsForRow.some((rangesAlreadyAddedToYOffset, levelIndex) => {
|
|
16178
|
+
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
16179
|
+
(comparisonRange) => {
|
|
16180
|
+
return checkIfPotentiallyCircularRangesOverlap(
|
|
16181
|
+
range,
|
|
16182
|
+
comparisonRange
|
|
16183
|
+
);
|
|
16184
|
+
}
|
|
16185
|
+
);
|
|
16186
|
+
if (rangeBlocked) return false;
|
|
16187
|
+
const siblingBlocked = siblingRangesOnThisRow.some(
|
|
16188
|
+
(siblingRange) => {
|
|
16189
|
+
return rangesAlreadyAddedToYOffset.some((comparisonRange) => {
|
|
16190
|
+
return checkIfPotentiallyCircularRangesOverlap(
|
|
16191
|
+
siblingRange,
|
|
16192
|
+
comparisonRange
|
|
16193
|
+
);
|
|
16194
|
+
});
|
|
16195
|
+
}
|
|
16196
|
+
);
|
|
16197
|
+
if (!siblingBlocked) {
|
|
16198
|
+
foundYOffset = levelIndex;
|
|
16199
|
+
return true;
|
|
16200
|
+
}
|
|
16201
|
+
return false;
|
|
16202
|
+
});
|
|
16203
|
+
if (foundYOffset > -1) {
|
|
16204
|
+
yOffset = foundYOffset;
|
|
16205
|
+
yOffsetsForRow[foundYOffset].push(range);
|
|
16206
|
+
} else {
|
|
16207
|
+
yOffset = yOffsetsForRow.length;
|
|
16208
|
+
yOffsetsForRow.push([range]);
|
|
16209
|
+
}
|
|
16210
|
+
} else {
|
|
16211
|
+
yOffset = getYOffsetForPotentiallyCircularRange(
|
|
16212
|
+
range,
|
|
16213
|
+
yOffsetsForRow,
|
|
16214
|
+
false
|
|
16215
|
+
);
|
|
16216
|
+
}
|
|
16217
|
+
}
|
|
16218
|
+
if (yOffset !== void 0) {
|
|
16219
|
+
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
16220
|
+
yOffsetsForRow[yOffset].push({
|
|
16221
|
+
start,
|
|
16222
|
+
end
|
|
16223
|
+
});
|
|
15999
16224
|
}
|
|
16000
|
-
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
16001
|
-
yOffsetsForRow[yOffset].push({
|
|
16002
|
-
start,
|
|
16003
|
-
end
|
|
16004
|
-
});
|
|
16005
16225
|
}
|
|
16006
16226
|
}
|
|
16007
|
-
annotationsForRow.push(__spreadProps(__spreadValues(__spreadValues({
|
|
16227
|
+
annotationsForRow.push(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, annotation), {
|
|
16008
16228
|
id: annotation.id,
|
|
16009
16229
|
annotation,
|
|
16010
16230
|
start,
|
|
16011
16231
|
end
|
|
16012
|
-
}, containsLocations && { containsLocations }), location && { isJoinedLocation: !!location }), {
|
|
16232
|
+
}), containsLocations && { containsLocations }), location && { isJoinedLocation: !!location }), {
|
|
16013
16233
|
yOffset,
|
|
16014
16234
|
enclosingRangeType: range.type
|
|
16015
|
-
//either "beginning", "end" or "beginningAndEnd"
|
|
16016
16235
|
}));
|
|
16017
16236
|
}
|
|
16018
16237
|
});
|
|
@@ -16022,10 +16241,14 @@ function prepareCircularViewData(sequenceData) {
|
|
|
16022
16241
|
const clonedSeqData = cloneDeep(sequenceData);
|
|
16023
16242
|
annotationTypes.forEach((annotationType) => {
|
|
16024
16243
|
if (annotationType !== "cutsites") {
|
|
16025
|
-
const
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16244
|
+
const annotations = clonedSeqData[annotationType];
|
|
16245
|
+
if (annotations) {
|
|
16246
|
+
const maxYOffset = getYOffsetsForPotentiallyCircularRanges(
|
|
16247
|
+
annotations,
|
|
16248
|
+
true
|
|
16249
|
+
).maxYOffset;
|
|
16250
|
+
clonedSeqData[annotationType].maxYOffset = maxYOffset;
|
|
16251
|
+
}
|
|
16029
16252
|
}
|
|
16030
16253
|
});
|
|
16031
16254
|
return clonedSeqData;
|
|
@@ -16038,14 +16261,19 @@ function prepareRowData(sequenceData, bpsPerRow) {
|
|
|
16038
16261
|
const rowMap = {};
|
|
16039
16262
|
annotationTypes.forEach((type) => {
|
|
16040
16263
|
rowMap[type] = mapAnnotationsToRows(
|
|
16041
|
-
sequenceData[type],
|
|
16264
|
+
sequenceData[type] || [],
|
|
16042
16265
|
sequenceLength,
|
|
16043
16266
|
bpsPerRow,
|
|
16044
16267
|
{ splitForwardReverse: type === "primers" }
|
|
16045
16268
|
);
|
|
16046
16269
|
});
|
|
16047
16270
|
for (let rowNumber = 0; rowNumber < totalRows; rowNumber++) {
|
|
16048
|
-
const row = {
|
|
16271
|
+
const row = {
|
|
16272
|
+
rowNumber,
|
|
16273
|
+
start: 0,
|
|
16274
|
+
end: 0,
|
|
16275
|
+
sequence: ""
|
|
16276
|
+
};
|
|
16049
16277
|
row.rowNumber = rowNumber;
|
|
16050
16278
|
row.start = rowNumber * bpsPerRow;
|
|
16051
16279
|
row.end = (rowNumber + 1) * bpsPerRow - 1 < sequenceLength ? (rowNumber + 1) * bpsPerRow - 1 : sequenceLength - 1;
|
|
@@ -16106,17 +16334,16 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16106
16334
|
}
|
|
16107
16335
|
}
|
|
16108
16336
|
const refSeqWithGaps = insertGapsIntoRefSeq(refSeq.sequence, seqReads);
|
|
16109
|
-
const seqReadsWithGaps = [
|
|
16110
|
-
{ name: refSeq.name, sequence: refSeqWithGaps.toUpperCase() }
|
|
16111
|
-
];
|
|
16337
|
+
const seqReadsWithGaps = [{ name: refSeq.name, sequence: refSeqWithGaps.toUpperCase() }];
|
|
16112
16338
|
seqReads.forEach((seqRead) => {
|
|
16113
16339
|
const allInsertionsInSeqReads = [];
|
|
16114
16340
|
seqReads.forEach((seqRead2) => {
|
|
16115
16341
|
const splitSeqRead = seqRead2.cigar.match(/([0-9]*[SMDI])/g);
|
|
16342
|
+
if (!splitSeqRead) return;
|
|
16116
16343
|
let adjustedSeqReadPos2 = cloneDeep(seqRead2.pos);
|
|
16117
16344
|
if (splitSeqRead[0].slice(-1) === "S") {
|
|
16118
16345
|
const numOfBeginningSoftClipped = splitSeqRead[0].slice(0, -1);
|
|
16119
|
-
adjustedSeqReadPos2 = seqRead2.pos - numOfBeginningSoftClipped;
|
|
16346
|
+
adjustedSeqReadPos2 = seqRead2.pos - Number(numOfBeginningSoftClipped);
|
|
16120
16347
|
}
|
|
16121
16348
|
for (let componentI = 0; componentI < splitSeqRead.length; componentI++) {
|
|
16122
16349
|
if (splitSeqRead[componentI].slice(-1) === "I") {
|
|
@@ -16142,10 +16369,11 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16142
16369
|
}
|
|
16143
16370
|
});
|
|
16144
16371
|
const splitSeqReadChunk = seqRead.cigar.match(/([0-9]*[SMDI])/g);
|
|
16372
|
+
if (!splitSeqReadChunk) return;
|
|
16145
16373
|
let adjustedSeqReadPos = cloneDeep(seqRead.pos);
|
|
16146
16374
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16147
16375
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16148
|
-
adjustedSeqReadPos = seqRead.pos - numOfBeginningSoftClipped;
|
|
16376
|
+
adjustedSeqReadPos = seqRead.pos - Number(numOfBeginningSoftClipped);
|
|
16149
16377
|
}
|
|
16150
16378
|
let eachSeqReadWithGaps = seqRead.seq.split("");
|
|
16151
16379
|
if (adjustedSeqReadPos > 0) {
|
|
@@ -16333,10 +16561,11 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16333
16561
|
const seqReadLengthsBeforeRefSeqStart = [];
|
|
16334
16562
|
seqReads.forEach((seq) => {
|
|
16335
16563
|
const splitSeqReadChunk = seq.cigar.match(/([0-9]*[SMDI])/g);
|
|
16564
|
+
if (!splitSeqReadChunk) return;
|
|
16336
16565
|
let adjustedSeqReadPos = cloneDeep(seq.pos);
|
|
16337
16566
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16338
16567
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16339
|
-
adjustedSeqReadPos = seq.pos - numOfBeginningSoftClipped;
|
|
16568
|
+
adjustedSeqReadPos = seq.pos - Number(numOfBeginningSoftClipped);
|
|
16340
16569
|
if (adjustedSeqReadPos < 0) {
|
|
16341
16570
|
seqReadLengthsBeforeRefSeqStart.push(Math.abs(adjustedSeqReadPos));
|
|
16342
16571
|
}
|
|
@@ -16346,13 +16575,14 @@ function addGapsToSeqReads(refSeq, seqReads) {
|
|
|
16346
16575
|
for (let i = 1; i < seqReadsWithGaps.length; i++) {
|
|
16347
16576
|
const eachSeqReadWithGaps = seqReadsWithGaps[i].sequence.split("");
|
|
16348
16577
|
const splitSeqReadChunk = seqReads[i - 1].cigar.match(/([0-9]*[SMDI])/g);
|
|
16578
|
+
if (!splitSeqReadChunk) continue;
|
|
16349
16579
|
let adjustedSeqReadPos = cloneDeep(seqReads[i - 1].pos);
|
|
16350
16580
|
if (seqReadLengthsBeforeRefSeqStart.length > 0) {
|
|
16351
16581
|
longestSeqReadLength = Math.max(...seqReadLengthsBeforeRefSeqStart);
|
|
16352
16582
|
}
|
|
16353
16583
|
if (splitSeqReadChunk[0].slice(-1) === "S") {
|
|
16354
16584
|
const numOfBeginningSoftClipped = splitSeqReadChunk[0].slice(0, -1);
|
|
16355
|
-
adjustedSeqReadPos = seqReads[i - 1].pos - numOfBeginningSoftClipped;
|
|
16585
|
+
adjustedSeqReadPos = seqReads[i - 1].pos - Number(numOfBeginningSoftClipped);
|
|
16356
16586
|
if (adjustedSeqReadPos > 0) {
|
|
16357
16587
|
if (longestSeqReadLength > 0) {
|
|
16358
16588
|
eachSeqReadWithGaps.unshift("-".repeat(longestSeqReadLength + 1));
|
|
@@ -16466,11 +16696,11 @@ function calculateNebTm(sequence, { monovalentCationConc = 0.05, primerConc = 5e
|
|
|
16466
16696
|
for (let i = 0; i < seq.length; i++) {
|
|
16467
16697
|
if (i === 0 || i === seq.length - 1) {
|
|
16468
16698
|
if (seq[i] === "G" || seq[i] === "C") {
|
|
16469
|
-
hi += sequenceToEnthalpyMap
|
|
16470
|
-
si += sequenceToEntropyMap
|
|
16699
|
+
hi += sequenceToEnthalpyMap["initiationWithTerminalGC"];
|
|
16700
|
+
si += sequenceToEntropyMap["initiationWithTerminalGC"];
|
|
16471
16701
|
} else if (seq[i] === "A" || seq[i] === "T") {
|
|
16472
|
-
hi += sequenceToEnthalpyMap
|
|
16473
|
-
si += sequenceToEntropyMap
|
|
16702
|
+
hi += sequenceToEnthalpyMap["initiationWithTerminalAT"];
|
|
16703
|
+
si += sequenceToEntropyMap["initiationWithTerminalAT"];
|
|
16474
16704
|
}
|
|
16475
16705
|
}
|
|
16476
16706
|
if (i < seq.length - 1) {
|
|
@@ -16513,9 +16743,13 @@ function calculateNebTa(sequences, primerConc, { monovalentCationConc, polymeras
|
|
|
16513
16743
|
`${sequences.length} sequences received when 2 primers were expected`
|
|
16514
16744
|
);
|
|
16515
16745
|
}
|
|
16516
|
-
const meltingTemperatures = sequences.map(
|
|
16517
|
-
|
|
16518
|
-
|
|
16746
|
+
const meltingTemperatures = sequences.map((seq) => {
|
|
16747
|
+
const tm = calculateNebTm(seq, { monovalentCationConc, primerConc });
|
|
16748
|
+
if (typeof tm !== "number") {
|
|
16749
|
+
throw new Error(`Invalid Tm calculated for ${seq}: ${tm}`);
|
|
16750
|
+
}
|
|
16751
|
+
return tm;
|
|
16752
|
+
});
|
|
16519
16753
|
meltingTemperatures.sort((a, b) => a - b);
|
|
16520
16754
|
const lowerMeltingTemp = meltingTemperatures[0];
|
|
16521
16755
|
let annealingTemp;
|
|
@@ -16592,17 +16826,17 @@ function isValidSequence(sequence) {
|
|
|
16592
16826
|
__name(isValidSequence, "isValidSequence");
|
|
16593
16827
|
function calculateSantaLuciaTm(sequence) {
|
|
16594
16828
|
try {
|
|
16595
|
-
|
|
16596
|
-
if (!isValidSequence(
|
|
16829
|
+
const seq = sequence == null ? void 0 : sequence.toUpperCase().trim();
|
|
16830
|
+
if (!isValidSequence(seq)) {
|
|
16597
16831
|
throw new Error("Invalid sequence: contains non-DNA characters");
|
|
16598
16832
|
}
|
|
16599
|
-
if (
|
|
16833
|
+
if (seq.length < 2) {
|
|
16600
16834
|
throw new Error("Sequence too short: minimum length is 2 bases");
|
|
16601
16835
|
}
|
|
16602
16836
|
let deltaH = 0;
|
|
16603
16837
|
let deltaS = 0;
|
|
16604
|
-
for (let i = 0; i <
|
|
16605
|
-
const dinucleotide =
|
|
16838
|
+
for (let i = 0; i < seq.length - 1; i++) {
|
|
16839
|
+
const dinucleotide = seq.substring(i, i + 2);
|
|
16606
16840
|
if (dinucleotide.includes("N")) {
|
|
16607
16841
|
continue;
|
|
16608
16842
|
}
|
|
@@ -16612,23 +16846,23 @@ function calculateSantaLuciaTm(sequence) {
|
|
|
16612
16846
|
deltaS += params.dS;
|
|
16613
16847
|
}
|
|
16614
16848
|
}
|
|
16615
|
-
const firstBase =
|
|
16616
|
-
const lastBase =
|
|
16849
|
+
const firstBase = seq[0];
|
|
16850
|
+
const lastBase = seq[seq.length - 1];
|
|
16617
16851
|
if (firstBase === "G" || firstBase === "C") {
|
|
16618
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16619
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16852
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16853
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16620
16854
|
} else {
|
|
16621
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16622
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16855
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16856
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16623
16857
|
}
|
|
16624
16858
|
if (lastBase === "G" || lastBase === "C") {
|
|
16625
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16626
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16859
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16860
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16627
16861
|
} else {
|
|
16628
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16629
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16862
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16863
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16630
16864
|
}
|
|
16631
|
-
const nnPairs =
|
|
16865
|
+
const nnPairs = seq.length - 1;
|
|
16632
16866
|
deltaS = applySaltCorrection(deltaS, nnPairs);
|
|
16633
16867
|
const C = PRIMER3_PARAMS.dnaConc * 1e-9;
|
|
16634
16868
|
const Tm = deltaH * 1e3 / (deltaS + PRIMER3_PARAMS.R * Math.log(C / 4));
|
|
@@ -16640,16 +16874,16 @@ function calculateSantaLuciaTm(sequence) {
|
|
|
16640
16874
|
__name(calculateSantaLuciaTm, "calculateSantaLuciaTm");
|
|
16641
16875
|
function calculateEndStability(sequence) {
|
|
16642
16876
|
try {
|
|
16643
|
-
|
|
16644
|
-
if (!isValidSequence(
|
|
16877
|
+
const seq = sequence == null ? void 0 : sequence.toUpperCase().trim();
|
|
16878
|
+
if (!isValidSequence(seq)) {
|
|
16645
16879
|
throw new Error("Invalid sequence: contains non-DNA characters");
|
|
16646
16880
|
}
|
|
16647
|
-
if (
|
|
16881
|
+
if (seq.length < 5) {
|
|
16648
16882
|
throw new Error(
|
|
16649
16883
|
"Sequence too short: minimum length is 5 bases for end stability calculation"
|
|
16650
16884
|
);
|
|
16651
16885
|
}
|
|
16652
|
-
const last5Bases =
|
|
16886
|
+
const last5Bases = seq.substring(seq.length - 5);
|
|
16653
16887
|
let deltaH = 0;
|
|
16654
16888
|
let deltaS = 0;
|
|
16655
16889
|
for (let i = 0; i < 4; i++) {
|
|
@@ -16666,18 +16900,18 @@ function calculateEndStability(sequence) {
|
|
|
16666
16900
|
const firstBase = last5Bases[0];
|
|
16667
16901
|
const lastBase = last5Bases[last5Bases.length - 1];
|
|
16668
16902
|
if (firstBase === "G" || firstBase === "C") {
|
|
16669
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16670
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16903
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16904
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16671
16905
|
} else {
|
|
16672
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16673
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16906
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16907
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16674
16908
|
}
|
|
16675
16909
|
if (lastBase === "G" || lastBase === "C") {
|
|
16676
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16677
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16910
|
+
deltaH += SANTA_LUCIA_INIT["GC"].dH;
|
|
16911
|
+
deltaS += SANTA_LUCIA_INIT["GC"].dS;
|
|
16678
16912
|
} else {
|
|
16679
|
-
deltaH += SANTA_LUCIA_INIT
|
|
16680
|
-
deltaS += SANTA_LUCIA_INIT
|
|
16913
|
+
deltaH += SANTA_LUCIA_INIT["AT"].dH;
|
|
16914
|
+
deltaS += SANTA_LUCIA_INIT["AT"].dS;
|
|
16681
16915
|
}
|
|
16682
16916
|
const T = 310.15;
|
|
16683
16917
|
const deltaG = deltaH - T * deltaS / 1e3;
|
|
@@ -16692,24 +16926,40 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16692
16926
|
const pairs = [];
|
|
16693
16927
|
if (!cutsites.length) return [];
|
|
16694
16928
|
let sortedCutsites = cutsites.sort((a, b) => {
|
|
16695
|
-
return a.topSnipPosition - b.topSnipPosition;
|
|
16929
|
+
return (a.topSnipPosition || 0) - (b.topSnipPosition || 0);
|
|
16696
16930
|
});
|
|
16697
16931
|
if (!circular) {
|
|
16698
16932
|
sortedCutsites = [
|
|
16699
16933
|
{
|
|
16934
|
+
start: 0,
|
|
16935
|
+
end: 0,
|
|
16700
16936
|
topSnipPosition: 0,
|
|
16701
16937
|
bottomSnipPosition: 0,
|
|
16702
16938
|
overhangSize: 0,
|
|
16703
16939
|
type: "START_OR_END_OF_SEQ",
|
|
16704
|
-
name: "START_OF_SEQ"
|
|
16940
|
+
name: "START_OF_SEQ",
|
|
16941
|
+
restrictionEnzyme: {
|
|
16942
|
+
name: "START_OF_SEQ",
|
|
16943
|
+
site: "",
|
|
16944
|
+
forwardRegex: "",
|
|
16945
|
+
reverseRegex: ""
|
|
16946
|
+
}
|
|
16705
16947
|
},
|
|
16706
16948
|
...sortedCutsites,
|
|
16707
16949
|
{
|
|
16950
|
+
start: sequenceLength,
|
|
16951
|
+
end: sequenceLength,
|
|
16708
16952
|
topSnipPosition: sequenceLength,
|
|
16709
16953
|
bottomSnipPosition: sequenceLength,
|
|
16710
16954
|
overhangSize: 0,
|
|
16711
16955
|
type: "START_OR_END_OF_SEQ",
|
|
16712
|
-
name: "END_OF_SEQ"
|
|
16956
|
+
name: "END_OF_SEQ",
|
|
16957
|
+
restrictionEnzyme: {
|
|
16958
|
+
name: "END_OF_SEQ",
|
|
16959
|
+
site: "",
|
|
16960
|
+
forwardRegex: "",
|
|
16961
|
+
reverseRegex: ""
|
|
16962
|
+
}
|
|
16713
16963
|
}
|
|
16714
16964
|
];
|
|
16715
16965
|
}
|
|
@@ -16732,11 +16982,11 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16732
16982
|
});
|
|
16733
16983
|
pairs.forEach(([cut1, cut2]) => {
|
|
16734
16984
|
const start = normalizePositionByRangeLength(
|
|
16735
|
-
cut1.topSnipPosition,
|
|
16985
|
+
cut1.topSnipPosition || 0,
|
|
16736
16986
|
sequenceLength
|
|
16737
16987
|
);
|
|
16738
16988
|
const end = normalizePositionByRangeLength(
|
|
16739
|
-
cut2.topSnipPosition - 1,
|
|
16989
|
+
(cut2.topSnipPosition || 0) - 1,
|
|
16740
16990
|
sequenceLength
|
|
16741
16991
|
);
|
|
16742
16992
|
const fragmentRange = { start, end };
|
|
@@ -16754,7 +17004,9 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16754
17004
|
})
|
|
16755
17005
|
}, fragmentRange), {
|
|
16756
17006
|
size,
|
|
16757
|
-
id
|
|
17007
|
+
id,
|
|
17008
|
+
name: `${cut1.restrictionEnzyme.name} -- ${cut2.restrictionEnzyme.name} ${size} bps`
|
|
17009
|
+
// Add missing name property
|
|
16758
17010
|
}));
|
|
16759
17011
|
});
|
|
16760
17012
|
fragments.filter((fragment) => {
|
|
@@ -16766,21 +17018,33 @@ function getDigestFragmentsForCutsites(sequenceLength, circular, cutsites, opts
|
|
|
16766
17018
|
return fragments;
|
|
16767
17019
|
}
|
|
16768
17020
|
__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,
|
|
17021
|
+
function getDigestFragmentsForRestrictionEnzymes(sequence, circular, contextEnzymes, options) {
|
|
17022
|
+
const cutsitesByName = getCutsitesFromSequence(
|
|
17023
|
+
sequence,
|
|
16780
17024
|
circular,
|
|
16781
|
-
|
|
16782
|
-
opts
|
|
17025
|
+
Array.isArray(contextEnzymes) ? contextEnzymes : [contextEnzymes]
|
|
16783
17026
|
);
|
|
17027
|
+
const digest = computeDigestFragments(__spreadProps(__spreadValues({
|
|
17028
|
+
cutsites: flatMap(cutsitesByName),
|
|
17029
|
+
sequenceLength: sequence.length,
|
|
17030
|
+
circular
|
|
17031
|
+
}, options), {
|
|
17032
|
+
computePartialDigest: (options == null ? void 0 : options.computePartialDigest) || (options == null ? void 0 : options.computePartialDigests)
|
|
17033
|
+
}));
|
|
17034
|
+
const fragments = uniqBy(digest.fragments, (fragment) => {
|
|
17035
|
+
return `${fragment.start}-${fragment.end}-${fragment.size}`;
|
|
17036
|
+
});
|
|
17037
|
+
if (circular && ((options == null ? void 0 : options.computePartialDigest) || (options == null ? void 0 : options.computePartialDigests))) {
|
|
17038
|
+
const fullLengthFragmentIndex = fragments.findIndex(
|
|
17039
|
+
(f) => f.size === sequence.length
|
|
17040
|
+
);
|
|
17041
|
+
if (fullLengthFragmentIndex > -1) {
|
|
17042
|
+
fragments.splice(fullLengthFragmentIndex, 1);
|
|
17043
|
+
}
|
|
17044
|
+
}
|
|
17045
|
+
return fragments.sort((a, b) => {
|
|
17046
|
+
return a.start - b.start || b.size - a.size;
|
|
17047
|
+
});
|
|
16784
17048
|
}
|
|
16785
17049
|
__name(getDigestFragmentsForRestrictionEnzymes, "getDigestFragmentsForRestrictionEnzymes");
|
|
16786
17050
|
function convertAACaretPositionOrRangeToDna(rangeOrCaret) {
|
|
@@ -16826,11 +17090,13 @@ function shiftAnnotationsByLen({
|
|
|
16826
17090
|
}) {
|
|
16827
17091
|
modifiableTypes.forEach((annotationType) => {
|
|
16828
17092
|
const existingAnnotations = seqData[annotationType];
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
17093
|
+
if (existingAnnotations) {
|
|
17094
|
+
seqData[annotationType] = adjustAnnotationsToInsert(
|
|
17095
|
+
existingAnnotations,
|
|
17096
|
+
caretPosition,
|
|
17097
|
+
insertLength
|
|
17098
|
+
);
|
|
17099
|
+
}
|
|
16834
17100
|
});
|
|
16835
17101
|
}
|
|
16836
17102
|
__name(shiftAnnotationsByLen, "shiftAnnotationsByLen");
|
|
@@ -16900,7 +17166,7 @@ exports.getMassOfAaString = getMassOfAaString;
|
|
|
16900
17166
|
exports.getMergedFeatureMap = getMergedFeatureMap;
|
|
16901
17167
|
exports.getOrfsFromSequence = getOrfsFromSequence;
|
|
16902
17168
|
exports.getOverlapBetweenTwoSequences = getOverlapBetweenTwoSequences;
|
|
16903
|
-
exports.getPossiblePartsFromSequenceAndEnzymes =
|
|
17169
|
+
exports.getPossiblePartsFromSequenceAndEnzymes = getPossiblePartsFromSequenceAndEnzymes;
|
|
16904
17170
|
exports.getReverseAminoAcidStringFromSequenceString = getReverseAminoAcidStringFromSequenceString;
|
|
16905
17171
|
exports.getReverseComplementAminoAcidStringFromSequenceString = getReverseComplementAminoAcidStringFromSequenceString;
|
|
16906
17172
|
exports.getReverseComplementAnnotation = getReverseComplementAnnotation;
|
|
@@ -16927,3 +17193,4 @@ exports.shiftAnnotationsByLen = shiftAnnotationsByLen;
|
|
|
16927
17193
|
exports.threeLetterSequenceStringToAminoAcidMap = threeLetterSequenceStringToAminoAcidMap;
|
|
16928
17194
|
exports.tidyUpAnnotation = tidyUpAnnotation;
|
|
16929
17195
|
exports.tidyUpSequenceData = tidyUpSequenceData;
|
|
17196
|
+
exports.types = types;
|