-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.nf
72 lines (53 loc) · 1.77 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
nextflow.enable.dsl = 2
include {p2p; send; sketch; taxonomy; receive_filter; receive_nofilter} from './modules/processes.nf'
def helpMessage() {
log.info"""
Usage:
# Start the IPFS daemon
ipfs daemon &
# Start the local RabbitMQ server if no url
rabbitmq-server &
# The typical command for running the pipeline is as follows:
nextflow main.nf --help
nextflow main.nf --url localhost --exchange foobar
nextflow main.nf --filter false
Mandatory arguments:
--url {localhost, <url>}
--exchange <name> Name of the remote RabbitMQ exchange
Options:
--lca LCA database
""".stripIndent()
}
// Show help message
if (params.help){
helpMessage()
exit 0
}
// Check if IPFS daemon is running:
file(params.p2p_daemon, hidden: true, checkIfExists: true)
lca = file(params.lca, checkIfExists: true)
tags = file(params.tags, checkIfExists: true)
workflow {
// https://www.nextflow.io/docs/latest/channel.html#watchpath
// batch: .fromPath(params.send)
// stream: .watchPath(params.send, 'create,modify')
genomes_ch = Channel
.watchPath(params.send, 'create,modify')
.map { file -> tuple(file.baseName, file) }
.unique()
// file.name, file.simpleName, file.baseName
// https://github.com/nextflow-io/nextflow/issues/278
p2p(genomes_ch)
sketch(genomes_ch)
taxonomy(sketch.out, lca)
send_ch = genomes_ch.join(p2p.out).join(sketch.out).join(taxonomy.out)
send(send_ch, lca)
if (params.filter){
receive_filter(
file(params.filter.sbt),
file(params.filter.sbt_hidden),
tags)
} else {
receive_nofilter(tags)
}
}