@platforma-open/milaboratories.samples-and-data.workflow 1.13.2 → 2.1.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.
package/dist/index.cjs CHANGED
@@ -1,3 +1,6 @@
1
1
  module.exports = { Templates: {
2
+ 'parse-bulk-count-matrix': { type: 'from-file', path: require.resolve('./tengo/tpl/parse-bulk-count-matrix.plj.gz') },
3
+ 'parse-multisample-h5ad': { type: 'from-file', path: require.resolve('./tengo/tpl/parse-multisample-h5ad.plj.gz') },
4
+ 'prerun': { type: 'from-file', path: require.resolve('./tengo/tpl/prerun.plj.gz') },
2
5
  'main': { type: 'from-file', path: require.resolve('./tengo/tpl/main.plj.gz') }
3
6
  }};
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 = "main";
2
+ declare type TplName = "parse-bulk-count-matrix" | "parse-multisample-h5ad" | "prerun" | "main";
3
3
  declare const Templates: Record<TplName, TemplateFromFile>;
4
4
  export { Templates };
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  import { resolve } from 'node:path';
2
2
  export const Templates = {
3
+ 'parse-bulk-count-matrix': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/parse-bulk-count-matrix.plj.gz') },
4
+ 'parse-multisample-h5ad': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/parse-multisample-h5ad.plj.gz') },
5
+ 'prerun': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/prerun.plj.gz') },
3
6
  'main': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/main.plj.gz') }
4
7
  };
