generated from CCBR/CCBR_NextflowTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.nf
72 lines (65 loc) · 2.07 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
log.info """\
CRISPIN 🍪
=============
NF version : $nextflow.version
runName : $workflow.runName
username : $workflow.userName
configs : $workflow.configFiles
profile : $workflow.profile
cmd line : $workflow.commandLine
start time : $workflow.start
projectDir : $workflow.projectDir
launchDir : $workflow.launchDir
workDir : $workflow.workDir
homeDir : $workflow.homeDir
input : ${params.input}
"""
.stripIndent()
// SUBMODULES
include { INPUT_CHECK } from './subworkflows/local/input_check.nf'
include { TRIM_COUNT } from './subworkflows/local/trim_count.nf'
include { MAGECK } from './subworkflows/local/mageck.nf'
include { BAGEL } from './subworkflows/local/bagel.nf'
// MODULES
include { DRUGZ } from './modules/local/drugz.nf'
workflow.onComplete {
if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) {
def pipeline_name = "${workflow.manifest.name.tokenize('/')[-1]}"
def launch_dir = "${workflow.launchDir}"
println "Running: spooker $launch_dir $pipeline_name"
def message = Utils.spooker(launch_dir, pipeline_name)
if (message) {
println message
}
}
}
workflow {
INPUT_CHECK(file(params.input))
INPUT_CHECK.out
.reads
.set { raw_reads }
ch_count = params.count_table ? file(params.count_table, checkIfExists: true) : null
if (!ch_count) { // trim reads and run mageck count
TRIM_COUNT(raw_reads, file(params.library, checkIfExists: true))
ch_count = TRIM_COUNT.out.count
}
raw_reads
.branch { meta, fastq ->
treat: meta.treat_or_ctrl == 'treatment'
return meta.id
ctrl: meta.treat_or_ctrl == 'control'
return meta.id
}
.set { treat_meta }
treat = treat_meta.treat.collect()
control = treat_meta.ctrl.collect()
if (params.mageck.run) {
MAGECK(ch_count, treat, control)
}
if (params.drugz.run) {
DRUGZ(ch_count, treat, control)
}
if (params.bagel.run) {
BAGEL(ch_count, control)
}
}