This repository has been archived by the owner on Apr 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
227 lines (172 loc) · 7.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/usr/bin/env nextflow
/*
vim: syntax=groovy
-*- mode: groovy;-*-
========================================================================================
QBIC-megSAP-Pipeline B E S T P R A C T I C E
========================================================================================
Medical genetics analysis pipeline (imgag/megSAP). Started in October 2017.
#### Homepage / Documentation
https://github.com/qbicsoftware/QBIC-megSAP-NGS
#### Authors
Alexander Peltzer <alexander.peltzer@qbic.uni-tuebingen.de>
----------------------------------------------------------------------------------------
*/
//Version of the pipeline
version=1.0
def helpMessage() {
log.info"""
=========================================
QBIC-megSAP-Pipeline v${version}
=========================================
Usage:
There are three different commands available in the pipeline. For now, we only support the standard analysis procedure that produces BAM files within this script.
- DNA: Single sample analysis
- DNA: Multi sample analysis ( and trio )
- RNA: Expression analysis
DNA-Single Sample parameters:
Mandatory parameters:
-folder <string> Analysis data folder.
-name <string> Base file name, typically the processed sample ID (e.g. 'GS120001_01').
Optional parameters:
-system <infile> Processing system INI file (determined from NGSD via the 'name' by default).
-steps <string> Comma-separated list of steps to perform:
ma=mapping, vc=variant calling, an=annotation, db=import into NGSD, cn=copy-number analysis.
Default is: 'ma,vc,an,db,cn'.
-backup Backup old analysis files to old_[date] folder.
-lofreq Add low frequency variant detection.
-threads <int> The maximum number of threads used.
Default is: '2'.
-thres <int> Splicing region size used for annotation (flanking the exons).
Default is: '20'.
-clip_overlap Soft-clip overlapping read pairs.
-no_abra Skip realignment with ABRA.
-out_folder <string> Folder where analysis results should be stored. Default is same as in '-folder' (e.g. Sample_xyz/).
Default is: 'default'.
Special parameters:
--log <file> Enables logging to the specified file.
--conf <file> Uses the given configuration file.
--tdx Writes a Tool Defition XML file.
--email Sends you an e-mail on success/fail/etc (NOT YET IMPLEMENTED)
DNA-Multi Sample parameters: TBD
RNA Expression parameters: TBD
"""
}
//Help message if nothing else is specified
params.help = false
if(params.help){
helpMessage()
exit 0
}
//Check NF version similar to NGI-RNAseq, thanks guys!
nf_required_version = '0.25.0'
try {
if( ! nextflow.version.matches(">= $nf_required_version") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version $nf_required_version required! You are running v$workflow.nextflow.version.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please run `nextflow self-update` to update Nextflow.\n" +
"============================================================"
}
//We're using the same defaults as in the original workflow specification here
params.folder = false
params.name = false
params.system = false
params.steps = "ma,vc,an,cn" //db import not for us, just at IMGAG
params.backup = false
params.lofreq = false
params.threads = '2'
params.thres = '20'
params.clip_overlap = false
params.no_abra = false
params.out_folder = 'default'
params.log = false
params.conf = false
params.tdx = false
params.email = false
params.multiqc_config = "$baseDir/conf/multiqc_config.yaml"
multiqc_config = file(params.multiqc_config)
//Validate inputs
//TBD
//Header log info
log.info "========================================="
log.info " QBIC-megSAP-NGS : v${version}"
log.info "========================================="
def summary = [:]
summary['Folder'] = params.folder
summary['Name'] = params.name
summary['System'] = params.system
summary['Steps'] = params.steps
summary['Backup'] = params.backup
summary['Low Frequency'] = params.lofreq
summary['Threads'] = params.threads
summary["Threshold"] = params.thres
summary["Clip Overlap"] = params.clip_overlap
summary["Logfile"] = params.log
summary["Special configuration"] = params.conf
summary["TDX"] = params.tdx
if(params.email) summary['E-Mail address'] = params.email
log.info summary.collect { k,v -> "${k.padRight(15)}: $v" }.join("\n")
log.info "========================================="
/*
Process input FastQ files in a way that the pipeline can read them
*/
/*process qbic_prepare_data_for_megSAP {
tag $params.name
}
*/
/*
Run megSAP-analyze.php with selected parameters on input file(s)
*/
process qbic_megsap_single_sample_analysis {
tag "$params.name"
publishDir "${params.out_folder}", mode: 'copy',
saveAs: {filename ->
if(filename.indexOf(".bam") == -1) "$params.out_folder/$filename"
else if(filename.indexOf(".bai") == -1) "$params.out_folder/$filename"
else if(filename.indexOf(".gsvar") == -1) "$params.out_folder/$filename"
else if(filename.indexOf(".qcml") == -1) "$params.out_folder/$filename"
else "$filename"
}
//publishDirs etc?
system_ch = Channel.fromPath("${params.system}")
folder_ch = Channel.fromPath("${params.folder}")
input:
file folder_path from folder_ch
val sample_id from params.name
val threads from params.threads
val steps from params.steps
file system from system_ch
//file system from params.system
output:
script:
"""
php /megSAP/src/Pipelines/analyze.php -folder ${folder_path} -name ${sample_id} -threads ${threads} -steps ${steps} -system ${system}
"""
/*-folder <string> Analysis data folder.
-name <string> Base file name, typically the processed sample ID (e.g. 'GS120001_01').
Optional parameters:
-system <infile> Processing system INI file (determined from NGSD via the 'name' by default).
-steps <string> Comma-separated list of steps to perform:
ma=mapping, vc=variant calling, an=annotation, db=import into NGSD, cn=copy-number analysis.
Default is: 'ma,vc,an,db,cn'.
-backup Backup old analysis files to old_[date] folder.
-lofreq Add low frequency variant detection.
-threads <int> The maximum number of threads used.
Default is: '2'.
-thres <int> Splicing region size used for annotation (flanking the exons).
Default is: '20'.
-clip_overlap Soft-clip overlapping read pairs.
-no_abra Skip realignment with ABRA.
-out_folder <string> Folder where analysis results should be stored. Default is same as in '-folder' (e.g. Sample_xyz/).
Default is: 'default'.
Special parameters:
--log <file> Enables logging to the specified file.
--conf <file> Uses the given configuration file.
--tdx Writes a Tool Defition XML file.
--email Sends you an e-mail on success/fail/etc (NOT YET IMPLEMENTED)
*/
}