tycho-components 0.2.0-SNAPSHOT-21 → 0.2.0-SNAPSHOT-22

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.
@@ -89,14 +89,15 @@ class CytoscapeTreeConverter {
89
89
  this.convertChunk(tree, struct, chunk);
90
90
  this.removeTemporaryEdges(tree, struct, chunk);
91
91
  }
92
- struct.tokens
93
- .filter((t) => t.ec)
94
- .forEach((t) => {
95
- const associated = struct.chunks.find((c) => this.isEmptyCategoryInChunk(c, t));
96
- if (associated) {
97
- this.convertEmptyCategory(tree, associated, t);
98
- }
99
- });
92
+ struct.tokens &&
93
+ struct.tokens
94
+ .filter((t) => t.ec)
95
+ .forEach((t) => {
96
+ const associated = struct.chunks.find((c) => this.isEmptyCategoryInChunk(c, t));
97
+ if (associated) {
98
+ this.convertEmptyCategory(tree, associated, t);
99
+ }
100
+ });
100
101
  }
101
102
  isEmptyCategoryInChunk(chunk, token) {
102
103
  if (chunk.l !== token.l)
@@ -137,7 +138,7 @@ class CytoscapeTreeConverter {
137
138
  id: nodeId,
138
139
  data: {
139
140
  id: nodeId,
140
- label: this.getLabelValue(chunk.t, chunk.coidx),
141
+ label: this.getLabelValue(chunk.t, chunk.coidx, chunk.ep),
141
142
  chunk: { ...chunk },
142
143
  },
143
144
  });
@@ -232,7 +233,7 @@ class CytoscapeTreeConverter {
232
233
  id: rootId,
233
234
  data: {
234
235
  id: rootId,
235
- label: this.getLabelValue(chunkRoot.t, chunkRoot.coidx),
236
+ label: this.getLabelValue(chunkRoot.t, chunkRoot.coidx, chunkRoot.ep),
236
237
  chunk: chunkRoot,
237
238
  },
238
239
  };
@@ -307,14 +308,14 @@ class CytoscapeTreeConverter {
307
308
  const tokens = this.sortTokens(struct.tokens);
308
309
  return tokens.slice(ti - 1, tf);
309
310
  }
310
- getLabelValue(value, coidx) {
311
+ getLabelValue(value, coidx, ep) {
311
312
  let idxLabel = '';
312
313
  if (coidx) {
313
314
  for (const idx of coidx) {
314
- idxLabel += `-${idx.toString()}`;
315
+ idxLabel += `${ep ? '=' : '-'}${idx.toString()}`;
315
316
  }
316
317
  }
317
- return value ?? '' + idxLabel;
318
+ return (value || '') + idxLabel;
318
319
  }
319
320
  getChunksByLevel(struct, chunk, level) {
320
321
  return struct.chunks.filter((c) => c.l === chunk.l - level);
@@ -114,7 +114,7 @@ export const structExample = {
114
114
  v: '*T*',
115
115
  l: 4,
116
116
  ec: true,
117
- coidx: [1],
117
+ coidx: [1, 2],
118
118
  },
119
119
  {
120
120
  splits: [
@@ -222,7 +222,7 @@ export const structExample = {
222
222
  f: 5,
223
223
  t: 'WNP',
224
224
  l: 3,
225
- coidx: [1],
225
+ coidx: [1, 2],
226
226
  },
227
227
  {
228
228
  i: 6,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.2.0-SNAPSHOT-21",
4
+ "version": "0.2.0-SNAPSHOT-22",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {