-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
202 lines (179 loc) · 5.56 KB
/
main.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/env nextflow
/*
========================================================================================
Pig pancreas analysis
========================================================================================
GitHub : https://github.com/theislab/atlas-feature-selection-benchmark
Website:
----------------------------------------------------------------------------------------
*/
nextflow.enable.dsl = 2
/*
========================================================================================
WORKFLOWS
========================================================================================
*/
include { DATASETS } from './workflows/datasets'
include { METHODS } from './workflows/methods'
include { INTEGRATION } from './workflows/integration'
include { METRICS } from './workflows/metrics'
include { REPORTS } from './workflows/reports'
prepared_datasets_ch = Channel
.fromList(params.datasets)
.map { dataset ->
tuple(
dataset.name,
file(params.outdir + "/datasets-prepped/" + dataset.name + "-reference.h5ad"),
file(params.outdir + "/datasets-prepped/" + dataset.name + "-query.h5ad")
)
}
tirosh_genes_ch = Channel
.fromList(["tirosh-genes"])
.map { dataset ->
tuple(
file(params.outdir + "/datasets-raw/" + dataset + ".tsv"),
)
}
human_tfs_ch = Channel
.fromList(["human_tfs"])
.map { dataset ->
tuple(
file(params.outdir + "/datasets-raw/" + dataset + ".tsv"),
)
}
features_ch = Channel
.fromList(params.methods)
.map { method ->
tuple(
method.name
)
}
datasets_features_ch = prepared_datasets_ch
.combine(features_ch)
.map { input ->
tuple(
input[0], // Dataset name
input[1], // Path to reference file
input[2], // Path to query file
input[3], // Method name
file(params.outdir + "/selected-features/" + input[0] + "/" + input[3] + ".tsv")
)
}
integrations_ch = Channel.fromList(["scVI", "scANVI", "Symphony"])
reference_ch = datasets_features_ch
.combine(integrations_ch)
.map { input ->
tuple(
input[0], // Dataset name
input[3], // Method name
input[5], // Integration name
file(params.outdir + "/" + input[0] + "/" + input[3] + "/" + input[5] + "-reference/adata.h5ad"),
input[1] // Path to reference file
)
}
query_ch = datasets_features_ch
.combine(integrations_ch)
.map { input ->
tuple(
input[0], // Dataset name
input[3], // Method name
input[5], // Integration name
file(params.outdir + "/" + input[0] + "/" + input[3] + "/" + input[5] + "-reference/adata.h5ad"),
file(params.outdir + "/" + input[0] + "/" + input[3] + "/" + input[5] + "-mapped/adata.h5ad")
)
}
labels_ch = reference_ch
.map { input ->
tuple(
input[0], // Dataset name
input[1], // Method name
input[2], // Integration name
file(params.outdir + "/" + input[0] + "/" + input[1] + "/" + input[2] + "-mapped/adata.h5ad"),
file(params.outdir + "/" + input[0] + "/" + input[1] + "/" + input[2] + "-labels.tsv")
)
}
combined_metrics_ch = Channel.fromList([file(params.outdir + "/metrics/all-metrics.tsv")])
//
// WORKFLOW: Run main analysis pipeline, prints a message and ends
//
workflow WF_MAIN {
println '\n'
println "==== ATLAS FEATURE SELECTION BENCHMARKING PIPELINE ===="
println '\n'
println "Specify the workflow to run using the '-entry' option."
println '\n'
println 'Current workflows are:'
println '\n'
println '* WF_DATASETS - Download and prepare datasets'
println '* WF_METHODS - Run feature selection methods'
println '* WF_INTEGRATION - Run integration steps'
println '* WF_METRICS - Run evaluation metrics'
println '* WF_REPORTS - Run reports'
println '* WF_ALL - Run all analysis steps in order'
println '\n'
println 'Stopping.'
println '\n'
println "======================================================="
println '\n'
}
//
// WORKFLOW: Download and prepare datasets
//
workflow WF_DATASETS {
DATASETS()
}
//
// WORKFLOW: Run feature selection methods
//
workflow WF_METHODS {
METHODS(prepared_datasets_ch, human_tfs_ch)
}
//
// WORKFLOW: Run integration
//
workflow WF_INTEGRATION {
INTEGRATION(datasets_features_ch)
}
//
// WORKFLOW: Run metrics
//
workflow WF_METRICS {
METRICS(reference_ch, query_ch, labels_ch, tirosh_genes_ch)
}
//
// WORKFLOW: Run reports
//
workflow WF_REPORTS {
REPORTS(combined_metrics_ch)
}
//
// WORKFLOW: Run all analysis steps in order
//
workflow WF_ALL {
DATASETS()
METHODS(DATASETS.out.prepared_datasets_ch, DATASETS.out.human_tfs_ch)
INTEGRATION(METHODS.out.datasets_features_ch)
METRICS(
INTEGRATION.out.reference_ch,
INTEGRATION.out.query_ch,
INTEGRATION.out.labels_ch,
DATASETS.out.tirosh_genes_ch
)
REPORTS(METRICS.out)
}
/*
========================================================================================
DEFAULT WORKFLOW
========================================================================================
*/
//
// Implicit workflow executed when no entry is specified
//
workflow {
WF_MAIN ()
}
/*
========================================================================================
THE END
========================================================================================
*/