-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.nf
198 lines (167 loc) · 6.03 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
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-core/callingcards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/nf-core/callingcards
Website: https://nf-co.re/callingcards
Slack : https://nfcore.slack.com/channels/callingcards
----------------------------------------------------------------------------------------
*/
nextflow.enable.dsl = 2
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { CALLINGCARDS } from './workflows/callingcards'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_callingcards_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_callingcards_pipeline'
include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_callingcards_pipeline'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENOME PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// This is an example of how to use getGenomeAttribute() to fetch parameters
// from igenomes.config using `--genome`
params.fasta = getGenomeAttribute('fasta')
params.gtf = getGenomeAttribute('gtf')
if (params.datatype == 'yeast'){
if(params.genome == 'R64-1-1'){
log.info"${projectDir}"
params.regions_mask = "${projectDir}/assets/yeast/igenomes/R64-1-1/regions_mask.bed"
log.info"Using default regions mask for yeast analysis: ${params.regions_mask}"
params.fasta_index = null
log.info"Genome fasta will be indexed in the workflow"
}
if(!params.containsKey('additional_fasta')){
params.additional_fasta = "${projectDir}/assets/yeast/plasmid_sequences.fasta"
log.info"Using default plasmid sequences for yeast analysis: ${params.additional_fasta}"
}
}
if (params.genome == 'GRCm38'){
if(params.aligner == 'bwa'){
params.bwa_index = WorkflowMain.getGenomeAttribute(params, 'bwa')
}
}
if(!params.containsKey('regions_mask')){
params.regions_mask = null
log.info"Regions mask not specified. The entire genome will be used for alignment"
}
if(!params.containsKey('additional_fasta')){
params.additional_fasta = null
log.info"Additional fasta not specified. No additional sequences beyond those in the genome fasta will be used for alignment"
}
if (!params.containsKey('fasta_index')){
params.fasta_index = null
log.info"Genome fasta will be indexed in the workflow"
}
// these parameters are used in the pipeline and may or may not be set either
// by the user or through the --genome argument. If they are null, then
// the appropriate index will be created in the workflow
if(!params.containsKey('bwa_index')){
params.bwa_index = null
}
if(!params.containsKey('bwamem2_index')){
params.bwamem2_index = null
}
if(!params.containsKey('bowtie_index')){
params.bowtie_index = null
}
if(!params.containsKey('bowtie2_index')){
params.bowtie2_index = null
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//
// WORKFLOW: Run main analysis pipeline depending on type of input
//
workflow NFCORE_CALLINGCARDS {
take:
reads
barcode_details
main:
if(params.fasta){
ch_fasta = Channel.fromPath(params.fasta, checkIfExists: true).collect()
.map{ it -> [[id:it[0].getSimpleName()], it[0]]}
} else {
exit 1, 'Either a valid configured `genome` or a `fasta` file must be specified.'
}
if(params.gtf){
ch_gtf = Channel.fromPath(params.gtf, checkIfExists:true).collect()
} else {
exit 1, 'Either a valid configured `genome` or a `gtf` file must be specified.'
}
ch_regions_mask = params.regions_mask ?
Channel.fromPath(params.regions_mask, checkIfExists: true)
.collect().map{ it -> [[id:it[0].getSimpleName()], it[0]]} :
Channel.empty()
additional_fasta = params.additional_fasta ?
Channel.fromPath(params.additional_fasta, checkIfExists: true).collect() :
Channel.empty()
def rseqc_modules = params.rseqc_modules ?
params.rseqc_modules.split(',').collect{ it.trim().toLowerCase() } :
[]
//
// WORKFLOW: Run pipeline
//
CALLINGCARDS (
reads,
barcode_details,
ch_fasta,
ch_gtf,
ch_regions_mask,
additional_fasta,
rseqc_modules
)
emit:
multiqc_report = CALLINGCARDS.out.multiqc_report // channel: /path/to/multiqc_report.html
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
main:
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.help,
params.validate_params,
params.monochrome_logs,
args,
params.outdir,
params.input
)
//
// WORKFLOW: Run main workflow
//
NFCORE_CALLINGCARDS (
PIPELINE_INITIALISATION.out.reads,
PIPELINE_INITIALISATION.out.barcode_details
)
//
// SUBWORKFLOW: Run completion tasks
//
PIPELINE_COMPLETION (
params.email,
params.email_on_fail,
params.plaintext_email,
params.outdir,
params.monochrome_logs,
params.hook_url,
NFCORE_CALLINGCARDS.out.multiqc_report
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/