@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.
Files changed (45) hide show
  1. package/calculateNebTm.d.ts +3 -2
  2. package/calculateTm.d.ts +7 -1
  3. package/degenerateDnaToAminoAcidMap.d.ts +1 -1
  4. package/degenerateRnaToAminoAcidMap.d.ts +1 -1
  5. package/getAminoAcidDataForEachBaseOfDna.d.ts +13 -3
  6. package/{index.mjs → index.cjs} +2769 -6273
  7. package/index.d.ts +76 -81
  8. package/index.js +2738 -6242
  9. package/{index.umd.js → index.umd.cjs} +2648 -6152
  10. package/insertSequenceDataAtPosition.d.ts +1 -1
  11. package/package.json +1 -1
  12. package/src/addGapsToSeqReads.js +1 -1
  13. package/src/adjustAnnotationsToInsert.js +1 -1
  14. package/src/autoAnnotate.js +1 -1
  15. package/src/calculateNebTm.js +1 -2
  16. package/src/calculateNebTm.test.js +16 -7
  17. package/src/calculateTm.js +54 -17
  18. package/src/calculateTm.test.js +7 -1
  19. package/src/computeDigestFragments.js +1 -1
  20. package/src/cutSequenceByRestrictionEnzyme.js +1 -1
  21. package/src/degenerateDnaToAminoAcidMap.js +1 -1
  22. package/src/degenerateRnaToAminoAcidMap.js +1 -1
  23. package/src/deleteSequenceDataAtRange.test.js +1 -1
  24. package/src/diffUtils.js +1 -1
  25. package/src/diffUtils.test.js +1 -1
  26. package/src/featureTypesAndColors.js +1 -1
  27. package/src/filterSequenceString.js +1 -1
  28. package/src/findSequenceMatches.js +1 -1
  29. package/src/generateSequenceData.test.js +1 -1
  30. package/src/getAminoAcidDataForEachBaseOfDna.js +246 -115
  31. package/src/getAminoAcidDataForEachBaseOfDna.test.js +55 -0
  32. package/src/getComplementSequenceString.js +1 -1
  33. package/src/getDigestFragmentsForRestrictionEnzymes.js +1 -1
  34. package/src/getReverseComplementAnnotation.js +9 -1
  35. package/src/getReverseComplementSequenceAndAnnotations.js +1 -1
  36. package/src/getReverseComplementSequenceAndAnnotations.test.js +51 -0
  37. package/src/getSequenceDataBetweenRange.js +1 -1
  38. package/src/getVirtualDigest.js +1 -1
  39. package/src/insertSequenceDataAtPositionOrRange.js +1 -1
  40. package/src/insertSequenceDataAtPositionOrRange.test.js +22 -0
  41. package/src/mapAnnotationsToRows.js +1 -1
  42. package/src/prepareCircularViewData.js +1 -1
  43. package/src/rotateSequenceDataToPosition.js +1 -1
  44. package/src/tidyUpAnnotation.js +1 -1
  45. package/src/tidyUpSequenceData.js +9 -2
@@ -1,2 +1,2 @@
1
+ import { default as insertSequenceDataAtPositionOrRange } from './insertSequenceDataAtPositionOrRange';
1
2
  export default insertSequenceDataAtPositionOrRange;
2
- import insertSequenceDataAtPositionOrRange from "./insertSequenceDataAtPositionOrRange";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/sequence-utils",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "dependencies": {
5
5
  "@teselagen/range-utils": "0.3.7",
6
6
  "bson-objectid": "^2.0.4",
@@ -1,6 +1,6 @@
1
1
  import insertGapsIntoRefSeq from "./insertGapsIntoRefSeq.js";
2
2
 
3
- import { cloneDeep } from "lodash";
3
+ import { cloneDeep } from "lodash-es";
4
4
 
5
5
  // bam.seq: NTGTAAGTCGTGAAAAAANCNNNCATATTNCGGAGGTAAAAATGAAAA...
6
6
  // bam.pos: 43
@@ -1,5 +1,5 @@
1
1
  import { adjustRangeToInsert } from "@teselagen/range-utils";
2
- import { map } from "lodash";
2
+ import { map } from "lodash-es";
3
3
 
