@teselagen/sequence-utils 0.3.24 → 0.3.26
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/calculateNebTm.d.ts +3 -2
- package/calculateTm.d.ts +7 -1
- package/degenerateDnaToAminoAcidMap.d.ts +1 -1
- package/degenerateRnaToAminoAcidMap.d.ts +1 -1
- package/getAminoAcidDataForEachBaseOfDna.d.ts +13 -3
- package/{index.mjs → index.cjs} +2769 -6273
- package/index.d.ts +76 -81
- package/index.js +2738 -6242
- package/{index.umd.js → index.umd.cjs} +2648 -6152
- package/insertSequenceDataAtPosition.d.ts +1 -1
- package/package.json +1 -1
- package/src/addGapsToSeqReads.js +1 -1
- package/src/adjustAnnotationsToInsert.js +1 -1
- package/src/autoAnnotate.js +1 -1
- package/src/calculateNebTm.js +1 -2
- package/src/calculateNebTm.test.js +16 -7
- package/src/calculateTm.js +54 -17
- package/src/calculateTm.test.js +7 -1
- package/src/computeDigestFragments.js +1 -1
- package/src/cutSequenceByRestrictionEnzyme.js +1 -1
- package/src/degenerateDnaToAminoAcidMap.js +1 -1
- package/src/degenerateRnaToAminoAcidMap.js +1 -1
- package/src/deleteSequenceDataAtRange.test.js +1 -1
- package/src/diffUtils.js +1 -1
- package/src/diffUtils.test.js +1 -1
- package/src/featureTypesAndColors.js +1 -1
- package/src/filterSequenceString.js +1 -1
- package/src/findSequenceMatches.js +1 -1
- package/src/generateSequenceData.test.js +1 -1
- package/src/getAminoAcidDataForEachBaseOfDna.js +246 -115
- package/src/getAminoAcidDataForEachBaseOfDna.test.js +55 -0
- package/src/getComplementSequenceString.js +1 -1
- package/src/getDigestFragmentsForRestrictionEnzymes.js +1 -1
- package/src/getReverseComplementAnnotation.js +9 -1
- package/src/getReverseComplementSequenceAndAnnotations.js +1 -1
- package/src/getReverseComplementSequenceAndAnnotations.test.js +51 -0
- package/src/getSequenceDataBetweenRange.js +1 -1
- package/src/getVirtualDigest.js +1 -1
- package/src/insertSequenceDataAtPositionOrRange.js +1 -1
- package/src/insertSequenceDataAtPositionOrRange.test.js +22 -0
- package/src/mapAnnotationsToRows.js +1 -1
- package/src/prepareCircularViewData.js +1 -1
- package/src/rotateSequenceDataToPosition.js +1 -1
- package/src/tidyUpAnnotation.js +1 -1
- package/src/tidyUpSequenceData.js +9 -2
package/package.json
CHANGED
package/src/addGapsToSeqReads.js
CHANGED
package/src/autoAnnotate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
|
|
2
|
-
import { forEach, omitBy } from "lodash";
|
|
2
|
+
import { forEach, omitBy } from "lodash-es";
|
|
3
3
|
import { ambiguous_dna_values } from "./bioData";
|
|
4
4
|
import aminoAcidToDegenerateDnaMap from "./aminoAcidToDegenerateDnaMap";
|
|
5
5
|
import {
|
package/src/calculateNebTm.js
CHANGED
|
@@ -9,8 +9,7 @@ import calculatePercentGc from "./calculatePercentGC";
|
|
|
9
9
|
// primer concentration & monovalent cation concentration in M
|
|
10
10
|
export default function calculateNebTm(
|
|
11
11
|
sequence,
|
|
12
|
-
primerConc
|
|
13
|
-
{ monovalentCationConc } = {}
|
|
12
|
+
{ monovalentCationConc = 0.05, primerConc = 0.0000005 } = {}
|
|
14
13
|
) {
|
|
15
14
|
try {
|
|
16
15
|
const checkForDegenerateBases = /[^atgc]/i.test(sequence);
|
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
|
-
import
|
|
2
|
+
import calculateNebTm from "./calculateNebTm";
|
|
3
|
+
// import calculateTm from "./calculateTm";
|
|
3
4
|
|
|
4
5
|
describe("calculate Tm based on SantaLucia 1998 & Owczarzy 2004", () => {
|
|
5
6
|
it("should return the melting temperature of a given sequence, if no degenerate bases are present", () => {
|
|
6
7
|
const options = {
|
|
7
8
|
// 50 mM KCl in Q5 protocol
|
|
8
|
-
monovalentCationConc: 0.05
|
|
9
|
+
monovalentCationConc: 0.05,
|
|
10
|
+
primerConc: 0.0000005
|
|
9
11
|
};
|
|
12
|
+
// console.log(`calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),:`,calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),)
|
|
13
|
+
// console.log(`calculateTm("AGCGGATAACAATTTCACACAGGA", options),:`,calculateTm("AGCGGATAACAATTTCACACAGGA", options),)
|
|
14
|
+
// console.log(`calculateTm("AGCGGATAnbACdAATTTCACACANNGGA", options),:`,calculateTm("AGCGGATAACAATTTCACACAGGA", options),)
|
|
10
15
|
// primer concentration in Q5 protocol is 500 nM
|
|
11
16
|
assert.equal(
|
|
12
|
-
|
|
17
|
+
calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),
|
|
13
18
|
65.8994505801345
|
|
14
19
|
);
|
|
15
20
|
assert.equal(
|
|
16
|
-
|
|
21
|
+
calculateNebTm("AGCGGATAACAATTTCAC", options),
|
|
17
22
|
56.11037835109477
|
|
18
23
|
);
|
|
19
24
|
assert.equal(
|
|
20
|
-
|
|
25
|
+
calculateNebTm("AGCGGATAACAATTTcac", options),
|
|
21
26
|
56.11037835109477
|
|
22
27
|
);
|
|
23
28
|
assert.equal(
|
|
24
|
-
|
|
29
|
+
calculateNebTm("ataataccgcgccacatagc", options),
|
|
30
|
+
65.03019485849268
|
|
31
|
+
);
|
|
32
|
+
assert.equal(
|
|
33
|
+
calculateNebTm("AGCGGNNN", options),
|
|
25
34
|
"Error calculating Tm for sequence AGCGGNNN: Error: Degenerate bases prohibited in Tm calculation of sequence AGCGGNNN"
|
|
26
35
|
);
|
|
27
36
|
assert.equal(
|
|
28
|
-
|
|
37
|
+
calculateNebTm("AGCGGnnn", options),
|
|
29
38
|
"Error calculating Tm for sequence AGCGGnnn: Error: Degenerate bases prohibited in Tm calculation of sequence AGCGGnnn"
|
|
30
39
|
);
|
|
31
40
|
});
|
package/src/calculateTm.js
CHANGED
|
@@ -11,8 +11,8 @@ const calcTmMethods = {
|
|
|
11
11
|
|
|
12
12
|
A: -10.8, // Helix initiation for deltaS
|
|
13
13
|
R: 1.987, // Gas constant (cal/(K*mol)).
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
primerConc: 0.0000005, // Oligo concentration. 0.5uM is typical for PCR.
|
|
15
|
+
monovalentCationConc: 0.05, // Monovalent salt concentration. 50mM is typical for PCR.
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Calculates temperature for DNA sequence using a given algorithm.
|
|
@@ -20,11 +20,17 @@ const calcTmMethods = {
|
|
|
20
20
|
* type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
|
|
21
21
|
* A - Helix initation for deltaS. Defaults to -10.8.
|
|
22
22
|
* R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
|
|
23
|
-
*
|
|
23
|
+
* monovalentCationConc - THe monovalent salt concentration. Defaults to 50e-3M.
|
|
24
24
|
* return - Temperature for the given sequence, in Celsius.
|
|
25
25
|
*/
|
|
26
|
-
calculateTemperature: function (
|
|
26
|
+
calculateTemperature: function (
|
|
27
|
+
_sequence,
|
|
28
|
+
{ type, A, R, primerConc, monovalentCationConc } = {}
|
|
29
|
+
) {
|
|
30
|
+
const sequence = _sequence.toLowerCase();
|
|
27
31
|
if (typeof type === "undefined") {
|
|
32
|
+
// type = this.TABLE_SUGIMOTO ;
|
|
33
|
+
// type = this.TABLE_UNIFIED;
|
|
28
34
|
type = this.TABLE_BRESLAUER;
|
|
29
35
|
} else if (
|
|
30
36
|
type != this.TABLE_BRESLAUER &&
|
|
@@ -40,11 +46,11 @@ const calcTmMethods = {
|
|
|
40
46
|
if (!R) {
|
|
41
47
|
R = this.R;
|
|
42
48
|
}
|
|
43
|
-
if (!
|
|
44
|
-
|
|
49
|
+
if (!primerConc) {
|
|
50
|
+
primerConc = this.primerConc;
|
|
45
51
|
}
|
|
46
|
-
if (!
|
|
47
|
-
|
|
52
|
+
if (!monovalentCationConc) {
|
|
53
|
+
monovalentCationConc = this.monovalentCationConc;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
const sequenceLength = sequence.length;
|
|
@@ -56,7 +62,7 @@ const calcTmMethods = {
|
|
|
56
62
|
const deltaHTable = this.getDeltaHTable(type);
|
|
57
63
|
const deltaSTable = this.getDeltaSTable(type);
|
|
58
64
|
|
|
59
|
-
const neighbors = []; // List goes in order: aa, at, ac, ag, tt, ta, tc, tg, cc, ca, ct, cg, gg, gt, gc
|
|
65
|
+
const neighbors = []; // List goes in order: aa, at, ac, ag, tt, ta, tc, tg, cc, ca, ct, cg, gg, ga, gt, gc
|
|
60
66
|
|
|
61
67
|
neighbors.push(this.calculateReps(sequence, "aa"));
|
|
62
68
|
neighbors.push(this.calculateNumberOfOccurrences(sequence, "at"));
|
|
@@ -87,16 +93,12 @@ const calcTmMethods = {
|
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
const temperature =
|
|
90
|
-
(-1000.0 * sumDeltaH) /
|
|
96
|
+
(-1000.0 * sumDeltaH) /
|
|
97
|
+
(A + -sumDeltaS + R * Math.log(primerConc / 4.0)) -
|
|
91
98
|
273.15 +
|
|
92
|
-
16.6 * Math.LOG10E * Math.log(
|
|
99
|
+
16.6 * Math.LOG10E * Math.log(monovalentCationConc);
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
if (temperature < 0) {
|
|
96
|
-
return 0;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return temperature.toFixed(2);
|
|
101
|
+
return temperature;
|
|
100
102
|
},
|
|
101
103
|
|
|
102
104
|
/**
|
|
@@ -125,6 +127,41 @@ const calcTmMethods = {
|
|
|
125
127
|
return null;
|
|
126
128
|
}
|
|
127
129
|
},
|
|
130
|
+
// "AA/TT": -7.9, 7.9
|
|
131
|
+
// "AT/TA": -7.2, 7.2
|
|
132
|
+
// "AC/TG": -8.4, 8.4
|
|
133
|
+
// "AG/TC": -7.8, 7.8
|
|
134
|
+
// "TT/AA": -7.9, 7.9
|
|
135
|
+
// "TA/AT": -7.2, 7.2
|
|
136
|
+
// "TG/AC": -8.5, 8.2
|
|
137
|
+
// "TC/AG": -8.2, 8.5
|
|
138
|
+
// "CC/GG": -8.0, 8.0
|
|
139
|
+
// "CA/GT": -8.5, 8.5
|
|
140
|
+
// "CT/GA": -7.8, 7.8
|
|
141
|
+
// "CG/GC": -10.6, 10.6
|
|
142
|
+
// "GG/CC": -8.0, 8.0
|
|
143
|
+
// "GA/CT": -8.2, 8.2,
|
|
144
|
+
// "GT/CA": -8.4, 8.4
|
|
145
|
+
// "GC/CG": -9.8, 9.8
|
|
146
|
+
|
|
147
|
+
// aa, at, ac, ag, tt, ta, tc, tg, cc, ca, ct, cg, gg, ga, gt, gc
|
|
148
|
+
|
|
149
|
+
// "AA/TT": -22.2,22.2,
|
|
150
|
+
// "AT/TA": -20.4,20.4,
|
|
151
|
+
// "AC/TG": -22.4,22.4,
|
|
152
|
+
// "AG/TC": -21.0,21.0,
|
|
153
|
+
// "TT/AA": -22.2,22.2,
|
|
154
|
+
// "TA/AT": -21.3,21.3,
|
|
155
|
+
// "TC/AG": -22.2,22.2,
|
|
156
|
+
// "TG/AC": -22.7,22.7,
|
|
157
|
+
// "CC/GG": -19.9,19.9,
|
|
158
|
+
// "CA/GT": -22.7,22.7,
|
|
159
|
+
// "CT/GA": -21.0,21.0,
|
|
160
|
+
// "CG/GC": -27.2,27.2,
|
|
161
|
+
// "GG/CC": -19.9,19.9,
|
|
162
|
+
// "GT/CA": -22.4,22.2,
|
|
163
|
+
// "GA/CT": -22.2,22.4,
|
|
164
|
+
// "GC/CG": -24.4,24.4
|
|
128
165
|
|
|
129
166
|
/**
|
|
130
167
|
* @private
|
package/src/calculateTm.test.js
CHANGED
|
@@ -2,6 +2,12 @@ import calculateTm from "./calculateTm";
|
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
describe("calculateTm", () => {
|
|
4
4
|
it("should calculate the correct tm", () => {
|
|
5
|
-
assert.equal(calculateTm("atagagaggga"), 26.
|
|
5
|
+
assert.equal(calculateTm("atagagaggga"), 26.211404758492115);
|
|
6
|
+
assert.equal(calculateTm("AGCGGATAACAATTTCACACAGGA"), 67.27154960706082);
|
|
7
|
+
assert.equal(calculateTm("AGCGGATAACAATTTCAC"), 54.91103113095034);
|
|
8
|
+
assert.equal(calculateTm("AGCGGATAACAATTTcac"), 54.91103113095034);
|
|
9
|
+
assert.equal(calculateTm("ataataccgcgccacatagc"), 63.51394755261396);
|
|
10
|
+
assert.equal(calculateTm("AGCGGNNN"), -5.0392194500109255);
|
|
11
|
+
assert.equal(calculateTm("AGCGGnnn"), -5.0392194500109255);
|
|
6
12
|
});
|
|
7
13
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import chai from "chai";
|
|
4
4
|
|
|
5
5
|
import { getRangeLength } from "@teselagen/range-utils";
|
|
6
|
-
import { cloneDeep } from "lodash";
|
|
6
|
+
import { cloneDeep } from "lodash-es";
|
|
7
7
|
import chaiSubset from "chai-subset";
|
|
8
8
|
|
|
9
9
|
import deleteSequenceDataAtRange from "./deleteSequenceDataAtRange";
|
package/src/diffUtils.js
CHANGED
package/src/diffUtils.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chai from "chai";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { map } from "lodash";
|
|
3
|
+
import { map } from "lodash-es";
|
|
4
4
|
import tidyUpSequenceData from "./tidyUpSequenceData";
|
|
5
5
|
import { getDiffFromSeqs, patchSeqWithDiff, reverseSeqDiff } from "./diffUtils";
|
|
6
6
|
import chaiSubset from "chai-subset";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
modulateRangeBySequenceLength,
|
|
3
3
|
flipContainedRange
|
|
4
4
|
} from "@teselagen/range-utils";
|
|
5
|
-
import { reduce, uniqBy } from "lodash";
|
|
5
|
+
import { reduce, uniqBy } from "lodash-es";
|
|
6
6
|
import escapeStringRegexp from "escape-string-regexp";
|
|
7
7
|
import getAminoAcidStringFromSequenceString from "./getAminoAcidStringFromSequenceString";
|
|
8
8
|
import { ambiguous_dna_values, extended_protein_values } from "./bioData";
|