@teselagen/bio-parsers 0.4.37 → 0.4.38

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.cjs CHANGED
@@ -23681,6 +23681,38 @@ function cutUpStr(val2, start, end) {
23681
23681
  return val2.slice(start, end);
23682
23682
  }
23683
23683
  __name(cutUpStr, "cutUpStr");
23684
+ function featureToGenbankLocationString(feat, options) {
23685
+ const { inclusive1BasedStart, inclusive1BasedEnd, isProtein } = options;
23686
+ let locStr = "";
23687
+ if (feat.locations && feat.locations.length > 1) {
23688
+ feat.locations.forEach((loc, i) => {
23689
+ locStr += getProteinStart(
23690
+ parseInt(loc.start, 10) + (inclusive1BasedStart ? 0 : 1),
23691
+ isProtein
23692
+ ) + ".." + getProteinEnd(
23693
+ parseInt(loc.end, 10) + (inclusive1BasedEnd ? 0 : 1),
23694
+ isProtein
23695
+ );
23696
+ if (i !== feat.locations.length - 1) {
23697
+ locStr += ",";
23698
+ }
23699
+ });
23700
+ locStr = "join(" + locStr + ")";
23701
+ } else {
23702
+ locStr += getProteinStart(
23703
+ parseInt(feat.start, 10) + (inclusive1BasedStart ? 0 : 1),
23704
+ isProtein
23705
+ ) + ".." + getProteinEnd(
23706
+ parseInt(feat.end, 10) + (inclusive1BasedEnd ? 0 : 1),
23707
+ isProtein
23708
+ );
23709
+ }
23710
+ if (feat.strand === -1) {
23711
+ locStr = "complement(" + locStr + ")";
23712
+ }
23713
+ return locStr;
23714
+ }
23715
+ __name(featureToGenbankLocationString, "featureToGenbankLocationString");
23684
23716
  function jsonToGenbank(_serSeq, options) {
23685
23717
  options = options || {};
23686
23718
  options.reformatSeqName = options.reformatSeqName !== false;
@@ -23875,33 +23907,7 @@ function featureToGenbankString(feat, options) {
23875
23907
  feat.type = "primer_bind";
23876
23908
  }
23877
23909
  const line = " " + StringUtil.rpad(feat.type || "misc_feature", " ", options.featurePadLength);
23878
- let locStr = "";
23879
- if (feat.locations && feat.locations.length > 1) {
23880
- feat.locations.forEach((loc, i) => {
23881
- locStr += getProteinStart(
23882
- parseInt(loc.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
23883
- options.isProtein
23884
- ) + ".." + getProteinEnd(
23885
- parseInt(loc.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
23886
- options.isProtein
23887
- );
23888
- if (i !== feat.locations.length - 1) {
23889
- locStr += ",";
23890
- }
23891
- });
23892
- locStr = "join(" + locStr + ")";
23893
- } else {
23894
- locStr += getProteinStart(
23895
- parseInt(feat.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
23896
- options.isProtein
23897
- ) + ".." + getProteinEnd(
23898
- parseInt(feat.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
23899
- options.isProtein
23900
- );
23901
- }
23902
- if (feat.strand === -1) {
23903
- locStr = "complement(" + locStr + ")";
23904
- }
23910
+ const locStr = featureToGenbankLocationString(feat, options);
23905
23911
  lines.push(line + locStr);
23906
23912
  lines.push(
23907
23913
  featureNoteInDataToGenbankString(
package/index.js CHANGED
@@ -23679,6 +23679,38 @@ function cutUpStr(val2, start, end) {
23679
23679
  return val2.slice(start, end);
23680
23680
  }
23681
23681
  __name(cutUpStr, "cutUpStr");
23682
+ function featureToGenbankLocationString(feat, options) {
23683
+ const { inclusive1BasedStart, inclusive1BasedEnd, isProtein } = options;
23684
+ let locStr = "";
23685
+ if (feat.locations && feat.locations.length > 1) {
23686
+ feat.locations.forEach((loc, i) => {
23687
+ locStr += getProteinStart(
23688
+ parseInt(loc.start, 10) + (inclusive1BasedStart ? 0 : 1),
23689
+ isProtein
23690
+ ) + ".." + getProteinEnd(
23691
+ parseInt(loc.end, 10) + (inclusive1BasedEnd ? 0 : 1),
23692
+ isProtein
23693
+ );
23694
+ if (i !== feat.locations.length - 1) {
23695
+ locStr += ",";
23696
+ }
23697
+ });
23698
+ locStr = "join(" + locStr + ")";
23699
+ } else {
23700
+ locStr += getProteinStart(
23701
+ parseInt(feat.start, 10) + (inclusive1BasedStart ? 0 : 1),
23702
+ isProtein
23703
+ ) + ".." + getProteinEnd(
23704
+ parseInt(feat.end, 10) + (inclusive1BasedEnd ? 0 : 1),
23705
+ isProtein
23706
+ );
23707
+ }
23708
+ if (feat.strand === -1) {
23709
+ locStr = "complement(" + locStr + ")";
23710
+ }
23711
+ return locStr;
23712
+ }
23713
+ __name(featureToGenbankLocationString, "featureToGenbankLocationString");
23682
23714
  function jsonToGenbank(_serSeq, options) {
23683
23715
  options = options || {};
23684
23716
  options.reformatSeqName = options.reformatSeqName !== false;
@@ -23873,33 +23905,7 @@ function featureToGenbankString(feat, options) {
23873
23905
  feat.type = "primer_bind";
23874
23906
  }
23875
23907
  const line = " " + StringUtil.rpad(feat.type || "misc_feature", " ", options.featurePadLength);
23876
- let locStr = "";
23877
- if (feat.locations && feat.locations.length > 1) {
23878
- feat.locations.forEach((loc, i) => {
23879
- locStr += getProteinStart(
23880
- parseInt(loc.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
23881
- options.isProtein
23882
- ) + ".." + getProteinEnd(
23883
- parseInt(loc.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
23884
- options.isProtein
23885
- );
23886
- if (i !== feat.locations.length - 1) {
23887
- locStr += ",";
23888
- }
23889
- });
23890
- locStr = "join(" + locStr + ")";
23891
- } else {
23892
- locStr += getProteinStart(
23893
- parseInt(feat.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
23894
- options.isProtein
23895
- ) + ".." + getProteinEnd(
23896
- parseInt(feat.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
23897
- options.isProtein
23898
- );
23899
- }
23900
- if (feat.strand === -1) {
23901
- locStr = "complement(" + locStr + ")";
23902
- }
23908
+ const locStr = featureToGenbankLocationString(feat, options);
23903
23909
  lines.push(line + locStr);
23904
23910
  lines.push(
23905
23911
  featureNoteInDataToGenbankString(
package/index.umd.cjs CHANGED
@@ -23683,6 +23683,38 @@ ${seq.sequence}
23683
23683
  return val2.slice(start, end);
23684
23684
  }
23685
23685
  __name(cutUpStr, "cutUpStr");
23686
+ function featureToGenbankLocationString(feat, options) {
23687
+ const { inclusive1BasedStart, inclusive1BasedEnd, isProtein } = options;
23688
+ let locStr = "";
23689
+ if (feat.locations && feat.locations.length > 1) {
23690
+ feat.locations.forEach((loc, i2) => {
23691
+ locStr += getProteinStart(
23692
+ parseInt(loc.start, 10) + (inclusive1BasedStart ? 0 : 1),
23693
+ isProtein
23694
+ ) + ".." + getProteinEnd(
23695
+ parseInt(loc.end, 10) + (inclusive1BasedEnd ? 0 : 1),
23696
+ isProtein
23697
+ );
23698
+ if (i2 !== feat.locations.length - 1) {
23699
+ locStr += ",";
23700
+ }
23701
+ });
23702
+ locStr = "join(" + locStr + ")";
23703
+ } else {
23704
+ locStr += getProteinStart(
23705
+ parseInt(feat.start, 10) + (inclusive1BasedStart ? 0 : 1),
23706
+ isProtein
23707
+ ) + ".." + getProteinEnd(
23708
+ parseInt(feat.end, 10) + (inclusive1BasedEnd ? 0 : 1),
23709
+ isProtein
23710
+ );
23711
+ }
23712
+ if (feat.strand === -1) {
23713
+ locStr = "complement(" + locStr + ")";
23714
+ }
23715
+ return locStr;
23716
+ }
23717
+ __name(featureToGenbankLocationString, "featureToGenbankLocationString");
23686
23718
  function jsonToGenbank(_serSeq, options) {
23687
23719
  options = options || {};
23688
23720
  options.reformatSeqName = options.reformatSeqName !== false;
@@ -23877,33 +23909,7 @@ ${seq.sequence}
23877
23909
  feat.type = "primer_bind";
23878
23910
  }
23879
23911
  const line = " " + StringUtil.rpad(feat.type || "misc_feature", " ", options.featurePadLength);
23880
- let locStr = "";
23881
- if (feat.locations && feat.locations.length > 1) {
23882
- feat.locations.forEach((loc, i2) => {
23883
- locStr += getProteinStart(
23884
- parseInt(loc.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
23885
- options.isProtein
23886
- ) + ".." + getProteinEnd(
23887
- parseInt(loc.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
23888
- options.isProtein
23889
- );
23890
- if (i2 !== feat.locations.length - 1) {
23891
- locStr += ",";
23892
- }
23893
- });
23894
- locStr = "join(" + locStr + ")";
23895
- } else {
23896
- locStr += getProteinStart(
23897
- parseInt(feat.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
23898
- options.isProtein
23899
- ) + ".." + getProteinEnd(
23900
- parseInt(feat.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
23901
- options.isProtein
23902
- );
23903
- }
23904
- if (feat.strand === -1) {
23905
- locStr = "complement(" + locStr + ")";
23906
- }
23912
+ const locStr = featureToGenbankLocationString(feat, options);
23907
23913
  lines.push(line + locStr);
23908
23914
  lines.push(
23909
23915
  featureNoteInDataToGenbankString(
@@ -1 +1,2 @@
1
+ export function featureToGenbankLocationString(feat: any, options: any): string;
1
2
  export default function _default(_serSeq: any, options: any): string | false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/bio-parsers",
3
- "version": "0.4.37",
3
+ "version": "0.4.38",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/TeselaGen/tg-oss",
6
6
  "dependencies": {
@@ -76,6 +76,47 @@ function cutUpStr(val, start, end) {
76
76
  return val.slice(start, end);
77
77
  }
78
78
 
79
+ export function featureToGenbankLocationString(feat, options) {
80
+ const { inclusive1BasedStart, inclusive1BasedEnd, isProtein } = options;
81
+ let locStr = "";
82
+
83
+ if (feat.locations && feat.locations.length > 1) {
84
+ feat.locations.forEach((loc, i) => {
85
+ locStr +=
86
+ getProteinStart(
87
+ parseInt(loc.start, 10) + (inclusive1BasedStart ? 0 : 1),
88
+ isProtein
89
+ ) +
90
+ ".." +
91
+ getProteinEnd(
92
+ parseInt(loc.end, 10) + (inclusive1BasedEnd ? 0 : 1),
93
+ isProtein
94
+ );
95
+
96
+ if (i !== feat.locations.length - 1) {
97
+ locStr += ",";
98
+ }
99
+ });
100
+ locStr = "join(" + locStr + ")";
101
+ } else {
102
+ locStr +=
103
+ getProteinStart(
104
+ parseInt(feat.start, 10) + (inclusive1BasedStart ? 0 : 1),
105
+ isProtein
106
+ ) +
107
+ ".." +
108
+ getProteinEnd(
109
+ parseInt(feat.end, 10) + (inclusive1BasedEnd ? 0 : 1),
110
+ isProtein
111
+ );
112
+ }
113
+
114
+ if (feat.strand === -1) {
115
+ locStr = "complement(" + locStr + ")";
116
+ }
117
+ return locStr;
118
+ }
119
+
79
120
  export default function (_serSeq, options) {
80
121
  options = options || {};
81
122
  options.reformatSeqName = options.reformatSeqName !== false;
@@ -325,49 +366,8 @@ function featureToGenbankString(feat, options) {
325
366
  const line =
326
367
  " " +
327
368
  StringUtil.rpad(feat.type || "misc_feature", " ", options.featurePadLength);
328
- let locStr = "";
329
-
330
- //for(var i=0;i<feat.locations.length;i++) {
331
- // var loc = feat.locations[i];
332
- // locStr.push((loc.start+1) + '..' + loc.end);
333
- //}
334
369
 
335
- if (feat.locations && feat.locations.length > 1) {
336
- feat.locations.forEach((loc, i) => {
337
- locStr +=
338
- getProteinStart(
339
- parseInt(loc.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
340
- options.isProtein
341
- ) +
342
- ".." +
343
- getProteinEnd(
344
- parseInt(loc.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
345
- options.isProtein
346
- );
347
-
348
- if (i !== feat.locations.length - 1) {
349
- locStr += ",";
350
- }
351
- });
352
- locStr = "join(" + locStr + ")";
353
- } else {
354
- locStr +=
355
- getProteinStart(
356
- parseInt(feat.start, 10) + (options.inclusive1BasedStart ? 0 : 1),
357
- options.isProtein
358
- ) +
359
- ".." +
360
- getProteinEnd(
361
- parseInt(feat.end, 10) + (options.inclusive1BasedEnd ? 0 : 1),
362
- options.isProtein
363
- );
364
- }
365
-
366
- // locStr = locStr.join(",");
367
-
368
- if (feat.strand === -1) {
369
- locStr = "complement(" + locStr + ")";
370
- }
370
+ const locStr = featureToGenbankLocationString(feat, options);
371
371
 
372
372
  lines.push(line + locStr);
373
373