-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
executable file
·91 lines (64 loc) · 2.8 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
/* ========================================================================================
INPUT FILES
======================================================================================== */
params.input = null
if (!params.input) {
error "Input not specified. Use --input to specify the input."
}
input_files = file(params.input)
/* ========================================================================================
OUTPUT DIRECTORY
======================================================================================== */
params.outdir = false
if(params.outdir){
outdir = params.outdir
} else {
outdir = '.'
}
/* ========================================================================================
PARAMETERS
======================================================================================== */
params.genome = 'Mus_musculus_GRCm39' // Default genome
params.macs_callpeak_args = ''
params.seacr_args = ''
params.peak_caller = 'macs'
/* ========================================================================================
MESSAGES
======================================================================================== */
// Validate peak callers
assert params.peak_caller == 'macs' || params.peak_caller == 'seacr' : "Invalid peak caller option: >>${params.peak_caller}<<. Valid options are: 'macs' or 'seacr'\n\n"
println ("Using peak caller: " + params.peak_caller)
/* ========================================================================================
FILES CHANNEL
======================================================================================== */
include { makeFilesChannel; getFileBaseNames } from './modules/files.mod.nf'
// Loading the design csv file
if (params.input.endsWith('.csv')) {
Channel.fromPath(params.input)
.splitCsv(header: true, sep: ',')
.map { row -> [ file(row.treatment, checkIfExists: true), file(row.control, checkIfExists: true) ] }
.set { files_ch }
} else {
Channel.fromPath(params.input)
.set { files_ch }
}
/* ========================================================================================
WORKFLOW
======================================================================================== */
if (params.peak_caller == 'macs'){
include { MACS_CALLPEAK } from './modules/macs.mod.nf' params(genome: params.genome)
}
else if (params.peak_caller == 'seacr'){
include { SEACR } from './modules/seacr.mod.nf'
}
workflow {
main:
if (params.peak_caller == 'macs'){
MACS_CALLPEAK (files_ch, outdir, params.macs_callpeak_args)
}
else if (params.peak_caller == 'seacr'){
SEACR (files_ch, outdir, params.seacr_args)
}
}