@teselagen/bio-parsers 0.4.4 → 0.4.6

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.
@@ -1,2 +1,3 @@
1
+ export function parseFeatureLocation(locStr: any, isProtein: any, inclusive1BasedStart: any, inclusive1BasedEnd: any): any[];
1
2
  export default genbankToJson;
2
3
  declare function genbankToJson(string: any, options?: {}): any;
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { default as anyToJson } from "./anyToJson";
2
2
  export { default as fastaToJson } from "./fastaToJson";
3
- export { default as genbankToJson } from "./genbankToJson";
4
3
  export { default as sbolXmlToJson } from "./sbolXmlToJson";
5
4
  export { default as geneiousXmlToJson } from "./geneiousXmlToJson";
6
5
  export { default as jbeiXmlToJson } from "./jbeiXmlToJson";
@@ -12,5 +11,6 @@ export { default as cleanUpTeselagenJsonForExport } from "./utils/cleanUpTeselag
12
11
  export { default as parseUracilFeatures } from "./utils/parseUracilFeatures";
13
12
  export { default as jsonToJsonString } from "./jsonToJsonString";
14
13
  export { default as validateSequenceArray } from "./utils/validateSequenceArray";
14
+ export { default as genbankToJson, parseFeatureLocation } from "./genbankToJson";
15
15
  export { default as ab1ToJson, convertBasePosTraceToPerBpTrace } from "./ab1ToJson";
16
16
  export { default as searchWholeObjByName, searchWholeObjByNameSimple, searchWholeObjByNameSimpleArray } from "./utils/searchWholeObjByName";
package/index.js CHANGED
@@ -948,7 +948,7 @@ lodash.exports;
948
948
  }
949
949
  __name(unicodeWords, "unicodeWords");
950
950
  var runInContext = /* @__PURE__ */ __name(function runInContext2(context) {
951
- context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
951
+ context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
952
952
  var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
953
953
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
954
954
  var coreJsData = context["__core-js_shared__"];
@@ -6159,17 +6159,16 @@ lodash.exports;
6159
6159
  }
6160
6160
  return lodash2;
6161
6161
  }, "runInContext");
6162
- var _2 = runInContext();
6162
+ var _ = runInContext();
6163
6163
  if (freeModule) {
6164
- (freeModule.exports = _2)._ = _2;
6165
- freeExports._ = _2;
6164
+ (freeModule.exports = _)._ = _;
6165
+ freeExports._ = _;
6166
6166
  } else {
6167
- root._ = _2;
6167
+ root._ = _;
6168
6168
  }
6169
6169
  }).call(commonjsGlobal);
6170
6170
  })(lodash, lodash.exports);
6171
6171
  var lodashExports = lodash.exports;
6172
- const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
6173
6172
  const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO";
6174
6173
  const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
6175
6174
  const ambiguous_rna_letters = "GAUCRYWSMKHBVDN";
@@ -19779,6 +19778,30 @@ function flattenSequenceArray(parsingResultArray, opts) {
19779
19778
  return parsingResultArray;
19780
19779
  }
19781
19780
  __name(flattenSequenceArray, "flattenSequenceArray");
