-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdupfinder.nf
191 lines (137 loc) · 4.95 KB
/
dupfinder.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
/*
*
*
/
/*
*
*/
nextflow.enable.dsl=2
params.genome_file = ""
params.reads_sr = "{prefix}_*{1,2}.f*q*"
params.annot = ""
params.out = ""
params.reads_lr = "{prefix}_*.f*q*"
params.help = false
params.sr = false
params.lr = false
//params.bam = false
/*
* Add help message
*/
def helpMessage() {
log.info"""
=========================================
DUPFinder version: v1.0.0
=========================================
Usage:
Usage: nextflow run dupfinder.nf --c file.config --genome_file reference.fa --reads "prefix_{1,2}.fastq" --annot file.bed --out Output_DUPFinder
Command arguments DUPFinder:
--genome_file: Reference genome in FASTA format
--reads_sr: set of paired-end short reads in FASTQ format. Gzipped FASTQ files are allowed
--reads_lr: set of single-end long reads in FASTQ format. Gzipped FASTQ files are allowed
--sr: allow to run the short reads version
--lr: allow to run the long reads version
--annot: the file containing the gene annotation: it can be in gff or bed format and must be tabulated
--out: Output directory to which all results will be written
--c: Config file specifying the number of CPU cores and memory that will be assigned to DUPFinder
Optional arguments:
-w: Working directory to which intermediate results will be written. Default: work
""".stripIndent()
}
/*
* SET UP CONFIGURATION VARIABLES
*/
// Show help emssage
if (params.help){
helpMessage()
exit 0
}
/*
* Input parameters validation and setup
*/
if (! params.out ) {
println "Missing output directory parameter"
exit 1
}
if (! params.reads_sr ) {
println "Missing reads_sr parameter"
exit 1
}
if (! params.reads_lr ) {
println "Missing reads_lr parameter"
exit 1
}
if (! params.genome_file ) {
println "Missing genome file parameter"
exit 1
}
include { MAPPING } from './module_sr/bwa'
include { VARIANT } from './module_sr/calling'
include { VCF_MERGE } from './module_sr/merge_vcf.nf'
include { GENE_DUPLICATED } from './module_sr/dup_gene.nf'
include { VCF_FILTER } from './module_sr/filter_vcf.nf'
//include { DYSGU } from './module_sr/dysgu.nf'
//include { DELLY } from './module_sr/delly.nf'
//include { SMOOVE; DELLY; DYSGU; VCF_MERGE } from './module_sr/smoove.nf'
include { MAPPING_LR } from './module_lr/minimap2.nf'
include { VARIANT_LR } from './module_lr/calling_lr.nf'
include { FILTER_LR } from './module_lr/filter_lr.nf'
include { MERGE_LR } from './module_lr/mergeVcf_lr.nf'
include { GENE_DUPLICATED_LR } from './module_lr/dupgene_lr.nf'
//Declare your variable
genome = file(params.genome_file)
genome_index_file = file(params.genome_file + ".fai")
genome_bwa_amb_file = file(params.genome_file + ".amb")
genome_bwa_ann_file = file(params.genome_file + ".ann")
genome_bwa_bwt_file = file(params.genome_file + ".bwt")
genome_bwa_pac_file = file(params.genome_file + ".pac")
genome_bwa_sa_file = file(params.genome_file + ".sa")
annotation = file(params.annot)
Channel
.fromFilePairs(params.reads_sr)
// .ifEmpty { error "Cannot find any fastq files matching: ${params.reads_sr}" }
.set{reads_file}
Channel
.fromPath(params.reads_lr)
// .ifEmpty { error "Cannot find any fastq files matching: ${params.reads_lr}" }
.map { file -> tuple( file.baseName, file )}
.set{reads_lr}
workflow {
if (params.sr) {
MAPPING(reads_file, genome,genome_index_file,genome_bwa_amb_file,genome_bwa_ann_file,genome_bwa_bwt_file, genome_bwa_pac_file, genome_bwa_sa_file)
VARIANT(MAPPING.out.bam_file_ch, genome, genome_index_file )
VCF_FILTER(MAPPING.out.bam_file_ch, VARIANT.out.variant_calls, genome, genome_index_file )
VCF_MERGE(VCF_FILTER.out.duplication_annot_calls)
GENE_DUPLICATED(VCF_MERGE.out.filter_file, annotation)
}
else if(params.lr) {
MAPPING_LR( reads_lr, genome)
VARIANT_LR(MAPPING_LR.out, genome)
FILTER_LR (MAPPING_LR.out.bam_file_ch, VARIANT_LR.out.variant_calls, genome)
MERGE_LR ( FILTER_LR.out.duplication_annot_calls )
GENE_DUPLICATED_LR (MERGE_LR.out.filterVcf_file, annotation)
// DYSGU(MAPPING.out.bam_file_ch, genome, genome_index_file )
// DELLY(MAPPING.out.bam_file_ch, genome, genome_index_file )
// SMOOVE(MAPPING.out.bam_file_ch, genome, genome_index_file )
}
}
/*
========================================================================================
Workflow DupFinder tools for long and short reads data
========================================================================================
*/
workflow.onComplete {
println ( workflow.success ? """
DUPFinder tools execution summary
---------------------------
Completed at : ${workflow.complete}
Duration : ${workflow.duration}
Success : ${workflow.success}
workDir : ${workflow.workDir}
exit status : ${workflow.exitStatus}
""" : """
Failed: ${workflow.errorReport}
exit status : ${workflow.exitStatus}
"""
)
}