@platforma-open/milaboratories.samples-and-data.workflow 2.0.0 → 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 +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/tengo/lib/ds-bulk-count-matrix.lib.tengo +47 -46
- package/dist/tengo/lib/ds-cellranger-mtx.lib.tengo +30 -29
- package/dist/tengo/lib/ds-fasta.lib.tengo +21 -20
- package/dist/tengo/lib/ds-fastq.lib.tengo +32 -31
- package/dist/tengo/lib/ds-h5ad.lib.tengo +34 -0
- package/dist/tengo/lib/ds-multilane-fastq.lib.tengo +41 -40
- package/dist/tengo/lib/ds-multisample-h5ad.lib.tengo +69 -0
- package/dist/tengo/lib/ds-tagged-fastq.lib.tengo +71 -70
- package/dist/tengo/lib/ds-tagged-xsv.lib.tengo +47 -46
- package/dist/tengo/lib/ds-xsv.lib.tengo +22 -21
- package/dist/tengo/tpl/main.plj.gz +0 -0
- package/dist/tengo/tpl/parse-bulk-count-matrix.plj.gz +0 -0
- package/dist/tengo/tpl/parse-multisample-h5ad.plj.gz +0 -0
- package/dist/tengo/tpl/prerun.plj.gz +0 -0
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
module.exports = { Templates: {
|
|
2
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') },
|
|
3
4
|
'prerun': { type: 'from-file', path: require.resolve('./tengo/tpl/prerun.plj.gz') },
|
|
4
5
|
'main': { type: 'from-file', path: require.resolve('./tengo/tpl/main.plj.gz') }
|
|
5
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 = "parse-bulk-count-matrix" | "prerun" | "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,6 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
export const Templates = {
|
|
3
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') },
|
|
4
5
|
'prerun': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/prerun.plj.gz') },
|
|
5
6
|
'main': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/main.plj.gz') }
|
|
6
7
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
3
2
|
pt := import("@platforma-sdk/workflow-tengo:pt")
|
|
4
3
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
@@ -9,59 +8,61 @@ parseHeaderTpl := assets.importTemplate("@platforma-open/milaboratories.samples-
|
|
|
9
8
|
|
|
10
9
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
isGrouped: true,
|
|
14
|
-
|
|
15
|
-
getSamples: func(dataset, importFile) {
|
|
16
|
-
|
|
17
|
-
result := {}
|
|
18
|
-
for groupId, importHandle in dataset.content.data {
|
|
19
|
-
if !importHandle {
|
|
20
|
-
ll.panic("File handle not set for group %v", groupId)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
headerContent := txt.head(importFile(importHandle), {lines: 1})
|
|
11
|
+
getSamples := func(dataset, importFile) {
|
|
24
12
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
separator = ","
|
|
30
|
-
} else {
|
|
31
|
-
ll.panic("Unsupported file extension: " + dataset.content.xsvType)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
samples := render.create(parseHeaderTpl, {
|
|
35
|
-
header: headerContent,
|
|
36
|
-
delimiter: separator
|
|
37
|
-
}).output("samples")
|
|
38
|
-
|
|
39
|
-
result[groupId] = samples
|
|
13
|
+
result := {}
|
|
14
|
+
for groupId, importHandle in dataset.content.data {
|
|
15
|
+
if !importHandle {
|
|
16
|
+
ll.panic("File handle not set for group %v", groupId)
|
|
40
17
|
}
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
|
|
19
|
+
headerContent := txt.head(importFile(importHandle), {lines: 1})
|
|
43
20
|
|
|
44
|
-
|
|
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
|
+
}
|
|
45
29
|
|
|
46
|
-
|
|
30
|
+
samples := render.create(parseHeaderTpl, {
|
|
31
|
+
header: headerContent,
|
|
32
|
+
delimiter: separator
|
|
33
|
+
}).output("samples")
|
|
47
34
|
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
result[groupId] = samples
|
|
36
|
+
}
|
|
37
|
+
return result
|
|
38
|
+
}
|
|
50
39
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
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]
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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)
|
|
63
51
|
}
|
|
52
|
+
data.add([groupId], importFile(importHandle))
|
|
53
|
+
}
|
|
64
54
|
|
|
65
|
-
|
|
55
|
+
result := {}
|
|
56
|
+
result["dataset." + dataset.id] = {
|
|
57
|
+
spec: spec,
|
|
58
|
+
data: data.build()
|
|
66
59
|
}
|
|
60
|
+
|
|
61
|
+
return result
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
isGrouped: true,
|
|
66
|
+
getSamples: getSamples,
|
|
67
|
+
createDataset: createDataset
|
|
67
68
|
}
|
|
@@ -5,43 +5,44 @@ util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
|
5
5
|
|
|
6
6
|
cellRangerMtxRoles := ["matrix.mtx", "features.tsv", "barcodes.tsv"]
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
9
|
+
compression := dataset.content.gzipped ? "gz" : "none"
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
spec := util.datasetColumnSpecBase(blockId, dataset, undefined)
|
|
12
|
+
spec.domain["pl7.app/compression"] = compression
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: "pl7.app/sc/cellRangerFileRole",
|
|
20
|
-
annotations: {
|
|
21
|
-
"pl7.app/label": "Role"
|
|
22
|
-
}
|
|
14
|
+
cellRangerFileRoleAxisSpec := {
|
|
15
|
+
type: "String",
|
|
16
|
+
name: "pl7.app/sc/cellRangerFileRole",
|
|
17
|
+
annotations: {
|
|
18
|
+
"pl7.app/label": "Role"
|
|
23
19
|
}
|
|
20
|
+
}
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
spec.axesSpec = [sampleIdAxis, cellRangerFileRoleAxisSpec]
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
data.add([sampleId, role], importFile(importHandle))
|
|
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)
|
|
35
30
|
}
|
|
31
|
+
data.add([sampleId, role], importFile(importHandle))
|
|
36
32
|
}
|
|
33
|
+
}
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return result
|
|
35
|
+
result := {}
|
|
36
|
+
result["dataset." + dataset.id] = {
|
|
37
|
+
spec: spec,
|
|
38
|
+
data: data.build()
|
|
45
39
|
}
|
|
40
|
+
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
isGrouped: false,
|
|
46
|
+
createDataset: createDataset
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -4,29 +4,30 @@ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
|
|
|
4
4
|
|
|
5
5
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
8
|
+
extension := dataset.content.gzipped ? "fasta.gz" : "fasta"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
14
|
-
spec.axesSpec = [sampleIdAxis]
|
|
10
|
+
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
11
|
+
spec.axesSpec = [sampleIdAxis]
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
data.add([sampleId], importFile(importHandle))
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
result := {}
|
|
25
|
-
result["dataset." + dataset.id] = {
|
|
26
|
-
spec: spec,
|
|
27
|
-
data: data.build()
|
|
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)
|
|
28
17
|
}
|
|
18
|
+
data.add([sampleId], importFile(importHandle))
|
|
19
|
+
}
|
|
29
20
|
|
|
30
|
-
|
|
21
|
+
result := {}
|
|
22
|
+
result["dataset." + dataset.id] = {
|
|
23
|
+
spec: spec,
|
|
24
|
+
data: data.build()
|
|
31
25
|
}
|
|
26
|
+
|
|
27
|
+
return result
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
isGrouped: false,
|
|
32
|
+
createDataset: createDataset
|
|
32
33
|
}
|
|
@@ -4,48 +4,49 @@ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
|
|
|
4
4
|
json := import("json")
|
|
5
5
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
8
|
+
extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
|
|
12
|
-
|
|
13
|
-
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
10
|
+
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
readIndexAxisSpec := {
|
|
13
|
+
type: "String",
|
|
14
|
+
name: "pl7.app/sequencing/readIndex",
|
|
15
|
+
annotations: {
|
|
16
|
+
"pl7.app/label": "Read Index"
|
|
17
|
+
},
|
|
18
|
+
domain: {
|
|
22
19
|
|
|
23
20
|
|
|
24
21
|
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
}
|
|
23
|
+
"pl7.app/readIndices": string(json.encode(dataset.content.readIndices))
|
|
28
24
|
}
|
|
25
|
+
}
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
spec.axesSpec = [sampleIdAxis, readIndexAxisSpec]
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
data.add([sampleId, readIndex], importFile(importHandle))
|
|
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)
|
|
40
35
|
}
|
|
36
|
+
data.add([sampleId, readIndex], importFile(importHandle))
|
|
41
37
|
}
|
|
38
|
+
}
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return result
|
|
40
|
+
result := {}
|
|
41
|
+
result["dataset." + dataset.id] = {
|
|
42
|
+
spec: spec,
|
|
43
|
+
data: data.build()
|
|
50
44
|
}
|
|
45
|
+
|
|
46
|
+
return result
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
isGrouped: false,
|
|
51
|
+
createDataset: createDataset
|
|
51
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
|
+
|
|
@@ -4,58 +4,59 @@ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
|
|
|
4
4
|
json := import("json")
|
|
5
5
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
8
|
+
extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
name: "pl7.app/sequencing/lane",
|
|
18
|
-
annotations: {
|
|
19
|
-
"pl7.app/label": "Lane"
|
|
20
|
-
}
|
|
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"
|
|
21
17
|
}
|
|
18
|
+
}
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
readIndexAxisSpec := {
|
|
21
|
+
type: "String",
|
|
22
|
+
name: "pl7.app/sequencing/readIndex",
|
|
23
|
+
annotations: {
|
|
24
|
+
"pl7.app/label": "Read Index"
|
|
25
|
+
},
|
|
26
|
+
domain: {
|
|
30
27
|
|
|
31
28
|
|
|
32
29
|
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
}
|
|
31
|
+
"pl7.app/readIndices": string(json.encode(dataset.content.readIndices))
|
|
36
32
|
}
|
|
33
|
+
}
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
data.add([sampleId, laneId, readIndex], importFile(importHandle))
|
|
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)
|
|
49
44
|
}
|
|
45
|
+
data.add([sampleId, laneId, readIndex], importFile(importHandle))
|
|
50
46
|
}
|
|
51
47
|
}
|
|
48
|
+
}
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return result
|
|
50
|
+
result := {}
|
|
51
|
+
result["dataset." + dataset.id] = {
|
|
52
|
+
spec: spec,
|
|
53
|
+
data: data.build()
|
|
60
54
|
}
|
|
55
|
+
|
|
56
|
+
return result
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
isGrouped: false,
|
|
61
|
+
createDataset: createDataset
|
|
61
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
|
+
|
|
@@ -5,92 +5,93 @@ maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
|
5
5
|
json := import("json")
|
|
6
6
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
9
|
+
extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
extension := dataset.content.gzipped ? "fastq.gz" : "fastq"
|
|
13
|
-
|
|
14
|
-
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
15
|
-
|
|
16
|
-
axesSpec := [sampleIdAxis]
|
|
17
|
-
|
|
18
|
-
for tag in dataset.content.tags {
|
|
19
|
-
axesSpec = append(axesSpec, {
|
|
20
|
-
type: "String",
|
|
21
|
-
name: "pl7.app/sequencing/tag",
|
|
22
|
-
domain: {
|
|
23
|
-
"pl7.app/sequencing/tag": tag
|
|
24
|
-
},
|
|
25
|
-
annotations: {
|
|
26
|
-
"pl7.app/label": tag + " tag"
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
}
|
|
11
|
+
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
30
12
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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"
|
|
38
24
|
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
39
27
|
|
|
40
|
-
|
|
28
|
+
if dataset.content.hasLanes {
|
|
29
|
+
laneAxisSpec := {
|
|
30
|
+
type: "String",
|
|
31
|
+
name: "pl7.app/sequencing/lane",
|
|
32
|
+
annotations: {
|
|
33
|
+
"pl7.app/label": "Lane"
|
|
34
|
+
}
|
|
41
35
|
}
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
name: "pl7.app/sequencing/readIndex",
|
|
46
|
-
annotations: {
|
|
47
|
-
"pl7.app/label": "Read Index"
|
|
48
|
-
},
|
|
49
|
-
domain: {
|
|
37
|
+
axesSpec = append(axesSpec, laneAxisSpec)
|
|
38
|
+
}
|
|
50
39
|
|
|
40
|
+
readIndexAxisSpec := {
|
|
41
|
+
type: "String",
|
|
42
|
+
name: "pl7.app/sequencing/readIndex",
|
|
43
|
+
annotations: {
|
|
44
|
+
"pl7.app/label": "Read Index"
|
|
45
|
+
},
|
|
46
|
+
domain: {
|
|
51
47
|
|
|
52
48
|
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
|
|
51
|
+
"pl7.app/readIndices": string(json.encode(dataset.content.readIndices))
|
|
56
52
|
}
|
|
53
|
+
}
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
keyPrefix = append(keyPrefix, tagValue)
|
|
72
|
-
}
|
|
73
|
-
if dataset.content.hasLanes {
|
|
74
|
-
keyPrefix = append(keyPrefix, record.lane)
|
|
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)
|
|
75
67
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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)
|
|
84
79
|
}
|
|
80
|
+
data.add(key, importFile(importHandle))
|
|
85
81
|
}
|
|
86
82
|
}
|
|
83
|
+
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return result
|
|
85
|
+
result := {}
|
|
86
|
+
result["dataset." + dataset.id] = {
|
|
87
|
+
spec: spec,
|
|
88
|
+
data: data.build()
|
|
95
89
|
}
|
|
90
|
+
|
|
91
|
+
return result
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
isGrouped: false,
|
|
96
|
+
createDataset: createDataset
|
|
96
97
|
}
|
|
@@ -5,59 +5,60 @@ maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
|
5
5
|
|
|
6
6
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
isGrouped: false,
|
|
8
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
axesSpec := [sampleIdAxis]
|
|
18
|
-
|
|
19
|
-
for tag in dataset.content.tags {
|
|
20
|
-
axesSpec = append(axesSpec, {
|
|
21
|
-
type: "String",
|
|
22
|
-
name: "pl7.app/sequencing/tag",
|
|
23
|
-
domain: {
|
|
24
|
-
"pl7.app/sequencing/tag": tag
|
|
25
|
-
},
|
|
26
|
-
annotations: {
|
|
27
|
-
"pl7.app/label": tag + " tag"
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
}
|
|
10
|
+
extension := dataset.content.xsvType + (dataset.content.gzipped ? ".gz" : "")
|
|
11
|
+
|
|
12
|
+
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
13
|
+
|
|
14
|
+
axesSpec := [sampleIdAxis]
|
|
31
15
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
key = append(key, tagValue)
|
|
45
|
-
}
|
|
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
|
+
}
|
|
46
28
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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)
|
|
50
40
|
}
|
|
51
|
-
|
|
41
|
+
key = append(key, tagValue)
|
|
52
42
|
}
|
|
53
|
-
}
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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))
|
|
59
49
|
}
|
|
50
|
+
}
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
result := {}
|
|
53
|
+
result["dataset." + dataset.id] = {
|
|
54
|
+
spec: spec,
|
|
55
|
+
data: data.build()
|
|
62
56
|
}
|
|
57
|
+
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
isGrouped: false,
|
|
63
|
+
createDataset: createDataset
|
|
63
64
|
}
|
|
@@ -4,30 +4,31 @@ pColumn := import("@platforma-sdk/workflow-tengo:pframes.pcolumn")
|
|
|
4
4
|
|
|
5
5
|
util := import("@platforma-open/milaboratories.samples-and-data.workflow:util")
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
isGrouped: false,
|
|
7
|
+
createDataset := func(blockId, sampleIdAxis, dataset, importFile) {
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
15
|
-
spec.axesSpec = [sampleIdAxis]
|
|
16
|
-
|
|
17
|
-
data := pColumn.resourceMapBuilder(1)
|
|
18
|
-
for sampleId, importHandle in dataset.content.data {
|
|
19
|
-
if !importHandle {
|
|
20
|
-
ll.panic("File handle not set for sample %v", sampleId)
|
|
21
|
-
}
|
|
22
|
-
data.add([sampleId], importFile(importHandle))
|
|
23
|
-
}
|
|
9
|
+
extension := dataset.content.xsvType + (dataset.content.gzipped ? ".gz" : "")
|
|
10
|
+
|
|
11
|
+
spec := util.datasetColumnSpecBase(blockId, dataset, extension)
|
|
12
|
+
spec.axesSpec = [sampleIdAxis]
|
|
24
13
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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)
|
|
29
18
|
}
|
|
19
|
+
data.add([sampleId], importFile(importHandle))
|
|
20
|
+
}
|
|
30
21
|
|
|
31
|
-
|
|
22
|
+
result := {}
|
|
23
|
+
result["dataset." + dataset.id] = {
|
|
24
|
+
spec: spec,
|
|
25
|
+
data: data.build()
|
|
32
26
|
}
|
|
27
|
+
|
|
28
|
+
return result
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
isGrouped: false,
|
|
33
|
+
createDataset: createDataset
|
|
33
34
|
}
|
|
Binary file
|
|
Binary file
|
|
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": "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": "
|
|
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": "
|
|
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",
|