@platforma-open/milaboratories.top-antibodies.workflow 1.15.1 → 1.17.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.15.1 build /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow
3
+ > @platforma-open/milaboratories.top-antibodies.workflow@1.17.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"...
@@ -9,17 +9,17 @@ Processing "src/main.tpl.tengo"...
9
9
  Processing "src/pf-kabat-conv.lib.tengo"...
10
10
  Processing "src/pf-spectratype-conv.lib.tengo"...
11
11
  Processing "src/pf-vj-usage-conv.lib.tengo"...
12
- Processing "src/prerun.tpl.tengo"...
13
12
  Processing "src/sampled-cols-conv.lib.tengo"...
13
+ Processing "src/utils.lib.tengo"...
14
14
  No syntax errors found.
15
15
  info: Compiling 'dist'...
16
16
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/lib/pf-kabat-conv.lib.tengo
17
17
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/lib/pf-spectratype-conv.lib.tengo
18
18
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/lib/pf-vj-usage-conv.lib.tengo
19
19
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/lib/sampled-cols-conv.lib.tengo
20
+ info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/lib/utils.lib.tengo
20
21
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/tpl/assembling-fasta.plj.gz
21
22
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/tpl/filter-and-sample.plj.gz
22
- info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/tpl/prerun.plj.gz
23
23
  info: - writing /home/runner/work/antibody-tcr-lead-selection/antibody-tcr-lead-selection/workflow/dist/tengo/tpl/main.plj.gz
24
24
  info: Template Pack build done.
25
25
  info: Template Pack build done.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @platforma-open/milaboratories.top-antibodies.workflow
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b201aaf: Improve cluster ranking, improve performance
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [b201aaf]
12
+ - @platforma-open/milaboratories.top-antibodies.anarci-kabat@1.3.0
13
+ - @platforma-open/milaboratories.top-antibodies.assembling-fasta@1.3.0
14
+ - @platforma-open/milaboratories.top-antibodies.sample-clonotypes@1.9.0
15
+ - @platforma-open/milaboratories.top-antibodies.spectratype@1.8.0
16
+
17
+ ## 1.16.0
18
+
19
+ ### Minor Changes
20
+
21
+ - 4ecbe6b: Improve cluster-based ranking
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [4ecbe6b]
26
+ - @platforma-open/milaboratories.top-antibodies.sample-clonotypes@1.8.0
27
+
3
28
  ## 1.15.1
4
29
 
5
30
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  module.exports = { Templates: {
2
2
  'assembling-fasta': { type: 'from-file', path: require.resolve('./tengo/tpl/assembling-fasta.plj.gz') },
3
3
  'filter-and-sample': { type: 'from-file', path: require.resolve('./tengo/tpl/filter-and-sample.plj.gz') },
4
- 'prerun': { type: 'from-file', path: require.resolve('./tengo/tpl/prerun.plj.gz') },
5
4
  'main': { type: 'from-file', path: require.resolve('./tengo/tpl/main.plj.gz') }
6
5
  }};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
2
- declare type TplName = "assembling-fasta" | "filter-and-sample" | "prerun" | "main";
2
+ declare type TplName = "assembling-fasta" | "filter-and-sample" | "main";
3
3
  declare const Templates: Record<TplName, TemplateFromFile>;
4
4
  export { Templates };
package/dist/index.js CHANGED
@@ -2,6 +2,5 @@ import { resolve } from 'node:path';
2
2
  export const Templates = {
3
3
  'assembling-fasta': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/assembling-fasta.plj.gz') },
4
4
  'filter-and-sample': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/filter-and-sample.plj.gz') },
5
- 'prerun': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/prerun.plj.gz') },
6
5
  'main': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/main.plj.gz') }
7
6
  };
@@ -11,7 +11,7 @@ getColumns := func(datasetSpec, addRanking) {
11
11
  domain: {},
12
12
  annotations: {
13
13
  "pl7.app/label": "Sampling column",
14
- "pl7.app/table/visibility": "optional",
14
+ "pl7.app/table/visibility": "hidden",
15
15
  "pl7.app/isSubset": "true"
16
16
  }
17
17
  }