4
4
  export default function adjustAnnotationsToInsert(
5
5
  annotationsToBeAdjusted,
@@ -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 {
@@ -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 calculateTm from "./calculateNebTm";
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
- calculateTm("AGCGGATAACAATTTCACACAGGA", 0.0000005, options),
17
+ calculateNebTm("AGCGGATAACAATTTCACACAGGA", options),
13
18
  65.8994505801345
14
19
  );
15
20
  assert.equal(
16
- calculateTm("AGCGGATAACAATTTCAC", 0.0000005, options),
21
+ calculateNebTm("AGCGGATAACAATTTCAC", options),
17
22
  56.11037835109477
18
23
  );
19
24
  assert.equal(
20
- calculateTm("AGCGGATAACAATTTcac", 0.0000005, options),
25
+ calculateNebTm("AGCGGATAACAATTTcac", options),
21
26
  56.11037835109477
22
27
  );
23
28
  assert.equal(
24
- calculateTm("AGCGGNNN", 0.0000005, options),
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
- calculateTm("AGCGGnnn", 0.0000005, options),
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
  });
@@ -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
- C: 0.5e-6, // Oligo concentration. 0.5uM is typical for PCR.
15
- Na: 50e-3, // Monovalent salt concentration. 50mM is typical for PCR.
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
- * Na - THe monovalent salt concentration. Defaults to 50e-3M.
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 (sequence, type, A, R, C, Na) {
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 (!C) {
44
- C = this.C;
49
+ if (!primerConc) {
50
+ primerConc = this.primerConc;
45
51
  }
46
- if (!Na) {
47
- Na = this.Na;
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) / (A + -sumDeltaS + R * Math.log(C / 4.0)) -
96
+ (-1000.0 * sumDeltaH) /
97
+ (A + -sumDeltaS + R * Math.log(primerConc / 4.0)) -
91
98
  273.15 +
92
- 16.6 * Math.LOG10E * Math.log(Na);
99
+ 16.6 * Math.LOG10E * Math.log(monovalentCationConc);
93
100
 
94
- // If temperature is negative then return 0.
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
@@ -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.21);
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
  });
@@ -1,5 +1,5 @@
1
1
  import shortid from "shortid";
2
- import { flatMap, cloneDeep } from "lodash";
2
+ import { flatMap, cloneDeep } from "lodash-es";
3
3
  import {
4
4
  normalizePositionByRangeLength,
5
5
  getRangeLength
@@ -1,4 +1,4 @@
1
- import { assign } from "lodash";
1
+ import { assign } from "lodash-es";
2
2
  import shortid from "shortid";
3
3
  import getReverseComplementSequenceString from "./getReverseComplementSequenceString";
4
4
 
@@ -1,4 +1,4 @@
1
- import { invert } from "lodash";
1
+ import { invert } from "lodash-es";
2
2
  import aminoAcidToDegenerateDnaMap from "./aminoAcidToDegenerateDnaMap";
3
3
 
4
4
  const degenerateDnaToAminoAcidMap = invert(aminoAcidToDegenerateDnaMap);
@@ -1,4 +1,4 @@
1
- import { invert } from "lodash";
1
+ import { invert } from "lodash-es";
2
2
  import aminoAcidToDegenerateRnaMap from "./aminoAcidToDegenerateRnaMap";
3
3
 
4
4
  const degenerateRnaToAminoAcidMap = invert(aminoAcidToDegenerateRnaMap);
@@ -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
@@ -1,4 +1,4 @@
1
- import { cloneDeep, forEach } from "lodash";
1
+ import { cloneDeep, forEach } from "lodash-es";
2
2
  import { diff, patch, reverse } from "jsondiffpatch/dist/jsondiffpatch.umd";
3
3
 
4
4
  import tidyUpSequenceData from "./tidyUpSequenceData";
@@ -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";
@@ -1,4 +1,4 @@
1
- import { get, keyBy, filter } from "lodash";
1
+ import { get, keyBy, filter } from "lodash-es";
2
2
 
3
3
  const genbankFeatureTypes = [
4
4
  { name: "-10_signal", color: "#4ECDC4" },
@@ -1,4 +1,4 @@
1
- import { debounce, uniq } from "lodash";
1
+ import { debounce, uniq } from "lodash-es";
2
2
  import {
3
3
  ambiguous_dna_letters,
4
4
  ambiguous_rna_letters,
@@ -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";
@@ -1,7 +1,7 @@
1
1
  import generateSequenceData from "./generateSequenceData";
2
2
  import chai from "chai";
3
3
  import chaiSubset from "chai-subset";
4
- import { map } from "lodash";
4
+ import { map } from "lodash-es";
5
5
 
6
6
  chai.should();
7
7
  chai.use(chaiSubset);