@platforma-open/milaboratories.top-antibodies.workflow 1.2.1 → 1.3.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/top-antibodies/top-antibodies/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @platforma-open/milaboratories.top-antibodies.workflow@1.2.1 build /home/runner/work/top-antibodies/top-antibodies/workflow
3
+ > @platforma-open/milaboratories.top-antibodies.workflow@1.3.0 build /home/runner/work/top-antibodies/top-antibodies/workflow
4
4
  > rm -rf dist && pl-tengo check && pl-tengo build
5
5
 
6
6
  Processing "src/main.tpl.tengo"...
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @platforma-open/milaboratories.top-antibodies.workflow
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2e24f7a: Disable default normalization in VJ usage plot and change spectratype/VJ usage script to run on top clonotypes if provided
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [2e24f7a]
12
+ - @platforma-open/milaboratories.top-antibodies.spectratype@1.3.0
13
+
3
14
  ## 1.2.1
4
15
 
5
16
  ### Patch Changes
Binary file
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.top-antibodies.workflow",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "description": "Block Workflow",
6
6
  "dependencies": {
7
- "@platforma-sdk/workflow-tengo": "^4.5.1",
7
+ "@platforma-sdk/workflow-tengo": "^4.6.1",
8
+ "@platforma-open/milaboratories.top-antibodies.spectratype": "1.3.0",
8
9
  "@platforma-open/milaboratories.top-antibodies.sample-clonotypes": "1.0.1",
9
- "@platforma-open/milaboratories.top-antibodies.umap": "1.0.1",
10
- "@platforma-open/milaboratories.top-antibodies.spectratype": "1.2.0"
10
+ "@platforma-open/milaboratories.top-antibodies.umap": "1.0.1"
11
11
  },
12
12
  "devDependencies": {
13
- "@platforma-sdk/tengo-builder": "^2.1.3",
14
- "@platforma-sdk/test": "^1.30.39",
13
+ "@platforma-sdk/tengo-builder": "^2.1.5",
14
+ "@platforma-sdk/test": "^1.31.16",
15
15
  "vitest": "^2.1.8"
16
16
  },
