@teselagen/sequence-utils 0.3.7 → 0.3.9
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/README.md +89 -0
- package/bioData.d.ts +1 -339
- package/filterSequenceString.d.ts +26 -1
- package/index.d.ts +7 -8
- package/index.js +329 -413
- package/index.mjs +329 -413
- package/index.umd.js +329 -413
- package/package.json +1 -2
- package/src/addGapsToSeqReads.js +2 -2
- package/src/adjustAnnotationsToInsert.js +3 -3
- package/src/adjustBpsToReplaceOrInsert.js +3 -3
- package/src/adjustBpsToReplaceOrInsert.test.js +0 -1
- package/src/aminoAcidToDnaRna.test.js +1 -1
- package/src/annotateSingleSeq.js +1 -1
- package/src/annotateSingleSeq.test.js +1 -4
- package/src/autoAnnotate.js +5 -2
- package/src/autoAnnotate.test.js +6 -30
- package/src/bioData.js +1 -366
- package/src/calculateNebTa.js +1 -1
- package/src/calculateNebTm.js +1 -1
- package/src/calculatePercentGC.js +2 -2
- package/src/calculateTm.js +19 -102
- package/src/computeDigestFragments.js +7 -4
- package/src/computeDigestFragments.test.js +1 -1
- package/src/condensePairwiseAlignmentDifferences.js +1 -1
- package/src/convertAACaretPositionOrRangeToDna.js +1 -1
- package/src/convertDnaCaretPositionOrRangeToAA.js +1 -1
- package/src/cutSequenceByRestrictionEnzyme.js +3 -3
- package/src/cutSequenceByRestrictionEnzyme.test.js +0 -1
- package/src/degenerateDnaToAminoAcidMap.js +1 -1
- package/src/degenerateRnaToAminoAcidMap.js +1 -1
- package/src/deleteSequenceDataAtRange.js +1 -1
- package/src/deleteSequenceDataAtRange.test.js +23 -9
- package/src/diffUtils.js +4 -4
- package/src/diffUtils.test.js +2 -2
- package/src/doesEnzymeChopOutsideOfRecognitionSite.js +1 -1
- package/src/doesEnzymeChopOutsideOfRecognitionSite.test.js +0 -2
- package/src/featureTypesAndColors.js +5 -5
- package/src/featureTypesAndColors.test.js +1 -1
- package/src/filterSequenceString.js +111 -16
- package/src/filterSequenceString.test.js +62 -3
- package/src/findNearestRangeOfSequenceOverlapToPosition.js +1 -1
- package/src/findOrfsInPlasmid.js +1 -1
- package/src/findSequenceMatches.js +9 -10
- package/src/generateAnnotations.js +1 -1
- package/src/generateSequenceData.js +1 -1
- package/src/generateSequenceData.test.js +1 -1
- package/src/getAllInsertionsInSeqReads.js +1 -1
- package/src/getAminoAcidDataForEachBaseOfDna.js +2 -2
- package/src/getAminoAcidDataForEachBaseOfDna.test.js +0 -2
- package/src/getAminoAcidFromSequenceTriplet.js +1 -1
- package/src/getAminoAcidStringFromSequenceString.js +1 -1
- package/src/getCodonRangeForAASliver.js +1 -1
- package/src/getComplementAminoAcidStringFromSequenceString.js +2 -5
- package/src/getComplementSequenceAndAnnotations.js +1 -2
- package/src/getComplementSequenceString.js +5 -3
- package/src/getComplementSequenceString.test.js +6 -6
- package/src/getCutsiteType.js +1 -1
- package/src/getCutsitesFromSequence.js +1 -1
- package/src/getDegenerateDnaStringFromAAString.js +1 -1
- package/src/getDegenerateRnaStringFromAAString.js +1 -1
- package/src/getDigestFragmentsForCutsites.js +5 -2
- package/src/getDigestFragmentsForRestrictionEnzymes.js +2 -2
- package/src/getInsertBetweenVals.js +2 -2
- package/src/getLeftAndRightOfSequenceInRangeGivenPosition.js +2 -2
- package/src/getLeftAndRightOfSequenceInRangeGivenPosition.test.js +0 -2
- package/src/getMassOfAaString.js +4 -1
- package/src/getMassofAaString.test.js +9 -8
- package/src/getOrfsFromSequence.js +1 -2
- package/src/getOrfsFromSequence.test.js +1 -3
- package/src/getOverlapBetweenTwoSequences.js +3 -3
- package/src/getOverlapBetweenTwoSequences.test.js +1 -1
- package/src/getPossiblePartsFromSequenceAndEnzymes.js +2 -2
- package/src/getReverseAminoAcidStringFromSequenceString.js +1 -1
- package/src/getReverseComplementAminoAcidStringFromSequenceString.js +9 -6
- package/src/getReverseComplementAnnotation.js +1 -1
- package/src/getReverseComplementSequenceAndAnnotations.js +2 -3
- package/src/getReverseComplementSequenceString.js +1 -2
- package/src/getReverseSequenceString.js +1 -1
- package/src/getSequenceDataBetweenRange.js +7 -4
- package/src/getSequenceDataBetweenRange.test.js +0 -1
- package/src/getVirtualDigest.js +6 -3
- package/src/guessIfSequenceIsDnaAndNotProtein.js +2 -2
- package/src/index.js +79 -80
- package/src/index.test.js +5 -4
- package/src/insertGapsIntoRefSeq.js +1 -1
- package/src/insertSequenceDataAtPosition.test.js +4 -2
- package/src/insertSequenceDataAtPositionOrRange.js +5 -5
- package/src/insertSequenceDataAtPositionOrRange.test.js +3 -17
- package/src/isEnzymeType2S.js +1 -1
- package/src/mapAnnotationsToRows.js +3 -3
- package/src/mapAnnotationsToRows.test.js +1 -3
- package/src/prepareCircularViewData.js +5 -5
- package/src/prepareCircularViewData.test.js +1 -1
- package/src/prepareRowData.js +1 -2
- package/src/prepareRowData.test.js +1 -3
- package/src/prepareRowData_output1.json +381 -381
- package/src/proteinAlphabet.js +31 -26
- package/src/rotateBpsToPosition.js +7 -11
- package/src/rotateBpsToPosition.test.js +6 -6
- package/src/rotateSequenceDataToPosition.js +4 -4
- package/src/shiftAnnotationsByLen.js +2 -2
- package/src/tidyUpAnnotation.js +8 -7
- package/src/tidyUpSequenceData.js +15 -18
- package/filterAminoAcidSequenceString.d.ts +0 -1
- package/filterAminoAcidSequenceString.test.d.ts +0 -1
- package/src/filterAminoAcidSequenceString.js +0 -13
- package/src/filterAminoAcidSequenceString.test.js +0 -22
package/src/proteinAlphabet.js
CHANGED
|
@@ -6,7 +6,7 @@ const proteinAlphabet = {
|
|
|
6
6
|
hydrophobicity: 1.8,
|
|
7
7
|
colorByFamily: "#00FFFF",
|
|
8
8
|
color: "hsl(327.3, 100%, 69%)",
|
|
9
|
-
mass:
|
|
9
|
+
mass: 71.0779
|
|
10
10
|
},
|
|
11
11
|
R: {
|
|
12
12
|
value: "R",
|
|
@@ -15,8 +15,9 @@ const proteinAlphabet = {
|
|
|
15
15
|
hydrophobicity: -4.5,
|
|
16
16
|
colorByFamily: "#FFC0CB",
|
|
17
17
|
color: "hsl(258.1, 100%, 69%)",
|
|
18
|
-
mass:
|
|
18
|
+
mass: 156.18568
|
|
19
19
|
},
|
|
20
|
+
|
|
20
21
|
N: {
|
|
21
22
|
value: "N",
|
|
22
23
|
name: "Asparagine",
|
|
@@ -24,7 +25,7 @@ const proteinAlphabet = {
|
|
|
24
25
|
hydrophobicity: -3.5,
|
|
25
26
|
colorByFamily: "#D3D3D3",
|
|
26
27
|
color: "hsl(268.9, 100%, 69%)",
|
|
27
|
-
mass:
|
|
28
|
+
mass: 114.10264
|
|
28
29
|
},
|
|
29
30
|
D: {
|
|
30
31
|
value: "D",
|
|
@@ -33,7 +34,7 @@ const proteinAlphabet = {
|
|
|
33
34
|
hydrophobicity: -3.5,
|
|
34
35
|
colorByFamily: "#EE82EE",
|
|
35
36
|
color: "hsl(268.9, 100%, 69%)",
|
|
36
|
-
mass:
|
|
37
|
+
mass: 115.0874
|
|
37
38
|
},
|
|
38
39
|
C: {
|
|
39
40
|
value: "C",
|
|
@@ -42,8 +43,9 @@ const proteinAlphabet = {
|
|
|
42
43
|
hydrophobicity: 2.5,
|
|
43
44
|
colorByFamily: "#FFFF00",
|
|
44
45
|
color: "hsl(335.1, 100%, 69%)",
|
|
45
|
-
mass:
|
|
46
|
+
mass: 103.1429
|
|
46
47
|
},
|
|
48
|
+
|
|
47
49
|
E: {
|
|
48
50
|
value: "E",
|
|
49
51
|
name: "Glutamic acid",
|
|
@@ -51,7 +53,7 @@ const proteinAlphabet = {
|
|
|
51
53
|
hydrophobicity: -3.5,
|
|
52
54
|
colorByFamily: "#EE82EE",
|
|
53
55
|
color: "hsl(268.9, 100%, 69%)",
|
|
54
|
-
mass:
|
|
56
|
+
mass: 129.11398
|
|
55
57
|
},
|
|
56
58
|
Q: {
|
|
57
59
|
value: "Q",
|
|
@@ -60,7 +62,7 @@ const proteinAlphabet = {
|
|
|
60
62
|
hydrophobicity: -3.5,
|
|
61
63
|
colorByFamily: "#D3D3D3",
|
|
62
64
|
color: "hsl(268.9, 100%, 69%)",
|
|
63
|
-
mass:
|
|
65
|
+
mass: 128.12922
|
|
64
66
|
},
|
|
65
67
|
G: {
|
|
66
68
|
value: "G",
|
|
@@ -69,8 +71,9 @@ const proteinAlphabet = {
|
|
|
69
71
|
hydrophobicity: -0.4,
|
|
70
72
|
colorByFamily: "#00FFFF",
|
|
71
73
|
color: "hsl(303.1, 100%, 69%)",
|
|
72
|
-
mass:
|
|
74
|
+
mass: 57.05132
|
|
73
75
|
},
|
|
76
|
+
|
|
74
77
|
H: {
|
|
75
78
|
value: "H",
|
|
76
79
|
name: "Histidine",
|
|
@@ -78,8 +81,9 @@ const proteinAlphabet = {
|
|
|
78
81
|
hydrophobicity: -3.2,
|
|
79
82
|
colorByFamily: "#FFC0CB",
|
|
80
83
|
color: "hsl(272.2, 100%, 69%)",
|
|
81
|
-
mass:
|
|
84
|
+
mass: 137.13928
|
|
82
85
|
},
|
|
86
|
+
|
|
83
87
|
I: {
|
|
84
88
|
value: "I",
|
|
85
89
|
name: "Isoleucine ",
|
|
@@ -87,7 +91,7 @@ const proteinAlphabet = {
|
|
|
87
91
|
hydrophobicity: 4.5,
|
|
88
92
|
colorByFamily: "#00FFFF",
|
|
89
93
|
color: "hsl(356.9, 100%, 69%)",
|
|
90
|
-
mass:
|
|
94
|
+
mass: 113.15764
|
|
91
95
|
},
|
|
92
96
|
L: {
|
|
93
97
|
value: "L",
|
|
@@ -96,7 +100,7 @@ const proteinAlphabet = {
|
|
|
96
100
|
hydrophobicity: 3.8,
|
|
97
101
|
colorByFamily: "#00FFFF",
|
|
98
102
|
color: "hsl(349.4, 100%, 69%)",
|
|
99
|
-
mass:
|
|
103
|
+
mass: 113.15764
|
|
100
104
|
},
|
|
101
105
|
K: {
|
|
102
106
|
value: "K",
|
|
@@ -105,8 +109,9 @@ const proteinAlphabet = {
|
|
|
105
109
|
hydrophobicity: -3.9,
|
|
106
110
|
colorByFamily: "#FFC0CB",
|
|
107
111
|
color: "hsl(264.7, 100%, 69%)",
|
|
108
|
-
mass:
|
|
112
|
+
mass: 128.17228
|
|
109
113
|
},
|
|
114
|
+
|
|
110
115
|
M: {
|
|
111
116
|
value: "M",
|
|
112
117
|
name: "Methionine",
|
|
@@ -114,7 +119,7 @@ const proteinAlphabet = {
|
|
|
114
119
|
hydrophobicity: 1.9,
|
|
115
120
|
colorByFamily: "#FFFF00",
|
|
116
121
|
color: "hsl(328.5, 100%, 69%)",
|
|
117
|
-
mass:
|
|
122
|
+
mass: 131.19606
|
|
118
123
|
},
|
|
119
124
|
F: {
|
|
120
125
|
value: "F",
|
|
@@ -123,7 +128,7 @@ const proteinAlphabet = {
|
|
|
123
128
|
hydrophobicity: 2.8,
|
|
124
129
|
colorByFamily: "#FFA500",
|
|
125
130
|
color: "hsl(338.4, 100%, 69%)",
|
|
126
|
-
mass:
|
|
131
|
+
mass: 147.17386
|
|
127
132
|
},
|
|
128
133
|
P: {
|
|
129
134
|
value: "P",
|
|
@@ -132,7 +137,7 @@ const proteinAlphabet = {
|
|
|
132
137
|
hydrophobicity: -1.6,
|
|
133
138
|
colorByFamily: "#00FFFF",
|
|
134
139
|
color: "hsl(289.9, 100%, 69%)",
|
|
135
|
-
mass:
|
|
140
|
+
mass: 97.11518
|
|
136
141
|
},
|
|
137
142
|
S: {
|
|
138
143
|
value: "S",
|
|
@@ -141,7 +146,7 @@ const proteinAlphabet = {
|
|
|
141
146
|
hydrophobicity: -0.8,
|
|
142
147
|
colorByFamily: "#90EE90",
|
|
143
148
|
color: "hsl(298.6, 100%, 69%)",
|
|
144
|
-
mass:
|
|
149
|
+
mass: 87.0773
|
|
145
150
|
},
|
|
146
151
|
T: {
|
|
147
152
|
value: "T",
|
|
@@ -150,7 +155,7 @@ const proteinAlphabet = {
|
|
|
150
155
|
hydrophobicity: -0.7,
|
|
151
156
|
colorByFamily: "#90EE90",
|
|
152
157
|
color: "hsl(299.8, 100%, 69%)",
|
|
153
|
-
mass:
|
|
158
|
+
mass: 101.10388
|
|
154
159
|
},
|
|
155
160
|
U: {
|
|
156
161
|
value: "U",
|
|
@@ -158,7 +163,7 @@ const proteinAlphabet = {
|
|
|
158
163
|
threeLettersName: "Sec",
|
|
159
164
|
colorByFamily: "#FF0000",
|
|
160
165
|
color: "hsl(0, 100%, 69%)",
|
|
161
|
-
mass:
|
|
166
|
+
mass: 150.3079
|
|
162
167
|
},
|
|
163
168
|
W: {
|
|
164
169
|
value: "W",
|
|
@@ -167,7 +172,7 @@ const proteinAlphabet = {
|
|
|
167
172
|
hydrophobicity: -0.9,
|
|
168
173
|
colorByFamily: "#FFA500",
|
|
169
174
|
color: "hsl(297.6, 100%, 69%)",
|
|
170
|
-
mass:
|
|
175
|
+
mass: 186.2099
|
|
171
176
|
},
|
|
172
177
|
Y: {
|
|
173
178
|
value: "Y",
|
|
@@ -176,7 +181,7 @@ const proteinAlphabet = {
|
|
|
176
181
|
hydrophobicity: -1.3,
|
|
177
182
|
colorByFamily: "#FFA500",
|
|
178
183
|
color: "hsl(293.2, 100%, 69%)",
|
|
179
|
-
mass:
|
|
184
|
+
mass: 163.17326
|
|
180
185
|
},
|
|
181
186
|
V: {
|
|
182
187
|
value: "V",
|
|
@@ -185,7 +190,7 @@ const proteinAlphabet = {
|
|
|
185
190
|
hydrophobicity: 4.2,
|
|
186
191
|
colorByFamily: "#00FFFF",
|
|
187
192
|
color: "hsl(353.6, 100%, 69%)",
|
|
188
|
-
mass:
|
|
193
|
+
mass: 99.13106
|
|
189
194
|
},
|
|
190
195
|
"*": {
|
|
191
196
|
value: "*",
|
|
@@ -210,7 +215,7 @@ const proteinAlphabet = {
|
|
|
210
215
|
threeLettersName: "Gap",
|
|
211
216
|
colorByFamily: "#FF0000",
|
|
212
217
|
color: "hsl(0, 100%, 69%)",
|
|
213
|
-
mass: 0
|
|
218
|
+
mass: 0
|
|
214
219
|
},
|
|
215
220
|
B: {
|
|
216
221
|
value: "B",
|
|
@@ -220,7 +225,7 @@ const proteinAlphabet = {
|
|
|
220
225
|
isAmbiguous: true,
|
|
221
226
|
name: "B",
|
|
222
227
|
aliases: "ND",
|
|
223
|
-
mass: 0
|
|
228
|
+
mass: 0
|
|
224
229
|
},
|
|
225
230
|
J: {
|
|
226
231
|
value: "J",
|
|
@@ -230,7 +235,7 @@ const proteinAlphabet = {
|
|
|
230
235
|
isAmbiguous: true,
|
|
231
236
|
name: "J",
|
|
232
237
|
aliases: "IL",
|
|
233
|
-
mass: 0
|
|
238
|
+
mass: 0
|
|
234
239
|
},
|
|
235
240
|
X: {
|
|
236
241
|
value: "X",
|
|
@@ -240,7 +245,7 @@ const proteinAlphabet = {
|
|
|
240
245
|
isAmbiguous: true,
|
|
241
246
|
name: "X",
|
|
242
247
|
aliases: "ACDEFGHIKLMNPQRSTVWY",
|
|
243
|
-
mass: 0
|
|
248
|
+
mass: 0
|
|
244
249
|
},
|
|
245
250
|
Z: {
|
|
246
251
|
value: "Z",
|
|
@@ -254,4 +259,4 @@ const proteinAlphabet = {
|
|
|
254
259
|
}
|
|
255
260
|
};
|
|
256
261
|
|
|
257
|
-
export default proteinAlphabet
|
|
262
|
+
export default proteinAlphabet;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export default function rotateBpsToPosition(
|
|
2
|
-
bps,
|
|
3
|
-
|
|
4
|
-
) {
|
|
5
|
-
return arrayRotate(bps.split(""), caretPosition).join("")
|
|
6
|
-
};
|
|
7
|
-
|
|
1
|
+
export default function rotateBpsToPosition(bps, caretPosition) {
|
|
2
|
+
return arrayRotate(bps.split(""), caretPosition).join("");
|
|
3
|
+
}
|
|
8
4
|
|
|
9
5
|
function arrayRotate(arr, count) {
|
|
10
|
-
count -= arr.length * Math.floor(count / arr.length)
|
|
11
|
-
arr.push.apply(arr, arr.splice(0, count))
|
|
12
|
-
return arr
|
|
13
|
-
}
|
|
6
|
+
count -= arr.length * Math.floor(count / arr.length);
|
|
7
|
+
arr.push.apply(arr, arr.splice(0, count));
|
|
8
|
+
return arr;
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import rotateBpsToPosition from
|
|
2
|
-
describe(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
})
|
|
1
|
+
import rotateBpsToPosition from "./rotateBpsToPosition";
|
|
2
|
+
describe("rotateBpsToPosition", () => {
|
|
3
|
+
it("should rotate Bps To Position correctly ", () => {
|
|
4
|
+
expect(rotateBpsToPosition("atgaccc", 4)).toEqual("cccatga");
|
|
5
|
+
});
|
|
6
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {map} from "lodash";
|
|
2
|
-
import {adjustRangeToRotation} from "@teselagen/range-utils";
|
|
1
|
+
import { map } from "lodash";
|
|
2
|
+
import { adjustRangeToRotation } from "@teselagen/range-utils";
|
|
3
3
|
import tidyUpSequenceData from "./tidyUpSequenceData";
|
|
4
|
-
import {modifiableTypes} from "./annotationTypes";
|
|
4
|
+
import { modifiableTypes } from "./annotationTypes";
|
|
5
5
|
import rotateBpsToPosition from "./rotateBpsToPosition";
|
|
6
6
|
|
|
7
7
|
export default function rotateSequenceDataToPosition(
|
|
@@ -28,7 +28,7 @@ export default function rotateSequenceDataToPosition(
|
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
30
|
return newSequenceData;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
function adjustAnnotationsToRotation(
|
|
34
34
|
annotationsToBeAdjusted,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {modifiableTypes} from "./annotationTypes";
|
|
1
|
+
import { modifiableTypes } from "./annotationTypes";
|
|
2
2
|
import adjustAnnotationsToInsert from "./adjustAnnotationsToInsert";
|
|
3
3
|
|
|
4
4
|
export default function shiftAnnotationsByLen({
|
|
@@ -14,4 +14,4 @@ export default function shiftAnnotationsByLen({
|
|
|
14
14
|
insertLength
|
|
15
15
|
);
|
|
16
16
|
});
|
|
17
|
-
}
|
|
17
|
+
}
|
package/src/tidyUpAnnotation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {cloneDeep, get, some} from "lodash";
|
|
2
|
-
import {getFeatureToColorMap, getFeatureTypes} from "./featureTypesAndColors";
|
|
1
|
+
import { cloneDeep, get, some } from "lodash";
|
|
2
|
+
import { getFeatureToColorMap, getFeatureTypes } from "./featureTypesAndColors";
|
|
3
3
|
import shortid from "shortid";
|
|
4
4
|
|
|
5
5
|
export default function tidyUpAnnotation(
|
|
@@ -114,8 +114,9 @@ export default function tidyUpAnnotation(
|
|
|
114
114
|
annotation.notes = JSON.parse(annotation.notes);
|
|
115
115
|
} catch (error) {
|
|
116
116
|
console.info(
|
|
117
|
-
`warning 33y00a0912 - couldn't parse notes for ${
|
|
118
|
-
""
|
|
117
|
+
`warning 33y00a0912 - couldn't parse notes for ${
|
|
118
|
+
annotation.name || ""
|
|
119
|
+
} ${annotation.notes}:`,
|
|
119
120
|
error
|
|
120
121
|
);
|
|
121
122
|
}
|
|
@@ -125,7 +126,7 @@ export default function tidyUpAnnotation(
|
|
|
125
126
|
annotation.color = getFeatureToColorMap()[annotation.type];
|
|
126
127
|
}
|
|
127
128
|
return annotation;
|
|
128
|
-
}
|
|
129
|
+
}
|
|
129
130
|
|
|
130
131
|
function coerceLocation({
|
|
131
132
|
location,
|
|
@@ -156,7 +157,7 @@ function coerceLocation({
|
|
|
156
157
|
" and set to size: " +
|
|
157
158
|
size
|
|
158
159
|
); //setting it to 0 internally, but users will see it as 1
|
|
159
|
-
location.start = size - (isProtein ? 3 : 1);
|
|
160
|
+
location.start = Math.max(0, size - (isProtein ? 3 : 1));
|
|
160
161
|
}
|
|
161
162
|
if (
|
|
162
163
|
location.end < 0 ||
|
|
@@ -171,7 +172,7 @@ function coerceLocation({
|
|
|
171
172
|
" and set to seq size: " +
|
|
172
173
|
size
|
|
173
174
|
); //setting it to 0 internally, but users will see it as 1
|
|
174
|
-
location.end = size - 1;
|
|
175
|
+
location.end = Math.max(0, size - 1);
|
|
175
176
|
}
|
|
176
177
|
if (location.start > location.end && circular === false) {
|
|
177
178
|
messages.push(
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
import shortid from "shortid";
|
|
3
3
|
|
|
4
4
|
import getAminoAcidDataForEachBaseOfDna from "./getAminoAcidDataForEachBaseOfDna";
|
|
5
|
-
import {cloneDeep, flatMap} from "lodash";
|
|
5
|
+
import { cloneDeep, flatMap } from "lodash";
|
|
6
6
|
import { annotationTypes } from "./annotationTypes";
|
|
7
7
|
import filterSequenceString from "./filterSequenceString";
|
|
8
8
|
import tidyUpAnnotation from "./tidyUpAnnotation";
|
|
9
|
-
import filterAminoAcidSequenceString from "./filterAminoAcidSequenceString";
|
|
10
9
|
import getDegenerateDnaStringFromAaString from "./getDegenerateDnaStringFromAAString";
|
|
11
|
-
import {getFeatureTypes} from "./featureTypesAndColors";
|
|
10
|
+
import { getFeatureTypes } from "./featureTypesAndColors";
|
|
12
11
|
|
|
13
12
|
export default function tidyUpSequenceData(pSeqData, options = {}) {
|
|
14
13
|
const {
|
|
@@ -17,11 +16,10 @@ export default function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
17
16
|
removeUnwantedChars,
|
|
18
17
|
additionalValidChars,
|
|
19
18
|
noTranslationData,
|
|
20
|
-
charOverrides,
|
|
21
19
|
doNotProvideIdsForAnnotations,
|
|
22
|
-
proteinFilterOptions,
|
|
23
20
|
noCdsTranslations,
|
|
24
|
-
convertAnnotationsFromAAIndices
|
|
21
|
+
convertAnnotationsFromAAIndices,
|
|
22
|
+
topLevelSeqData
|
|
25
23
|
} = options;
|
|
26
24
|
let seqData = cloneDeep(pSeqData); //sequence is usually immutable, so we clone it and return it
|
|
27
25
|
const response = {
|
|
@@ -56,18 +54,17 @@ export default function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
56
54
|
}
|
|
57
55
|
if (removeUnwantedChars) {
|
|
58
56
|
if (seqData.isProtein) {
|
|
59
|
-
seqData.proteinSequence
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
57
|
+
const [newSeq] = filterSequenceString(seqData.proteinSequence, {
|
|
58
|
+
includeStopCodon: true,
|
|
59
|
+
...(topLevelSeqData || seqData)
|
|
60
|
+
});
|
|
61
|
+
seqData.proteinSequence = newSeq;
|
|
63
62
|
} else {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
charOverrides
|
|
70
|
-
);
|
|
63
|
+
const [newSeq] = filterSequenceString(seqData.sequence, {
|
|
64
|
+
additionalValidChars,
|
|
65
|
+
...(topLevelSeqData || seqData)
|
|
66
|
+
});
|
|
67
|
+
seqData.sequence = newSeq;
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
if (seqData.isProtein) {
|
|
@@ -166,4 +163,4 @@ export default function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
166
163
|
console.info("tidyUpSequenceData messages:", response.messages);
|
|
167
164
|
}
|
|
168
165
|
return seqData;
|
|
169
|
-
}
|
|
166
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function filterAminoAcidSequenceString(sequenceString: any, options: any): any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
export default function filterAminoAcidSequenceString(
|
|
3
|
-
sequenceString,
|
|
4
|
-
options
|
|
5
|
-
) {
|
|
6
|
-
options = options || {};
|
|
7
|
-
if (options.includeStopCodon) {
|
|
8
|
-
//tnrtodo this maybe needs the stop codon char in it?
|
|
9
|
-
return sequenceString.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
|
|
10
|
-
}
|
|
11
|
-
// ac.throw(ac.string, sequenceString);
|
|
12
|
-
return sequenceString.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
|
|
13
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
import filterAminoAcidSequenceString from "./filterAminoAcidSequenceString";
|
|
3
|
-
describe("filterAminoAcidSequenceString", () => {
|
|
4
|
-
it("should filter only valid amino acids by default", () => {
|
|
5
|
-
const filteredString = filterAminoAcidSequenceString(
|
|
6
|
-
'bbb342"""xtgalmfwkqespvicyhrnd,,../'
|
|
7
|
-
);
|
|
8
|
-
assert.equal(filteredString, "xtgalmfwkqespvicyhrnd");
|
|
9
|
-
});
|
|
10
|
-
it("should handle upper case letters", () => {
|
|
11
|
-
const filteredString = filterAminoAcidSequenceString("xtgalmfWKQEspvicyhrnd");
|
|
12
|
-
assert.equal(filteredString, "xtgalmfWKQEspvicyhrnd");
|
|
13
|
-
});
|
|
14
|
-
it("should handle the option to includeStopCodon by allowing periods", () => {
|
|
15
|
-
const options = { includeStopCodon: true };
|
|
16
|
-
const filteredString = filterAminoAcidSequenceString(
|
|
17
|
-
'bbb342"""xtgalmfwkqespvicyhrnd,,../',
|
|
18
|
-
options
|
|
19
|
-
);
|
|
20
|
-
assert.equal(filteredString, "xtgalmfwkqespvicyhrnd..");
|
|
21
|
-
});
|
|
22
|
-
});
|