@platforma-open/milaboratories.mixcr-amplicon-alignment.workflow 1.20.1 → 1.21.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/mixcr-amplicon-alignment/mixcr-amplicon-alignment/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @platforma-open/milaboratories.mixcr-amplicon-alignment.workflow@1.20.1 build /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow
3
+ > @platforma-open/milaboratories.mixcr-amplicon-alignment.workflow@1.21.0 build /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow
4
4
  > rm -rf dist && pl-tengo check && pl-tengo build
5
5
 
6
6
  Processing "src/aggregate-by-clonotype-key.tpl.tengo"...
@@ -10,6 +10,7 @@ Processing "src/export-report.tpl.tengo"...
10
10
  Processing "src/main.tpl.tengo"...
11
11
  Processing "src/mixcr-analyze.tpl.tengo"...
12
12
  Processing "src/mixcr-export.tpl.tengo"...
13
+ Processing "src/prerun.tpl.tengo"...
13
14
  Processing "src/process.tpl.tengo"...
14
15
  Processing "src/qc-report-columns.lib.tengo"...
15
16
  Processing "src/repseqio-library.tpl.tengo"...
@@ -24,6 +25,7 @@ No syntax errors found.
24
25
  info: - writing /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow/dist/tengo/tpl/mixcr-export.plj.gz
25
26
  info: - writing /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow/dist/tengo/tpl/process.plj.gz
26
27
  info: - writing /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow/dist/tengo/tpl/repseqio-library.plj.gz
28
+ info: - writing /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow/dist/tengo/tpl/prerun.plj.gz
27
29
  info: - writing /home/runner/work/mixcr-amplicon-alignment/mixcr-amplicon-alignment/workflow/dist/tengo/tpl/main.plj.gz
28
30
  info: Template Pack build done.
29
31
  info: Template Pack build done.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @platforma-open/milaboratories.mixcr-amplicon-alignment.workflow
2
2
 
3
+ ## 1.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 00ded91: Support custom reference library
8
+
3
9
  ## 1.20.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -5,5 +5,6 @@ module.exports = { Templates: {
5
5
  'mixcr-export': { type: 'from-file', path: require.resolve('./tengo/tpl/mixcr-export.plj.gz') },
6
6
  'process': { type: 'from-file', path: require.resolve('./tengo/tpl/process.plj.gz') },
7
7
  'repseqio-library': { type: 'from-file', path: require.resolve('./tengo/tpl/repseqio-library.plj.gz') },
8
+ 'prerun': { type: 'from-file', path: require.resolve('./tengo/tpl/prerun.plj.gz') },
8
9
  'main': { type: 'from-file', path: require.resolve('./tengo/tpl/main.plj.gz') }
9
10
  }};
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 = "aggregate-by-clonotype-key" | "export-report" | "mixcr-analyze" | "mixcr-export" | "process" | "repseqio-library" | "main";
2
+ declare type TplName = "aggregate-by-clonotype-key" | "export-report" | "mixcr-analyze" | "mixcr-export" | "process" | "repseqio-library" | "prerun" | "main";
3
3
  declare const Templates: Record<TplName, TemplateFromFile>;
4
4
  export { Templates };
package/dist/index.js CHANGED
@@ -6,5 +6,6 @@ export const Templates = {
6
6
  'mixcr-export': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/mixcr-export.plj.gz') },
7
7
  'process': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/process.plj.gz') },
8
8
  'repseqio-library': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/repseqio-library.plj.gz') },
9
+ 'prerun': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/prerun.plj.gz') },
9
10
  'main': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/main.plj.gz') }
10
11
  };
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.mixcr-amplicon-alignment.workflow",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "description": "MiXCR Amplicon Alignment Workflow",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -137,7 +137,9 @@ self.body(func(inputs) {
137
137
 
138
138
  exportReportCmd.arg("qc-report.tsv").saveFile("qc-report.tsv")
