@platforma-open/milaboratories.top-antibodies.workflow 1.14.1 → 1.15.0

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,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @platforma-open/milaboratories.top-antibodies.workflow@1.14.1 build /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow
3
+ > @platforma-open/milaboratories.top-antibodies.workflow@1.15.0 build /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow
4
4
  > rm -rf dist && pl-tengo check && pl-tengo build
5
5
 
6
6
  Processing "src/assembling-fasta.tpl.tengo"...
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @platforma-open/milaboratories.top-antibodies.workflow
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 00143a9: multiple clustering blocks fix, columns names fix, dependencies updates
8
+
3
9
  ## 1.14.1
4
10
 
5
11
  ### Patch Changes
Binary file
Binary file
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.top-antibodies.workflow",
3
- "version": "1.14.1",
3
+ "version": "1.15.0",
4
4
  "type": "module",
5
5
  "description": "Block Workflow",
6
6
  "dependencies": {
7
- "@platforma-sdk/workflow-tengo": "^5.6.4",
7
+ "@platforma-sdk/workflow-tengo": "^5.6.6",
8
8
  "@platforma-open/milaboratories.software-anarci": "^0.0.3",
9
9
  "@platforma-open/milaboratories.top-antibodies.sample-clonotypes": "1.7.1",
10
10
  "@platforma-open/milaboratories.top-antibodies.umap": "1.2.1",
11
- "@platforma-open/milaboratories.top-antibodies.anarci-kabat": "1.2.1",
11
+ "@platforma-open/milaboratories.top-antibodies.spectratype": "1.7.1",
12
12
  "@platforma-open/milaboratories.top-antibodies.assembling-fasta": "1.2.1",
13
- "@platforma-open/milaboratories.top-antibodies.spectratype": "1.7.1"
13
+ "@platforma-open/milaboratories.top-antibodies.anarci-kabat": "1.2.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@platforma-sdk/tengo-builder": "^2.3.14",
17
- "@platforma-sdk/test": "^1.46.3",
16
+ "@platforma-sdk/tengo-builder": "^2.4.0",
17
+ "@platforma-sdk/test": "^1.47.3",
18
18
  "vitest": "^2.1.8"
19
19
  },
