@teselagen/sequence-utils 0.3.17 → 0.3.19

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/calculateTm.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare function _default(sequence: string, type: string, A: Double, R: Double, C: any, Na: Double): Double;
1
+ declare function _default(sequence: any, type: any, A: any, R: any, C: any, Na: any): string | 0;
2
2
  export default _default;
@@ -1 +1,11 @@
1
- export default function findOrfsInPlasmid(sequence: any, circular: any, minimumOrfSize: any, useAdditionalOrfStartCodons: any): Teselagen.bio.orf.ORF[];
1
+ export default function findOrfsInPlasmid(sequence: any, circular: any, minimumOrfSize: any, useAdditionalOrfStartCodons: any): {
2
+ start: number;
3
+ end: number;
4
+ length: number;
5
+ internalStartCodonIndices: never[];
6
+ frame: number;
7
+ forward: any;
8
+ annotationTypePlural: string;
9
+ isOrf: boolean;
10
+ id: any;
11
+ }[];
@@ -1,10 +1,20 @@
1
1
  /**
2
2
  * @private
3
3
  * Finds ORFs in a given DNA forward in a given frame.
4
- * @param {Int} frame The frame to look in.
5
- * @param {String}sequence The dna sequence.
6
- * @param {Int} minimumOrfSize The minimum length of ORF to return.
7
- * @param {boolean} forward Should we find forward facing orfs or reverse facing orfs
8
- * @return {Teselagen.bio.orf.ORF[]} The list of ORFs found.
4
+ * frame - The frame to look in.
5
+ * sequence - The dna sequence.
6
+ * minimumOrfSize - The minimum length of ORF to return.
7
+ * forward - Should we find forward facing orfs or reverse facing orfs
8
+ * return - The list of ORFs found.
9
9
  */
10
- export default function getOrfsFromSequence(options: any): Teselagen.bio.orf.ORF[];
10
+ export default function getOrfsFromSequence(options: any): {
11
+ start: number;
12
+ end: number;
13
+ length: number;
14
+ internalStartCodonIndices: never[];
15
+ frame: number;
16
+ forward: any;
17
+ annotationTypePlural: string;
18
+ isOrf: boolean;
19
+ id: any;
20
+ }[];
package/index.js CHANGED
@@ -12326,7 +12326,7 @@ const modifiableTypes = [
12326
12326
  let allWarnings = [];
12327
12327
  let makeToast = /* @__PURE__ */ __name(() => {
12328
12328
  if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
12329
- window.toastr.warning(allWarnings.join("\n"));
12329
+ window.toastr.warning(lodashExports.uniq(allWarnings).join("\n"));
12330
12330
  }
12331
12331
  allWarnings = [];
12332
12332
  }, "makeToast");