139
139
  if library {
140
- if isLibraryFileGzipped {
140
+ if is_string(library) {
141
+ exportReportCmd.writeFile("library.json", library).saveFile("library.json")
142
+ } else if isLibraryFileGzipped {
141
143
  exportReportCmd.addFile("library.json.gz", library)
142
144
  } else {
143
145
  exportReportCmd.addFile("library.json", library)
@@ -226,7 +228,9 @@ self.body(func(inputs) {
226
228
  arg("clones.tsv").
227
229
  saveFile("clones.tsv")
228
230
  if library {
229
- if isLibraryFileGzipped {
231
+ if is_string(library) {
232
+ exportFiltersCmd.writeFile("library.json", library).saveFile("library.json")
233
+ } else if isLibraryFileGzipped {
230
234
  exportFiltersCmd.addFile("library.json.gz", library)
231
235
  } else {
232
236
  exportFiltersCmd.addFile("library.json", library)
@@ -15,6 +15,8 @@ json := import("json")
15
15
  processTpl := assets.importTemplate(":process")
16
16
  repseqioLibraryTpl := assets.importTemplate(":repseqio-library")
17
17
 
18
+ wf.setPreRun(assets.importTemplate(":prerun"))
19
+
18
20
  wf.prepare(func(args){
19
21
  return {}
20
22
  })
@@ -47,11 +49,74 @@ wf.body(func(args) {
47
49
  debugOutput := undefined
48
50
  libraryImportHandle := undefined
49
51
 
50
- if !is_undefined(args.libraryFile) {
52
+ mode := args.referenceInputMode
53
+ if is_undefined(mode) {
54
+ mode = "fastaSequence"
55
+ }
56
+
57
+ if mode == "buildLibrary" {
58
+ // Build library mode — construct library.json from entry definitions
59
+ chainInfoForMixcr := chainInfos[chains].mixcrFilter
60
+ genes := []
61
+ fragments := []
62
+ for entry in args.libraryEntries {
63
+ vName := entry.name + "_Vgene"
64
+ jName := entry.name + "_Jgene"
65
+ vUri := "local://" + vName
66
+ jUri := "local://" + jName
67
+ genes = append(genes, {
68
+ baseSequence: vUri,
69
+ name: vName,
70
+ geneType: "V",
71
+ isFunctional: true,
72
+ chains: [chainInfoForMixcr],
73
+ anchorPoints: {
74
+ FR1Begin: entry.vAnchorPoints.fr1Begin,
75
+ CDR1Begin: entry.vAnchorPoints.cdr1Begin,
76
+ FR2Begin: entry.vAnchorPoints.fr2Begin,
77
+ CDR2Begin: entry.vAnchorPoints.cdr2Begin,
78
+ FR3Begin: entry.vAnchorPoints.fr3Begin,
79
+ CDR3Begin: entry.vAnchorPoints.cdr3Begin,
80
+ VEnd: entry.vAnchorPoints.vEnd
81
+ }
82
+ })
83
+ fragments = append(fragments, {
84
+ uri: vUri,
85
+ range: { from: 0, to: len(entry.vSequence) },
86
+ sequence: entry.vSequence
87
+ })
88
+ genes = append(genes, {
89
+ baseSequence: jUri,
90
+ name: jName,
91
+ geneType: "J",
92
+ isFunctional: true,
93
+ chains: [chainInfoForMixcr],
94
+ anchorPoints: {
95
+ JBegin: entry.jAnchorPoints.jBegin,
96
+ FR4Begin: entry.jAnchorPoints.fr4Begin,
97
+ FR4End: entry.jAnchorPoints.fr4End
98
+ }
99
+ })
100
+ fragments = append(fragments, {
101
+ uri: jUri,
102
+ range: { from: 0, to: len(entry.jSequence) },
103
+ sequence: entry.jSequence
104
+ })
105
+ }
106
+ library := [{
107
+ taxonId: 1111,
108
+ speciesNames: ["custom"],
109
+ genes: genes,
110
+ sequenceFragments: fragments,
111
+ checksumVersion: 1
112
+ }]
113
+ referenceLibrary = string(json.encode(library))
114
+ } else if mode == "libraryFile" {
51
115
  fImport := file.importFile(args.libraryFile)
52
116
  libraryImportHandle = fImport.handle
53
117
  referenceLibrary = fImport.file
54
118
  } else {
119
+ // fastaSequence or fastaFile — both use vGenes/jGenes via repseqio
55
120
  repseqioResults := render.create(repseqioLibraryTpl, {
56
121
  vGenes: args.vGenes,
57
122
  jGenes: args.jGenes,
@@ -101,7 +166,7 @@ wf.body(func(args) {
101
166
  }
102
167
  }
103
168
 
104
- if !is_undefined(args.libraryFile) {
169
+ if mode == "libraryFile" {
105
170
  exports.library = {
106
171
  data: referenceLibrary,
107
172
  spec: {
@@ -127,7 +192,9 @@ wf.body(func(args) {
127
192
  progress: runMixcr.output("progress.data"),
128
193
  clonotypeTables: pframes.exportFrame(runMixcr.output("clonotypeTables"))
129
194
  }
130
- outputs.referenceLibrary = file.exportFile(referenceLibrary)
195
+ if mode != "buildLibrary" {
196
+ outputs.referenceLibrary = file.exportFile(referenceLibrary)
197
+ }
131
198
  if !is_undefined(debugOutput) {
132
199
  outputs.debugOutput = debugOutput
133
200
  }
@@ -89,8 +89,15 @@ self.body(func(inputs) {
89
89
  mixcrCmdBuilder.
90
90
  arg("--assemble-clonotypes-by").arg(formatAssemblingFeature(params.assemblingFeature)).
91
91
  arg("--species").arg("custom").
92
- arg("--library").arg(libraryFileName).
93
- addFile(libraryFileName, params.referenceLibrary).
92
+ arg("--library").arg(libraryFileName)
93
+
94
+ if is_string(params.referenceLibrary) {
95
+ mixcrCmdBuilder.writeFile(libraryFileName, params.referenceLibrary).saveFile(libraryFileName)
96
+ } else {
97
+ mixcrCmdBuilder.addFile(libraryFileName, params.referenceLibrary)
98
+ }
99
+
100
+ mixcrCmdBuilder.
94
101
  arg("--rna").
95
102
  arg("--force-overwrite").
96
103
  arg("--rigid-left-alignment-boundary").
@@ -221,12 +221,19 @@ self.body(func(inputs) {
221
221
  libraryFileName = "library.json.gz"
222
222
  }
223
223
 
224
- return mixcrCmdBuilder.
224
+ mixcrCmdBuilder.
225
225
  arg("clones.clns").
226
226
  addFile("clones.clns", clnsFile).
227
227
  arg("clones.tsv").
228
- saveFile("clones.tsv").
229
- addFile(libraryFileName, params.referenceLibrary).
228
+ saveFile("clones.tsv")
229
+
230
+ if is_string(params.referenceLibrary) {
231
+ mixcrCmdBuilder.writeFile(libraryFileName, params.referenceLibrary).saveFile(libraryFileName)
232
+ } else {
233
+ mixcrCmdBuilder.addFile(libraryFileName, params.referenceLibrary)
234
+ }
235
+
236
+ return mixcrCmdBuilder.
230
237
  cacheHours(3).
231
238
  run()
232
239
  }
@@ -0,0 +1,34 @@
1
+ wf := import("@platforma-sdk/workflow-tengo:workflow")
2
+ render := import("@platforma-sdk/workflow-tengo:render")
3
+ assets := import("@platforma-sdk/workflow-tengo:assets")
4
+ file := import("@platforma-sdk/workflow-tengo:file")
5
+
6
+ repseqioLibraryTpl := assets.importTemplate(":repseqio-library")
7
+
8
+ wf.body(func(args) {
9
+ outputs := {}
10
+
11
+ if args.referenceInputMode == "buildLibrary" && !is_undefined(args.buildLibraryVGenes) && !is_undefined(args.buildLibraryJGenes) {
12
+ chainInfos := {
13
+ "IGHeavy": "IGH",
14
+ "IGLight": "IGK",
15
+ "TCRAlpha": "TRA",
16
+ "TCRBeta": "TRB",
17
+ "TCRGamma": "TRD",
18
+ "TCRDelta": "TRG"
19
+ }
20
+ chains := chainInfos[args.chains]
21
+
22
+ repseqioResults := render.createEphemeral(repseqioLibraryTpl, {
23
+ vGenes: args.buildLibraryVGenes,
24
+ jGenes: args.buildLibraryJGenes,
25
+ chains: chains
26
+ })
27
+ outputs.referenceLibrary = file.exportFile(repseqioResults.output("referenceLibrary"))
28
+ }
29
+
30
+ return {
31
+ outputs: outputs,
32
+ exports: {}
33
+ }
34
+ })