@teselagen/sequence-utils 0.3.25 → 0.3.27
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/index.cjs +10 -3
- package/index.js +10 -3
- package/index.umd.cjs +10 -3
- package/package.json +1 -1
- package/src/calculateNebTm.test.js +0 -1
- package/src/calculateTm.js +1 -1
- package/src/getReverseComplementAnnotation.js +9 -1
- package/src/getReverseComplementSequenceAndAnnotations.test.js +49 -0
package/index.cjs
CHANGED
|
@@ -9517,7 +9517,7 @@ const calcTmMethods = {
|
|
|
9517
9517
|
* return - Temperature for the given sequence, in Celsius.
|
|
9518
9518
|
*/
|
|
9519
9519
|
calculateTemperature: function(_sequence, { type, A, R, primerConc, monovalentCationConc } = {}) {
|
|
9520
|
-
const sequence = _sequence.toLowerCase();
|
|
9520
|
+
const sequence = (_sequence || "").toLowerCase();
|
|
9521
9521
|
if (typeof type === "undefined") {
|
|
9522
9522
|
type = this.TABLE_BRESLAUER;
|
|
9523
9523
|
} else if (type != this.TABLE_BRESLAUER && type != this.TABLE_UNIFIED && type != this.TABLE_SUGIMOTO) {
|
|
@@ -18359,12 +18359,19 @@ function getReverseComplementAminoAcidStringFromSequenceString(sequenceString) {
|
|
|
18359
18359
|
}
|
|
18360
18360
|
__name(getReverseComplementAminoAcidStringFromSequenceString, "getReverseComplementAminoAcidStringFromSequenceString");
|
|
18361
18361
|
function getReverseComplementAnnotation(annotation, sequenceLength) {
|
|
18362
|
-
return Object.assign({}, annotation, {
|
|
18362
|
+
return Object.assign({}, annotation, __spreadValues({
|
|
18363
18363
|
start: sequenceLength - (annotation.end + 1),
|
|
18364
18364
|
end: sequenceLength - (annotation.start + 1),
|
|
18365
18365
|
forward: !annotation.forward,
|
|
18366
18366
|
strand: annotation.strand === 1 ? -1 : 1
|
|
18367
|
-
}
|
|
18367
|
+
}, annotation.locations && {
|
|
18368
|
+
locations: annotation.locations.map((location) => {
|
|
18369
|
+
return {
|
|
18370
|
+
start: sequenceLength - (location.end + 1),
|
|
18371
|
+
end: sequenceLength - (location.start + 1)
|
|
18372
|
+
};
|
|
18373
|
+
})
|
|
18374
|
+
}));
|
|
18368
18375
|
}
|
|
18369
18376
|
__name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
|
|
18370
18377
|
function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
package/index.js
CHANGED
|
@@ -9515,7 +9515,7 @@ const calcTmMethods = {
|
|
|
9515
9515
|
* return - Temperature for the given sequence, in Celsius.
|
|
9516
9516
|
*/
|
|
9517
9517
|
calculateTemperature: function(_sequence, { type, A, R, primerConc, monovalentCationConc } = {}) {
|
|
9518
|
-
const sequence = _sequence.toLowerCase();
|
|
9518
|
+
const sequence = (_sequence || "").toLowerCase();
|
|
9519
9519
|
if (typeof type === "undefined") {
|
|
9520
9520
|
type = this.TABLE_BRESLAUER;
|
|
9521
9521
|
} else if (type != this.TABLE_BRESLAUER && type != this.TABLE_UNIFIED && type != this.TABLE_SUGIMOTO) {
|
|
@@ -18357,12 +18357,19 @@ function getReverseComplementAminoAcidStringFromSequenceString(sequenceString) {
|
|
|
18357
18357
|
}
|
|
18358
18358
|
__name(getReverseComplementAminoAcidStringFromSequenceString, "getReverseComplementAminoAcidStringFromSequenceString");
|
|
18359
18359
|
function getReverseComplementAnnotation(annotation, sequenceLength) {
|
|
18360
|
-
return Object.assign({}, annotation, {
|
|
18360
|
+
return Object.assign({}, annotation, __spreadValues({
|
|
18361
18361
|
start: sequenceLength - (annotation.end + 1),
|
|
18362
18362
|
end: sequenceLength - (annotation.start + 1),
|
|
18363
18363
|
forward: !annotation.forward,
|
|
18364
18364
|
strand: annotation.strand === 1 ? -1 : 1
|
|
18365
|
-
}
|
|
18365
|
+
}, annotation.locations && {
|
|
18366
|
+
locations: annotation.locations.map((location) => {
|
|
18367
|
+
return {
|
|
18368
|
+
start: sequenceLength - (location.end + 1),
|
|
18369
|
+
end: sequenceLength - (location.start + 1)
|
|
18370
|
+
};
|
|
18371
|
+
})
|
|
18372
|
+
}));
|
|
18366
18373
|
}
|
|
18367
18374
|
__name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
|
|
18368
18375
|
function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
package/index.umd.cjs
CHANGED
|
@@ -9519,7 +9519,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
9519
9519
|
* return - Temperature for the given sequence, in Celsius.
|
|
9520
9520
|
*/
|
|
9521
9521
|
calculateTemperature: function(_sequence, { type, A, R, primerConc, monovalentCationConc } = {}) {
|
|
9522
|
-
const sequence = _sequence.toLowerCase();
|
|
9522
|
+
const sequence = (_sequence || "").toLowerCase();
|
|
9523
9523
|
if (typeof type === "undefined") {
|
|
9524
9524
|
type = this.TABLE_BRESLAUER;
|
|
9525
9525
|
} else if (type != this.TABLE_BRESLAUER && type != this.TABLE_UNIFIED && type != this.TABLE_SUGIMOTO) {
|
|
@@ -18361,12 +18361,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
18361
18361
|
}
|
|
18362
18362
|
__name(getReverseComplementAminoAcidStringFromSequenceString, "getReverseComplementAminoAcidStringFromSequenceString");
|
|
18363
18363
|
function getReverseComplementAnnotation(annotation, sequenceLength) {
|
|
18364
|
-
return Object.assign({}, annotation, {
|
|
18364
|
+
return Object.assign({}, annotation, __spreadValues({
|
|
18365
18365
|
start: sequenceLength - (annotation.end + 1),
|
|
18366
18366
|
end: sequenceLength - (annotation.start + 1),
|
|
18367
18367
|
forward: !annotation.forward,
|
|
18368
18368
|
strand: annotation.strand === 1 ? -1 : 1
|
|
18369
|
-
}
|
|
18369
|
+
}, annotation.locations && {
|
|
18370
|
+
locations: annotation.locations.map((location) => {
|
|
18371
|
+
return {
|
|
18372
|
+
start: sequenceLength - (location.end + 1),
|
|
18373
|
+
end: sequenceLength - (location.start + 1)
|
|
18374
|
+
};
|
|
18375
|
+
})
|
|
18376
|
+
}));
|
|
18370
18377
|
}
|
|
18371
18378
|
__name(getReverseComplementAnnotation, "getReverseComplementAnnotation");
|
|
18372
18379
|
function getReverseComplementSequenceAndAnnoations(pSeqObj, options = {}) {
|
package/package.json
CHANGED
|
@@ -8,7 +8,6 @@ describe("calculate Tm based on SantaLucia 1998 & Owczarzy 2004", () => {
|
|
|
8
8
|
// 50 mM KCl in Q5 protocol
|
|
9
9
|
monovalentCationConc: 0.05,
|
|
10
10
|
primerConc: 0.0000005
|
|
11
|
-
|
|
12
11
|
};
|
|
13
12
|
// console.log(`calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),:`,calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),)
|
|
14
13
|
// console.log(`calculateTm("AGCGGATAACAATTTCACACAGGA", options),:`,calculateTm("AGCGGATAACAATTTCACACAGGA", options),)
|
package/src/calculateTm.js
CHANGED
|
@@ -27,7 +27,7 @@ const calcTmMethods = {
|
|
|
27
27
|
_sequence,
|
|
28
28
|
{ type, A, R, primerConc, monovalentCationConc } = {}
|
|
29
29
|
) {
|
|
30
|
-
const sequence = _sequence.toLowerCase();
|
|
30
|
+
const sequence = (_sequence || "").toLowerCase();
|
|
31
31
|
if (typeof type === "undefined") {
|
|
32
32
|
// type = this.TABLE_SUGIMOTO ;
|
|
33
33
|
// type = this.TABLE_UNIFIED;
|
|
@@ -18,6 +18,14 @@ export default function getReverseComplementAnnotation(
|
|
|
18
18
|
start: sequenceLength - (annotation.end + 1),
|
|
19
19
|
end: sequenceLength - (annotation.start + 1),
|
|
20
20
|
forward: !annotation.forward,
|
|
21
|
-
strand: annotation.strand === 1 ? -1 : 1
|
|
21
|
+
strand: annotation.strand === 1 ? -1 : 1,
|
|
22
|
+
...(annotation.locations && {
|
|
23
|
+
locations: annotation.locations.map(location => {
|
|
24
|
+
return {
|
|
25
|
+
start: sequenceLength - (location.end + 1),
|
|
26
|
+
end: sequenceLength - (location.start + 1)
|
|
27
|
+
};
|
|
28
|
+
})
|
|
29
|
+
})
|
|
22
30
|
});
|
|
23
31
|
}
|
|
@@ -89,6 +89,55 @@ describe("getReverseComplementSequenceAndAnnotations", () => {
|
|
|
89
89
|
]
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
+
it("handles reverse complementing a feature with locations correctly", () => {
|
|
93
|
+
const newSeq = getReverseComplementSequenceAndAnnotations({
|
|
94
|
+
sequence: "aaatttcccgttttttt",
|
|
95
|
+
// 01234567890123456
|
|
96
|
+
// fffffff
|
|
97
|
+
// lll ll
|
|
98
|
+
// after:
|
|
99
|
+
// 65432109876543210
|
|
100
|
+
// fffffff
|
|
101
|
+
// ll lll
|
|
102
|
+
circular: true,
|
|
103
|
+
features: [
|
|
104
|
+
{
|
|
105
|
+
start: 1,
|
|
106
|
+
end: 7,
|
|
107
|
+
locations: [
|
|
108
|
+
{
|
|
109
|
+
start: 1,
|
|
110
|
+
end: 3
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
start: 6,
|
|
114
|
+
end: 7
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
newSeq.should.containSubset({
|
|
121
|
+
// sequence: "tttaaacggg",
|
|
122
|
+
features: [
|
|
123
|
+
{
|
|
124
|
+
start: 9,
|
|
125
|
+
end: 15,
|
|
126
|
+
forward: true,
|
|
127
|
+
locations: [
|
|
128
|
+
{
|
|
129
|
+
start: 9,
|
|
130
|
+
end: 10
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
start: 13,
|
|
134
|
+
end: 15
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
});
|
|
92
141
|
it("handles a range option correctly and reverse complements a subset of the sequence across the origin ", () => {
|
|
93
142
|
const newSeq = getReverseComplementSequenceAndAnnotations(
|
|
94
143
|
{
|