19781
+ function parseFeatureLocation(locStr, isProtein, inclusive1BasedStart, inclusive1BasedEnd) {
19782
+ locStr = locStr.trim();
19783
+ const locArr = [];
19784
+ locStr.replace(/(\d+)/g, function(string, match) {
19785
+ locArr.push(match);
19786
+ });
19787
+ const locArray = [];
19788
+ for (let i = 0; i < locArr.length; i += 2) {
19789
+ const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
19790
+ let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
19791
+ if (isNaN(end)) {
19792
+ end = start;
19793
+ }
19794
+ const location = {
19795
+ start,
19796
+ end
19797
+ };
19798
+ locArray.push(
19799
+ isProtein ? convertAACaretPositionOrRangeToDna(location) : location
19800
+ );
19801
+ }
19802
+ return locArray;
19803
+ }
19804
+ __name(parseFeatureLocation, "parseFeatureLocation");
19782
19805
  function genbankToJson(string, options = {}) {
19783
19806
  const {
19784
19807
  inclusive1BasedStart,
@@ -20103,7 +20126,15 @@ function genbankToJson(string, options = {}) {
20103
20126
  }
20104
20127
  if (isFeatureLineRunon(line, featureLocationIndentation)) {
20105
20128
  if (lastLineWasLocation) {
20106
- parseFeatureLocation(line.trim(), options);
20129
+ const feat = getCurrentFeature();
20130
+ feat.locations = feat.locations.concat(
20131
+ parseFeatureLocation(
20132
+ line.trim(),
20133
+ options.isProtein,
20134
+ inclusive1BasedStart,
20135
+ inclusive1BasedEnd
20136
+ )
20137
+ );
20107
20138
  lastLineWasLocation = true;
20108
20139
  } else {
20109
20140
  if (currentFeatureNote) {
@@ -20129,7 +20160,14 @@ function genbankToJson(string, options = {}) {
20129
20160
  const feat = getCurrentFeature();
20130
20161
  feat.type = key;
20131
20162
  feat.strand = strand;
20132
- parseFeatureLocation(val2, options);
20163
+ feat.locations = feat.locations.concat(
20164
+ parseFeatureLocation(
20165
+ val2,
20166
+ options.isProtein,
20167
+ inclusive1BasedStart,
20168
+ inclusive1BasedEnd
20169
+ )
20170
+ );
20133
20171
  lastLineWasLocation = true;
20134
20172
  }
20135
20173
  }
@@ -20152,29 +20190,6 @@ function genbankToJson(string, options = {}) {
20152
20190
  return qual;
20153
20191
  }
20154
20192
  __name(isNote, "isNote");
20155
- function parseFeatureLocation(locStr, options2) {
20156
- locStr = locStr.trim();
20157
- const locArr = [];
20158
- locStr.replace(/(\d+)/g, function(string2, match) {
20159
- locArr.push(match);
20160
- });
20161
- for (let i = 0; i < locArr.length; i += 2) {
20162
- const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
20163
- let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
20164
- if (isNaN(end)) {
20165
- end = start;
20166
- }
20167
- const location = {
20168
- start,
20169
- end
20170
- };
20171
- const feat = getCurrentFeature();
20172
- feat.locations.push(
20173
- options2.isProtein ? convertAACaretPositionOrRangeToDna(location) : location
20174
- );
20175
- }
20176
- }
20177
- __name(parseFeatureLocation, "parseFeatureLocation");
20178
20193
  function parseFeatureNote(line) {
20179
20194
  let newLine;
20180
20195
  newLine = line.trimLeft();
@@ -26893,7 +26908,7 @@ function requireBuffer_list() {
26893
26908
  // Make sure the linked list only shows the minimal necessary information.
26894
26909
  }, {
26895
26910
  key: custom,
26896
- value: /* @__PURE__ */ __name(function value(_2, options) {
26911
+ value: /* @__PURE__ */ __name(function value(_, options) {
26897
26912
  return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
26898
26913
  // Only inspect one level.
26899
26914
  depth: 0,
@@ -27189,7 +27204,7 @@ function requireBrowser() {
27189
27204
  try {
27190
27205
  if (!commonjsGlobal.localStorage)
27191
27206
  return false;
27192
- } catch (_2) {
27207
+ } catch (_) {
27193
27208
  return false;
27194
27209
  }
27195
27210
  var val2 = commonjsGlobal.localStorage[name];
@@ -27297,7 +27312,7 @@ function require_stream_writable() {
27297
27312
  return this.getBuffer();
27298
27313
  }, "writableStateBufferGetter"), "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
27299
27314
  });
27300
- } catch (_2) {
27315
+ } catch (_) {
27301
27316
  }
27302
27317
  })();
27303
27318
  var realHasInstance;
@@ -29919,7 +29934,7 @@ function gffToJson(string) {
29919
29934
  if (!features[feature.seq_id])
29920
29935
  features[feature.seq_id] = [];
29921
29936
  const attributes = feature.attributes || {};
29922
- const name = _.get(attributes, "ID[0]");
29937
+ const name = lodashExports.get(attributes, "ID[0]");
29923
29938
  features[feature.seq_id].push({
29924
29939
  name,
29925
29940
  start: feature.start,
@@ -32765,6 +32780,7 @@ exports.jsonToBed = jsonToBed;
32765
32780
  exports.jsonToFasta = jsonToFasta;
32766
32781
  exports.jsonToGenbank = jsonToGenbank;
32767
32782
  exports.jsonToJsonString = jsonToJsonString;
32783
+ exports.parseFeatureLocation = parseFeatureLocation;
32768
32784
  exports.parseUracilFeatures = parseUracilFeatures;
32769
32785
  exports.sbolXmlToJson = sbolXmlToJson;
32770
32786
  exports.searchWholeObjByName = searchWholeObjByName;
package/index.mjs CHANGED
@@ -946,7 +946,7 @@ lodash.exports;
946
946
  }
947
947
  __name(unicodeWords, "unicodeWords");
948
948
  var runInContext = /* @__PURE__ */ __name(function runInContext2(context) {
949
- context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
949
+ context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
950
950
  var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
951
951
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
952
952
  var coreJsData = context["__core-js_shared__"];
@@ -6157,17 +6157,16 @@ lodash.exports;
6157
6157
  }
6158
6158
  return lodash2;
6159
6159
  }, "runInContext");
6160
- var _2 = runInContext();
6160
+ var _ = runInContext();
6161
6161
  if (freeModule) {
6162
- (freeModule.exports = _2)._ = _2;
6163
- freeExports._ = _2;
6162
+ (freeModule.exports = _)._ = _;
6163
+ freeExports._ = _;
6164
6164
  } else {
6165
- root._ = _2;
6165
+ root._ = _;
6166
6166
  }
6167
6167
  }).call(commonjsGlobal);
6168
6168
  })(lodash, lodash.exports);
6169
6169
  var lodashExports = lodash.exports;
6170
- const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
6171
6170
  const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO";
6172
6171
  const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
6173
6172
  const ambiguous_rna_letters = "GAUCRYWSMKHBVDN";
@@ -19777,6 +19776,30 @@ function flattenSequenceArray(parsingResultArray, opts) {
19777
19776
  return parsingResultArray;
19778
19777
  }
19779
19778
  __name(flattenSequenceArray, "flattenSequenceArray");
19779
+ function parseFeatureLocation(locStr, isProtein, inclusive1BasedStart, inclusive1BasedEnd) {
19780
+ locStr = locStr.trim();
19781
+ const locArr = [];
19782
+ locStr.replace(/(\d+)/g, function(string, match) {
19783
+ locArr.push(match);
19784
+ });
19785
+ const locArray = [];
19786
+ for (let i = 0; i < locArr.length; i += 2) {
19787
+ const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
19788
+ let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
19789
+ if (isNaN(end)) {
19790
+ end = start;
19791
+ }
19792
+ const location = {
19793
+ start,
19794
+ end
19795
+ };
19796
+ locArray.push(
19797
+ isProtein ? convertAACaretPositionOrRangeToDna(location) : location
19798
+ );
19799
+ }
19800
+ return locArray;
19801
+ }
19802
+ __name(parseFeatureLocation, "parseFeatureLocation");
19780
19803
  function genbankToJson(string, options = {}) {
19781
19804
  const {
19782
19805
  inclusive1BasedStart,
@@ -20101,7 +20124,15 @@ function genbankToJson(string, options = {}) {
20101
20124
  }
20102
20125
  if (isFeatureLineRunon(line, featureLocationIndentation)) {
20103
20126
  if (lastLineWasLocation) {
20104
- parseFeatureLocation(line.trim(), options);
20127
+ const feat = getCurrentFeature();
20128
+ feat.locations = feat.locations.concat(
20129
+ parseFeatureLocation(
20130
+ line.trim(),
20131
+ options.isProtein,
20132
+ inclusive1BasedStart,
20133
+ inclusive1BasedEnd
20134
+ )
20135
+ );
20105
20136
  lastLineWasLocation = true;
20106
20137
  } else {
20107
20138
  if (currentFeatureNote) {
@@ -20127,7 +20158,14 @@ function genbankToJson(string, options = {}) {
20127
20158
  const feat = getCurrentFeature();
20128
20159
  feat.type = key;
20129
20160
  feat.strand = strand;
20130
- parseFeatureLocation(val2, options);
20161
+ feat.locations = feat.locations.concat(
20162
+ parseFeatureLocation(
20163
+ val2,
20164
+ options.isProtein,
20165
+ inclusive1BasedStart,
20166
+ inclusive1BasedEnd
20167
+ )
20168
+ );
20131
20169
  lastLineWasLocation = true;
20132
20170
  }
20133
20171
  }
@@ -20150,29 +20188,6 @@ function genbankToJson(string, options = {}) {
20150
20188
  return qual;
20151
20189
  }
20152
20190
  __name(isNote, "isNote");
20153
- function parseFeatureLocation(locStr, options2) {
20154
- locStr = locStr.trim();
20155
- const locArr = [];
20156
- locStr.replace(/(\d+)/g, function(string2, match) {
20157
- locArr.push(match);
20158
- });
20159
- for (let i = 0; i < locArr.length; i += 2) {
20160
- const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
20161
- let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
20162
- if (isNaN(end)) {
20163
- end = start;
20164
- }
20165
- const location = {
20166
- start,
20167
- end
20168
- };
20169
- const feat = getCurrentFeature();
20170
- feat.locations.push(
20171
- options2.isProtein ? convertAACaretPositionOrRangeToDna(location) : location
20172
- );
20173
- }
20174
- }
20175
- __name(parseFeatureLocation, "parseFeatureLocation");
20176
20191
  function parseFeatureNote(line) {
20177
20192
  let newLine;
20178
20193
  newLine = line.trimLeft();
@@ -26891,7 +26906,7 @@ function requireBuffer_list() {
26891
26906
  // Make sure the linked list only shows the minimal necessary information.
26892
26907
  }, {
26893
26908
  key: custom,
26894
- value: /* @__PURE__ */ __name(function value(_2, options) {
26909
+ value: /* @__PURE__ */ __name(function value(_, options) {
26895
26910
  return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
26896
26911
  // Only inspect one level.
26897
26912
  depth: 0,
@@ -27187,7 +27202,7 @@ function requireBrowser() {
27187
27202
  try {
27188
27203
  if (!commonjsGlobal.localStorage)
27189
27204
  return false;
27190
- } catch (_2) {
27205
+ } catch (_) {
27191
27206
  return false;
27192
27207
  }
27193
27208
  var val2 = commonjsGlobal.localStorage[name];
@@ -27295,7 +27310,7 @@ function require_stream_writable() {
27295
27310
  return this.getBuffer();
27296
27311
  }, "writableStateBufferGetter"), "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
27297
27312
  });
27298
- } catch (_2) {
27313
+ } catch (_) {
27299
27314
  }
27300
27315
  })();
27301
27316
  var realHasInstance;
@@ -29917,7 +29932,7 @@ function gffToJson(string) {
29917
29932
  if (!features[feature.seq_id])
29918
29933
  features[feature.seq_id] = [];
29919
29934
  const attributes = feature.attributes || {};
29920
- const name = _.get(attributes, "ID[0]");
29935
+ const name = lodashExports.get(attributes, "ID[0]");
29921
29936
  features[feature.seq_id].push({
29922
29937
  name,
29923
29938
  start: feature.start,
@@ -32764,6 +32779,7 @@ export {
32764
32779
  jsonToFasta,
32765
32780
  jsonToGenbank,
32766
32781
  jsonToJsonString,
32782
+ parseFeatureLocation,
32767
32783
  parseUracilFeatures,
32768
32784
  sbolXmlToJson,
32769
32785
  searchWholeObjByName,
package/index.umd.js CHANGED
@@ -950,7 +950,7 @@ var __async = (__this, __arguments, generator) => {
950
950
  }
951
951
  __name(unicodeWords, "unicodeWords");
952
952
  var runInContext = /* @__PURE__ */ __name(function runInContext2(context) {
953
- context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
953
+ context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
954
954
  var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
955
955
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
956
956
  var coreJsData = context["__core-js_shared__"];
@@ -6161,17 +6161,16 @@ var __async = (__this, __arguments, generator) => {
6161
6161
  }
6162
6162
  return lodash2;
6163
6163
  }, "runInContext");
6164
- var _2 = runInContext();
6164
+ var _ = runInContext();
6165
6165
  if (freeModule) {
6166
- (freeModule.exports = _2)._ = _2;
6167
- freeExports._ = _2;
6166
+ (freeModule.exports = _)._ = _;
6167
+ freeExports._ = _;
6168
6168
  } else {
6169
- root._ = _2;
6169
+ root._ = _;
6170
6170
  }
6171
6171
  }).call(commonjsGlobal);
6172
6172
  })(lodash, lodash.exports);
6173
6173
  var lodashExports = lodash.exports;
6174
- const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
6175
6174
  const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO";
6176
6175
  const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
6177
6176
  const ambiguous_rna_letters = "GAUCRYWSMKHBVDN";
@@ -19781,6 +19780,30 @@ var __async = (__this, __arguments, generator) => {
19781
19780
  return parsingResultArray;
19782
19781
  }
19783
19782
  __name(flattenSequenceArray, "flattenSequenceArray");
19783
+ function parseFeatureLocation(locStr, isProtein, inclusive1BasedStart, inclusive1BasedEnd) {
19784
+ locStr = locStr.trim();
19785
+ const locArr = [];
19786
+ locStr.replace(/(\d+)/g, function(string, match) {
19787
+ locArr.push(match);
19788
+ });
19789
+ const locArray = [];
19790
+ for (let i2 = 0; i2 < locArr.length; i2 += 2) {
19791
+ const start = parseInt(locArr[i2], 10) - (inclusive1BasedStart ? 0 : 1);
19792
+ let end = parseInt(locArr[i2 + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
19793
+ if (isNaN(end)) {
19794
+ end = start;
19795
+ }
19796
+ const location = {
19797
+ start,
19798
+ end
19799
+ };
19800
+ locArray.push(
19801
+ isProtein ? convertAACaretPositionOrRangeToDna(location) : location
19802
+ );
19803
+ }
19804
+ return locArray;
19805
+ }
19806
+ __name(parseFeatureLocation, "parseFeatureLocation");
19784
19807
  function genbankToJson(string, options = {}) {
19785
19808
  const {
19786
19809
  inclusive1BasedStart,
@@ -20105,7 +20128,15 @@ var __async = (__this, __arguments, generator) => {
20105
20128
  }
20106
20129
  if (isFeatureLineRunon(line, featureLocationIndentation)) {
20107
20130
  if (lastLineWasLocation) {
20108
- parseFeatureLocation(line.trim(), options);
20131
+ const feat = getCurrentFeature();
20132
+ feat.locations = feat.locations.concat(
20133
+ parseFeatureLocation(
20134
+ line.trim(),
20135
+ options.isProtein,
20136
+ inclusive1BasedStart,
20137
+ inclusive1BasedEnd
20138
+ )
20139
+ );
20109
20140
  lastLineWasLocation = true;
20110
20141
  } else {
20111
20142
  if (currentFeatureNote) {
@@ -20131,7 +20162,14 @@ var __async = (__this, __arguments, generator) => {
20131
20162
  const feat = getCurrentFeature();
20132
20163
  feat.type = key;
20133
20164
  feat.strand = strand;
20134
- parseFeatureLocation(val2, options);
20165
+ feat.locations = feat.locations.concat(
20166
+ parseFeatureLocation(
20167
+ val2,
20168
+ options.isProtein,
20169
+ inclusive1BasedStart,
20170
+ inclusive1BasedEnd
20171
+ )
20172
+ );
20135
20173
  lastLineWasLocation = true;
20136
20174
  }
20137
20175
  }
@@ -20154,29 +20192,6 @@ var __async = (__this, __arguments, generator) => {
20154
20192
  return qual;
20155
20193
  }
20156
20194
  __name(isNote, "isNote");
20157
- function parseFeatureLocation(locStr, options2) {
20158
- locStr = locStr.trim();
20159
- const locArr = [];
20160
- locStr.replace(/(\d+)/g, function(string2, match) {
20161
- locArr.push(match);
20162
- });
20163
- for (let i2 = 0; i2 < locArr.length; i2 += 2) {
20164
- const start = parseInt(locArr[i2], 10) - (inclusive1BasedStart ? 0 : 1);
20165
- let end = parseInt(locArr[i2 + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
20166
- if (isNaN(end)) {
20167
- end = start;
20168
- }
20169
- const location = {
20170
- start,
20171
- end
20172
- };
20173
- const feat = getCurrentFeature();
20174
- feat.locations.push(
20175
- options2.isProtein ? convertAACaretPositionOrRangeToDna(location) : location
20176
- );
20177
- }
20178
- }
20179
- __name(parseFeatureLocation, "parseFeatureLocation");
20180
20195
  function parseFeatureNote(line) {
20181
20196
  let newLine;
20182
20197
  newLine = line.trimLeft();
@@ -26895,7 +26910,7 @@ var __async = (__this, __arguments, generator) => {
26895
26910
  // Make sure the linked list only shows the minimal necessary information.
26896
26911
  }, {
26897
26912
  key: custom,
26898
- value: /* @__PURE__ */ __name(function value(_2, options) {
26913
+ value: /* @__PURE__ */ __name(function value(_, options) {
26899
26914
  return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
26900
26915
  // Only inspect one level.
26901
26916
  depth: 0,
@@ -27191,7 +27206,7 @@ var __async = (__this, __arguments, generator) => {
27191
27206
  try {
27192
27207
  if (!commonjsGlobal.localStorage)
27193
27208
  return false;
27194
- } catch (_2) {
27209
+ } catch (_) {
27195
27210
  return false;
27196
27211
  }
27197
27212
  var val2 = commonjsGlobal.localStorage[name2];
@@ -27299,7 +27314,7 @@ var __async = (__this, __arguments, generator) => {
27299
27314
  return this.getBuffer();
27300
27315
  }, "writableStateBufferGetter"), "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
27301
27316
  });
27302
- } catch (_2) {
27317
+ } catch (_) {
27303
27318
  }
27304
27319
  })();
27305
27320
  var realHasInstance;
@@ -29921,7 +29936,7 @@ ${seq.sequence}
29921
29936
  if (!features[feature.seq_id])
29922
29937
  features[feature.seq_id] = [];
29923
29938
  const attributes = feature.attributes || {};
29924
- const name2 = _.get(attributes, "ID[0]");
29939
+ const name2 = lodashExports.get(attributes, "ID[0]");
29925
29940
  features[feature.seq_id].push({
29926
29941
  name: name2,
29927
29942
  start: feature.start,
@@ -32767,6 +32782,7 @@ ${seq.sequence}
32767
32782
  exports2.jsonToFasta = jsonToFasta;
32768
32783
  exports2.jsonToGenbank = jsonToGenbank;
32769
32784
  exports2.jsonToJsonString = jsonToJsonString;
32785
+ exports2.parseFeatureLocation = parseFeatureLocation;
32770
32786
  exports2.parseUracilFeatures = parseUracilFeatures;
32771
32787
  exports2.sbolXmlToJson = sbolXmlToJson;
32772
32788
  exports2.searchWholeObjByName = searchWholeObjByName;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@teselagen/bio-parsers",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "dependencies": {
5
- "@teselagen/sequence-utils": "0.3.11",
5
+ "@teselagen/sequence-utils": "0.3.12",
6
6
  "@teselagen/range-utils": "0.3.7",
7
7
  "@gmod/gff": "^1.2.1",
8
8
  "buffer": "^6.0.3",
@@ -8,6 +8,40 @@ import splitStringIntoLines from "./utils/splitStringIntoLines.js";
8
8
 
9
9
  import createInitialSequence from "./utils/createInitialSequence";
10
10
 
11
+ export function parseFeatureLocation(
12
+ locStr,
13
+ isProtein,
14
+ inclusive1BasedStart,
15
+ inclusive1BasedEnd
16
+ ) {
17
+ locStr = locStr.trim();
18
+ const locArr = [];
19
+ locStr.replace(/(\d+)/g, function (string, match) {
20
+ locArr.push(match);
21
+ });
22
+ const locArray = [];
23
+ for (let i = 0; i < locArr.length; i += 2) {
24
+ const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
25
+ let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
26
+ if (isNaN(end)) {
27
+ //if no end is supplied, assume that the end should be set to whatever the start is
28
+ //this makes a feature location passed as:
29
+ //147
30
+ //function like:
31
+ //147..147
32
+ end = start;
33
+ }
34
+ const location = {
35
+ start: start,
36
+ end: end
37
+ };
38
+ locArray.push(
39
+ isProtein ? convertAACaretPositionOrRangeToDna(location) : location
40
+ );
41
+ }
42
+ return locArray;
43
+ }
44
+
11
45
  function genbankToJson(string, options = {}) {
12
46
  const {
13
47
  inclusive1BasedStart,
@@ -428,7 +462,15 @@ function genbankToJson(string, options = {}) {
428
462
  //the line is a continuation of the above line
429
463
  if (lastLineWasLocation) {
430
464
  //the last line was a location, so the run-on line is expected to be a feature location as well
431
- parseFeatureLocation(line.trim(), options);
465
+ const feat = getCurrentFeature();
466
+ feat.locations = feat.locations.concat(
467
+ parseFeatureLocation(
468
+ line.trim(),
469
+ options.isProtein,
470
+ inclusive1BasedStart,
471
+ inclusive1BasedEnd
472
+ )
473
+ );
432
474
  lastLineWasLocation = true;
433
475
  } else {
434
476
  //the last line was a note
@@ -466,8 +508,14 @@ function genbankToJson(string, options = {}) {
466
508
  const feat = getCurrentFeature();
467
509
  feat.type = key;
468
510
  feat.strand = strand;
469
-
470
- parseFeatureLocation(val, options);
511
+ feat.locations = feat.locations.concat(
512
+ parseFeatureLocation(
513
+ val,
514
+ options.isProtein,
515
+ inclusive1BasedStart,
516
+ inclusive1BasedEnd
517
+ )
518
+ );
471
519
  lastLineWasLocation = true;
472
520
  }
473
521
  }
@@ -495,36 +543,6 @@ function genbankToJson(string, options = {}) {
495
543
  return qual;
496
544
  }
497
545
 
498
- function parseFeatureLocation(locStr, options) {
499
- locStr = locStr.trim();
500
- const locArr = [];
501
- locStr.replace(/(\d+)/g, function (string, match) {
502
- locArr.push(match);
503
- });
504
- for (let i = 0; i < locArr.length; i += 2) {
505
- const start = parseInt(locArr[i], 10) - (inclusive1BasedStart ? 0 : 1);
506
- let end = parseInt(locArr[i + 1], 10) - (inclusive1BasedEnd ? 0 : 1);
507
- if (isNaN(end)) {
508
- //if no end is supplied, assume that the end should be set to whatever the start is
509
- //this makes a feature location passed as:
510
- //147
511
- //function like:
512
- //147..147
513
- end = start;
514
- }
515
- const location = {
516
- start: start,
517
- end: end
518
- };
519
- const feat = getCurrentFeature();
520
- feat.locations.push(
521
- options.isProtein
522
- ? convertAACaretPositionOrRangeToDna(location)
523
- : location
524
- );
525
- }
526
- }
527
-
528
546
  function parseFeatureNote(line) {
529
547
  let newLine;
530
548
 
package/src/gffToJson.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import gff from "@gmod/gff";
2
- import _ from "lodash";
2
+ import {get} from "lodash";
3
3
 
4
4
  function gffToJson(string) {
5
5
  const arrayOfThings = gff.parseStringSync(string);
@@ -13,7 +13,7 @@ function gffToJson(string) {
13
13
  const feature = featureOrSeq[0];
14
14
  if (!features[feature.seq_id]) features[feature.seq_id] = [];
15
15
  const attributes = feature.attributes || {};
16
- const name = _.get(attributes, "ID[0]");
16
+ const name = get(attributes, "ID[0]");
17
17
  features[feature.seq_id].push({
18
18
  name,
19
19
  start: feature.start,
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as anyToJson } from "./anyToJson";
2
2
  export { default as fastaToJson } from "./fastaToJson";
3
- export { default as genbankToJson } from "./genbankToJson";
3
+ export { default as genbankToJson, parseFeatureLocation } from "./genbankToJson";
4
4
  export { default as sbolXmlToJson } from "./sbolXmlToJson";
5
5
  export { default as geneiousXmlToJson } from "./geneiousXmlToJson";
6
6
  export { default as jbeiXmlToJson } from "./jbeiXmlToJson";