@platforma-open/milaboratories.mixcr-library-builder.workflow 1.0.2

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.
@@ -0,0 +1,11 @@
1
+  WARN  Issue while reading "/home/runner/work/mixcr-library-builder/mixcr-library-builder/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
+
3
+ > @platforma-open/milaboratories.mixcr-library-builder.workflow@1.0.2 build /home/runner/work/mixcr-library-builder/mixcr-library-builder/workflow
4
+ > rm -rf dist && pl-tengo check && pl-tengo build
5
+
6
+ Processing "src/main.tpl.tengo"...
7
+ No syntax errors found.
8
+ info: Compiling 'dist'...
9
+ info: - writing /home/runner/work/mixcr-library-builder/mixcr-library-builder/workflow/dist/tengo/tpl/main.plj.gz
10
+ info:
11
+ info: Template Pack build done.
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @platforma-open/milaboratories.mixcr-library-builder.workflow
2
+
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - d46bab1: chore: change npmjs repo
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 344b5fc: chore: inital release
package/dist/index.cjs ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = { Templates: {
2
+ 'main': { type: 'from-file', path: require.resolve('./tengo/tpl/main.plj.gz') }
3
+ }};
@@ -0,0 +1,4 @@
1
+ declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
2
+ declare type TplName = "main";
3
+ declare const Templates: Record<TplName, TemplateFromFile>;
4
+ export { Templates };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { resolve } from 'node:path';
2
+ export const Templates = {
3
+ 'main': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/main.plj.gz') }
4
+ };
Binary file
package/format.el ADDED
@@ -0,0 +1,43 @@
1
+ ;; This program formats all files inside src directory. Usage: emacs --script ./format.el
2
+
3
+ (defun install-go-mode ()
4
+ "Installs go-mode"
5
+ (require 'package)
6
+ (add-to-list 'package-archives
7
+ '("melpa-stable" . "https://stable.melpa.org/packages/"))
8
+ (package-initialize)
9
+ (unless package-archive-contents
10
+ (package-refresh-contents))
11
+
12
+ (package-install 'go-mode t)
13
+ (require 'go-mode))
14
+
15
+ ;; spaces -> tabs only at the beginning of lines
16
+ (setq tabify-regexp "^\t* [ \t]+")
17
+
18
+ (defun format-file (file)
19
+ "Formats a file according to slightly changed Go rules"
20
+ (message "Format %s" file)
21
+ (save-excursion
22
+ (find-file file)
23
+ (delete-trailing-whitespace) ;; deletes whitespaces
24
+ (go-mode) ;; sets golang rules for indentation
25
+ (tabify (point-min) (point-max)) ;; spaces -> tabs in the whole file
26
+ (indent-region (point-min) (point-max)) ;; indentation in the whole file
27
+ (save-buffer))) ;; save file
28
+
29
+ (install-go-mode)
30
+
31
+ ;; change syntax of a standard go-mode a bit
32
+ (advice-add
33
+ 'go--in-composite-literal-p
34
+ :filter-return
35
+ (lambda (&rest r) t))
36
+
37
+ ;; find all files in src
38
+ (setq files (directory-files-recursively "src" "\\.tengo\\'"))
39
+
40
+ ;; call format on every file.
41
+ (dolist (file files)
42
+ (format-file file))
43
+
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
2
+ declare type TplName = "main";
3
+ declare const Templates: Record<TplName, TemplateFromFile>;
4
+ export { Templates };
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = { Templates: {
2
+ 'main': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/main.plj.gz') }
3
+ }}
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@platforma-open/milaboratories.mixcr-library-builder.workflow",
3
+ "version": "1.0.2",
4
+ "type": "module",
5
+ "description": "Block Workflow",
6
+ "dependencies": {},
7
+ "devDependencies": {
8
+ "@platforma-sdk/tengo-builder": "^1.17.7",
9
+ "@platforma-sdk/workflow-tengo": "^2.12.1",
10
+ "@platforma-open/milaboratories.software-small-binaries": "^1.15.6",
11
+ "@platforma-open/milaboratories.software-mixcr": "4.7.0-139-develop",
12
+ "@platforma-sdk/test": "^1.22.49",
13
+ "vitest": "^3.0.5"
14
+ },
15
+ "scripts": {
16
+ "build": "rm -rf dist && pl-tengo check && pl-tengo build",
17
+ "test": "vitest",
18
+ "format": "/usr/bin/env emacs --script ./format.el"
19
+ }
20
+ }
@@ -0,0 +1,108 @@
1
+ // "hello world"
2
+ wf := import("@platforma-sdk/workflow-tengo:workflow")
3
+ exec := import("@platforma-sdk/workflow-tengo:exec")
4
+ ll := import("@platforma-sdk/workflow-tengo:ll")
5
+ assets := import("@platforma-sdk/workflow-tengo:assets")
6
+ file := import("@platforma-sdk/workflow-tengo:file")
7
+ times := import("times")
8
+ json := import("json")
9
+ rand := import("rand")
10
+
11
+ mixcrSw := assets.importSoftware("@platforma-open/milaboratories.software-mixcr:main")
12
+
13
+ wf.body(func(args) {
14
+
15
+ if is_undefined(args.vFastaFile) && is_undefined(args.vSpecies) {
16
+
17
+ ll.panic("expected to have either `fastaFile` or `built in`; provided no any")
18
+ }
19
+
20
+ if is_undefined(args.jFastaFile) && is_undefined(args.jSpecies) {
21
+
22
+ ll.panic("expected to have either `fastaFile` or `built in`; provided no any")
23
+ }
24
+
25
+ outputs := {}
26
+
27
+ species := args.species
28
+ chain := args.chain
29
+
30
+ libraryBuilderCmdBuilder := undefined
31
+
32
+ taxonId := string(rand.intn(9000) + 1000)
33
+ libraryBuilderCmdBuilder = exec.builder().
34
+ software(mixcrSw).
35
+ secret("MI_LICENSE", "MI_LICENSE").
36
+ arg("buildLibrary").
37
+ arg("--debug").
38
+ arg("--species").arg(species).
39
+ arg("--chain").arg(chain).
40
+ arg("--taxon-id").arg(taxonId)
41
+ if !is_undefined(args.vFastaFile) {
42
+ vImport := file.importFile(args.vFastaFile)
43
+ outputs.vImportHandle = vImport.handle
44
+ libraryBuilderCmdBuilder.arg("--v-gene-feature").arg("VRegion").
45
+ arg("--v-genes-from-fasta").arg("v.fasta").
46
+ addFile("v.fasta", vImport.file)
47
+ } else {
48
+ libraryBuilderCmdBuilder.arg("--v-genes-from-species").arg(args.vSpecies)
49
+ }
50
+
51
+ if !is_undefined(args.jFastaFile) {
52
+ jImport := file.importFile(args.jFastaFile)
53
+ outputs.jImportHandle = jImport.handle
54
+ libraryBuilderCmdBuilder.arg("--j-genes-from-fasta").arg("j.fasta").
55
+ addFile("j.fasta", jImport.file)
56
+ } else {
57
+ libraryBuilderCmdBuilder.arg("--j-genes-from-species").arg(args.jSpecies)
58
+ }
59
+
60
+ if !is_undefined(args.dFastaFile) {
61
+ dImport := file.importFile(args.dFastaFile)
62
+ outputs.dImportHandle = dImport.handle
63
+ libraryBuilderCmdBuilder.arg("--d-genes-from-fasta").arg("d.fasta").
64
+ addFile("d.fasta", dImport.file)
65
+ } else if !is_undefined(args.dSpecies) {
66
+ libraryBuilderCmdBuilder.arg("--d-genes-from-species").arg(args.dSpecies)
67
+ }
68
+
69
+ if !is_undefined(args.cFastaFile) {
70
+ cImport := file.importFile(args.cFastaFile)
71
+ outputs.cImportHandle = cImport.handle
72
+ libraryBuilderCmdBuilder.arg("--c-genes-from-fasta").arg("c.fasta").
73
+ addFile("c.fasta", cImport.file)
74
+ } else if !is_undefined(args.cSpecies) {
75
+ libraryBuilderCmdBuilder.arg("--c-genes-from-species").arg(args.cSpecies)
76
+ }
77
+
78
+ libraryBuilderCmdBuilder.arg("library.json").
79
+ saveFile("library.json").
80
+ printErrStreamToStdout()
81
+ libraryBuilderCmd := libraryBuilderCmdBuilder.run()
82
+
83
+ debugOutput := libraryBuilderCmd.getStdoutStream()
84
+ library := libraryBuilderCmd.getFile("library.json")
85
+
86
+ outputs.debugOutput = debugOutput
87
+
88
+ exports := {
89
+ library : {
90
+ data: library,
91
+ spec: {
92
+ kind: "File",
93
+ annotations: {
94
+ "pl7.app/species": species,
95
+ "pl7.app/vdj/chain": chain,
96
+ "pl7.app/vdj/isLibrary": "true",
97
+ "pl7.app/label": species + "_" + chain + "_library"
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ return {
104
+ outputs: outputs,
105
+ exports: exports
106
+ }
107
+ })
108
+
package/src/wf.test.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { tplTest } from "@platforma-sdk/test";
2
+
3
+ tplTest(
4
+ 'should return a concatenated string',
5
+ async ({ helper, expect }) => {
6
+ const results = await helper.renderWorkflow("main", false, {
7
+ name: 'World'
8
+ });
9
+
10
+ const tengoMessage = results.output("tengoMessage", (a) => a?.getDataAsJson<string>());
11
+ expect(await tengoMessage.awaitStableValue()).eq('Hello from Tengo, World!');
12
+ }
13
+ );
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "esModuleInterop": true,
7
+ "strict": true,
8
+ "outDir": "./dist",
9
+ "rootDir": "./src",
10
+ "sourceMap": true,
11
+ "declaration": true
12
+ },
13
+ "types": [],
14
+ "include": ["src/**/*"],
15
+ "exclude": ["node_modules", "dist"]
16
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ watch: false,
6
+ maxConcurrency: 3,
7
+ testTimeout: 5000
8
+ }
9
+ });