@teselagen/bio-parsers 0.4.36 → 0.4.37

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
@@ -17145,17 +17145,20 @@ function snapgeneToJson(_0) {
17145
17145
  const b = new fxpExports.XMLParser({
17146
17146
  ignoreAttributes: false,
17147
17147
  attributeNamePrefix: "",
17148
- isArray: /* @__PURE__ */ __name((name) => name === "Feature" || name === "Segment", "isArray")
17148
+ isArray: /* @__PURE__ */ __name((name) => ["Feature", "Segment", "Q", "V"].includes(name), "isArray")
17149
17149
  }).parse(xml);
17150
17150
  const { Features: { Feature = [] } = {} } = b;
17151
17151
  data.features = [];
17152
17152
  Feature.forEach((feat) => {
17153
+ var _a2, _b2, _c, _d;
17153
17154
  const { directionality, Segment = [], name, type } = feat;
17155
+ let color2;
17154
17156
  let maxStart = 0;
17155
17157
  let maxEnd = 0;
17156
17158
  const locations = Segment && Segment.map((seg) => {
17157
17159
  if (!seg) throw new Error("invalid feature definition");
17158
17160
  const { range } = seg;
17161
+ if (seg.color) color2 = seg.color;
17159
17162
  let { start, end } = getStartAndEndFromRangeString(range);
17160
17163
  start = isProtein ? start * 3 : start;
17161
17164
  end = isProtein ? end * 3 + 2 : end;
@@ -17166,6 +17169,10 @@ function snapgeneToJson(_0) {
17166
17169
  end
17167
17170
  };
17168
17171
  });
17172
+ const colorQual = (_a2 = feat.Q) == null ? void 0 : _a2.find((q) => q.name === "color");
17173
+ if (colorQual) {
17174
+ color2 = ((_c = (_b2 = colorQual.V) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) || ((_d = colorQual.V) == null ? void 0 : _d[0]);
17175
+ }
17169
17176
  data.features.push(__spreadProps(__spreadValues({
17170
17177
  name,
17171
17178
  type
@@ -17173,8 +17180,8 @@ function snapgeneToJson(_0) {
17173
17180
  strand: directionality ? strand_dict[directionality][0] : 1,
17174
17181
  arrowheadType: directionality ? strand_dict[directionality][1] : "NONE",
17175
17182
  start: maxStart,
17176
- end: maxEnd
17177
- // color,
17183
+ end: maxEnd,
17184
+ color: color2
17178
17185
  }));
17179
17186
  });
17180
17187
  } else if (ord(next_byte) === 6) {
package/index.js CHANGED
@@ -17143,17 +17143,20 @@ function snapgeneToJson(_0) {
17143
17143
  const b = new fxpExports.XMLParser({
17144
17144
  ignoreAttributes: false,
17145
17145
  attributeNamePrefix: "",
17146
- isArray: /* @__PURE__ */ __name((name) => name === "Feature" || name === "Segment", "isArray")
17146
+ isArray: /* @__PURE__ */ __name((name) => ["Feature", "Segment", "Q", "V"].includes(name), "isArray")
17147
17147
  }).parse(xml);
17148
17148
  const { Features: { Feature = [] } = {} } = b;
17149
17149
  data.features = [];
17150
17150
  Feature.forEach((feat) => {
17151
+ var _a2, _b2, _c, _d;
17151
17152
  const { directionality, Segment = [], name, type } = feat;
17153
+ let color2;
17152
17154
  let maxStart = 0;
17153
17155
  let maxEnd = 0;
17154
17156
  const locations = Segment && Segment.map((seg) => {
17155
17157
  if (!seg) throw new Error("invalid feature definition");
17156
17158
  const { range } = seg;
17159
+ if (seg.color) color2 = seg.color;
17157
17160
  let { start, end } = getStartAndEndFromRangeString(range);
17158
17161
  start = isProtein ? start * 3 : start;
17159
17162
  end = isProtein ? end * 3 + 2 : end;
@@ -17164,6 +17167,10 @@ function snapgeneToJson(_0) {
17164
17167
  end
17165
17168
  };
17166
17169
  });
17170
+ const colorQual = (_a2 = feat.Q) == null ? void 0 : _a2.find((q) => q.name === "color");
17171
+ if (colorQual) {
17172
+ color2 = ((_c = (_b2 = colorQual.V) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) || ((_d = colorQual.V) == null ? void 0 : _d[0]);
17173
+ }
17167
17174
  data.features.push(__spreadProps(__spreadValues({
17168
17175
  name,
17169
17176
  type
@@ -17171,8 +17178,8 @@ function snapgeneToJson(_0) {
17171
17178
  strand: directionality ? strand_dict[directionality][0] : 1,
17172
17179
  arrowheadType: directionality ? strand_dict[directionality][1] : "NONE",
17173
17180
  start: maxStart,
17174
- end: maxEnd
17175
- // color,
17181
+ end: maxEnd,
17182
+ color: color2
17176
17183
  }));
17177
17184
  });
17178
17185
  } else if (ord(next_byte) === 6) {
package/index.umd.cjs CHANGED
@@ -17147,17 +17147,20 @@ var __async = (__this, __arguments, generator) => {
17147
17147
  const b = new fxpExports.XMLParser({
17148
17148
  ignoreAttributes: false,
17149
17149
  attributeNamePrefix: "",
17150
- isArray: /* @__PURE__ */ __name((name) => name === "Feature" || name === "Segment", "isArray")
17150
+ isArray: /* @__PURE__ */ __name((name) => ["Feature", "Segment", "Q", "V"].includes(name), "isArray")
17151
17151
  }).parse(xml);
17152
17152
  const { Features: { Feature = [] } = {} } = b;
17153
17153
  data.features = [];
17154
17154
  Feature.forEach((feat) => {
17155
+ var _a2, _b2, _c, _d;
17155
17156
  const { directionality, Segment = [], name, type } = feat;
17157
+ let color2;
17156
17158
  let maxStart = 0;
17157
17159
  let maxEnd = 0;
17158
17160
  const locations = Segment && Segment.map((seg) => {
17159
17161
  if (!seg) throw new Error("invalid feature definition");
17160
17162
  const { range } = seg;
17163
+ if (seg.color) color2 = seg.color;
17161
17164
  let { start, end } = getStartAndEndFromRangeString(range);
17162
17165
  start = isProtein ? start * 3 : start;
17163
17166
  end = isProtein ? end * 3 + 2 : end;
@@ -17168,6 +17171,10 @@ var __async = (__this, __arguments, generator) => {
17168
17171
  end
17169
17172
  };
17170
17173
  });
17174
+ const colorQual = (_a2 = feat.Q) == null ? void 0 : _a2.find((q) => q.name === "color");
17175
+ if (colorQual) {
17176
+ color2 = ((_c = (_b2 = colorQual.V) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) || ((_d = colorQual.V) == null ? void 0 : _d[0]);
17177
+ }
17171
17178
  data.features.push(__spreadProps(__spreadValues({
17172
17179
  name,
17173
17180
  type
@@ -17175,8 +17182,8 @@ var __async = (__this, __arguments, generator) => {
17175
17182
  strand: directionality ? strand_dict[directionality][0] : 1,
17176
17183
  arrowheadType: directionality ? strand_dict[directionality][1] : "NONE",
17177
17184
  start: maxStart,
17178
- end: maxEnd
17179
- // color,
17185
+ end: maxEnd,
17186
+ color: color2
17180
17187
  }));
17181
17188
  });
17182
17189
  } else if (ord(next_byte) === 6) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/bio-parsers",
3
- "version": "0.4.36",
3
+ "version": "0.4.37",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/TeselaGen/tg-oss",
6
6
  "dependencies": {
@@ -113,13 +113,13 @@ async function snapgeneToJson(fileObj, options = {}) {
113
113
  const b = new XMLParser({
114
114
  ignoreAttributes: false,
115
115
  attributeNamePrefix: "",
116
- isArray: name => name === "Feature" || name === "Segment"
116
+ isArray: name => ["Feature", "Segment", "Q", "V"].includes(name)
117
117
  }).parse(xml);
118
118
  const { Features: { Feature = [] } = {} } = b;
119
119
  data.features = [];
120
120
  Feature.forEach(feat => {
121
121
  const { directionality, Segment = [], name, type } = feat;
122
- // let color;
122
+ let color;
123
123
  let maxStart = 0;
124
124
  let maxEnd = 0;
125
125
  const locations =
@@ -127,7 +127,7 @@ async function snapgeneToJson(fileObj, options = {}) {
127
127
  Segment.map(seg => {
128
128
  if (!seg) throw new Error("invalid feature definition");
129
129
  const { range } = seg;
130
- // color = seg.color;
130
+ if (seg.color) color = seg.color;
131
131
  let { start, end } = getStartAndEndFromRangeString(range);
132
132
  start = isProtein ? start * 3 : start;
133
133
  end = isProtein ? end * 3 + 2 : end;
@@ -139,6 +139,11 @@ async function snapgeneToJson(fileObj, options = {}) {
139
139
  };
140
140
  });
141
141
 
142
+ const colorQual = feat.Q?.find(q => q.name === "color");
143
+ if (colorQual) {
144
+ color = colorQual.V?.[0]?.text || colorQual.V?.[0];
145
+ }
146
+
142
147
  data.features.push({
143
148
  name,
144
149
  type,
@@ -148,8 +153,8 @@ async function snapgeneToJson(fileObj, options = {}) {
148
153
  ? strand_dict[directionality][1]
149
154
  : "NONE",
150
155
  start: maxStart,
151
- end: maxEnd
152
- // color,
156
+ end: maxEnd,
157
+ color
153
158
  });
154
159
  });
155
160
  } else if (ord(next_byte) === 6) {