@teselagen/sequence-utils 0.3.41 → 0.3.42-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DNAComplementMap.d.ts +1 -1
- package/README.md +2 -8
- package/addGapsToSeqReads.d.ts +16 -3
- package/adjustAnnotationsToInsert.d.ts +2 -1
- package/adjustBpsToReplaceOrInsert.d.ts +2 -1
- package/aliasedEnzymesByName.d.ts +37 -1
- package/aminoAcidToDegenerateDnaMap.d.ts +1 -31
- package/aminoAcidToDegenerateRnaMap.d.ts +1 -1
- package/annotateSingleSeq.d.ts +5 -4
- package/annotationTypes.d.ts +2 -2
- package/autoAnnotate.d.ts +17 -8
- package/bioData.d.ts +10 -58
- package/calculateEndStability.d.ts +1 -1
- package/calculateNebTa.d.ts +6 -1
- package/calculateNebTm.d.ts +6 -4
- package/calculatePercentGC.d.ts +1 -1
- package/calculateSantaLuciaTm.d.ts +28 -114
- package/calculateTm.d.ts +13 -1
- package/computeDigestFragments.d.ts +30 -24
- package/condensePairwiseAlignmentDifferences.d.ts +1 -1
- package/convertAACaretPositionOrRangeToDna.d.ts +2 -1
- package/convertDnaCaretPositionOrRangeToAA.d.ts +2 -1
- package/cutSequenceByRestrictionEnzyme.d.ts +2 -1
- package/defaultEnzymesByName.d.ts +2 -1
- package/degenerateDnaToAminoAcidMap.d.ts +1 -1
- package/degenerateRnaToAminoAcidMap.d.ts +1 -1
- package/deleteSequenceDataAtRange.d.ts +2 -1
- package/diffUtils.d.ts +9 -7
- package/doesEnzymeChopOutsideOfRecognitionSite.d.ts +2 -1
- package/featureTypesAndColors.d.ts +19 -6
- package/filterSequenceString.d.ts +14 -10
- package/findApproxMatches.d.ts +7 -1
- package/findNearestRangeOfSequenceOverlapToPosition.d.ts +2 -1
- package/findOrfsInPlasmid.d.ts +2 -11
- package/findSequenceMatches.d.ts +11 -1
- package/generateAnnotations.d.ts +2 -1
- package/generateSequenceData.d.ts +8 -13
- package/getAllInsertionsInSeqReads.d.ts +11 -1
- package/getAminoAcidDataForEachBaseOfDna.d.ts +6 -5
- package/getAminoAcidFromSequenceTriplet.d.ts +1 -1
- package/getAminoAcidStringFromSequenceString.d.ts +3 -1
- package/getCodonRangeForAASliver.d.ts +3 -4
- package/getComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getComplementSequenceAndAnnotations.d.ts +5 -1
- package/getComplementSequenceString.d.ts +1 -1
- package/getCutsiteType.d.ts +2 -1
- package/getCutsitesFromSequence.d.ts +2 -1
- package/getDegenerateDnaStringFromAAString.d.ts +1 -1
- package/getDegenerateRnaStringFromAAString.d.ts +1 -1
- package/getDigestFragmentsForCutsites.d.ts +4 -1
- package/getDigestFragmentsForRestrictionEnzymes.d.ts +8 -1
- package/getInsertBetweenVals.d.ts +2 -1
- package/getLeftAndRightOfSequenceInRangeGivenPosition.d.ts +2 -1
- package/getOrfsFromSequence.d.ts +17 -11
- package/getOverlapBetweenTwoSequences.d.ts +2 -1
- package/getPossiblePartsFromSequenceAndEnzymes.d.ts +18 -1
- package/getReverseAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAnnotation.d.ts +11 -1
- package/getReverseComplementSequenceAndAnnotations.d.ts +5 -1
- package/getReverseComplementSequenceString.d.ts +1 -1
- package/getReverseSequenceString.d.ts +1 -1
- package/getSequenceDataBetweenRange.d.ts +9 -1
- package/getVirtualDigest.d.ts +11 -10
- package/guessIfSequenceIsDnaAndNotProtein.d.ts +5 -1
- package/index.cjs +765 -497
- package/index.d.ts +9 -5
- package/index.js +766 -498
- package/index.umd.cjs +765 -497
- package/insertGapsIntoRefSeq.d.ts +2 -1
- package/insertSequenceDataAtPositionOrRange.d.ts +10 -1
- package/isEnzymeType2S.d.ts +2 -1
- package/mapAnnotationsToRows.d.ts +9 -1
- package/package.json +9 -6
- package/prepareCircularViewData.d.ts +2 -1
- package/prepareRowData.d.ts +7 -3
- package/proteinAlphabet.d.ts +1 -1
- package/rotateBpsToPosition.d.ts +1 -1
- package/rotateSequenceDataToPosition.d.ts +3 -1
- package/shiftAnnotationsByLen.d.ts +4 -3
- package/src/{addGapsToSeqReads.js → addGapsToSeqReads.ts} +33 -14
- package/src/adjustAnnotationsToInsert.ts +22 -0
- package/src/{adjustBpsToReplaceOrInsert.js → adjustBpsToReplaceOrInsert.ts} +31 -8
- package/src/{aliasedEnzymesByName.js → aliasedEnzymesByName.ts} +4 -1
- package/src/{aminoAcidToDegenerateDnaMap.js → aminoAcidToDegenerateDnaMap.ts} +1 -1
- package/src/{annotateSingleSeq.js → annotateSingleSeq.ts} +11 -3
- package/src/autoAnnotate.test.js +0 -1
- package/src/{autoAnnotate.js → autoAnnotate.ts} +69 -24
- package/src/{bioData.js → bioData.ts} +2 -2
- package/src/{calculateEndStability.js → calculateEndStability.ts} +21 -16
- package/src/{calculateNebTa.js → calculateNebTa.ts} +20 -8
- package/src/{calculateNebTm.js → calculateNebTm.ts} +15 -9
- package/src/{calculatePercentGC.js → calculatePercentGC.ts} +1 -1
- package/src/{calculateSantaLuciaTm.js → calculateSantaLuciaTm.ts} +29 -22
- package/src/{calculateTm.js → calculateTm.ts} +50 -59
- package/src/{computeDigestFragments.js → computeDigestFragments.ts} +92 -36
- package/src/{condensePairwiseAlignmentDifferences.js → condensePairwiseAlignmentDifferences.ts} +4 -4
- package/src/{convertAACaretPositionOrRangeToDna.js → convertAACaretPositionOrRangeToDna.ts} +8 -4
- package/src/{convertDnaCaretPositionOrRangeToAA.js → convertDnaCaretPositionOrRangeToAA.ts} +8 -4
- package/src/cutSequenceByRestrictionEnzyme.ts +345 -0
- package/src/{defaultEnzymesByName.js → defaultEnzymesByName.ts} +2 -1
- package/src/deleteSequenceDataAtRange.ts +13 -0
- package/src/diffUtils.ts +80 -0
- package/src/doesEnzymeChopOutsideOfRecognitionSite.ts +16 -0
- package/src/{featureTypesAndColors.js → featureTypesAndColors.ts} +29 -14
- package/src/{filterSequenceString.js → filterSequenceString.ts} +51 -21
- package/src/{findApproxMatches.js → findApproxMatches.ts} +14 -6
- package/src/{findNearestRangeOfSequenceOverlapToPosition.js → findNearestRangeOfSequenceOverlapToPosition.ts} +13 -9
- package/src/{findOrfsInPlasmid.js → findOrfsInPlasmid.ts} +8 -7
- package/src/{findSequenceMatches.js → findSequenceMatches.ts} +31 -13
- package/src/{generateAnnotations.js → generateAnnotations.ts} +14 -9
- package/src/{generateSequenceData.js → generateSequenceData.ts} +19 -13
- package/src/{getAllInsertionsInSeqReads.js → getAllInsertionsInSeqReads.ts} +19 -2
- package/src/{getAminoAcidDataForEachBaseOfDna.js → getAminoAcidDataForEachBaseOfDna.ts} +36 -30
- package/src/{getAminoAcidFromSequenceTriplet.js → getAminoAcidFromSequenceTriplet.ts} +9 -4
- package/src/{getAminoAcidStringFromSequenceString.js → getAminoAcidStringFromSequenceString.ts} +14 -7
- package/src/{getCodonRangeForAASliver.js → getCodonRangeForAASliver.ts} +16 -6
- package/src/{getComplementAminoAcidStringFromSequenceString.js → getComplementAminoAcidStringFromSequenceString.ts} +5 -3
- package/src/{getComplementSequenceAndAnnotations.js → getComplementSequenceAndAnnotations.ts} +8 -6
- package/src/{getComplementSequenceString.js → getComplementSequenceString.ts} +5 -2
- package/src/getCutsiteType.ts +18 -0
- package/src/getCutsitesFromSequence.ts +22 -0
- package/src/getDegenerateDnaStringFromAAString.ts +15 -0
- package/src/getDegenerateRnaStringFromAAString.ts +15 -0
- package/src/{getDigestFragmentsForCutsites.js → getDigestFragmentsForCutsites.ts} +32 -14
- package/src/getDigestFragmentsForRestrictionEnzymes.ts +50 -0
- package/src/{getInsertBetweenVals.js → getInsertBetweenVals.ts} +8 -5
- package/src/{getLeftAndRightOfSequenceInRangeGivenPosition.js → getLeftAndRightOfSequenceInRangeGivenPosition.ts} +11 -10
- package/src/{getMassOfAaString.js → getMassOfAaString.ts} +4 -2
- package/src/{getOrfsFromSequence.js → getOrfsFromSequence.ts} +27 -7
- package/src/{getOverlapBetweenTwoSequences.js → getOverlapBetweenTwoSequences.ts} +4 -4
- package/src/{getPossiblePartsFromSequenceAndEnzymes.js → getPossiblePartsFromSequenceAndEnzymes.ts} +52 -25
- package/src/{getReverseAminoAcidStringFromSequenceString.js → getReverseAminoAcidStringFromSequenceString.ts} +4 -2
- package/src/{getReverseComplementAminoAcidStringFromSequenceString.js → getReverseComplementAminoAcidStringFromSequenceString.ts} +2 -2
- package/src/{getReverseComplementAnnotation.js → getReverseComplementAnnotation.ts} +4 -2
- package/src/getReverseComplementSequenceAndAnnotations.ts +45 -0
- package/src/{getReverseComplementSequenceString.js → getReverseComplementSequenceString.ts} +4 -4
- package/src/{getReverseSequenceString.js → getReverseSequenceString.ts} +1 -1
- package/src/getSequenceDataBetweenRange.test.js +6 -3
- package/src/{getSequenceDataBetweenRange.js → getSequenceDataBetweenRange.ts} +44 -29
- package/src/{getVirtualDigest.js → getVirtualDigest.ts} +20 -9
- package/src/{guessIfSequenceIsDnaAndNotProtein.js → guessIfSequenceIsDnaAndNotProtein.ts} +11 -5
- package/src/{index.test.js → index.test.ts} +9 -5
- package/src/{index.js → index.ts} +1 -0
- package/src/{insertGapsIntoRefSeq.js → insertGapsIntoRefSeq.ts} +7 -2
- package/src/{insertSequenceDataAtPositionOrRange.js → insertSequenceDataAtPositionOrRange.ts} +130 -56
- package/src/isEnzymeType2S.ts +8 -0
- package/src/mapAnnotationsToRows.ts +256 -0
- package/src/prepareCircularViewData.ts +24 -0
- package/src/{prepareRowData.js → prepareRowData.ts} +27 -8
- package/src/prepareRowData_output1.json +1 -0
- package/src/rotateBpsToPosition.ts +12 -0
- package/src/{rotateSequenceDataToPosition.js → rotateSequenceDataToPosition.ts} +11 -8
- package/src/shiftAnnotationsByLen.ts +24 -0
- package/src/{threeLetterSequenceStringToAminoAcidMap.js → threeLetterSequenceStringToAminoAcidMap.ts} +29 -9
- package/src/{tidyUpAnnotation.js → tidyUpAnnotation.ts} +40 -18
- package/src/{tidyUpSequenceData.js → tidyUpSequenceData.ts} +83 -39
- package/src/types.ts +99 -0
- package/threeLetterSequenceStringToAminoAcidMap.d.ts +11 -921
- package/tidyUpAnnotation.d.ts +13 -11
- package/tidyUpSequenceData.d.ts +18 -1
- package/types.d.ts +97 -0
- package/addGapsToSeqReads.test.d.ts +0 -1
- package/adjustBpsToReplaceOrInsert.test.d.ts +0 -1
- package/aminoAcidToDnaRna.test.d.ts +0 -1
- package/annotateSingleSeq.test.d.ts +0 -1
- package/autoAnnotate.test.d.ts +0 -1
- package/calculateEndStability.test.d.ts +0 -1
- package/calculateNebTa.test.d.ts +0 -1
- package/calculateNebTm.test.d.ts +0 -1
- package/calculatePercentGC.test.d.ts +0 -1
- package/calculateSantaLuciaTm.test.d.ts +0 -1
- package/calculateTm.test.d.ts +0 -1
- package/computeDigestFragments.test.d.ts +0 -1
- package/condensePairwiseAlignmentDifferences.test.d.ts +0 -1
- package/convertAACaretPositionOrRangeToDna.test.d.ts +0 -1
- package/convertDnaCaretPositionOrRangeToAA.test.d.ts +0 -1
- package/cutSequenceByRestrictionEnzyme.test.d.ts +0 -1
- package/deleteSequenceDataAtRange.test.d.ts +0 -1
- package/diffUtils.test.d.ts +0 -1
- package/doesEnzymeChopOutsideOfRecognitionSite.test.d.ts +0 -1
- package/featureTypesAndColors.test.d.ts +0 -1
- package/filterSequenceString.test.d.ts +0 -1
- package/findApproxMatches.test.d.ts +0 -1
- package/findNearestRangeOfSequenceOverlapToPosition.test.d.ts +0 -1
- package/findSequenceMatches.test.d.ts +0 -1
- package/generateSequenceData.test.d.ts +0 -1
- package/getAllInsertionsInSeqReads.test.d.ts +0 -1
- package/getAminoAcidDataForEachBaseOfDna.test.d.ts +0 -1
- package/getAminoAcidStringFromSequenceString.test.d.ts +0 -1
- package/getComplementSequenceString.test.d.ts +0 -1
- package/getDigestFragmentsForRestrictionEnzymes.test.d.ts +0 -1
- package/getInsertBetweenVals.test.d.ts +0 -1
- package/getLeftAndRightOfSequenceInRangeGivenPosition.test.d.ts +0 -1
- package/getMassofAaString.test.d.ts +0 -1
- package/getOrfsFromSequence.test.d.ts +0 -1
- package/getOverlapBetweenTwoSequences.test.d.ts +0 -1
- package/getPossiblePartsFromSequenceAndEnzymes.test.d.ts +0 -1
- package/getReverseAminoAcidStringFromSequenceString.test.d.ts +0 -1
- package/getReverseComplementAnnotation.test.d.ts +0 -1
- package/getReverseComplementSequenceAndAnnotations.test.d.ts +0 -1
- package/getReverseComplementSequenceString.test.d.ts +0 -1
- package/getReverseSequenceString.test.d.ts +0 -1
- package/getSequenceDataBetweenRange.test.d.ts +0 -1
- package/getVirtualDigest.test.d.ts +0 -1
- package/guessIfSequenceIsDnaAndNotProtein.test.d.ts +0 -1
- package/index.test.d.ts +0 -1
- package/insertGapsIntoRefSeq.test.d.ts +0 -1
- package/insertSequenceDataAtPosition.test.d.ts +0 -1
- package/insertSequenceDataAtPositionOrRange.test.d.ts +0 -1
- package/mapAnnotationsToRows.test.d.ts +0 -1
- package/prepareCircularViewData.test.d.ts +0 -1
- package/prepareRowData.test.d.ts +0 -1
- package/rotateBpsToPosition.test.d.ts +0 -1
- package/rotateSequenceDataToPosition.test.d.ts +0 -1
- package/src/adjustAnnotationsToInsert.js +0 -19
- package/src/cutSequenceByRestrictionEnzyme.js +0 -301
- package/src/deleteSequenceDataAtRange.js +0 -5
- package/src/diffUtils.js +0 -63
- package/src/doesEnzymeChopOutsideOfRecognitionSite.js +0 -10
- package/src/getCutsiteType.js +0 -10
- package/src/getCutsitesFromSequence.js +0 -17
- package/src/getDegenerateDnaStringFromAAString.js +0 -8
- package/src/getDegenerateRnaStringFromAAString.js +0 -8
- package/src/getDigestFragmentsForRestrictionEnzymes.js +0 -27
- package/src/getReverseComplementSequenceAndAnnotations.js +0 -40
- package/src/isEnzymeType2S.js +0 -3
- package/src/mapAnnotationsToRows.js +0 -174
- package/src/prepareCircularViewData.js +0 -17
- package/src/rotateBpsToPosition.js +0 -9
- package/src/shiftAnnotationsByLen.js +0 -17
- package/tidyUpSequenceData.test.d.ts +0 -1
- /package/src/{DNAComplementMap.js → DNAComplementMap.ts} +0 -0
- /package/src/{aminoAcidToDegenerateRnaMap.js → aminoAcidToDegenerateRnaMap.ts} +0 -0
- /package/src/{annotationTypes.js → annotationTypes.ts} +0 -0
- /package/src/{degenerateDnaToAminoAcidMap.js → degenerateDnaToAminoAcidMap.ts} +0 -0
- /package/src/{degenerateRnaToAminoAcidMap.js → degenerateRnaToAminoAcidMap.ts} +0 -0
- /package/src/{insertSequenceDataAtPosition.js → insertSequenceDataAtPosition.ts} +0 -0
- /package/src/{proteinAlphabet.js → proteinAlphabet.ts} +0 -0
package/src/diffUtils.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { cloneDeep, forEach } from "lodash-es";
|
|
2
|
-
import { diff, patch, reverse } from "jsondiffpatch";
|
|
3
|
-
|
|
4
|
-
import tidyUpSequenceData from "./tidyUpSequenceData";
|
|
5
|
-
|
|
6
|
-
const getDiffFromSeqs = (oldData, newData, { ignoreKeys = [] } = {}) => {
|
|
7
|
-
oldData = tidyUpSequenceData(oldData, {
|
|
8
|
-
annotationsAsObjects: true,
|
|
9
|
-
noTranslationData: true,
|
|
10
|
-
doNotRemoveInvalidChars: true
|
|
11
|
-
});
|
|
12
|
-
newData = tidyUpSequenceData(newData, {
|
|
13
|
-
annotationsAsObjects: true,
|
|
14
|
-
noTranslationData: true,
|
|
15
|
-
doNotRemoveInvalidChars: true
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
[oldData, newData].forEach(d => {
|
|
19
|
-
[
|
|
20
|
-
"cutsites",
|
|
21
|
-
"orfs",
|
|
22
|
-
"filteredFeatures",
|
|
23
|
-
"size",
|
|
24
|
-
"fromFileUpload",
|
|
25
|
-
"description",
|
|
26
|
-
"materiallyAvailable",
|
|
27
|
-
...ignoreKeys
|
|
28
|
-
].forEach(prop => {
|
|
29
|
-
delete d[prop];
|
|
30
|
-
});
|
|
31
|
-
if (d.translations) {
|
|
32
|
-
forEach(d.translations, (translation, key) => {
|
|
33
|
-
if (
|
|
34
|
-
translation.translationType &&
|
|
35
|
-
translation.translationType !== "User Created"
|
|
36
|
-
) {
|
|
37
|
-
delete d.translations[key];
|
|
38
|
-
} else {
|
|
39
|
-
delete translation.aminoAcids;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return diff(oldData, newData);
|
|
46
|
-
};
|
|
47
|
-
const patchSeqWithDiff = (oldData, diff, { ignoreKeys = [] } = {}) => {
|
|
48
|
-
ignoreKeys.forEach(k => {
|
|
49
|
-
delete diff[k];
|
|
50
|
-
});
|
|
51
|
-
return patch(
|
|
52
|
-
tidyUpSequenceData(cloneDeep(oldData), {
|
|
53
|
-
annotationsAsObjects: true,
|
|
54
|
-
doNotRemoveInvalidChars: true
|
|
55
|
-
}),
|
|
56
|
-
diff
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
const reverseSeqDiff = diff => {
|
|
60
|
-
return reverse(diff);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export { getDiffFromSeqs, patchSeqWithDiff, reverseSeqDiff };
|
package/src/getCutsiteType.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default function getCutsiteType(restrictionEnzyme) {
|
|
2
|
-
const { topSnipOffset, bottomSnipOffset } = restrictionEnzyme;
|
|
3
|
-
if (topSnipOffset === bottomSnipOffset) {
|
|
4
|
-
return "blunt";
|
|
5
|
-
} else if (topSnipOffset < bottomSnipOffset) {
|
|
6
|
-
return "5' overhang";
|
|
7
|
-
} else {
|
|
8
|
-
return "3' overhang";
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import cutSequenceByRestrictionEnzyme from "./cutSequenceByRestrictionEnzyme";
|
|
2
|
-
|
|
3
|
-
export default function getCutsitesFromSequence(
|
|
4
|
-
sequence,
|
|
5
|
-
circular,
|
|
6
|
-
restrictionEnzymes
|
|
7
|
-
) {
|
|
8
|
-
const cutsitesByName = {};
|
|
9
|
-
for (let i = 0; i < restrictionEnzymes.length; i++) {
|
|
10
|
-
const re = restrictionEnzymes[i];
|
|
11
|
-
const cutsites = cutSequenceByRestrictionEnzyme(sequence, circular, re);
|
|
12
|
-
if (cutsites.length) {
|
|
13
|
-
cutsitesByName[re.name] = cutsites;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return cutsitesByName;
|
|
17
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import aminoAcidToDegenerateDnaMap from "./aminoAcidToDegenerateDnaMap";
|
|
2
|
-
|
|
3
|
-
export default function getDegenerateDnaStringFromAAString(aaString) {
|
|
4
|
-
return aaString
|
|
5
|
-
.split("")
|
|
6
|
-
.map(char => aminoAcidToDegenerateDnaMap[char.toLowerCase()] || "nnn")
|
|
7
|
-
.join("");
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import aminoAcidToDegenerateRnaMap from "./aminoAcidToDegenerateRnaMap";
|
|
2
|
-
|
|
3
|
-
export default function getDegenerateRnaStringFromAAString(aaString) {
|
|
4
|
-
return aaString
|
|
5
|
-
.split("")
|
|
6
|
-
.map(char => aminoAcidToDegenerateRnaMap[char.toLowerCase()] || "nnn")
|
|
7
|
-
.join("");
|
|
8
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import getDigestFragmentsForCutsites from "./getDigestFragmentsForCutsites";
|
|
2
|
-
import cutSequenceByRestrictionEnzyme from "./cutSequenceByRestrictionEnzyme";
|
|
3
|
-
import { flatMap } from "lodash-es";
|
|
4
|
-
|
|
5
|
-
export default function getDigestFragmentsForRestrictionEnzymes(
|
|
6
|
-
sequence,
|
|
7
|
-
circular,
|
|
8
|
-
restrictionEnzymeOrEnzymes,
|
|
9
|
-
opts
|
|
10
|
-
) {
|
|
11
|
-
const restrictionEnzymes = Array.isArray(restrictionEnzymeOrEnzymes)
|
|
12
|
-
? restrictionEnzymeOrEnzymes
|
|
13
|
-
: [restrictionEnzymeOrEnzymes];
|
|
14
|
-
const cutsites = flatMap(restrictionEnzymes, restrictionEnzyme => {
|
|
15
|
-
return cutSequenceByRestrictionEnzyme(
|
|
16
|
-
sequence,
|
|
17
|
-
circular,
|
|
18
|
-
restrictionEnzyme
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
return getDigestFragmentsForCutsites(
|
|
22
|
-
sequence.length,
|
|
23
|
-
circular,
|
|
24
|
-
cutsites,
|
|
25
|
-
opts
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import getReverseComplementSequenceString from "./getReverseComplementSequenceString";
|
|
2
|
-
import getReverseComplementAnnotation from "./getReverseComplementAnnotation";
|
|
3
|
-
import { annotationTypes } from "./annotationTypes";
|
|
4
|
-
import { map } from "lodash-es";
|
|
5
|
-
import tidyUpSequenceData from "./tidyUpSequenceData";
|
|
6
|
-
|
|
7
|
-
import getSequenceDataBetweenRange from "./getSequenceDataBetweenRange";
|
|
8
|
-
|
|
9
|
-
// ac.throw([ac.string,ac.bool],arguments);
|
|
10
|
-
export default function getReverseComplementSequenceAndAnnoations(
|
|
11
|
-
pSeqObj,
|
|
12
|
-
options = {}
|
|
13
|
-
) {
|
|
14
|
-
const seqObj = tidyUpSequenceData(
|
|
15
|
-
getSequenceDataBetweenRange(pSeqObj, options.range),
|
|
16
|
-
{ doNotRemoveInvalidChars: true, ...options }
|
|
17
|
-
);
|
|
18
|
-
const newSeqObj = Object.assign(
|
|
19
|
-
{},
|
|
20
|
-
seqObj,
|
|
21
|
-
{
|
|
22
|
-
sequence: getReverseComplementSequenceString(seqObj.sequence)
|
|
23
|
-
},
|
|
24
|
-
annotationTypes.reduce((acc, type) => {
|
|
25
|
-
if (seqObj[type]) {
|
|
26
|
-
acc[type] = map(seqObj[type], annotation => {
|
|
27
|
-
return getReverseComplementAnnotation(
|
|
28
|
-
annotation,
|
|
29
|
-
seqObj.sequence.length
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return acc;
|
|
34
|
-
}, {})
|
|
35
|
-
);
|
|
36
|
-
return tidyUpSequenceData(newSeqObj, {
|
|
37
|
-
doNotRemoveInvalidChars: true,
|
|
38
|
-
...options
|
|
39
|
-
});
|
|
40
|
-
}
|
package/src/isEnzymeType2S.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { each, forEach, startsWith, filter } from "lodash-es";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getYOffsetForPotentiallyCircularRange,
|
|
5
|
-
splitRangeIntoTwoPartsIfItIsCircular
|
|
6
|
-
} from "@teselagen/range-utils";
|
|
7
|
-
|
|
8
|
-
export default function mapAnnotationsToRows(
|
|
9
|
-
annotations,
|
|
10
|
-
sequenceLength,
|
|
11
|
-
bpsPerRow,
|
|
12
|
-
{ splitForwardReverse } = {}
|
|
13
|
-
) {
|
|
14
|
-
const annotationsToRowsMap = {};
|
|
15
|
-
const yOffsetLevelMap = {};
|
|
16
|
-
const wrappedAnnotations = {};
|
|
17
|
-
each(annotations, annotation => {
|
|
18
|
-
const containsLocations = !!(
|
|
19
|
-
annotation.locations && annotation.locations.length
|
|
20
|
-
);
|
|
21
|
-
if (annotation.overlapsSelf) {
|
|
22
|
-
//if the annotation overlaps itself, first send a fake full spanning annotation thru the mapping function
|
|
23
|
-
if (!wrappedAnnotations[annotation.id]) {
|
|
24
|
-
mapAnnotationToRows({
|
|
25
|
-
wrappedAnnotations,
|
|
26
|
-
annotation: {
|
|
27
|
-
start: 0,
|
|
28
|
-
end: sequenceLength - 1,
|
|
29
|
-
id: `__tempAnnRemoveMe__${annotation.id}`
|
|
30
|
-
},
|
|
31
|
-
sequenceLength,
|
|
32
|
-
bpsPerRow,
|
|
33
|
-
annotationsToRowsMap,
|
|
34
|
-
yOffsetLevelMap,
|
|
35
|
-
containsLocations,
|
|
36
|
-
splitForwardReverse
|
|
37
|
-
});
|
|
38
|
-
wrappedAnnotations[annotation.id] = true;
|
|
39
|
-
// annotation.yOffset = wrappedAnnotations[annotation.id];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
mapAnnotationToRows({
|
|
44
|
-
wrappedAnnotations,
|
|
45
|
-
annotation,
|
|
46
|
-
sequenceLength,
|
|
47
|
-
bpsPerRow,
|
|
48
|
-
annotationsToRowsMap,
|
|
49
|
-
yOffsetLevelMap,
|
|
50
|
-
containsLocations,
|
|
51
|
-
splitForwardReverse
|
|
52
|
-
});
|
|
53
|
-
if (containsLocations) {
|
|
54
|
-
annotation.locations.forEach(location => {
|
|
55
|
-
mapAnnotationToRows({
|
|
56
|
-
wrappedAnnotations,
|
|
57
|
-
annotation,
|
|
58
|
-
sequenceLength,
|
|
59
|
-
bpsPerRow,
|
|
60
|
-
annotationsToRowsMap,
|
|
61
|
-
yOffsetLevelMap,
|
|
62
|
-
location,
|
|
63
|
-
splitForwardReverse
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
forEach(annotationsToRowsMap, (annotationsForRow, i) => {
|
|
69
|
-
annotationsToRowsMap[i] = filter(
|
|
70
|
-
annotationsForRow,
|
|
71
|
-
ann => !startsWith(ann.id, "__tempAnnRemoveMe__")
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
return annotationsToRowsMap;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function mapAnnotationToRows({
|
|
78
|
-
annotation,
|
|
79
|
-
sequenceLength,
|
|
80
|
-
bpsPerRow,
|
|
81
|
-
annotationsToRowsMap,
|
|
82
|
-
yOffsetLevelMap,
|
|
83
|
-
location,
|
|
84
|
-
containsLocations,
|
|
85
|
-
splitForwardReverse
|
|
86
|
-
}) {
|
|
87
|
-
const ranges = splitRangeIntoTwoPartsIfItIsCircular(
|
|
88
|
-
location || annotation,
|
|
89
|
-
sequenceLength
|
|
90
|
-
);
|
|
91
|
-
ranges.forEach((range, index) => {
|
|
92
|
-
// if (!isPositiveInteger(range.start)) {}
|
|
93
|
-
const startingRow = Math.floor(range.start / bpsPerRow);
|
|
94
|
-
const endingRow = Math.floor(range.end / bpsPerRow);
|
|
95
|
-
// const numberOfRows = endingRow - startingRow + 1;
|
|
96
|
-
for (let rowNumber = startingRow; rowNumber <= endingRow; rowNumber++) {
|
|
97
|
-
if (!annotationsToRowsMap[rowNumber]) {
|
|
98
|
-
annotationsToRowsMap[rowNumber] = [];
|
|
99
|
-
}
|
|
100
|
-
const key = splitForwardReverse
|
|
101
|
-
? annotation.forward
|
|
102
|
-
? rowNumber + "_forward"
|
|
103
|
-
: rowNumber + "_reverse"
|
|
104
|
-
: rowNumber;
|
|
105
|
-
|
|
106
|
-
const annotationsForRow = annotationsToRowsMap[rowNumber];
|
|
107
|
-
if (!yOffsetLevelMap[key]) {
|
|
108
|
-
yOffsetLevelMap[key] = [];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
let yOffset;
|
|
112
|
-
const yOffsetsForRow = yOffsetLevelMap[key];
|
|
113
|
-
const start =
|
|
114
|
-
rowNumber === startingRow ? range.start : rowNumber * bpsPerRow;
|
|
115
|
-
const end =
|
|
116
|
-
rowNumber === endingRow
|
|
117
|
-
? range.end
|
|
118
|
-
: rowNumber * bpsPerRow + bpsPerRow - 1;
|
|
119
|
-
if (annotation.overlapsSelf) {
|
|
120
|
-
annotationsForRow.forEach(ann => {
|
|
121
|
-
if (ann.id === `__tempAnnRemoveMe__${annotation.id}`) {
|
|
122
|
-
yOffset = ann.yOffset;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
} else {
|
|
126
|
-
if (location) {
|
|
127
|
-
//if there's a location then we will just use the previous yOffset for its parent annotation
|
|
128
|
-
annotationsForRow.forEach(ann => {
|
|
129
|
-
if (ann.id === annotation.id) {
|
|
130
|
-
yOffset = ann.yOffset;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
} else {
|
|
134
|
-
//we need to pass both ranges into this function so that we can correctly
|
|
135
|
-
//get the y-offset for circular features that start and end on the same row
|
|
136
|
-
//we pass the entire annotation range here and compare it only with ranges that have already been added to the row
|
|
137
|
-
if (
|
|
138
|
-
index > 0 && //second half of an annotation range
|
|
139
|
-
annotationsForRow.length && //there are already annotations within the row
|
|
140
|
-
annotationsForRow[annotationsForRow.length - 1].annotation ===
|
|
141
|
-
annotation
|
|
142
|
-
) {
|
|
143
|
-
//the first chunk of the annotation has already been pushed into the row,
|
|
144
|
-
//so set the yOffset for the range chunk to the already calculated yOffset
|
|
145
|
-
yOffset = annotationsForRow[annotationsForRow.length - 1].yOffset;
|
|
146
|
-
} else {
|
|
147
|
-
yOffset = getYOffsetForPotentiallyCircularRange(
|
|
148
|
-
annotation,
|
|
149
|
-
yOffsetsForRow
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
//add the new yOffset to the yOffset array
|
|
153
|
-
if (!yOffsetsForRow[yOffset]) yOffsetsForRow[yOffset] = [];
|
|
154
|
-
yOffsetsForRow[yOffset].push({
|
|
155
|
-
start: start,
|
|
156
|
-
end: end
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
annotationsForRow.push({
|
|
162
|
-
id: annotation.id,
|
|
163
|
-
annotation: annotation,
|
|
164
|
-
start: start,
|
|
165
|
-
end: end,
|
|
166
|
-
...(containsLocations && { containsLocations }),
|
|
167
|
-
...(location && { isJoinedLocation: !!location }),
|
|
168
|
-
yOffset: yOffset,
|
|
169
|
-
enclosingRangeType: range.type //either "beginning", "end" or "beginningAndEnd"
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
// return annotationsToRowsMap;
|
|
174
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { cloneDeep } from "lodash-es";
|
|
2
|
-
import { getYOffsetsForPotentiallyCircularRanges } from "@teselagen/range-utils";
|
|
3
|
-
import { annotationTypes } from "./annotationTypes";
|
|
4
|
-
|
|
5
|
-
//basically just adds yOffsets to the annotations
|
|
6
|
-
export default function prepareCircularViewData(sequenceData) {
|
|
7
|
-
const clonedSeqData = cloneDeep(sequenceData);
|
|
8
|
-
annotationTypes.forEach(annotationType => {
|
|
9
|
-
if (annotationType !== "cutsites") {
|
|
10
|
-
const maxYOffset = getYOffsetsForPotentiallyCircularRanges(
|
|
11
|
-
clonedSeqData[annotationType]
|
|
12
|
-
).maxYOffset;
|
|
13
|
-
clonedSeqData[annotationType].maxYOffset = maxYOffset;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return clonedSeqData;
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default function rotateBpsToPosition(bps, caretPosition) {
|
|
2
|
-
return arrayRotate(bps.split(""), caretPosition).join("");
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function arrayRotate(arr, count) {
|
|
6
|
-
count -= arr.length * Math.floor(count / arr.length);
|
|
7
|
-
arr.push.apply(arr, arr.splice(0, count));
|
|
8
|
-
return arr;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { modifiableTypes } from "./annotationTypes";
|
|
2
|
-
import adjustAnnotationsToInsert from "./adjustAnnotationsToInsert";
|
|
3
|
-
|
|
4
|
-
export default function shiftAnnotationsByLen({
|
|
5
|
-
seqData,
|
|
6
|
-
caretPosition,
|
|
7
|
-
insertLength
|
|
8
|
-
}) {
|
|
9
|
-
modifiableTypes.forEach(annotationType => {
|
|
10
|
-
const existingAnnotations = seqData[annotationType];
|
|
11
|
-
seqData[annotationType] = adjustAnnotationsToInsert(
|
|
12
|
-
existingAnnotations,
|
|
13
|
-
caretPosition,
|
|
14
|
-
insertLength
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|