-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.nf
61 lines (44 loc) · 1.36 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
include { nevermore_main } from "./nevermore/workflows/nevermore"
include { fastq_input } from "./nevermore/workflows/input"
include { run_metaphlan4; combine_metaphlan4; collate_metaphlan4_tables } from "./nevermore/modules/profilers/metaphlan4"
include { humann3 } from "./metaphlow/workflows/humann3"
workflow {
fastq_input(
Channel.fromPath(params.input_dir + "/*", type: "dir"),
Channel.of(null)
)
fastq_input_ch = fastq_input.out.fastqs
if (params.ignore_samples) {
ignore_samples = params.ignore_samples.split(",")
print ignore_samples
fastq_input_ch = fastq_input_ch
.filter { !ignore_samples.contains(it[0].id) }
}
fastq_input_ch.dump(pretty: true, tag: "fastq_input_ch")
nevermore_main(fastq_input_ch)
fastq_ch = nevermore_main.out.fastqs
fastq_ch = fastq_ch
.map { sample, fastqs ->
sample_id = sample.id.replaceAll(/\.singles$/, "")
return tuple(sample_id, fastqs)
}
.groupTuple()
.map { sample_id, fastqs ->
def meta = [:]
meta.id = sample_id
return tuple(meta, [fastqs].flatten())
}
run_metaphlan4(fastq_ch, params.mp4_db)
collate_metaphlan4_tables(
run_metaphlan4.out.mp4_table
.map { sample, table -> return table }
.collect()
)
humann3(
collate_metaphlan4_tables.out.mp4_abundance_table,
run_metaphlan4.out.mp4_table,
fastq_ch
)
}