17
17
  "scripts": {
@@ -19,7 +19,8 @@ wf.prepare(func(args){
19
19
  bundleBuilder.addAnchor("main", args.inputAnchor)
20
20
 
21
21
  for col in args.rankingOrder {
22
- bundleBuilder.addSingle(col)
22
+ bundleBuilder.addAnchor(col.value.anchorName, col.value.anchorRef)
23
+ bundleBuilder.addSingle(col.value.column)
23
24
  }
24
25
 
25
26
  // Add linker column
@@ -91,14 +92,14 @@ wf.body(func(args) {
91
92
  ////////// Clonotype Filtering //////////
92
93
 
93
94
  // Build clonotype table
94
- cloneTable := columns.xsvTableBuilder()
95
+ cloneTable := pframes.csvFileBuilder()
95
96
  cloneTable.setAxisHeader(datasetSpec.axesSpec[1].name, "clonotypeKey")
96
97
 
97
98
  for i, col in args.rankingOrder {
98
- cloneTable.add(col, {header: "Col" + string(i)})
99
+ cloneTable.add(columns.getColumn(col.value.column), {header: "Col" + string(i)})
99
100
 
100
101
  // If column does not have main anchor axis we have to include theirs
101
- colsSpec := columns.getSpec(col)
102
+ colsSpec := columns.getSpec(col.value.column)
102
103
  axesNames := slices.map(colsSpec.axesSpec, func (a) { return a.name})
103
104
  if !slices.hasElement(axesNames, datasetSpec.axesSpec[1].name) {
104
105
  for na, ax in colsSpec.axesSpec {
@@ -113,16 +114,18 @@ wf.body(func(args) {
113
114
  linkerAxisSpec := {}
114
115
  for i, col in columns.getColumns("linkers") {
115
116
  if datasetSpec.axesSpec[1].name == col.spec.axesSpec[1].name {
116
- cloneTable.add(col.key, {header: "linker." + string(i)})
117
+ cloneTable.add(col, {header: "linker." + string(i)})
117
118
  cloneTable.setAxisHeader(col.spec.axesSpec[0].name, "cluster_" + string(i))
118
119
  linkerAxisSpec["cluster_" + string(i)] = col.spec.axesSpec[0]
119
120
  } else if datasetSpec.axesSpec[1].name == col.spec.axesSpec[0].name {
120
- cloneTable.add(col.key, {header: "linker." + string(i)})
121
+ cloneTable.add(col, {header: "linker." + string(i)})
121
122
  cloneTable.setAxisHeader(col.spec.axesSpec[1].name, "cluster_" + string(i))
122
123
  linkerAxisSpec["cluster_" + string(i)] = col.spec.axesSpec[1]
123
124
  }
124
125
  }
125
- cloneTable = cloneTable.build("csv")
126
+ cloneTable = cloneTable.build()
127
+
128
+ topClonotypesCsv := undefined
126
129
 
127
130
  if topClonotypes != undefined {
128
131
  // Run sampling script
@@ -137,33 +140,36 @@ wf.body(func(args) {
137
140
  saveStdoutContent().
138
141
  cache(24 * 60 * 60 * 1000).
139
142
  run()
140
-
143
+
144
+ // Save top clonotypes CSV file
145
+ topClonotypesCsv = sampleClones.getFile("sampledClonotypes_top.csv")
146
+
141
147
  // Store outputs
142
148
  sampledColsParams := sampledColsConv.getColumns(datasetSpec, linkerAxisSpec)
143
- sampledColumnsPf := xsv.importFile(sampleClones.getFile("sampledClonotypes_top.csv"), "csv", sampledColsParams)
149
+ sampledColumnsPf := xsv.importFile(topClonotypesCsv, "csv", sampledColsParams)
144
150
  outputs["sampledRows"] = pframes.exportFrame(sampledColumnsPf)
145
151
 
146
152
  // Prepare filter col subset for UMAP
147
153
  // Avoid taking cluster axis using other params
148
154
  sampledColsUmapParams := sampledColsUmapConv.getColumns(datasetSpec)
149
- sampledColsUmapPf := xsv.importFile(sampleClones.getFile("sampledClonotypes_top.csv"), "csv", sampledColsUmapParams)
155
+ sampledColsUmapPf := xsv.importFile(topClonotypesCsv, "csv", sampledColsUmapParams)
150
156
  outputs["sampledRowsUmap"] = pframes.exportFrame(sampledColsUmapPf)
151
157
  }
152
158
 
153
159
  ////////// UMAP //////////
154
160
  // Generate input TSV with Clonotype ID and aa sequence
155
- umapTable := columns.xsvTableBuilder()
161
+ umapTable := pframes.tsvFileBuilder()
156
162
  umapTable.setAxisHeader(datasetSpec.axesSpec[1].name, "clonotypeKey")
157
163
  for col in columns.getColumns("aaSequence") {
158
164
  if isSingleCell {
159
165
  chainLabel := col.spec.domain["pl7.app/vdj/scClonotypeChain"]
160
- umapTable.add(col.key, {header: "aaSequence." + chainLabel})
166
+ umapTable.add(col, {header: "aaSequence." + chainLabel})
161
167
  } else {
162
168
  chainLabel := col.spec.axesSpec[0].domain["pl7.app/vdj/chain"]
163
- umapTable.add(col.key, {header: "aaSequence." + chainLabel})
169
+ umapTable.add(col, {header: "aaSequence." + chainLabel})
164
170
  }
165
171
  }
166
- umapTable = umapTable.build("tsv")
172
+ umapTable = umapTable.build()
167
173
 
168
174
  // UMAP script should go here
169
175
  umapClones := exec.builder().
@@ -183,7 +189,7 @@ wf.body(func(args) {
183
189
 
184
190
  ////////// CDR3 Length Calculation //////////
185
191
 
186
- cdr3SeqTable := columns.xsvTableBuilder()
192
+ cdr3SeqTable := pframes.tsvFileBuilder()
187
193
  cdr3SeqTable.setAxisHeader(datasetSpec.axesSpec[1].name, "clonotypeKey")
188
194
 
189
195
  // Must deal with multiple CDR3 sequences (two for each cell in single cell data)
@@ -218,7 +224,7 @@ wf.body(func(args) {
218
224
 
219
225
  for col in cdr3Sequences {
220
226
  headerName := makeHeaderName(col, "cdr3Sequence", isSingleCell)
221
- cdr3SeqTable.add(col.key, {header: headerName})
227
+ cdr3SeqTable.add(col, {header: headerName})
222
228
  }
223
229
 
224
230
  // Process V genes
@@ -226,7 +232,7 @@ wf.body(func(args) {
226
232
 
227
233
  for col in vGenes {
228
234
  headerName := makeHeaderName(col, "vGene", isSingleCell)
229
- cdr3SeqTable.add(col.key, {header: headerName})
235
+ cdr3SeqTable.add(col, {header: headerName})
230
236
  }
231
237
 
232
238
  // Process J genes
@@ -234,17 +240,26 @@ wf.body(func(args) {
234
240
 
235
241
  for col in jGenes {
236
242
  headerName := makeHeaderName(col, "jGene", isSingleCell)
237
- cdr3SeqTable.add(col.key, {header: headerName})
243
+ cdr3SeqTable.add(col, {header: headerName})
238
244
  }
239
245
 
240
- cdr3SeqTableBuilt := cdr3SeqTable.build("tsv")
246
+ cdr3SeqTableBuilt := cdr3SeqTable.build()
241
247
 
242
248
  cdr3VspectratypeCmd := exec.builder().
243
249
  software(assets.importSoftware("@platforma-open/milaboratories.top-antibodies.spectratype:main")).
244
250
  addFile("cdr3_sequences_input.tsv", cdr3SeqTableBuilt).
245
251
  arg("--input_tsv").arg("cdr3_sequences_input.tsv").
246
252
  arg("--spectratype_tsv").arg("spectratype.tsv").
247
- arg("--vj_usage_tsv").arg("vj_usage.tsv").
253
+ arg("--vj_usage_tsv").arg("vj_usage.tsv") // no dot here
254
+
255
+ // Add top clonotypes argument and file to the builder if provided
256
+ if topClonotypes != undefined {
257
+ cdr3VspectratypeCmd = cdr3VspectratypeCmd.
258
+ arg("--top_clonotypes_csv").arg("topClonotypes.csv").
259
+ addFile("topClonotypes.csv", topClonotypesCsv)
260
+ }
261
+
262
+ cdr3VspectratypeCmd = cdr3VspectratypeCmd. // continue building the command
248
263
  saveFile("spectratype.tsv").
249
264
  saveFile("vj_usage.tsv").
250
265
  printErrStreamToStdout().