20
20
  "scripts": {
@@ -210,31 +210,96 @@ wf.body(func(args) {
210
210
 
211
211
  // Get linker columns if needed
212
212
  linkerAxisSpec := {}
213
+ linkerClusterIdAxes := []
213
214
  if len(columns.getColumns("linkers")) > 0 {
214
215
  for i, col in columns.getColumns("linkers") {
216
+ clusterIdAxis := undefined
215
217
  if datasetSpec.axesSpec[1].name == col.spec.axesSpec[1].name {
216
218
  cloneTable.add(col, {header: "linker." + string(i)})
217
219
  cloneTable.setAxisHeader(col.spec.axesSpec[0], "cluster_" + string(i))
218
220
  linkerAxisSpec["cluster_" + string(i)] = col.spec.axesSpec[0]
221
+ clusterIdAxis = col.spec.axesSpec[0]
219
222
  } else if datasetSpec.axesSpec[1].name == col.spec.axesSpec[0].name {
220
223
  cloneTable.add(col, {header: "linker." + string(i)})
221
224
  cloneTable.setAxisHeader(col.spec.axesSpec[1], "cluster_" + string(i))
222
225
  linkerAxisSpec["cluster_" + string(i)] = col.spec.axesSpec[1]
226
+ clusterIdAxis = col.spec.axesSpec[1]
227
+ }
228
+ // Collect clusterId axes from linker columns to match cluster size columns
229
+ if !is_undefined(clusterIdAxis) && clusterIdAxis.name == "pl7.app/vdj/clusterId" {
230
+ linkerClusterIdAxes = append(linkerClusterIdAxes, clusterIdAxis)
223
231
  }
224
232
  addedCols = true
225
233
  }
226
234
  }
227
235
 
228
- // Add cluster size columns if available
236
+ // Add cluster size columns if available, but only those matching linker columns' clusterId axes
237
+ // This ensures we only join columns from the same clustering run
229
238
  if len(columns.getColumns("clusterSizes")) > 0 {
230
- for i, col in columns.getColumns("clusterSizes") {
231
- cloneTable.add(col, {header: "clusterSize." + string(i)})
232
- addedCols = true
233
- // Add the cluster axis header
234
- for axisIdx, axis in col.spec.axesSpec {
235
- if axis.name != datasetSpec.axesSpec[1].name {
236
- cloneTable.setAxisHeader(axis, "clusterAxis_" + string(i) + "_" + string(axisIdx))
239
+ clusterSizeIdx := 0
240
+ for col in columns.getColumns("clusterSizes") {
241
+ // Find the clusterId axis in this cluster size column
242
+ clusterSizeClusterIdAxis := undefined
243
+ for axis in col.spec.axesSpec {
244
+ if axis.name == "pl7.app/vdj/clusterId" {
245
+ clusterSizeClusterIdAxis = axis
246
+ break
247
+ }
248
+ }
249
+
250
+ // Only add if we have linker columns and this cluster size matches one of them
251
+ shouldAdd := false
252
+ if len(linkerClusterIdAxes) > 0 && !is_undefined(clusterSizeClusterIdAxis) {
253
+ // Check if this cluster size column matches any linker's clusterId axis
254
+ for linkerAxis in linkerClusterIdAxes {
255
+ // Compare domains - they must match exactly for same clustering run
256
+ if clusterSizeClusterIdAxis.name == linkerAxis.name &&
257
+ clusterSizeClusterIdAxis.type == linkerAxis.type {
258
+ // Check if domains match
259
+ domainsMatch := true
260
+ if is_undefined(clusterSizeClusterIdAxis.domain) != is_undefined(linkerAxis.domain) {
261
+ domainsMatch = false
262
+ } else if !is_undefined(clusterSizeClusterIdAxis.domain) && !is_undefined(linkerAxis.domain) {
263
+ // Compare domain keys and values
264
+ if len(clusterSizeClusterIdAxis.domain) != len(linkerAxis.domain) {
265
+ domainsMatch = false
266
+ } else {
267
+ for k, v in clusterSizeClusterIdAxis.domain {
268
+ if is_undefined(linkerAxis.domain[k]) || linkerAxis.domain[k] != v {
269
+ domainsMatch = false
270
+ break
271
+ }
272
+ }
273
+ }
274
+ }
275
+ if domainsMatch {
276
+ shouldAdd = true
277
+ break
278
+ }
279
+ }
280
+ }
281
+ }
282
+
283
+ // Only add cluster size columns that match a linker column's clustering run
284
+ if shouldAdd {
285
+ // Trace elements are already present in col.spec from the clustering block.
286
+ // deriveLabels (in label.ts) will use these existing trace elements to construct
287
+ // distinguishing labels when multiple clustering blocks are joined, similar to
288
+ // how LabelTypeFull ('__LABEL__@1') works. The trace includes:
289
+ // - Original dataset trace
290
+ // - "milaboratories.clonotype-clustering.sequences" trace element
291
+ // - "milaboratories.clonotype-clustering.clustering" trace element
292
+ // No modification needed - just preserve the existing trace.
293
+
294
+ cloneTable.add(col, {header: "clusterSize." + string(clusterSizeIdx)})
295
+ addedCols = true
296
+ // Add the cluster axis header
297
+ for axisIdx, axis in col.spec.axesSpec {
298
+ if axis.name != datasetSpec.axesSpec[1].name {
299
+ cloneTable.setAxisHeader(axis, "clusterAxis_" + string(clusterSizeIdx) + "_" + string(axisIdx))
300
+ }
237
301
  }
302
+ clusterSizeIdx = clusterSizeIdx + 1
238
303
  }
239
304
  }
240
305
  }