-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
254 lines (188 loc) · 8.81 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-core/genomeannotator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/nf-core/genomeannotator
Website: https://nf-co.re/genomeannotator
Slack : https://nfcore.slack.com/channels/genomeannotator
----------------------------------------------------------------------------------------
*/
nextflow.enable.dsl = 2
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GeneidX PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// nextflow run main.nf -profile docker --assembly data/SampleGenome.fa --outdir output/ --rm_lib data/GCA_000180735.1.repeatmodeler.fa --prot_file output/proteins/UniRef90.6658.3+.fa.gz
/*
* Defining the output folders.
*/
OutputFolder = "${params.output}"
OutputFolderProteinDBs = "${OutputFolder}/proteins"
OutputFolderSpecies = "${OutputFolder}/species"
OutputFolderSpeciesTaxid = "${OutputFolder}/species/${params.taxid}"
// fasta.gz
// fasta.gz.gzi
// fasta.gz.fai
// gff3.gz
// gff3.gz.tbi
// hsp.gff
// param
// paramOutputFolder = "${params.output}/params"
// genoom = file(params.genome)
/*
* Defining the module / subworkflow path, and include the elements
*/
subwork_folder = "${projectDir}/subworkflows"
include { UncompressFASTA } from "${subwork_folder}/tools" addParams(OUTPUT: OutputFolder)
include { fix_chr_names } from "${subwork_folder}/tools" addParams(OUTPUT: OutputFolder)
include { prot_down_workflow } from "${subwork_folder}/getProteins" addParams(OUTPUT: OutputFolderProteinDBs,
LABEL:'singlecpu')
include { repeat_down_workflow } from "${subwork_folder}/getRepeats" addParams(OUTPUT: OutputFolder,
LABEL:'singlecpu')
include { build_protein_DB } from "${subwork_folder}/build_dmnd_db" addParams(OUTPUT: OutputFolderProteinDBs,
LABEL:'fourcpus')
include { alignGenome_Proteins } from "${subwork_folder}/runDMND_BLASTx" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'fourcpus')
include { matchAssessment } from "${subwork_folder}/getTrainingSeq" addParams(OUTPUT: OutputFolder,
LABEL:'singlecpu')
include { param_selection_workflow } from "${subwork_folder}/getParams" addParams(OUTPUT: OutputFolder,
LABEL:'singlecpu')
include { param_value_selection_workflow } from "${subwork_folder}/getParamsValues" addParams(OUTPUT: OutputFolder,
LABEL:'singlecpu')
include { creatingParamFile } from "${subwork_folder}/modifyParamFile" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'singlecpu')
include { creatingParamFile_frommap } from "${subwork_folder}/modifyParamFile" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'singlecpu')
include { geneid_WORKFLOW } from "${subwork_folder}/geneid" addParams( LABEL:'singlecpu' )
include { prep_concat } from "${subwork_folder}/prepare_concatenation" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'singlecpu')
include { concatenate_Outputs_once } from "${subwork_folder}/geneid_concatenate" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'singlecpu')
include { gff3addInfo } from "${subwork_folder}/addMatchInfo" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'singlecpu')
// compress and index fastas to be stored and published to the cluster
include { compress_n_indexFASTA } from "${subwork_folder}/tools" addParams(OUTPUT: OutputFolderSpeciesTaxid,
LABEL:'singlecpu')
// compress and index gff3s to be stored and published to the cluster
include { gff34portal } from "${subwork_folder}/tools" addParams(OUTPUT: OutputFolderSpeciesTaxid)
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VALIDATE & PRINT PARAMETER SUMMARY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
WorkflowMain.initialise(workflow, params, log)
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOW FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { GENOMEANNOTATOR } from './workflows/genomeannotator'
//
// WORKFLOW: Run main nf-core/genomeannotator analysis pipeline
//
// workflow NFCORE_GENOMEANNOTATOR {
// GENOMEANNOTATOR ()
// }
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN ALL WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//
// WORKFLOW: Execute a single named workflow for the pipeline
// See: https://github.com/nf-core/rnaseq/issues/619
//
workflow {
parameter_location = file(params.parameter_path)
data_location = file(params.repeats_data_path)
// if (params.rm_lib) {
// repeats_file = file(params.rm_lib)
// } else {
// repeats_file = repeat_down_workflow(params.taxid,
// data_location)
// }
uncompressed_genome = GENOMEANNOTATOR()
// fix the chromosome names, ENA chrs have multiple labels
// separated by |
// keep only the last element
uncompressed_genome_mod = fix_chr_names(uncompressed_genome)
// none of the returned objects is used by downsteam processes
compress_n_indexFASTA(uncompressed_genome_mod)
// if proteins_file provided use proteins file
// else, use taxon to download the proteins_file
// both conditions are evaluated inside the execution of this workflow
if (params.prot_file) {
proteins_file = file(params.prot_file)
} else {
proteins_file = prot_down_workflow(params.taxid,
params.proteins_lower_lim,
params.proteins_upper_lim)
}
// Build protein database for DIAMOND
protDB = build_protein_DB(proteins_file)
// Run DIAMOND to find matches between genome and proteins
hsp_found = alignGenome_Proteins(protDB, uncompressed_genome_mod)
// Automatic computation of the parameter file
new_mats = matchAssessment(uncompressed_genome_mod, hsp_found,
params.match_score_min,
params.match_ORF_min,
params.intron_margin,
params.min_intron_size,
params.max_intron_size)
// if sites matrices provided, use them
// else, use taxon to get the closest geneid param file
if (params.acceptor_pwm) {
acc_pwm = params.acceptor_pwm
don_pwm = params.donor_pwm
sta_pwm = params.start_pwm
sto_pwm = params.stop_pwm
} else {
param_file_sel = param_selection_workflow(params.taxid, 0, parameter_location)
acc_pwm = param_file_sel.acceptor_pwm
don_pwm = param_file_sel.donor_pwm
sta_pwm = param_file_sel.start_pwm
sto_pwm = param_file_sel.stop_pwm
}
para_vals = param_value_selection_workflow(params.taxid, 0,
parameter_location,
params.maps_param_values)
new_param = creatingParamFile_frommap(
params.taxid,
para_vals.params_map,
sta_pwm,
acc_pwm,
don_pwm,
sto_pwm,
new_mats.ini_comb,
new_mats.trans_comb,
params.general_gene_params,
hsp_found
)
// Run Geneid
predictions = geneid_WORKFLOW(uncompressed_genome_mod,
new_param,
hsp_found)
// Prepare concatenation
// This will initialize the final GFF3 file
output_file = prep_concat(proteins_file, uncompressed_genome_mod)
// Run concatenation of individual GFF3 files
final_output = concatenate_Outputs_once(predictions.collect(), output_file)
// Add information about the proteins to the final GFF3
labelled_output = gff3addInfo(final_output, hsp_found)
// If proteins from UniRef, add GO terms to the GFF3
if (params.source_uniprot){
// func_labelled_output = addGOterms(labelled_output)
// gff34portal(func_labelled_output)
gff34portal(labelled_output)
} else {
// fix gff3 file and compress it for the portal
gff34portal(labelled_output)
}
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/