@teselagen/bio-parsers 0.4.10 → 0.4.12

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.js CHANGED
@@ -993,7 +993,7 @@ lodash.exports;
993
993
  return new LodashWrapper(value);
994
994
  }
995
995
  __name(lodash2, "lodash");
996
- var baseCreate = function() {
996
+ var baseCreate = /* @__PURE__ */ function() {
997
997
  function object() {
998
998
  }
999
999
  __name(object, "object");
@@ -4618,7 +4618,7 @@ lodash.exports;
4618
4618
  var gte = createRelationalOperation(function(value, other) {
4619
4619
  return value >= other;
4620
4620
  });
4621
- var isArguments = baseIsArguments(function() {
4621
+ var isArguments = baseIsArguments(/* @__PURE__ */ function() {
4622
4622
  return arguments;
4623
4623
  }()) ? baseIsArguments : function(value) {
4624
4624
  return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
@@ -6169,7 +6169,7 @@ lodash.exports;
6169
6169
  }).call(commonjsGlobal);
6170
6170
  })(lodash, lodash.exports);
6171
6171
  var lodashExports = lodash.exports;
6172
- const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO";
6172
+ const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO*";
6173
6173
  const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
6174
6174
  const ambiguous_rna_letters = "GAUCRYWSMKHBVDN";
6175
6175
  const aminoAcidToDegenerateDnaMap = {
@@ -6884,7 +6884,7 @@ __name(requireEmpty, "requireEmpty");
6884
6884
  throw new TypeError("Cannot call a class as a function");
6885
6885
  }
6886
6886
  }, "classCallCheck");