@@ -0,0 +1,139 @@
1
+
2
+
3
+ slices := import("@platforma-sdk/workflow-tengo:slices")
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ clusterAxisDomainsMatch := func(axis1, axis2) {
14
+
15
+ if is_undefined(axis1) || is_undefined(axis2) {
16
+ return false
17
+ }
18
+
19
+
20
+ if is_undefined(axis1.domain) != is_undefined(axis2.domain) {
21
+ return false
22
+ }
23
+
24
+
25
+ if is_undefined(axis1.domain) && is_undefined(axis2.domain) {
26
+ return true
27
+ }
28
+
29
+
30
+ if len(axis1.domain) != len(axis2.domain) {
31
+ return false
32
+ }
33
+
34
+
35
+ for k, v in axis1.domain {
36
+ if is_undefined(axis2.domain[k]) || axis2.domain[k] != v {
37
+ return false
38
+ }
39
+ }
40
+
41
+ return true
42
+ }
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+ findMatchingLinkerIndex := func(colsSpec, linkerColumns) {
53
+
54
+ rankingClusterIdAxis := undefined
55
+ for axis in colsSpec.axesSpec {
56
+ if axis.name == "pl7.app/vdj/clusterId" {
57
+ rankingClusterIdAxis = axis
58
+ break
59
+ }
60
+ }
61
+
62
+
63
+ if is_undefined(rankingClusterIdAxis) {
64
+ return undefined
65
+ }
66
+
67
+ for li, linkerCol in linkerColumns {
68
+
69
+ linkerClusterIdAxis := undefined
70
+ for axis in linkerCol.spec.axesSpec {
71
+ if axis.name == "pl7.app/vdj/clusterId" {
72
+ linkerClusterIdAxis = axis
73
+ break
74
+ }
75
+ }
76
+
77
+
78
+ if clusterAxisDomainsMatch(rankingClusterIdAxis, linkerClusterIdAxis) {
79
+ return li
80
+ }
81
+ }
82
+
83
+ return undefined
84
+ }
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ processRankingColumn := func(colsSpec, datasetMainAxisName, linkerColumns, clusterPropertyIdx) {
96
+ axesNames := slices.map(colsSpec.axesSpec, func (a) { return a.name})
97
+ isClusterProperty := !slices.hasElement(axesNames, datasetMainAxisName)
98
+
99
+ if !isClusterProperty {
100
+
101
+ return {
102
+ isClusterProperty: false,
103
+ header: undefined,
104
+ clusterAxisIdx: undefined,
105
+ newClusterPropertyIdx: clusterPropertyIdx
106
+ }
107
+ }
108
+
109
+
110
+ linkerIdx := findMatchingLinkerIndex(colsSpec, linkerColumns)
111
+
112
+ header := ""
113
+ clusterAxisIdx := undefined
114
+ newClusterPropertyIdx := clusterPropertyIdx
115
+
116
+ if linkerIdx != undefined {
117
+
118
+ header = "Col_linker." + string(linkerIdx)
119
+ clusterAxisIdx = linkerIdx
120
+ } else {
121
+
122
+ header = "Col_cluster." + string(clusterPropertyIdx)
123
+ clusterAxisIdx = clusterPropertyIdx
124
+ newClusterPropertyIdx = clusterPropertyIdx + 1
125
+ }
126
+
127
+ return {
128
+ isClusterProperty: true,
129
+ header: header,
130
+ clusterAxisIdx: clusterAxisIdx,
131
+ newClusterPropertyIdx: newClusterPropertyIdx
132
+ }
133
+ }
134
+
135
+ export {
136
+ clusterAxisDomainsMatch: clusterAxisDomainsMatch,
137
+ findMatchingLinkerIndex: findMatchingLinkerIndex,
138
+ processRankingColumn: processRankingColumn
139
+ }
Binary file
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.top-antibodies.workflow",
3
- "version": "1.15.1",
3
+ "version": "1.17.0",
4
4
  "type": "module",
5
5
  "description": "Block Workflow",
