@platforma-open/milaboratories.tcrdisco-enrichment.workflow 1.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.
@@ -0,0 +1,42 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+
3
+ getColumns := func(countsSpec) {
4
+ field := "differentialTCRAbundance"
5
+ degName := "log2foldchange"
6
+
7
+ axes := [
8
+ {
9
+ column: "clonotypeKey",
10
+ spec: countsSpec.axesSpec[1]
11
+ }
12
+ ]
13
+
14
+ columns := [
15
+ {
16
+ column: "subset",
17
+ id: "subset",
18
+ allowNA: true,
19
+ spec: {
20
+ name: "pl7.app/" + field + "/subset",
21
+ valueType: "String",
22
+ annotations: {
23
+ "pl7.app/label": "CD4/CD8 subset",
24
+ "pl7.app/table/visibility": "default",
25
+ "pl7.app/table/orderPriority": "60"
26
+ }
27
+ }
28
+ }
29
+ ]
30
+
31
+ return {
32
+ axes: axes,
33
+ columns: columns,
34
+ "storageFormat": "Parquet",
35
+ "partitionKeyLength": 0
36
+ }
37
+ }
38
+
39
+ export ll.toStrict({
40
+ getColumns: getColumns
41
+ })
42
+
@@ -0,0 +1,159 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ math := import("math")
3
+
4
+ getColumns := func(countsSpecAlpha, countsSpecBeta) {
5
+ field := "differentialTCRAbundance"
6
+ degName := "log2foldchange"
7
+
8
+ axes := [
9
+ {
10
+ column: "Numerator",
11
+ id: "numerator",
12
+ allowNA: false,
13
+ spec: {
14
+ name: "pl7.app/" + field + "/numerator",
15
+ type: "String",
16
+ annotations: {
17
+ "pl7.app/label": "Numerator"
18
+ }
19
+ }
20
+ },
21
+ {
22
+ column: "tra",
23
+ spec: countsSpecAlpha.axesSpec[1]
24
+ },
25
+ {
26
+ column: "trb",
27
+ spec: countsSpecBeta.axesSpec[1]
28
+ }
29
+ ]
30
+
31
+ columns := [
32
+ {
33
+ column: "estimate",
34
+ id: "estimate",
35
+ allowNA: true,
36
+ spec: {
37
+ name: "pl7.app/" + field + "/estimate",
38
+ valueType: "Double",
39
+ annotations: {
40
+ "pl7.app/label": "Correlation",
41
+ "pl7.app/table/orderPriority": "70",
42
+ "pl7.app/min":"0",
43
+ "pl7.app/max": "1",
44
+ "pl7.app/table/visibility": "default"
45
+ }
46
+ }
47
+ },
48
+ {
49
+ column: "p.value",
50
+ id: "pvalue",
51
+ allowNA: true,
52
+ spec: {
53
+ name: "pl7.app/" + field + "/pvalue",
54
+ valueType: "Double",
55
+ annotations: {
56
+ "pl7.app/label": "P-value",
57
+ "pl7.app/table/orderPriority": "60",
58
+ "pl7.app/graph/axis/symmetricRange": "0",
59
+ "pl7.app/table/visibility": "optional"
60
+ }
61
+ }
62
+ },
63
+ {
64
+ column: "p.adj",
65
+ id: "padj",
66
+ allowNA: true,
67
+ spec: {
68
+ name: "pl7.app/" + field + "/padj",
69
+ valueType: "Double",
70
+ annotations: {
71
+ "pl7.app/label": "Adjusted p-value",
72
+ "pl7.app/table/orderPriority": "50",
73
+ "pl7.app/table/visibility": "default"
74
+ }
75
+ }
76
+ },
77
+ {
78
+ column: "tra_CDR3aa",
79
+ id: "tra_CDR3aa",
80
+ allowNA: true,
81
+ spec: {
82
+ name: "pl7.app/" + field + "/tra_CDR3aa",
83
+ valueType: "String",
84
+ annotations: {
85
+ "pl7.app/label": "TCR Alpha CDR3 aa",
86
+ "pl7.app/table/orderPriority": "40",
87
+ "pl7.app/table/visibility": "default"
88
+ }
89
+ }
90
+ },
91
+ {
92
+ column: "trb_CDR3aa",
93
+ id: "trb_CDR3aa",
94
+ allowNA: true,
95
+ spec: {
96
+ name: "pl7.app/" + field + "/trb_CDR3aa",
97
+ valueType: "String",
98
+ annotations: {
99
+ "pl7.app/label": "TCR Beta CDR3 aa",
100
+ "pl7.app/table/orderPriority": "30",
101
+ "pl7.app/table/visibility": "default"
102
+ }
103
+ }
104
+ },
105
+ {
106
+ column: "tra_VGene",
107
+ id: "tra_VGene",
108
+ allowNA: true,
109
+ spec: {
110
+ name: "pl7.app/" + field + "/tra_VGene",
111
+ valueType: "String",
112
+ annotations: {
113
+ "pl7.app/label": "TCR Alpha VGene",
114
+ "pl7.app/table/orderPriority": "20",
115
+ "pl7.app/table/visibility": "optional"
116
+ }
117
+ }
118
+ },
119
+ {
120
+ column: "trb_VGene",
121
+ id: "trb_VGene",
122
+ allowNA: true,
123
+ spec: {
124
+ name: "pl7.app/" + field + "/trb_VGene",
125
+ valueType: "String",
126
+ annotations: {
127
+ "pl7.app/label": "TCR Beta VGene",
128
+ "pl7.app/table/orderPriority": "10",
129
+ "pl7.app/table/visibility": "optional"
130
+ }
131
+ }
132
+ },
133
+ {
134
+ column: "is_max_correlation",
135
+ id: "is_max_correlation",
136
+ allowNA: true,
137
+ spec: {
138
+ name: "pl7.app/" + field + "/max_cc_info",
139
+ valueType: "String",
140
+ annotations: {
141
+ "pl7.app/label": "Maximum correlation",
142
+ "pl7.app/table/orderPriority": "5",
143
+ "pl7.app/table/visibility": "optional"
144
+ }
145
+ }
146
+ }
147
+ ]
148
+
149
+ return {
150
+ axes: axes,
151
+ columns: columns,
152
+ "storageFormat": "Parquet",
153
+ "partitionKeyLength": 1
154
+ }
155
+ }
156
+
157
+ export ll.toStrict({
158
+ getColumns: getColumns
159
+ })
@@ -0,0 +1,54 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ json := import("json")
3
+
4
+ getColumns := func(countsSpec, cdSubsetCol, numerator, comparison) {
5
+
6
+ // Get runID label
7
+ runIdLabel := countsSpec.axesSpec[1].domain["pl7.app/vdj/clonotypingRunId"]
8
+ if runIdLabel == undefined {
9
+ runIdLabel = "pl7.app/vdj/vdjImport"
10
+ } else {
11
+ runIdLabel = "pl7.app/vdj/clonotypingRunId"
12
+ }
13
+
14
+ columns := [
15
+ {
16
+ column: "Robust_Enrichment",
17
+ id: "robustEnrichment",
18
+ allowNA: true,
19
+ spec: {
20
+ name: "pl7.app/differentialTCRAbundance/robustEnrichment",
21
+ valueType: "String",
22
+ annotations: {
23
+ "pl7.app/label": "Robust enrichment - " + numerator,
24
+ "pl7.app/table/visibility": "optional",
25
+ "pl7.app/table/orderPriority": "84000",
26
+ "pl7.app/hideDataFromGraphs": "true",
27
+ "pl7.app/isDiscreteFilter": "true",
28
+ "pl7.app/discreteValues": string(json.encode(["Robust", "Non-robust"]))
29
+ },
30
+ domain: {
31
+ runIdLabel: countsSpec.axesSpec[1].domain[runIdLabel],
32
+ "pl7.app/differentialTCRAbundance/comparison": comparison
33
+ }
34
+ }
35
+ }
36
+ ]
37
+
38
+ return {
39
+ "axes": [
40
+ {
41
+ column: "clonotypeKey",
42
+ spec: countsSpec.axesSpec[1]
43
+ }
44
+ ],
45
+ "columns": columns,
46
+ "storageFormat": "Parquet",
47
+ "partitionKeyLength": 0
48
+ }
49
+ }
50
+
51
+ export ll.toStrict({
52
+ getColumns: getColumns
53
+ })
54
+
@@ -0,0 +1,46 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ math := import("math")
3
+
4
+ getColumns := func(countsSpec) {
5
+ field := "differentialTCRAbundance"
6
+ degName := "log2foldchange"
7
+
8
+ axes := [
9
+ {
10
+ column: "internalSampleId",
11
+ spec: countsSpec.axesSpec[0]
12
+ },
13
+ {
14
+ column: "clonotypeKey",
15
+ spec: countsSpec.axesSpec[1]
16
+ }
17
+ ]
18
+
19
+ columns := [
20
+ {
21
+ column: "fraction",
22
+ id: "fraction",
23
+ allowNA: true,
24
+ spec: {
25
+ name: "pl7.app/" + field + "/countFraction",
26
+ valueType: "Double",
27
+ annotations: {
28
+ "pl7.app/label": "Fraction of counts",
29
+ "pl7.app/table/orderPriority": "100",
30
+ "pl7.app/table/visibility": "default"
31
+ }
32
+ }
33
+ }
34
+ ]
35
+
36
+ return {
37
+ axes: axes,
38
+ columns: columns,
39
+ "storageFormat": "Parquet",
40
+ "partitionKeyLength": 1
41
+ }
42
+ }
43
+
44
+ export ll.toStrict({
45
+ getColumns: getColumns
46
+ })
@@ -0,0 +1,238 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ math := import("math")
3
+
4
+ getColumns := func(countsSpec, inputType, log2FCThreshold, pAdjFCThreshold, cdSubsetCol, denominators) {
5
+ field := "differentialTCRAbundance"
6
+
7
+ // Define volcano plot significant line cut points
8
+ thresholds := "[{\"columnId\": {\"name\": \"pl7.app/" + field + "/log2foldchange_mean\",\"valueType\": \"Double\"},\"label\": \"Min LogFC (left vertical)\",\"value\": " + string(-log2FCThreshold) + "},"
9
+ thresholds = thresholds + "{\"columnId\": {\"name\": \"pl7.app/" + field + "/log2foldchange_mean\",\"valueType\": \"Double\"},\"label\": \"Max LogFC (right vertical)\",\"value\": " + string(log2FCThreshold) + "},"
10
+ thresholds = thresholds + "{\"columnId\": {\"name\": \"pl7.app/" + field + "/minlog10padj_mean\",\"valueType\": \"Double\"},\"label\": \"Y bound\",\"value\": " + string(-math.log10(pAdjFCThreshold)) + "}]"
11
+
12
+
13
+ axes := [
14
+ {
15
+ column: "Contrast",
16
+ id: "contrast",
17
+ allowNA: false,
18
+ spec: {
19
+ name: "pl7.app/" + field + "/contrastGroup",
20
+ type: "String",
21
+ annotations: {
22
+ "pl7.app/label": "Contrast"
23
+ }
24
+ }
25
+ },
26
+ {
27
+ column: "clonotypeKey",
28
+ spec: countsSpec.axesSpec[1]
29
+ }
30
+ ]
31
+
32
+ columns := [
33
+ {
34
+ column: "CDR3aa",
35
+ id: "cdr3aa",
36
+ allowNA: true,
37
+ spec: {
38
+ name: "pl7.app/" + field + "/cdr3aa",
39
+ valueType: "String",
40
+ annotations: {
41
+ "pl7.app/label": "CDR3 aa",
42
+ "pl7.app/table/orderPriority": "200",
43
+ "pl7.app/table/visibility": "default"
44
+ }
45
+ }
46
+ },
47
+ {
48
+ column: "VGene",
49
+ id: "vgene",
50
+ allowNA: true,
51
+ spec: {
52
+ name: "pl7.app/" + field + "/vgene",
53
+ valueType: "String",
54
+ annotations: {
55
+ "pl7.app/label": "VGene",
56
+ "pl7.app/table/orderPriority": "195",
57
+ "pl7.app/table/visibility": "default"
58
+ }
59
+ }
60
+ },
61
+ {
62
+ column: "log2FoldChange",
63
+ id: "log2foldchange",
64
+ allowNA: true,
65
+ spec: {
66
+ name: "pl7.app/" + field + "/log2foldchange",
67
+ valueType: "Double",
68
+ annotations: {
69
+ "pl7.app/label": "Log2FC",
70
+ "pl7.app/table/orderPriority": "95",
71
+ "pl7.app/graph/axis/symmetricRange": "0",
72
+ "pl7.app/table/visibility": "default"
73
+ }
74
+ }
75
+ },
76
+ {
77
+ column: "pvalue",
78
+ id: "pvalue",
79
+ allowNA: true,
80
+ spec: {
81
+ name: "pl7.app/" + field + "/pvalue",
82
+ valueType: "Double",
83
+ annotations: {
84
+ "pl7.app/label": "P-value",
85
+ "pl7.app/table/orderPriority": "110",
86
+ "pl7.app/table/visibility": "optional"
87
+ }
88
+ }
89
+ },
90
+ {
91
+ column: "padj",
92
+ id: "padj",
93
+ allowNA: true,
94
+ spec: {
95
+ name: "pl7.app/" + field + "/padj",
96
+ valueType: "Double",
97
+ annotations: {
98
+ "pl7.app/label": "Adjusted p-value",
99
+ "pl7.app/table/orderPriority": "105",
100
+ "pl7.app/table/visibility": "default"
101
+ }
102
+ }
103
+ },
104
+ {
105
+ column: "minlog10padj",
106
+ id: "minlog10padj",
107
+ allowNA: true,
108
+ spec: {
109
+ name: "pl7.app/" + field + "/minlog10padj",
110
+ valueType: "Double",
111
+ annotations: {
112
+ "pl7.app/label": "-log10 adjusted p-value",
113
+ "pl7.app/table/orderPriority": "100",
114
+ "pl7.app/table/visibility": "optional"
115
+ }
116
+ }
117
+ },
118
+ {
119
+ column: "Regulation",
120
+ id: "regulationDirection",
121
+ spec: {
122
+ name: "pl7.app/" + field + "/regulationDirection",
123
+ valueType: "String",
124
+ annotations: {
125
+ "pl7.app/label": "Regulation direction",
126
+ "pl7.app/graph/palette": "{\"name\":\"triadic\",\"mapping\":{\"Up\":\"19\",\"Down\":\"22\",\"NS\":\"25\"}}",
127
+ "pl7.app/graph/thresholds": thresholds,
128
+ "pl7.app/table/orderPriority": "80",
129
+ "pl7.app/table/visibility": "optional"
130
+ }
131
+ }
132
+ },
133
+ {
134
+ column: "Robust_Enrichment",
135
+ id: "robustEnrichment",
136
+ spec: {
137
+ name: "pl7.app/" + field + "/robustEnrichment",
138
+ valueType: "String",
139
+ annotations: {
140
+ "pl7.app/label": "Robust enrichment",
141
+ "pl7.app/table/orderPriority": "155",
142
+ "pl7.app/table/visibility": "optional"
143
+ }
144
+ }
145
+ }
146
+ ]
147
+ if cdSubsetCol != undefined {
148
+ columns += [{
149
+ column: "subset",
150
+ id: "subset",
151
+ spec: {
152
+ name: "pl7.app/" + field + "/cdsubset",
153
+ valueType: "String",
154
+ annotations: {
155
+ "pl7.app/label": "CD4/CD8 subset",
156
+ "pl7.app/table/visibility": "default",
157
+ "pl7.app/table/orderPriority": "150"
158
+ }
159
+ }
160
+ },
161
+ {
162
+ column: "umi_count_CD4",
163
+ id: "umi_count_CD4",
164
+ spec: {
165
+ name: "pl7.app/" + field + "/umi_count_CD4",
166
+ valueType: "Double",
167
+ annotations: {
168
+ "pl7.app/label": "UMI count CD4",
169
+ "pl7.app/table/visibility": "optional",
170
+ "pl7.app/table/orderPriority": "145"
171
+ }
172
+ }
173
+ },
174
+ {
175
+ column: "umi_freq_CD4",
176
+ id: "umi_freq_CD4",
177
+ spec: {
178
+ name: "pl7.app/" + field + "/umi_freq_CD4",
179
+ valueType: "Double",
180
+ annotations: {
181
+ "pl7.app/label": "UMI frequency CD4",
182
+ "pl7.app/table/visibility": "optional",
183
+ "pl7.app/table/orderPriority": "140"
184
+ }
185
+ }
186
+ },
187
+ {
188
+ column: "umi_count_CD8",
189
+ id: "umi_count_CD8",
190
+ spec: {
191
+ name: "pl7.app/" + field + "/umi_count_CD8",
192
+ valueType: "Double",
193
+ annotations: {
194
+ "pl7.app/label": "UMI count CD8",
195
+ "pl7.app/table/visibility": "optional",
196
+ "pl7.app/table/orderPriority": "135"
197
+ }
198
+ }
199
+ },
200
+ {
201
+ column: "umi_freq_CD8",
202
+ id: "umi_freq_CD8",
203
+ spec: {
204
+ name: "pl7.app/" + field + "/umi_freq_CD8",
205
+ valueType: "Double",
206
+ annotations: {
207
+ "pl7.app/label": "UMI frequency CD8",
208
+ "pl7.app/table/visibility": "optional",
209
+ "pl7.app/table/orderPriority": "130"
210
+ }
211
+ }
212
+ },
213
+ {
214
+ column: "subset_frequency",
215
+ id: "subset_frequency",
216
+ spec: {
217
+ name: "pl7.app/" + field + "/cdsubset_frequency",
218
+ valueType: "Double",
219
+ annotations: {
220
+ "pl7.app/label": "Log(10) major subset frequency",
221
+ "pl7.app/table/visibility": "optional",
222
+ "pl7.app/table/orderPriority": "125"
223
+ }
224
+ }
225
+ }]
226
+ }
227
+
228
+ return {
229
+ axes: axes,
230
+ columns: columns,
231
+ "storageFormat": "Parquet",
232
+ "partitionKeyLength": 1
233
+ }
234
+ }
235
+
236
+ export ll.toStrict({
237
+ getColumns: getColumns
238
+ })