6887
- var createClass = function() {
6887
+ var createClass = /* @__PURE__ */ function() {
6888
6888
  function defineProperties(target, props) {
6889
6889
  for (var i = 0; i < props.length; i++) {
6890
6890
  var descriptor = props[i];
@@ -6946,7 +6946,7 @@ __name(requireEmpty, "requireEmpty");
6946
6946
  }
6947
6947
  return call && (typeof call === "object" || typeof call === "function") ? call : self2;
6948
6948
  }, "possibleConstructorReturn");
6949
- var slicedToArray = function() {
6949
+ var slicedToArray = /* @__PURE__ */ function() {
6950
6950
  function sliceIterator(arr, i) {
6951
6951
  var _arr = [];
6952
6952
  var _n = true;
@@ -11274,6 +11274,20 @@ const annotationTypes = [
11274
11274
  "primers",
11275
11275
  "guides"
11276
11276
  ];
11277
+ let allWarnings = [];
11278
+ let makeToast = /* @__PURE__ */ __name(() => {
11279
+ if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
11280
+ window.toastr.warning(lodashExports.uniq(allWarnings).join("\n"));
11281
+ }
11282
+ allWarnings = [];
11283
+ }, "makeToast");
11284
+ makeToast = lodashExports.debounce(makeToast, 200);
11285
+ function showWarnings(warnings) {
11286
+ allWarnings = allWarnings.concat(warnings);
11287
+ makeToast.cancel();
11288
+ makeToast();
11289
+ }
11290
+ __name(showWarnings, "showWarnings");
11277
11291
  function filterSequenceString(sequenceString = "", {
11278
11292
  additionalValidChars = "",
11279
11293
  isOligo,
@@ -11321,14 +11335,15 @@ function filterSequenceString(sequenceString = "", {
11321
11335
  });
11322
11336
  if (sequenceString.length !== sanitizedVal.length) {
11323
11337
  warnings.push(
11324
- `${name ? `Sequence ${name}: ` : ""}Invalid character(s) detected and removed: ${invalidChars.slice(0, 100).join(", ")} `
11338
+ `${name ? `Sequence ${name}: ` : ""}Invalid character(s) detected and removed: ${lodashExports.uniq(invalidChars).map((c) => {
11339
+ if (c === " ") {
11340
+ return "space";
11341
+ }
11342
+ return c;
11343
+ }).slice(0, 100).join(", ")} `
11325
11344
  );
11326
11345
  }
11327
- if (typeof window !== "undefined" && window.toastr && warnings.length) {
11328
- warnings.forEach((warning) => {
11329
- window.toastr.warning(warning);
11330
- });
11331
- }
11346
+ showWarnings(warnings);
11332
11347
  return [sanitizedVal, warnings];
11333
11348
  }
11334
11349
  __name(filterSequenceString, "filterSequenceString");
@@ -11668,12 +11683,12 @@ const calcTmMethods = {
11668
11683
  // Monovalent salt concentration. 50mM is typical for PCR.
11669
11684
  /**
11670
11685
  * Calculates temperature for DNA sequence using a given algorithm.
11671
- * @param {String} sequence The DNA sequence to use.
11672
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
11673
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
11674
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
11675
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
11676
- * @return {Double} Temperature for the given sequence, in Celsius.
11686
+ * sequence - The DNA sequence to use.
11687
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
11688
+ * A - Helix initation for deltaS. Defaults to -10.8.
11689
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
11690
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
11691
+ * return - Temperature for the given sequence, in Celsius.
11677
11692
  */
11678
11693
  calculateTemperature: function(sequence, type, A, R, C, Na) {
11679
11694
  if (typeof type === "undefined") {
@@ -21064,7 +21079,6 @@ const util$1 = util$4;
21064
21079
  const xmlNode = xmlNode$1;
21065
21080
  const readDocType = DocTypeReader;
21066
21081
  const toNumber = strnum;
21067
- "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, util$1.nameRegexp);
21068
21082
  let OrderedObjParser$1 = (_a = class {
21069
21083
  constructor(options) {
21070
21084
  this.options = options;
@@ -21278,18 +21292,19 @@ const parseXml = /* @__PURE__ */ __name(function(xmlData) {
21278
21292
  const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
21279
21293
  const tagExp = xmlData.substring(i + 9, closeIndex);
21280
21294
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
21295
+ let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
21296
+ if (val2 == void 0)
21297
+ val2 = "";
21281
21298
  if (this.options.cdataPropName) {
21282
21299
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
21283
21300
  } else {
21284
- let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true);
21285
- if (val2 == void 0)
21286
- val2 = "";
21287
21301
  currentNode.add(this.options.textNodeName, val2);
21288
21302
  }
21289
21303
  i = closeIndex + 2;
21290
21304
  } else {
21291
21305
  let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
21292
21306
  let tagName = result.tagName;
21307
+ const rawTagName = result.rawTagName;
21293
21308
  let tagExp = result.tagExp;
21294
21309
  let attrExpPresent = result.attrExpPresent;
21295
21310
  let closeIndex = result.closeIndex;
@@ -21316,9 +21331,9 @@ const parseXml = /* @__PURE__ */ __name(function(xmlData) {
21316
21331
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
21317
21332
  i = result.closeIndex;
21318
21333
  } else {
21319
- const result2 = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
21334
+ const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
21320
21335
  if (!result2)
21321
- throw new Error(`Unexpected end of ${tagName}`);
21336
+ throw new Error(`Unexpected end of ${rawTagName}`);
21322
21337
  i = result2.i;
21323
21338
  tagContent = result2.tagContent;
21324
21339
  }
@@ -21480,9 +21495,10 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
21480
21495
  let tagName = tagExp;
21481
21496
  let attrExpPresent = true;
21482
21497
  if (separatorIndex !== -1) {
21483
- tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, "");
21484
- tagExp = tagExp.substr(separatorIndex + 1);
21498
+ tagName = tagExp.substring(0, separatorIndex);
21499
+ tagExp = tagExp.substring(separatorIndex + 1).trimStart();
21485
21500
  }
21501
+ const rawTagName = tagName;
21486
21502
  if (removeNSPrefix) {
21487
21503
  const colonIndex = tagName.indexOf(":");
21488
21504
  if (colonIndex !== -1) {
@@ -21494,7 +21510,8 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
21494
21510
  tagName,
21495
21511
  tagExp,
21496
21512
  closeIndex,
21497
- attrExpPresent
21513
+ attrExpPresent,
21514
+ rawTagName
21498
21515
  };
21499
21516
  }
21500
21517
  __name(readTagExp, "readTagExp");
@@ -21724,6 +21741,8 @@ function arrToStr(arr, options, jPath, indentation) {
21724
21741
  for (let i = 0; i < arr.length; i++) {
21725
21742
  const tagObj = arr[i];
21726
21743
  const tagName = propName(tagObj);
21744
+ if (tagName === void 0)
21745
+ continue;
21727
21746
  let newJPath = "";
21728
21747
  if (jPath.length === 0)
21729
21748
  newJPath = tagName;
@@ -21795,6 +21814,8 @@ function propName(obj) {
21795
21814
  const keys = Object.keys(obj);
21796
21815
  for (let i = 0; i < keys.length; i++) {
21797
21816
  const key = keys[i];
21817
+ if (!obj.hasOwnProperty(key))
21818
+ continue;
21798
21819
  if (key !== ":@")
21799
21820
  return key;
21800
21821
  }
@@ -21804,6 +21825,8 @@ function attr_to_str(attrMap, options) {
21804
21825
  let attrStr = "";
21805
21826
  if (attrMap && !options.ignoreAttributes) {
21806
21827
  for (let attr in attrMap) {
21828
+ if (!attrMap.hasOwnProperty(attr))
21829
+ continue;
21807
21830
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
21808
21831
  attrVal = replaceEntitiesValue(attrVal, options);
21809
21832
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -21912,6 +21935,8 @@ Builder.prototype.j2x = function(jObj, level) {
21912
21935
  let attrStr = "";
21913
21936
  let val2 = "";
21914
21937
  for (let key in jObj) {
21938
+ if (!Object.prototype.hasOwnProperty.call(jObj, key))
21939
+ continue;
21915
21940
  if (typeof jObj[key] === "undefined") {
21916
21941
  if (this.isAttribute(key)) {
21917
21942
  val2 += "";
@@ -30351,9 +30376,7 @@ var slc = /* @__PURE__ */ __name(function(v, s, e) {
30351
30376
  s = 0;
30352
30377
  if (e == null || e > v.length)
30353
30378
  e = v.length;
30354
- var n = new u8(e - s);
30355
- n.set(v.subarray(s, e));
30356
- return n;
30379
+ return new u8(v.subarray(s, e));
30357
30380
  }, "slc");
30358
30381
  var ec = [
30359
30382
  "unexpected EOF",
@@ -30385,9 +30408,10 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30385
30408
  var sl = dat.length, dl = dict ? dict.length : 0;
30386
30409
  if (!sl || st.f && !st.l)
30387
30410
  return buf || new u8(0);
30388
- var noBuf = !buf || st.i != 2;
30411
+ var noBuf = !buf;
30412
+ var resize = noBuf || st.i != 2;
30389
30413
  var noSt = st.i;
30390
- if (!buf)
30414
+ if (noBuf)
30391
30415
  buf = new u8(sl * 3);
30392
30416
  var cbuf = /* @__PURE__ */ __name(function(l2) {
30393
30417
  var bl = buf.length;
@@ -30411,7 +30435,7 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30411
30435
  err(0);
30412
30436
  break;
30413
30437
  }
30414
- if (noBuf)
30438
+ if (resize)
30415
30439
  cbuf(bt + l);
30416
30440
  buf.set(dat.subarray(s, t), bt);
30417
30441
  st.b = bt += l, st.p = pos = t * 8, st.f = final;
@@ -30461,7 +30485,7 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30461
30485
  break;
30462
30486
  }
30463
30487
  }
30464
- if (noBuf)
30488
+ if (resize)
30465
30489
  cbuf(bt + 131072);
30466
30490
  var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
30467
30491
  var lpos = pos;
@@ -30501,7 +30525,7 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30501
30525
  err(0);
30502
30526
  break;
30503
30527
  }
30504
- if (noBuf)
30528
+ if (resize)
30505
30529
  cbuf(bt + 131072);
30506
30530
  var end = bt + add;
30507
30531
  if (bt < dt) {
@@ -30511,20 +30535,15 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30511
30535
  for (; bt < dend; ++bt)
30512
30536
  buf[bt] = dict[shift + bt];
30513
30537
  }
30514
- for (; bt < end; bt += 4) {
30538
+ for (; bt < end; ++bt)
30515
30539
  buf[bt] = buf[bt - dt];
30516
- buf[bt + 1] = buf[bt + 1 - dt];
30517
- buf[bt + 2] = buf[bt + 2 - dt];
30518
- buf[bt + 3] = buf[bt + 3 - dt];
30519
- }
30520
- bt = end;
30521
30540
  }
30522
30541
  }
30523
30542
  st.l = lm, st.p = lpos, st.b = bt, st.f = final;
30524
30543
  if (lm)
30525
30544
  final = 1, st.m = lbt, st.d = dm, st.n = dbt;
30526
30545
  } while (!final);
30527
- return bt == buf.length ? buf : slc(buf, 0, bt);
30546
+ return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
30528
30547
  }, "inflt");
30529
30548
  var et = /* @__PURE__ */ new u8(0);
30530
30549
  var b2 = /* @__PURE__ */ __name(function(d, b) {
@@ -32688,13 +32707,12 @@ function jsonToFasta(jsonSequence, options) {
32688
32707
  proteinSize,
32689
32708
  proteinSequence
32690
32709
  } = cleanedData;
32691
- options = options || {};
32692
- let seqToUse = sequence;
32693
- let sizeToUse = size;
32694
- if (isProtein && proteinSequence) {
32695
- seqToUse = proteinSequence;
32696
- sizeToUse = proteinSize;
32697
- }
32710
+ options = __spreadValues({
32711
+ sequence: isProtein && proteinSequence ? proteinSequence : sequence,
32712
+ size: isProtein && proteinSequence ? proteinSize : size
32713
+ }, options);
32714
+ const seqToUse = options.sequence;
32715
+ const sizeToUse = options.size;
32698
32716
  let fastaString = "";
32699
32717
  fastaString += `>${name || "Untitled Sequence"}|`;
32700
32718
  fastaString += "|" + sizeToUse;
package/index.mjs CHANGED
@@ -991,7 +991,7 @@ lodash.exports;
991
991
  return new LodashWrapper(value);
992
992
  }
993
993
  __name(lodash2, "lodash");
994
- var baseCreate = function() {
994
+ var baseCreate = /* @__PURE__ */ function() {
995
995
  function object() {
996
996
  }
997
997
  __name(object, "object");
@@ -4616,7 +4616,7 @@ lodash.exports;
4616
4616
  var gte = createRelationalOperation(function(value, other) {
4617
4617
  return value >= other;
4618
4618
  });
4619
- var isArguments = baseIsArguments(function() {
4619
+ var isArguments = baseIsArguments(/* @__PURE__ */ function() {
4620
4620
  return arguments;
4621
4621
  }()) ? baseIsArguments : function(value) {
4622
4622
  return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
@@ -6167,7 +6167,7 @@ lodash.exports;
6167
6167
  }).call(commonjsGlobal);
6168
6168
  })(lodash, lodash.exports);
6169
6169
  var lodashExports = lodash.exports;
6170
- const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO";
6170
+ const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO*";
6171
6171
  const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
6172
6172
  const ambiguous_rna_letters = "GAUCRYWSMKHBVDN";
6173
6173
  const aminoAcidToDegenerateDnaMap = {
@@ -6882,7 +6882,7 @@ __name(requireEmpty, "requireEmpty");
6882
6882
  throw new TypeError("Cannot call a class as a function");
6883
6883
  }
6884
6884
  }, "classCallCheck");
6885
- var createClass = function() {
6885
+ var createClass = /* @__PURE__ */ function() {
6886
6886
  function defineProperties(target, props) {
6887
6887
  for (var i = 0; i < props.length; i++) {
6888
6888
  var descriptor = props[i];
@@ -6944,7 +6944,7 @@ __name(requireEmpty, "requireEmpty");
6944
6944
  }
6945
6945
  return call && (typeof call === "object" || typeof call === "function") ? call : self2;
6946
6946
  }, "possibleConstructorReturn");
6947
- var slicedToArray = function() {
6947
+ var slicedToArray = /* @__PURE__ */ function() {
6948
6948
  function sliceIterator(arr, i) {
6949
6949
  var _arr = [];
6950
6950
  var _n = true;
@@ -11272,6 +11272,20 @@ const annotationTypes = [
11272
11272
  "primers",
11273
11273
  "guides"
11274
11274
  ];
11275
+ let allWarnings = [];
11276
+ let makeToast = /* @__PURE__ */ __name(() => {
11277
+ if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
11278
+ window.toastr.warning(lodashExports.uniq(allWarnings).join("\n"));
11279
+ }
11280
+ allWarnings = [];
11281
+ }, "makeToast");
11282
+ makeToast = lodashExports.debounce(makeToast, 200);
11283
+ function showWarnings(warnings) {
11284
+ allWarnings = allWarnings.concat(warnings);
11285
+ makeToast.cancel();
11286
+ makeToast();
11287
+ }
11288
+ __name(showWarnings, "showWarnings");
11275
11289
  function filterSequenceString(sequenceString = "", {
11276
11290
  additionalValidChars = "",
11277
11291
  isOligo,
@@ -11319,14 +11333,15 @@ function filterSequenceString(sequenceString = "", {
11319
11333
  });
11320
11334
  if (sequenceString.length !== sanitizedVal.length) {
11321
11335
  warnings.push(
11322
- `${name ? `Sequence ${name}: ` : ""}Invalid character(s) detected and removed: ${invalidChars.slice(0, 100).join(", ")} `
11336
+ `${name ? `Sequence ${name}: ` : ""}Invalid character(s) detected and removed: ${lodashExports.uniq(invalidChars).map((c) => {
11337
+ if (c === " ") {
11338
+ return "space";
11339
+ }
11340
+ return c;
11341
+ }).slice(0, 100).join(", ")} `
11323
11342
  );
11324
11343
  }
11325
- if (typeof window !== "undefined" && window.toastr && warnings.length) {
11326
- warnings.forEach((warning) => {
11327
- window.toastr.warning(warning);
11328
- });
11329
- }
11344
+ showWarnings(warnings);
11330
11345
  return [sanitizedVal, warnings];
11331
11346
  }
11332
11347
  __name(filterSequenceString, "filterSequenceString");
@@ -11666,12 +11681,12 @@ const calcTmMethods = {
11666
11681
  // Monovalent salt concentration. 50mM is typical for PCR.
11667
11682
  /**
11668
11683
  * Calculates temperature for DNA sequence using a given algorithm.
11669
- * @param {String} sequence The DNA sequence to use.
11670
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
11671
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
11672
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
11673
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
11674
- * @return {Double} Temperature for the given sequence, in Celsius.
11684
+ * sequence - The DNA sequence to use.
11685
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
11686
+ * A - Helix initation for deltaS. Defaults to -10.8.
11687
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
11688
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
11689
+ * return - Temperature for the given sequence, in Celsius.
11675
11690
  */
11676
11691
  calculateTemperature: function(sequence, type, A, R, C, Na) {
11677
11692
  if (typeof type === "undefined") {
@@ -21062,7 +21077,6 @@ const util$1 = util$4;
21062
21077
  const xmlNode = xmlNode$1;
21063
21078
  const readDocType = DocTypeReader;
21064
21079
  const toNumber = strnum;
21065
- "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, util$1.nameRegexp);
21066
21080
  let OrderedObjParser$1 = (_a = class {
21067
21081
  constructor(options) {
21068
21082
  this.options = options;
@@ -21276,18 +21290,19 @@ const parseXml = /* @__PURE__ */ __name(function(xmlData) {
21276
21290
  const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
21277
21291
  const tagExp = xmlData.substring(i + 9, closeIndex);
21278
21292
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
21293
+ let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
21294
+ if (val2 == void 0)
21295
+ val2 = "";
21279
21296
  if (this.options.cdataPropName) {
21280
21297
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
21281
21298
  } else {
21282
- let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true);
21283
- if (val2 == void 0)
21284
- val2 = "";
21285
21299
  currentNode.add(this.options.textNodeName, val2);
21286
21300
  }
21287
21301
  i = closeIndex + 2;
21288
21302
  } else {
21289
21303
  let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
21290
21304
  let tagName = result.tagName;
21305
+ const rawTagName = result.rawTagName;
21291
21306
  let tagExp = result.tagExp;
21292
21307
  let attrExpPresent = result.attrExpPresent;
21293
21308
  let closeIndex = result.closeIndex;
@@ -21314,9 +21329,9 @@ const parseXml = /* @__PURE__ */ __name(function(xmlData) {
21314
21329
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
21315
21330
  i = result.closeIndex;
21316
21331
  } else {
21317
- const result2 = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
21332
+ const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
21318
21333
  if (!result2)
21319
- throw new Error(`Unexpected end of ${tagName}`);
21334
+ throw new Error(`Unexpected end of ${rawTagName}`);
21320
21335
  i = result2.i;
21321
21336
  tagContent = result2.tagContent;
21322
21337
  }
@@ -21478,9 +21493,10 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
21478
21493
  let tagName = tagExp;
21479
21494
  let attrExpPresent = true;
21480
21495
  if (separatorIndex !== -1) {
21481
- tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, "");
21482
- tagExp = tagExp.substr(separatorIndex + 1);
21496
+ tagName = tagExp.substring(0, separatorIndex);
21497
+ tagExp = tagExp.substring(separatorIndex + 1).trimStart();
21483
21498
  }
21499
+ const rawTagName = tagName;
21484
21500
  if (removeNSPrefix) {
21485
21501
  const colonIndex = tagName.indexOf(":");
21486
21502
  if (colonIndex !== -1) {
@@ -21492,7 +21508,8 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
21492
21508
  tagName,
21493
21509
  tagExp,
21494
21510
  closeIndex,
21495
- attrExpPresent
21511
+ attrExpPresent,
21512
+ rawTagName
21496
21513
  };
21497
21514
  }
21498
21515
  __name(readTagExp, "readTagExp");
@@ -21722,6 +21739,8 @@ function arrToStr(arr, options, jPath, indentation) {
21722
21739
  for (let i = 0; i < arr.length; i++) {
21723
21740
  const tagObj = arr[i];
21724
21741
  const tagName = propName(tagObj);
21742
+ if (tagName === void 0)
21743
+ continue;
21725
21744
  let newJPath = "";
21726
21745
  if (jPath.length === 0)
21727
21746
  newJPath = tagName;
@@ -21793,6 +21812,8 @@ function propName(obj) {
21793
21812
  const keys = Object.keys(obj);
21794
21813
  for (let i = 0; i < keys.length; i++) {
21795
21814
  const key = keys[i];
21815
+ if (!obj.hasOwnProperty(key))
21816
+ continue;
21796
21817
  if (key !== ":@")
21797
21818
  return key;
21798
21819
  }
@@ -21802,6 +21823,8 @@ function attr_to_str(attrMap, options) {
21802
21823
  let attrStr = "";
21803
21824
  if (attrMap && !options.ignoreAttributes) {
21804
21825
  for (let attr in attrMap) {
21826
+ if (!attrMap.hasOwnProperty(attr))
21827
+ continue;
21805
21828
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
21806
21829
  attrVal = replaceEntitiesValue(attrVal, options);
21807
21830
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -21910,6 +21933,8 @@ Builder.prototype.j2x = function(jObj, level) {
21910
21933
  let attrStr = "";
21911
21934
  let val2 = "";
21912
21935
  for (let key in jObj) {
21936
+ if (!Object.prototype.hasOwnProperty.call(jObj, key))
21937
+ continue;
21913
21938
  if (typeof jObj[key] === "undefined") {
21914
21939
  if (this.isAttribute(key)) {
21915
21940
  val2 += "";
@@ -30349,9 +30374,7 @@ var slc = /* @__PURE__ */ __name(function(v, s, e) {
30349
30374
  s = 0;
30350
30375
  if (e == null || e > v.length)
30351
30376
  e = v.length;
30352
- var n = new u8(e - s);
30353
- n.set(v.subarray(s, e));
30354
- return n;
30377
+ return new u8(v.subarray(s, e));
30355
30378
  }, "slc");
30356
30379
  var ec = [
30357
30380
  "unexpected EOF",
@@ -30383,9 +30406,10 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30383
30406
  var sl = dat.length, dl = dict ? dict.length : 0;
30384
30407
  if (!sl || st.f && !st.l)
30385
30408
  return buf || new u8(0);
30386
- var noBuf = !buf || st.i != 2;
30409
+ var noBuf = !buf;
30410
+ var resize = noBuf || st.i != 2;
30387
30411
  var noSt = st.i;
30388
- if (!buf)
30412
+ if (noBuf)
30389
30413
  buf = new u8(sl * 3);
30390
30414
  var cbuf = /* @__PURE__ */ __name(function(l2) {
30391
30415
  var bl = buf.length;
@@ -30409,7 +30433,7 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30409
30433
  err(0);
30410
30434
  break;
30411
30435
  }
30412
- if (noBuf)
30436
+ if (resize)
30413
30437
  cbuf(bt + l);
30414
30438
  buf.set(dat.subarray(s, t), bt);
30415
30439
  st.b = bt += l, st.p = pos = t * 8, st.f = final;
@@ -30459,7 +30483,7 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30459
30483
  break;
30460
30484
  }
30461
30485
  }
30462
- if (noBuf)
30486
+ if (resize)
30463
30487
  cbuf(bt + 131072);
30464
30488
  var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
30465
30489
  var lpos = pos;
@@ -30499,7 +30523,7 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30499
30523
  err(0);
30500
30524
  break;
30501
30525
  }
30502
- if (noBuf)
30526
+ if (resize)
30503
30527
  cbuf(bt + 131072);
30504
30528
  var end = bt + add;
30505
30529
  if (bt < dt) {
@@ -30509,20 +30533,15 @@ var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) {
30509
30533
  for (; bt < dend; ++bt)
30510
30534
  buf[bt] = dict[shift + bt];
30511
30535
  }
30512
- for (; bt < end; bt += 4) {
30536
+ for (; bt < end; ++bt)
30513
30537
  buf[bt] = buf[bt - dt];
30514
- buf[bt + 1] = buf[bt + 1 - dt];
30515
- buf[bt + 2] = buf[bt + 2 - dt];
30516
- buf[bt + 3] = buf[bt + 3 - dt];
30517
- }
30518
- bt = end;
30519
30538
  }
30520
30539
  }
30521
30540
  st.l = lm, st.p = lpos, st.b = bt, st.f = final;
30522
30541
  if (lm)
30523
30542
  final = 1, st.m = lbt, st.d = dm, st.n = dbt;
30524
30543
  } while (!final);
30525
- return bt == buf.length ? buf : slc(buf, 0, bt);
30544
+ return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
30526
30545
  }, "inflt");
30527
30546
  var et = /* @__PURE__ */ new u8(0);
30528
30547
  var b2 = /* @__PURE__ */ __name(function(d, b) {
@@ -32686,13 +32705,12 @@ function jsonToFasta(jsonSequence, options) {
32686
32705
  proteinSize,
32687
32706
  proteinSequence
32688
32707
  } = cleanedData;
32689
- options = options || {};
32690
- let seqToUse = sequence;
32691
- let sizeToUse = size;
32692
- if (isProtein && proteinSequence) {
32693
- seqToUse = proteinSequence;
32694
- sizeToUse = proteinSize;
32695
- }
32708
+ options = __spreadValues({
32709
+ sequence: isProtein && proteinSequence ? proteinSequence : sequence,
32710
+ size: isProtein && proteinSequence ? proteinSize : size
32711
+ }, options);
32712
+ const seqToUse = options.sequence;
32713
+ const sizeToUse = options.size;
32696
32714
  let fastaString = "";
32697
32715
  fastaString += `>${name || "Untitled Sequence"}|`;
32698
32716
  fastaString += "|" + sizeToUse;
package/index.umd.js CHANGED
@@ -1,4 +1,7 @@
1
- var __defProp = Object.defineProperty;
1
+ (function(global2, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.bioParsers = {}));
3
+ })(this, function(exports2) {
4
+ "use strict";var __defProp = Object.defineProperty;
2
5
  var __defProps = Object.defineProperties;
3
6
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -39,11 +42,8 @@ var __async = (__this, __arguments, generator) => {
39
42
  step((generator = generator.apply(__this, __arguments)).next());
40
43
  });
41
44
  };
42
- (function(global2, factory) {
43
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.bioParsers = {}));
44
- })(this, function(exports2) {
45
+
45
46
  var _a2, _b2;
46
- "use strict";
47
47
  const untitledSequenceName = "Untitled Sequence";
48
48
  const gbDivisions = {
49
49
  // https://www.ncbi.nlm.nih.gov/Sitemap/samplerecord.html#GenBankDivisionB
@@ -995,7 +995,7 @@ var __async = (__this, __arguments, generator) => {
995
995
  return new LodashWrapper(value);
996
996
  }
997
997
  __name(lodash2, "lodash");
998
- var baseCreate = function() {
998
+ var baseCreate = /* @__PURE__ */ function() {
999
999
  function object() {
1000
1000
  }
1001
1001
  __name(object, "object");
@@ -4620,7 +4620,7 @@ var __async = (__this, __arguments, generator) => {
4620
4620
  var gte = createRelationalOperation(function(value, other) {
4621
4621
  return value >= other;
4622
4622
  });
4623
- var isArguments = baseIsArguments(function() {
4623
+ var isArguments = baseIsArguments(/* @__PURE__ */ function() {
4624
4624
  return arguments;
4625
4625
  }()) ? baseIsArguments : function(value) {
4626
4626
  return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
@@ -6171,7 +6171,7 @@ var __async = (__this, __arguments, generator) => {
6171
6171
  }).call(commonjsGlobal);
6172
6172
  })(lodash, lodash.exports);
6173
6173
  var lodashExports = lodash.exports;
6174
- const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO";
6174
+ const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO*";
6175
6175
  const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
6176
6176
  const ambiguous_rna_letters = "GAUCRYWSMKHBVDN";
6177
6177
  const aminoAcidToDegenerateDnaMap = {
@@ -6886,7 +6886,7 @@ var __async = (__this, __arguments, generator) => {
6886
6886
  throw new TypeError("Cannot call a class as a function");
6887
6887
  }
6888
6888
  }, "classCallCheck");
6889
- var createClass = function() {
6889
+ var createClass = /* @__PURE__ */ function() {
6890
6890
  function defineProperties(target, props) {
6891
6891
  for (var i2 = 0; i2 < props.length; i2++) {
6892
6892
  var descriptor = props[i2];
@@ -6948,7 +6948,7 @@ var __async = (__this, __arguments, generator) => {
6948
6948
  }
6949
6949
  return call && (typeof call === "object" || typeof call === "function") ? call : self2;
6950
6950
  }, "possibleConstructorReturn");
6951
- var slicedToArray = function() {
6951
+ var slicedToArray = /* @__PURE__ */ function() {
6952
6952
  function sliceIterator(arr, i2) {
6953
6953
  var _arr = [];
6954
6954
  var _n = true;
@@ -11276,6 +11276,20 @@ var __async = (__this, __arguments, generator) => {
11276
11276
  "primers",
11277
11277
  "guides"
11278
11278
  ];
11279
+ let allWarnings = [];
11280
+ let makeToast = /* @__PURE__ */ __name(() => {
11281
+ if (typeof window !== "undefined" && window.toastr && allWarnings.length) {
11282
+ window.toastr.warning(lodashExports.uniq(allWarnings).join("\n"));
11283
+ }
11284
+ allWarnings = [];
11285
+ }, "makeToast");
11286
+ makeToast = lodashExports.debounce(makeToast, 200);
11287
+ function showWarnings(warnings) {
11288
+ allWarnings = allWarnings.concat(warnings);
11289
+ makeToast.cancel();
11290
+ makeToast();
11291
+ }
11292
+ __name(showWarnings, "showWarnings");
11279
11293
  function filterSequenceString(sequenceString = "", {
11280
11294
  additionalValidChars = "",
11281
11295
  isOligo,
@@ -11323,14 +11337,15 @@ var __async = (__this, __arguments, generator) => {
11323
11337
  });
11324
11338
  if (sequenceString.length !== sanitizedVal.length) {
11325
11339
  warnings.push(
11326
- `${name2 ? `Sequence ${name2}: ` : ""}Invalid character(s) detected and removed: ${invalidChars.slice(0, 100).join(", ")} `
11340
+ `${name2 ? `Sequence ${name2}: ` : ""}Invalid character(s) detected and removed: ${lodashExports.uniq(invalidChars).map((c) => {
11341
+ if (c === " ") {
11342
+ return "space";
11343
+ }
11344
+ return c;
11345
+ }).slice(0, 100).join(", ")} `
11327
11346
  );
11328
11347
  }
11329
- if (typeof window !== "undefined" && window.toastr && warnings.length) {
11330
- warnings.forEach((warning) => {
11331
- window.toastr.warning(warning);
11332
- });
11333
- }
11348
+ showWarnings(warnings);
11334
11349
  return [sanitizedVal, warnings];
11335
11350
  }
11336
11351
  __name(filterSequenceString, "filterSequenceString");
@@ -11670,12 +11685,12 @@ var __async = (__this, __arguments, generator) => {
11670
11685
  // Monovalent salt concentration. 50mM is typical for PCR.
11671
11686
  /**
11672
11687
  * Calculates temperature for DNA sequence using a given algorithm.
11673
- * @param {String} sequence The DNA sequence to use.
11674
- * @param {String} type Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
11675
- * @param {Double} A Helix initation for deltaS. Defaults to -10.8.
11676
- * @param {Double} R The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
11677
- * @param {Double} Na THe monovalent salt concentration. Defaults to 50e-3M.
11678
- * @return {Double} Temperature for the given sequence, in Celsius.
11688
+ * sequence - The DNA sequence to use.
11689
+ * type - Either Teselagen.bio.tools.TemperatureCalculator.TABLE_BRESLAUER, TABLE_SUGIMOTO, or TABLE_UNIFIED
11690
+ * A - Helix initation for deltaS. Defaults to -10.8.
11691
+ * R - The gas constant, in cal/(K*mol). Defaults to 0.5e-6M.
11692
+ * Na - THe monovalent salt concentration. Defaults to 50e-3M.
11693
+ * return - Temperature for the given sequence, in Celsius.
11679
11694
  */
11680
11695
  calculateTemperature: function(sequence, type, A, R, C, Na) {
11681
11696
  if (typeof type === "undefined") {
@@ -21066,7 +21081,6 @@ var __async = (__this, __arguments, generator) => {
21066
21081
  const xmlNode = xmlNode$1;
21067
21082
  const readDocType = DocTypeReader;
21068
21083
  const toNumber = strnum;
21069
- "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, util$1.nameRegexp);
21070
21084
  let OrderedObjParser$1 = (_a2 = class {
21071
21085
  constructor(options) {
21072
21086
  this.options = options;
@@ -21280,18 +21294,19 @@ var __async = (__this, __arguments, generator) => {
21280
21294
  const closeIndex = findClosingIndex(xmlData, "]]>", i2, "CDATA is not closed.") - 2;
21281
21295
  const tagExp = xmlData.substring(i2 + 9, closeIndex);
21282
21296
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
21297
+ let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
21298
+ if (val2 == void 0)
21299
+ val2 = "";
21283
21300
  if (this.options.cdataPropName) {
21284
21301
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
21285
21302
  } else {
21286
- let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true);
21287
- if (val2 == void 0)
21288
- val2 = "";
21289
21303
  currentNode.add(this.options.textNodeName, val2);
21290
21304
  }
21291
21305
  i2 = closeIndex + 2;
21292
21306
  } else {
21293
21307
  let result = readTagExp(xmlData, i2, this.options.removeNSPrefix);
21294
21308
  let tagName = result.tagName;
21309
+ const rawTagName = result.rawTagName;
21295
21310
  let tagExp = result.tagExp;
21296
21311
  let attrExpPresent = result.attrExpPresent;
21297
21312
  let closeIndex = result.closeIndex;
@@ -21318,9 +21333,9 @@ var __async = (__this, __arguments, generator) => {
21318
21333
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
21319
21334
  i2 = result.closeIndex;
21320
21335
  } else {
21321
- const result2 = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
21336
+ const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
21322
21337
  if (!result2)
21323
- throw new Error(`Unexpected end of ${tagName}`);
21338
+ throw new Error(`Unexpected end of ${rawTagName}`);
21324
21339
  i2 = result2.i;
21325
21340
  tagContent = result2.tagContent;
21326
21341
  }
@@ -21482,9 +21497,10 @@ var __async = (__this, __arguments, generator) => {
21482
21497
  let tagName = tagExp;
21483
21498
  let attrExpPresent = true;
21484
21499
  if (separatorIndex !== -1) {
21485
- tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, "");
21486
- tagExp = tagExp.substr(separatorIndex + 1);
21500
+ tagName = tagExp.substring(0, separatorIndex);
21501
+ tagExp = tagExp.substring(separatorIndex + 1).trimStart();
21487
21502
  }
21503
+ const rawTagName = tagName;
21488
21504
  if (removeNSPrefix) {
21489
21505
  const colonIndex = tagName.indexOf(":");
21490
21506
  if (colonIndex !== -1) {
@@ -21496,7 +21512,8 @@ var __async = (__this, __arguments, generator) => {
21496
21512
  tagName,
21497
21513
  tagExp,
21498
21514
  closeIndex,
21499
- attrExpPresent
21515
+ attrExpPresent,
21516
+ rawTagName
21500
21517
  };
21501
21518
  }
21502
21519
  __name(readTagExp, "readTagExp");
@@ -21726,6 +21743,8 @@ var __async = (__this, __arguments, generator) => {
21726
21743
  for (let i2 = 0; i2 < arr.length; i2++) {
21727
21744
  const tagObj = arr[i2];
21728
21745
  const tagName = propName(tagObj);
21746
+ if (tagName === void 0)
21747
+ continue;
21729
21748
  let newJPath = "";
21730
21749
  if (jPath.length === 0)
21731
21750
  newJPath = tagName;
@@ -21797,6 +21816,8 @@ var __async = (__this, __arguments, generator) => {
21797
21816
  const keys = Object.keys(obj);
21798
21817
  for (let i2 = 0; i2 < keys.length; i2++) {
21799
21818
  const key = keys[i2];
21819
+ if (!obj.hasOwnProperty(key))
21820
+ continue;
21800
21821
  if (key !== ":@")
21801
21822
  return key;
21802
21823
  }
@@ -21806,6 +21827,8 @@ var __async = (__this, __arguments, generator) => {
21806
21827
  let attrStr = "";
21807
21828
  if (attrMap && !options.ignoreAttributes) {
21808
21829
  for (let attr in attrMap) {
21830
+ if (!attrMap.hasOwnProperty(attr))
21831
+ continue;
21809
21832
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
21810
21833
  attrVal = replaceEntitiesValue(attrVal, options);
21811
21834
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -21914,6 +21937,8 @@ var __async = (__this, __arguments, generator) => {
21914
21937
  let attrStr = "";
21915
21938
  let val2 = "";
21916
21939
  for (let key in jObj) {
21940
+ if (!Object.prototype.hasOwnProperty.call(jObj, key))
21941
+ continue;
21917
21942
  if (typeof jObj[key] === "undefined") {
21918
21943
  if (this.isAttribute(key)) {
21919
21944
  val2 += "";
@@ -30353,9 +30378,7 @@ ${seq.sequence}
30353
30378
  s = 0;
30354
30379
  if (e == null || e > v.length)
30355
30380
  e = v.length;
30356
- var n = new u8(e - s);
30357
- n.set(v.subarray(s, e));
30358
- return n;
30381
+ return new u8(v.subarray(s, e));
30359
30382
  }, "slc");
30360
30383
  var ec = [
30361
30384
  "unexpected EOF",
@@ -30387,9 +30410,10 @@ ${seq.sequence}
30387
30410
  var sl = dat.length, dl = dict ? dict.length : 0;
30388
30411
  if (!sl || st.f && !st.l)
30389
30412
  return buf || new u8(0);
30390
- var noBuf = !buf || st.i != 2;
30413
+ var noBuf = !buf;
30414
+ var resize = noBuf || st.i != 2;
30391
30415
  var noSt = st.i;
30392
- if (!buf)
30416
+ if (noBuf)
30393
30417
  buf = new u8(sl * 3);
30394
30418
  var cbuf = /* @__PURE__ */ __name(function(l2) {
30395
30419
  var bl = buf.length;
@@ -30413,7 +30437,7 @@ ${seq.sequence}
30413
30437
  err(0);
30414
30438
  break;
30415
30439
  }
30416
- if (noBuf)
30440
+ if (resize)
30417
30441
  cbuf(bt + l);
30418
30442
  buf.set(dat.subarray(s, t), bt);
30419
30443
  st.b = bt += l, st.p = pos = t * 8, st.f = final;
@@ -30463,7 +30487,7 @@ ${seq.sequence}
30463
30487
  break;
30464
30488
  }
30465
30489
  }
30466
- if (noBuf)
30490
+ if (resize)
30467
30491
  cbuf(bt + 131072);
30468
30492
  var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
30469
30493
  var lpos = pos;
@@ -30503,7 +30527,7 @@ ${seq.sequence}
30503
30527
  err(0);
30504
30528
  break;
30505
30529
  }
30506
- if (noBuf)
30530
+ if (resize)
30507
30531
  cbuf(bt + 131072);
30508
30532
  var end = bt + add;
30509
30533
  if (bt < dt) {
@@ -30513,20 +30537,15 @@ ${seq.sequence}
30513
30537
  for (; bt < dend; ++bt)
30514
30538
  buf[bt] = dict[shift + bt];
30515
30539
  }
30516
- for (; bt < end; bt += 4) {
30540
+ for (; bt < end; ++bt)
30517
30541
  buf[bt] = buf[bt - dt];
30518
- buf[bt + 1] = buf[bt + 1 - dt];
30519
- buf[bt + 2] = buf[bt + 2 - dt];
30520
- buf[bt + 3] = buf[bt + 3 - dt];
30521
- }
30522
- bt = end;
30523
30542
  }
30524
30543
  }
30525
30544
  st.l = lm, st.p = lpos, st.b = bt, st.f = final;
30526
30545
  if (lm)
30527
30546
  final = 1, st.m = lbt, st.d = dm, st.n = dbt;
30528
30547
  } while (!final);
30529
- return bt == buf.length ? buf : slc(buf, 0, bt);
30548
+ return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
30530
30549
  }, "inflt");
30531
30550
  var et = /* @__PURE__ */ new u8(0);
30532
30551
  var b2 = /* @__PURE__ */ __name(function(d, b) {
@@ -32690,13 +32709,12 @@ ${seq.sequence}
32690
32709
  proteinSize,
32691
32710
  proteinSequence
32692
32711
  } = cleanedData;
32693
- options = options || {};
32694
- let seqToUse = sequence;
32695
- let sizeToUse = size;
32696
- if (isProtein && proteinSequence) {
32697
- seqToUse = proteinSequence;
32698
- sizeToUse = proteinSize;
32699
- }
32712
+ options = __spreadValues({
32713
+ sequence: isProtein && proteinSequence ? proteinSequence : sequence,
32714
+ size: isProtein && proteinSequence ? proteinSize : size
32715
+ }, options);
32716
+ const seqToUse = options.sequence;
32717
+ const sizeToUse = options.size;
32700
32718
  let fastaString = "";
32701
32719
  fastaString += `>${name2 || "Untitled Sequence"}|`;
32702
32720
  fastaString += "|" + sizeToUse;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@teselagen/bio-parsers",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "dependencies": {
5
- "@teselagen/sequence-utils": "0.3.15",
5
+ "@teselagen/sequence-utils": "0.3.21",
6
6
  "@teselagen/range-utils": "0.3.7",
7
7
  "@gmod/gff": "^1.2.1",
8
8
  "buffer": "^6.0.3",
@@ -693,8 +693,8 @@ function genbankToJson(string, options = {}) {
693
693
  feat.notes.direction[0].toUpperCase() === "BOTH"
694
694
  ? "BOTH"
695
695
  : feat.notes.direction[0].toUpperCase() === "NONE"
696
- ? "NONE"
697
- : undefined;
696
+ ? "NONE"
697
+ : undefined;
698
698
  delete feat.notes.direction;
699
699
  }
700
700
  return feat;
@@ -14,13 +14,13 @@ export default function jsonToFasta(jsonSequence, options) {
14
14
  proteinSequence
15
15
  } = cleanedData;
16
16
 
17
- options = options || {};
18
- let seqToUse = sequence;
19
- let sizeToUse = size;
20
- if (isProtein && proteinSequence) {
21
- seqToUse = proteinSequence;
22
- sizeToUse = proteinSize;
23
- }
17
+ options = {
18
+ sequence: isProtein && proteinSequence ? proteinSequence : sequence,
19
+ size: isProtein && proteinSequence ? proteinSize : size,
20
+ ...options
21
+ };
22
+ const seqToUse = options.sequence;
23
+ const sizeToUse = options.size;
24
24
  // options.reformatSeqName = options.reformatSeqName === false ? false : true;
25
25
  let fastaString = "";
26
26
  fastaString += `>${name || "Untitled Sequence"}|`;