6
6
  "dependencies": {
7
- "@platforma-sdk/workflow-tengo": "^5.6.6",
7
+ "@platforma-sdk/workflow-tengo": "^5.7.3",
8
8
  "@platforma-open/milaboratories.software-anarci": "^0.0.3",
9
- "@platforma-open/milaboratories.top-antibodies.sample-clonotypes": "1.7.2",
10
- "@platforma-open/milaboratories.top-antibodies.spectratype": "1.7.1",
9
+ "@platforma-open/milaboratories.top-antibodies.sample-clonotypes": "1.9.0",
11
10
  "@platforma-open/milaboratories.top-antibodies.umap": "1.2.1",
12
- "@platforma-open/milaboratories.top-antibodies.assembling-fasta": "1.2.1",
13
- "@platforma-open/milaboratories.top-antibodies.anarci-kabat": "1.2.1"
11
+ "@platforma-open/milaboratories.top-antibodies.assembling-fasta": "1.3.0",
12
+ "@platforma-open/milaboratories.top-antibodies.spectratype": "1.8.0",
13
+ "@platforma-open/milaboratories.top-antibodies.anarci-kabat": "1.3.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@platforma-sdk/tengo-builder": "^2.4.1",
17
- "@platforma-sdk/test": "^1.47.6",
16
+ "@platforma-sdk/tengo-builder": "^2.4.2",
17
+ "@platforma-sdk/test": "^1.48.8",
18
18
  "vitest": "^2.1.8"
19
19
  },