@@ -13026,12 +13026,12 @@ const calcTmMethods = {
13026
13026
  // Monovalent salt concentration. 50mM is typical for PCR.
13027
13027
  /**
13028
13028
  * Calculates temperature for DNA sequence using a given algorithm.
13029
- * @param {String} sequence The DNA sequence to use.
13030
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
13031
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
13032
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
13033
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
13034
- * @return {Double} Temperature for the given sequence, in Celsius.
13029
+ * sequence - The DNA sequence to use.
13030
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
13031
+ * A - Helix initation for deltaS. Defaults to -10.8.
13032
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
13033
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
13034
+ * return - Temperature for the given sequence, in Celsius.
13035
13035
  */
13036
13036
  calculateTemperature: function(sequence, type, A, R, C, Na) {
13037
13037
  if (typeof type === "undefined") {
@@ -21541,6 +21541,8 @@ function getComplementAminoAcidStringFromSequenceString(sequenceString) {
21541
21541
  }
21542
21542
  __name(getComplementAminoAcidStringFromSequenceString, "getComplementAminoAcidStringFromSequenceString");
21543
21543
  function getComplementSequenceString(sequence, isRna) {
21544
+ if (typeof sequence !== "string")
21545
+ return "";
21544
21546
  let complementSeqString = "";
21545
21547
  const complementMap = lodashExports.merge(
21546
21548
  DNAComplementMap,
package/index.mjs CHANGED
@@ -12324,7 +12324,7 @@ const modifiableTypes = [
12324
12324
  let allWarnings = [];
12325
12325
  let makeToast = /* @__PURE__ */ __name(() => {
12326
12326
  if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
12327
- window.toastr.warning(allWarnings.join("\n"));
12327
+ window.toastr.warning(lodashExports.uniq(allWarnings).join("\n"));
12328
12328
  }
12329
12329
  allWarnings = [];
12330
12330
  }, "makeToast");
@@ -13024,12 +13024,12 @@ const calcTmMethods = {
13024
13024
  // Monovalent salt concentration. 50mM is typical for PCR.
13025
13025
  /**
13026
13026
  * Calculates temperature for DNA sequence using a given algorithm.
13027
- * @param {String} sequence The DNA sequence to use.
13028
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
13029
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
13030
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
13031
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
13032
- * @return {Double} Temperature for the given sequence, in Celsius.
13027
+ * sequence - The DNA sequence to use.
13028
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
13029
+ * A - Helix initation for deltaS. Defaults to -10.8.
13030
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
13031
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
13032
+ * return - Temperature for the given sequence, in Celsius.
13033
13033
  */
13034
13034
  calculateTemperature: function(sequence, type, A, R, C, Na) {
13035
13035
  if (typeof type === "undefined") {
@@ -21539,6 +21539,8 @@ function getComplementAminoAcidStringFromSequenceString(sequenceString) {
21539
21539
  }
21540
21540
  __name(getComplementAminoAcidStringFromSequenceString, "getComplementAminoAcidStringFromSequenceString");
21541
21541
  function getComplementSequenceString(sequence, isRna) {
21542
+ if (typeof sequence !== "string")
21543
+ return "";
21542
21544
  let complementSeqString = "";
21543
21545
  const complementMap = lodashExports.merge(
21544
21546
  DNAComplementMap,
package/index.umd.js CHANGED
@@ -12328,7 +12328,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
12328
12328
  let allWarnings = [];
12329
12329
  let makeToast = /* @__PURE__ */ __name(() => {
12330
12330
  if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
12331
- window.toastr.warning(allWarnings.join("\n"));
12331
+ window.toastr.warning(lodashExports.uniq(allWarnings).join("\n"));
12332
12332
  }
12333
12333
  allWarnings = [];
12334
12334
  }, "makeToast");
@@ -13028,12 +13028,12 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
13028
13028
  // Monovalent salt concentration. 50mM is typical for PCR.
13029
13029
  /**
13030
13030
  * Calculates temperature for DNA sequence using a given algorithm.
13031
- * @param {String} sequence The DNA sequence to use.
13032
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
13033
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
13034
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
13035
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
13036
- * @return {Double} Temperature for the given sequence, in Celsius.
13031
+ * sequence - The DNA sequence to use.
13032
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
13033
+ * A - Helix initation for deltaS. Defaults to -10.8.
13034
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
13035
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
13036
+ * return - Temperature for the given sequence, in Celsius.
13037
13037
  */
13038
13038
  calculateTemperature: function(sequence, type, A, R, C, Na) {
13039
13039
  if (typeof type === "undefined") {
@@ -21543,6 +21543,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
21543
21543
  }
21544
21544
  __name(getComplementAminoAcidStringFromSequenceString, "getComplementAminoAcidStringFromSequenceString");
21545
21545
  function getComplementSequenceString(sequence, isRna) {
21546
+ if (typeof sequence !== "string")
21547
+ return "";
21546
21548
  let complementSeqString = "";
21547
21549
  const complementMap = lodashExports.merge(
21548
21550
  DNAComplementMap,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/sequence-utils",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "dependencies": {
5
5
  "@teselagen/range-utils": "0.3.7",
6
6
  "bson-objectid": "^2.0.4",
@@ -16,12 +16,12 @@ const calcTmMethods = {
16
16
 
17
17
  /**
18
18
  * Calculates temperature for DNA sequence using a given algorithm.
19
- * @param {String} sequence The DNA sequence to use.
20
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
21
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
22
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
23
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
24
- * @return {Double} Temperature for the given sequence, in Celsius.
19
+ * sequence - The DNA sequence to use.
20
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
21
+ * A - Helix initation for deltaS. Defaults to -10.8.
22
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
23
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
24
+ * return - Temperature for the given sequence, in Celsius.
25
25
  */
26
26
  calculateTemperature: function (sequence, type, A, R, C, Na) {
27
27
  if (typeof type === "undefined") {
@@ -9,7 +9,7 @@ let allWarnings = [];
9
9
 
10
10
  let makeToast = () => {
11
11
  if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
12
- window.toastr.warning(allWarnings.join("\n"));
12
+ window.toastr.warning(uniq(allWarnings).join("\n"));
13
13
  }
14
14
  allWarnings = [];
15
15
  };
@@ -8,23 +8,17 @@ describe("filterSequenceString", () => {
8
8
  });
9
9
  expect(str).toBe("tatuuaga");
10
10
  // expect(warnings[0]).toBe('Replaced "t" with "u" 2 times');
11
- expect(warnings[0]).toBe(
12
- "Invalid character(s) detected and removed: -, - "
13
- );
11
+ expect(warnings[0]).toBe("Invalid character(s) detected and removed: - ");
14
12
  });
15
13
  it("should not convert u's to t's for isDna (default isDna=true) seqs", () => {
16
14
  const [str, warnings] = filterSequenceString("tatuuag--a", {});
17
15
  // expect(warnings[0]).toBe('Replaced "u" with "t" 2 times');
18
- expect(warnings[0]).toBe(
19
- "Invalid character(s) detected and removed: -, - "
20
- );
16
+ expect(warnings[0]).toBe("Invalid character(s) detected and removed: - ");
21
17
  expect(str).toBe("tatuuaga");
22
18
  });
23
19
  it("should filter out unwanted chars", () => {
24
20
  const [str, warnings] = filterSequenceString("tatag--a");
25
- expect(warnings[0]).toBe(
26
- "Invalid character(s) detected and removed: -, - "
27
- );
21
+ expect(warnings[0]).toBe("Invalid character(s) detected and removed: - ");
28
22
  expect(str).toBe("tataga");
29
23
  });
30
24
  it("should handle additional chars option", () => {
@@ -51,7 +45,7 @@ describe("filterSequenceString", () => {
51
45
  );
52
46
  // expect(warnings[0]).toBe(`Replaced "." with "*" 2 times`);
53
47
  expect(warnings[0]).toBe(
54
- 'Invalid character(s) detected and removed: 3, 4, 2, ", ", ", ,, ,, ., ., / '
48
+ 'Invalid character(s) detected and removed: 3, 4, 2, ", ,, ., / '
55
49
  );
56
50
  expect(str).toBe("bbbxtgalmfwkqespvicyhrnd");
57
51
  });
@@ -1,9 +1,8 @@
1
1
  import DNAComplementMap from "./DNAComplementMap";
2
2
  import { merge } from "lodash";
3
3
 
4
- // ac.throw([ac.string,ac.bool],arguments);
5
4
  export default function getComplementSequenceString(sequence, isRna) {
6
- // ac.throw([ac.string],arguments);
5
+ if (typeof sequence !== "string") return "";
7
6
  let complementSeqString = "";
8
7
  const complementMap = merge(
9
8
  DNAComplementMap,
@@ -4,21 +4,13 @@ import getReverseComplementSequenceString from "./getReverseComplementSequenceSt
4
4
  /**
5
5
  * @private
6
6
  * Finds ORFs in a given DNA forward in a given frame.
7
- * @param {Int} frame The frame to look in.
8
- * @param {String}sequence The dna sequence.
9
- * @param {Int} minimumOrfSize The minimum length of ORF to return.
10
- * @param {boolean} forward Should we find forward facing orfs or reverse facing orfs
11
- * @return {Teselagen.bio.orf.ORF[]} The list of ORFs found.
7
+ * frame - The frame to look in.
8
+ * sequence - The dna sequence.
9
+ * minimumOrfSize - The minimum length of ORF to return.
10
+ * forward - Should we find forward facing orfs or reverse facing orfs
11
+ * return - The list of ORFs found.
12
12
  */
13
13
  export default function getOrfsFromSequence(options) {
14
- // ac.throw([ac.shape({
15
- // sequence: ac.string,
16
- // minimumOrfSize: ac.posInt,
17
- // forward: ac.bool,
18
- // circular: ac.bool
19
- // })], arguments);
20
-
21
- // const frame = options.frame;
22
14
  let sequence = options.sequence;
23
15
  const minimumOrfSize = options.minimumOrfSize;
24
16
  const forward = options.forward;
@@ -38,7 +30,6 @@ export default function getOrfsFromSequence(options) {
38
30
  const re = useAdditionalOrfStartCodons
39
31
  ? /(?=((?:A[TU]G|G[TU]G|C[TU]G)(?:.{3})*?(?:[TU]AG|[TU]AA|[TU]GA)))/gi
40
32
  : /(?=((?:A[TU]G)(?:.{3})*?(?:[TU]AG|[TU]AA|[TU]GA)))/gi;
41
- // const str = 'tatgaatgaatgffffffatgfftaaftaafatgfatgfffffsdfatgffatgfffstaafftaafffffffffffffffatgtaaataa\n\natgffftaaf\n\natgffatgftaafftaa\n\natgatgftaafftaa\n\natgatgtaataa\n\ntttttttttttttaatgatgfffffffffftaa';
42
33
  let m;
43
34
  const orfRanges = [];
44
35
  //loop through orf hits!
@@ -103,8 +94,6 @@ export default function getOrfsFromSequence(options) {
103
94
  } else {
104
95
  orfEnds[orf.end] = index;
105
96
  if (!forward) {
106
- // if (originalSequenceLength - orf.end - 1 == 3657) {
107
- // }
108
97
  //this check needs to come after the above assignment of orfEnds
109
98
  //flip the start and ends
110
99
  const endHolder = orf.end; //temp variable