@@ -0,0 +1,68 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ pt := import("@platforma-sdk/workflow-tengo:pt")
3
+ render := import("@platforma-sdk/workflow-tengo:render")
4
+ assets := import("@platforma-sdk/workflow-tengo:assets")
5
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
6
+ txt := import("@platforma-sdk/workflow-tengo:txt")
7
+ parseHeaderTpl := assets.importTemplate("@platforma-open/milaboratories.samples-and-data.workflow:parse-bulk-count-matrix")
8
+
9
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
10
+
11
+ getSamples := func(dataset, importFile) {
12
+
13
+ result := {}
14
+ for groupId, importHandle in dataset.content.data {
15
+ if !importHandle {
16
+ ll.panic("File handle not set for group %v", groupId)
17
+ }
18
+
19
+ headerContent := txt.head(importFile(importHandle), {lines: 1})
20
+
21
+ separator := "\t"
22
+ if dataset.content.xsvType == "tsv" {
23
+ separator = "\t"
24
+ } else if dataset.content.xsvType == "csv" {
25
+ separator = ","
26
+ } else {
27
+ ll.panic("Unsupported file extension: " + dataset.content.xsvType)
28
+ }
29
+
30
+ samples := render.create(parseHeaderTpl, {
31
+ header: headerContent,
32
+ delimiter: separator
33
+ }).output("samples")
34
+
35
+ result[groupId] = samples
36
+ }
37
+ return result
38
+ }
39
+
40
+ createDataset := func(blockId, sampleIdAxis, groupIdAxis, dataset, importFile) {
41
+
42
+ extension := dataset.content.xsvType + (dataset.content.gzipped ? ".gz" : "")
43
+
44
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
45
+ spec.axesSpec = [groupIdAxis]
46
+
47
+ data := pColumn.resourceMapBuilder(1)
48
+ for groupId, importHandle in dataset.content.data {
49
+ if !importHandle {
50
+ ll.panic("File handle not set for sample %v", groupId)
51
+ }
52
+ data.add([groupId], importFile(importHandle))
53
+ }
54
+
55
+ result := {}
56
+ result["dataset." + dataset.id] = {
57
+ spec: spec,
58
+ data: data.build()
59
+ }
60
+
61
+ return result
62
+ }
63
+
64
+ export {
65
+ isGrouped: true,
66
+ getSamples: getSamples,
67
+ createDataset: createDataset
68
+ }
@@ -0,0 +1,48 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
5
+
6
+ cellRangerMtxRoles := ["matrix.mtx", "features.tsv", "barcodes.tsv"]
7
+
8
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
9
+ compression := dataset.content.gzipped ? "gz" : "none"
10
+
11
+ spec := util.datasetColumnSpecBase(blockId, dataset, undefined)
12
+ spec.domain["pl7.app/compression"] = compression
13
+
14
+ cellRangerFileRoleAxisSpec := {
15
+ type: "String",
16
+ name: "pl7.app/sc/cellRangerFileRole",
17
+ annotations: {
18
+ "pl7.app/label": "Role"
19
+ }
20
+ }
21
+
22
+ spec.axesSpec = [sampleIdAxis, cellRangerFileRoleAxisSpec]
23
+
24
+ data := pColumn.resourceMapBuilder(2)
25
+ for sampleId, fileGroup in dataset.content.data {
26
+ for role in cellRangerMtxRoles {
27
+ importHandle := fileGroup[role]
28
+ if !importHandle {
29
+ ll.panic("File handle not set for %v in sample %v", role, sampleId)
30
+ }
31
+ data.add([sampleId, role], importFile(importHandle))
32
+ }
33
+ }
34
+
35
+ result := {}
36
+ result["dataset." + dataset.id] = {
37
+ spec: spec,
38
+ data: data.build()
39
+ }
40
+
41
+ return result
42
+ }
43
+
44
+ export {
45
+ isGrouped: false,
46
+ createDataset: createDataset
47
+ }
48
+
@@ -0,0 +1,33 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+
5
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
6
+
7
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
8
+ extension := dataset.content.gzipped ? "fasta.gz" : "fasta"
9
+
10
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
11
+ spec.axesSpec = [sampleIdAxis]
12
+
13
+ data := pColumn.resourceMapBuilder(1)
14
+ for sampleId, importHandle in dataset.content.data {
15
+ if !importHandle {
16
+ ll.panic("File handle not set for sample %v", sampleId)
17
+ }
18
+ data.add([sampleId], importFile(importHandle))
19
+ }
20
+
21
+ result := {}
22
+ result["dataset." + dataset.id] = {
23
+ spec: spec,
24
+ data: data.build()
25
+ }
26
+
27
+ return result
28
+ }
29
+
30
+ export {
31
+ isGrouped: false,
32
+ createDataset: createDataset
33
+ }
@@ -0,0 +1,52 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+ json := import("json")
5
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
6
+
7
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
8
+ extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
9
+
10
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
11
+
12
+ readIndexAxisSpec := {
13
+ type: "String",
14
+ name: "pl7.app/sequencing/readIndex",
15
+ annotations: {
16
+ "pl7.app/label": "Read Index"
17
+ },
18
+ domain: {
19
+
20
+
21
+
22
+
23
+ "pl7.app/readIndices": string(json.encode(dataset.content.readIndices))
24
+ }
25
+ }
26
+
27
+ spec.axesSpec = [sampleIdAxis, readIndexAxisSpec]
28
+
29
+ data := pColumn.resourceMapBuilder(2)
30
+ for sampleId, fileGroup in dataset.content.data {
31
+ for _, readIndex in dataset.content.readIndices {
32
+ importHandle := fileGroup[readIndex]
33
+ if !importHandle {
34
+ ll.panic("File handle not set for %v in sample %v", readIndex, sampleId)
35
+ }
36
+ data.add([sampleId, readIndex], importFile(importHandle))
37
+ }
38
+ }
39
+
40
+ result := {}
41
+ result["dataset." + dataset.id] = {
42
+ spec: spec,
43
+ data: data.build()
44
+ }
45
+
46
+ return result
47
+ }
48
+
49
+ export {
50
+ isGrouped: false,
51
+ createDataset: createDataset
52
+ }
@@ -0,0 +1,34 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+
5
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
6
+
7
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
8
+ extension := "h5ad"
9
+
10
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
11
+ spec.axesSpec = [sampleIdAxis]
12
+
13
+ data := pColumn.resourceMapBuilder(1)
14
+ for sampleId, importHandle in dataset.content.data {
15
+ if !importHandle {
16
+ ll.panic("File handle not set for sample %v", sampleId)
17
+ }
18
+ data.add([sampleId], importFile(importHandle))
19
+ }
20
+
21
+ result := {}
22
+ result["dataset." + dataset.id] = {
23
+ spec: spec,
24
+ data: data.build()
25
+ }
26
+
27
+ return result
28
+ }
29
+
30
+ export {
31
+ isGrouped: false,
32
+ createDataset: createDataset
33
+ }
34
+
@@ -0,0 +1,62 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+ json := import("json")
5
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
6
+
7
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
8
+ extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
9
+
10
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
11
+
12
+ laneAxisSpec := {
13
+ type: "String",
14
+ name: "pl7.app/sequencing/lane",
15
+ annotations: {
16
+ "pl7.app/label": "Lane"
17
+ }
18
+ }
19
+
20
+ readIndexAxisSpec := {
21
+ type: "String",
22
+ name: "pl7.app/sequencing/readIndex",
23
+ annotations: {
24
+ "pl7.app/label": "Read Index"
25
+ },
26
+ domain: {
27
+
28
+
29
+
30
+
31
+ "pl7.app/readIndices": string(json.encode(dataset.content.readIndices))
32
+ }
33
+ }
34
+
35
+ spec.axesSpec = [sampleIdAxis, laneAxisSpec, readIndexAxisSpec]
36
+
37
+ data := pColumn.resourceMapBuilder(3)
38
+ for sampleId, laneData in dataset.content.data {
39
+ for laneId, fileGroup in laneData {
40
+ for _, readIndex in dataset.content.readIndices {
41
+ importHandle := fileGroup[readIndex]
42
+ if !importHandle {
43
+ ll.panic("File handle not set for %v, lane %v in sample %v", readIndex, laneId, sampleId)
44
+ }
45
+ data.add([sampleId, laneId, readIndex], importFile(importHandle))
46
+ }
47
+ }
48
+ }
49
+
50
+ result := {}
51
+ result["dataset." + dataset.id] = {
52
+ spec: spec,
53
+ data: data.build()
54
+ }
55
+
56
+ return result
57
+ }
58
+
59
+ export {
60
+ isGrouped: false,
61
+ createDataset: createDataset
62
+ }
@@ -0,0 +1,69 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ render := import("@platforma-sdk/workflow-tengo:render")
3
+ assets := import("@platforma-sdk/workflow-tengo:assets")
4
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
5
+ parseH5adTpl := assets.importTemplate("@platforma-open/milaboratories.samples-and-data.workflow:parse-multisample-h5ad")
6
+
7
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
8
+
9
+ getColumns := func(fImport, importFile) {
10
+ h5adFile := importFile(fImport)
11
+ columnsCsv := render.create(parseH5adTpl, {
12
+ h5adFile: h5adFile,
13
+ sampleColumnName: "sample"
14
+ }).output("columnsCsv")
15
+
16
+ return columnsCsv
17
+ }
18
+
19
+ getSamples := func(dataset, importFile) {
20
+ result := {}
21
+ sampleColumnName := dataset.content.sampleColumnName
22
+ if !sampleColumnName {
23
+ sampleColumnName = "sample"
24
+ }
25
+ for groupId, importHandle in dataset.content.data {
26
+ if !importHandle {
27
+ ll.panic("File handle not set for group %v", groupId)
28
+ }
29
+ h5adFile := importFile(importHandle)
30
+ samplesCsv := render.create(parseH5adTpl, {
31
+ h5adFile: h5adFile,
32
+ sampleColumnName: sampleColumnName
33
+ }).output("samplesCsv")
34
+ result[groupId] = samplesCsv
35
+ }
36
+ return result
37
+ }
38
+
39
+ createDataset := func(blockId, sampleIdAxis, groupIdAxis, dataset, importFile) {
40
+
41
+ extension := "h5ad"
42
+
43
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
44
+ spec.axesSpec = [groupIdAxis]
45
+
46
+ data := pColumn.resourceMapBuilder(1)
47
+ for groupId, importHandle in dataset.content.data {
48
+ if !importHandle {
49
+ ll.panic("File handle not set for sample %v", groupId)
50
+ }
51
+ data.add([groupId], importFile(importHandle))
52
+ }
53
+
54
+ result := {}
55
+ result["dataset." + dataset.id] = {
56
+ spec: spec,
57
+ data: data.build()
58
+ }
59
+
60
+ return result
61
+ }
62
+
63
+ export {
64
+ isGrouped: true,
65
+ getColumns: getColumns,
66
+ getSamples: getSamples,
67
+ createDataset: createDataset
68
+ }
69
+
@@ -0,0 +1,97 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+ maps := import("@platforma-sdk/workflow-tengo:maps")
5
+ json := import("json")
6
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
7
+
8
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
9
+ extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
10
+
11
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
12
+
13
+ axesSpec := [sampleIdAxis]
14
+
15
+ for tag in dataset.content.tags {
16
+ axesSpec = append(axesSpec, {
17
+ type: "String",
18
+ name: "pl7.app/sequencing/tag",
19
+ domain: {
20
+ "pl7.app/sequencing/tag": tag
21
+ },
22
+ annotations: {
23
+ "pl7.app/label": tag + " tag"
24
+ }
25
+ })
26
+ }
27
+
28
+ if dataset.content.hasLanes {
29
+ laneAxisSpec := {
30
+ type: "String",
31
+ name: "pl7.app/sequencing/lane",
32
+ annotations: {
33
+ "pl7.app/label": "Lane"
34
+ }
35
+ }
36
+
37
+ axesSpec = append(axesSpec, laneAxisSpec)
38
+ }
39
+
40
+ readIndexAxisSpec := {
41
+ type: "String",
42
+ name: "pl7.app/sequencing/readIndex",
43
+ annotations: {
44
+ "pl7.app/label": "Read Index"
45
+ },
46
+ domain: {
47
+
48
+
49
+
50
+
51
+ "pl7.app/readIndices": string(json.encode(dataset.content.readIndices))
52
+ }
53
+ }
54
+
55
+ axesSpec = append(axesSpec, readIndexAxisSpec)
56
+ spec.axesSpec = axesSpec
57
+
58
+ data := pColumn.resourceMapBuilder(len(axesSpec))
59
+
60
+ for sampleId, records in dataset.content.data {
61
+ for record in records {
62
+ keyPrefix := [sampleId]
63
+ for tag in dataset.content.tags {
64
+ tagValue := record.tags[tag]
65
+ if !tagValue {
66
+ ll.panic("No tag value for %v in sample %v", tag, sampleId)
67
+ }
68
+ keyPrefix = append(keyPrefix, tagValue)
69
+ }
70
+ if dataset.content.hasLanes {
71
+ keyPrefix = append(keyPrefix, record.lane)
72
+ }
73
+ for readIndex in dataset.content.readIndices {
74
+ importHandle := record.files[readIndex]
75
+ key := maps.clone(keyPrefix)
76
+ key = append(key, readIndex)
77
+ if !importHandle {
78
+ ll.panic("File handle not set for key %v", key)
79
+ }
80
+ data.add(key, importFile(importHandle))
81
+ }
82
+ }
83
+ }
84
+
85
+ result := {}
86
+ result["dataset." + dataset.id] = {
87
+ spec: spec,
88
+ data: data.build()
89
+ }
90
+
91
+ return result
92
+ }
93
+
94
+ export {
95
+ isGrouped: false,
96
+ createDataset: createDataset
97
+ }
@@ -0,0 +1,64 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+ maps := import("@platforma-sdk/workflow-tengo:maps")
5
+
6
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
7
+
8
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
9
+
10
+ extension := dataset.content.xsvType + (dataset.content.gzipped ? ".gz" : "")
11
+
12
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
13
+
14
+ axesSpec := [sampleIdAxis]
15
+
16
+ for tag in dataset.content.tags {
17
+ axesSpec = append(axesSpec, {
18
+ type: "String",
19
+ name: "pl7.app/sequencing/tag",
20
+ domain: {
21
+ "pl7.app/sequencing/tag": tag
22
+ },
23
+ annotations: {
24
+ "pl7.app/label": tag + " tag"
25
+ }
26
+ })
27
+ }
28
+
29
+ spec.axesSpec = axesSpec
30
+
31
+ data := pColumn.resourceMapBuilder(len(axesSpec))
32
+
33
+ for sampleId, records in dataset.content.data {
34
+ for record in records {
35
+ key := [sampleId]
36
+ for tag in dataset.content.tags {
37
+ tagValue := record.tags[tag]
38
+ if !tagValue {
39
+ ll.panic("No tag value for %v in sample %v", tag, sampleId)
40
+ }
41
+ key = append(key, tagValue)
42
+ }
43
+
44
+ importHandle := record.file
45
+ if !importHandle {
46
+ ll.panic("File handle not set for key %v", key)
47
+ }
48
+ data.add(key, importFile(importHandle))
49
+ }
50
+ }
51
+
52
+ result := {}
53
+ result["dataset." + dataset.id] = {
54
+ spec: spec,
55
+ data: data.build()
56
+ }
57
+
58
+ return result
59
+ }
60
+
61
+ export {
62
+ isGrouped: false,
63
+ createDataset: createDataset
64
+ }
@@ -0,0 +1,34 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
4
+
5
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
6
+
7
+ createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
8
+
9
+ extension := dataset.content.xsvType + (dataset.content.gzipped ? ".gz" : "")
10
+
11
+ spec := util.datasetColumnSpecBase(blockId, dataset, extension)
12
+ spec.axesSpec = [sampleIdAxis]
13
+
14
+ data := pColumn.resourceMapBuilder(1)
15
+ for sampleId, importHandle in dataset.content.data {
16
+ if !importHandle {
17
+ ll.panic("File handle not set for sample %v", sampleId)
18
+ }
19
+ data.add([sampleId], importFile(importHandle))
20
+ }
21
+
22
+ result := {}
23
+ result["dataset." + dataset.id] = {
24
+ spec: spec,
25
+ data: data.build()
26
+ }
27
+
28
+ return result
29
+ }
30
+
31
+ export {
32
+ isGrouped: false,
33
+ createDataset: createDataset
34
+ }
@@ -0,0 +1,63 @@
1
+
2
+ ll := import("@platforma-sdk/workflow-tengo:ll")
3
+ json := import("json")
4
+ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
5
+
6
+
7
+ normalizeString := func(str) {
8
+ return str
9
+ }
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+ createMetadata := func(args, blockId, sampleIdAxisSpec) {
21
+ columns := {}
22
+ for _, column in args.metadata {
23
+ columns["metadata." + column.id] = {
24
+ spec: {
25
+ kind: "PColumn",
26
+ name: "pl7.app/metadata",
27
+ valueType: column.valueType,
28
+ annotations: {
29
+ "pl7.app/label": column.label
30
+ },
31
+ domain: {
32
+ "pl7.app/columnId": column.global ? normalizeString(column.label) : column.id
33
+ },
34
+ axesSpec: [sampleIdAxisSpec]
35
+ },
36
+ data: util.createJsonPColumnData(column.data)
37
+ }
38
+ }
39
+
40
+
41
+
42
+
43
+
44
+ columns["metadata.sampleId"] = {
45
+ spec: {
46
+ kind: "PColumn",
47
+ name: "pl7.app/label",
48
+ valueType: "String",
49
+ annotations: {
50
+ "pl7.app/label": args.sampleLabelColumnLabel,
51
+ "pl7.app/isLabel": "true"
52
+ },
53
+ axesSpec: [sampleIdAxisSpec]
54
+ },
55
+ data: util.createJsonPColumnData(args.sampleLabels)
56
+ }
57
+
58
+ return columns
59
+ }
60
+
61
+ export {
62
+ createMetadata: createMetadata
63
+ }
@@ -0,0 +1,80 @@
1
+ json := import("json")
2
+ maps := import("@platforma-sdk/workflow-tengo:maps")
3
+ smart := import("@platforma-sdk/workflow-tengo:smart")
4
+ consts := import("@platforma-sdk/workflow-tengo:pframes.constants")
5
+
6
+ RTYPE_P_COLUMN_DATA_JSON := consts.RTYPE_P_COLUMN_DATA_JSON
7
+
8
+ mapToPValueData := func(map) {
9
+ data := {}
10
+ for key, value in map {
11
+ data[json.encode([key])] = value
12
+ }
13
+ result := {
14
+ keyLength: 1,
15
+ data: data
16
+ }
17
+ return result
18
+ }
19
+
20
+ createJsonPColumnData := func(data) {
21
+ return smart.createValueResource(RTYPE_P_COLUMN_DATA_JSON, json.encode(mapToPValueData(data)))
22
+ }
23
+
24
+ datasetColumnSpecBase := func(blockId, dataset, extension) {
25
+ return {
26
+ kind: "PColumn",
27
+ name: "pl7.app/sequencing/data",
28
+ domain: maps.clone({
29
+ "pl7.app/fileExtension": extension,
30
+ "pl7.app/block": blockId,
31
+ "pl7.app/dataset": dataset.id
32
+ }, { removeUndefs: true }),
33
+ valueType: "File",
34
+ annotations: {
35
+ "pl7.app/label": "Sequencing Data",
36
+ "pl7.app/hideDataFromUi": "true",
37
+ "pl7.app/axisKeys/0": string(json.encode(maps.getKeys(dataset.content.data))) // axis values for sampleIdAxis or groupIdAxis
38
+ }
39
+ }
40
+ }
41
+
42
+ sampleGroupsLinkerColumn := func(blockId, dataset, sampleIdAxis, groupIdAxis) {
43
+ data := {}
44
+ samples := []
45
+ for groupId, ss in dataset.content.sampleGroups {
46
+ for sampleId, sampleName in ss {
47
+ samples = samples + [sampleId]
48
+ data[json.encode([groupId, sampleId])] = sampleName
49
+ }
50
+ }
51
+ spec := {
52
+ kind: "PColumn",
53
+ name: "pl7.app/sequencing/data/sampleGroups",
54
+ domain: {
55
+ "pl7.app/block": blockId,
56
+ "pl7.app/dataset": dataset.id
57
+ },
58
+ valueType: "String",
59
+ axesSpec: [groupIdAxis, sampleIdAxis],
60
+ annotations: {
61
+ "pl7.app/label": "Sample Groups",
62
+ "pl7.app/isLinkedColumn": "true",
63
+ "pl7.app/hideDataFromUi": "true",
64
+ "pl7.app/axisKeys/0": string(json.encode(maps.getKeys(dataset.content.data))), // axis values for groupIdAxis
65
+ "pl7.app/axisKeys/1": string(json.encode(samples)) // axis values for sampleIdAxis
66
+ }
67
+ }
68
+
69
+ return {
70
+ spec: spec,
71
+ data: smart.createValueResource(RTYPE_P_COLUMN_DATA_JSON, json.encode(data))
72
+ }
73
+ }
74
+
75
+
76
+ export {
77
+ createJsonPColumnData: createJsonPColumnData,
78
+ datasetColumnSpecBase: datasetColumnSpecBase,
79
+ sampleGroupsLinkerColumn: sampleGroupsLinkerColumn
80
+ }
Binary file
Binary file
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.samples-and-data.workflow",
3
- "version": "1.13.2",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "./dist/**/*"
7
7
  ],
8
8
  "description": "Tengo-based template",
9
9
  "dependencies": {
10
- "@platforma-sdk/workflow-tengo": "^5.2.0"
10
+ "@platforma-sdk/workflow-tengo": "5.5.15",
11
+ "@platforma-open/milaboratories.samples-and-data.parse-h5ad": "1.1.0"
11
12
  },
12
13
  "devDependencies": {
13
- "@platforma-sdk/tengo-builder": "^2.1.13"
14
+ "@platforma-sdk/tengo-builder": "2.3.3"
14
15
  },
15
16
  "scripts": {
16
17
  "build": "rm -rf dist/* && pl-tengo check && pl-tengo build",