20
20
  "scripts": {
@@ -12,7 +12,7 @@ self.body(func(inputs) {
12
12
 
13
13
  inputTsv := inputs.inputTsv
14
14
  keyColumn := inputs.keyColumn // "clonotypeKey" or "scClonotypeKey"
15
- finalClonotypesCsv := inputs.finalClonotypesCsv // optional
15
+ finalClonotypes := inputs.finalClonotypes // optional
16
16
  isSingleCell := inputs.isSingleCell // boolean
17
17
  bulkChain := inputs.bulkChain // "H" or "KL" when !isSingleCell
18
18
 
@@ -20,14 +20,14 @@ self.body(func(inputs) {
20
20
  software(assets.importSoftware("@platforma-open/milaboratories.top-antibodies.assembling-fasta:main")).
21
21
  cpu(1).
22
22
  mem("4GiB").
23
- addFile("assembling.tsv", inputTsv).
24
- arg("--input_tsv").arg("assembling.tsv").
23
+ addFile("assembling.parquet", inputTsv).
24
+ arg("--input_parquet").arg("assembling.parquet").
25
25
  arg("--key_column").arg(keyColumn).
26
26
  arg("--output_fasta").arg("assembling.fasta")
27
27
 
28
- if finalClonotypesCsv != undefined {
29
- cmd = cmd.addFile("finalClonotypes.csv", finalClonotypesCsv).
30
- arg("--final_clonotypes_csv").arg("finalClonotypes.csv")
28
+ if finalClonotypes != undefined {
29
+ cmd = cmd.addFile("finalClonotypes.parquet", finalClonotypes).
30
+ arg("--final-clonotypes").arg("finalClonotypes.parquet")
31
31
  }
32
32
 
33
33
  cmd = cmd.saveFile("assembling.fasta").
@@ -8,7 +8,7 @@ render := import("@platforma-sdk/workflow-tengo:render")
8
8
  sampledColsConv := import(":sampled-cols-conv")
9
9
  json := import("json")
10
10
 
11
- self.defineOutputs("sampledRows", "finalClonotypesCsv")
11
+ self.defineOutputs("sampledRows", "finalClonotypes")
12
12
 
13
13
  self.body(func(inputs) {
14
14
 
@@ -19,63 +19,73 @@ self.body(func(inputs) {
19
19
  topClonotypes := inputs.topClonotypes
20
20
 
21
21
  outputs := {}
22
- finalClonotypesCsv := undefined
22
+ finalClonotypes := undefined
23
23
 
24
24
  // Run filtering script
25
25
  filterResult := exec.builder().
26
26
  software(assets.importSoftware("@platforma-open/milaboratories.top-antibodies.sample-clonotypes:filter")).
27
27
  mem("16GiB").
28
28
  cpu(1).
29
- addFile("clonotypes.csv", cloneTable).
30
- arg("--csv").arg("clonotypes.csv").
31
- arg("--out").arg("filteredClonotypes.csv").
29
+ addFile("clonotypes.parquet", cloneTable).
30
+ arg("--parquet").arg("clonotypes.parquet").
31
+ arg("--out").arg("filteredClonotypes.parquet").
32
32
  arg("--filter-map").arg(string(json.encode(filterMap))).
33
- saveFile("filteredClonotypes.csv").
33
+ saveFile("filteredClonotypes.parquet").
34
34
  printErrStreamToStdout().
35
35
  cache(24 * 60 * 60 * 1000).
36
36
  run()
37
37
 
38
- // Save filtered CSV file
39
- filteredClonotypesCsv := filterResult.getFile("filteredClonotypes.csv")
38
+ // Save filtered parquet file
39
+ filteredClonotypes := filterResult.getFile("filteredClonotypes.parquet")
40
40
 
41
41
  // Store outputs
42
42
  sampledColsParams := sampledColsConv.getColumns(datasetSpec, false) // No ranking column
43
- filteredClonotypesPf := xsv.importFile(filteredClonotypesCsv, "csv", sampledColsParams,
43
+ filteredClonotypesPf := xsv.importFile(filteredClonotypes, "parquet", sampledColsParams,
44
44
  {cpu: 1, mem: "16GiB"})
45
45
 
46
46
  // Prepare outputs in case there is no top ranking
47
47
  outputs["sampledRows"] = pframes.exportFrame(filteredClonotypesPf)
48
- finalClonotypesCsv = filteredClonotypesCsv
48
+ finalClonotypes = filteredClonotypes
49
49
 
50
50
  if topClonotypes != undefined {
51
51
 
52
52
  ////////// Top Clonotypes Sampling //////////
53
53
  // Run sampling script on filtered data
54
- sampleClones := exec.builder().
54
+ builder := exec.builder().
55
55
  software(assets.importSoftware("@platforma-open/milaboratories.top-antibodies.sample-clonotypes:main")).
56
56
  mem("16GiB").
57
57
  cpu(1).
58
- addFile("filteredClonotypes.csv", filteredClonotypesCsv).
59
- arg("--csv").arg("filteredClonotypes.csv").
58
+ addFile("filteredClonotypes.parquet", filteredClonotypes).
59
+ arg("--parquet").arg("filteredClonotypes.parquet").
60
60
  arg("--n").arg(string(topClonotypes)).
61
- arg("--ranking-map").arg(string(json.encode(rankingMap))).
62
- arg("--out").arg("sampledClonotypes_top.csv").
63
- saveFile("sampledClonotypes_top.csv").
61
+ arg("--ranking-map").arg(string(json.encode(rankingMap)))
62
+
63
+ // Add optional parameters if provided in block args
64
+ if inputs.disableClusterRanking {
65
+ builder = builder.arg("--disable-cluster-ranking")
66
+ }
67
+ if inputs.clusterColumn != undefined && inputs.clusterColumn != "" {
68
+ builder = builder.arg("--cluster-column").arg(inputs.clusterColumn)
69
+ }
70
+
71
+ sampleClones := builder.
72
+ arg("--out").arg("sampledClonotypes_top.parquet").
73
+ saveFile("sampledClonotypes_top.parquet").
64
74
  printErrStreamToStdout().
65
75
  cache(24 * 60 * 60 * 1000).
66
76
  run()
67
77
 
68
- // Save top clonotypes CSV file
69
- finalClonotypesCsv = sampleClones.getFile("sampledClonotypes_top.csv")
78
+ // Save top clonotypes parquet file
79
+ finalClonotypes = sampleClones.getFile("sampledClonotypes_top.parquet")
70
80
 
71
81
  // Store outputs
72
82
  sampledColsParams := sampledColsConv.getColumns(datasetSpec, true) // Add ranking column
73
- sampledColumnsPf := xsv.importFile(finalClonotypesCsv, "csv", sampledColsParams,
83
+ sampledColumnsPf := xsv.importFile(finalClonotypes, "parquet", sampledColsParams,
74
84
  {cpu: 1, mem: "16GiB"})
75
85
  outputs["sampledRows"] = pframes.exportFrame(sampledColumnsPf)
76
86
  }
77
87
 
78
- outputs["finalClonotypesCsv"] = finalClonotypesCsv
88
+ outputs["finalClonotypes"] = finalClonotypes
79
89
 
80
90
  return outputs
81
91
  })