-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
164 lines (123 loc) · 4.13 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
#!/usr/bin/env nextflow
// Enable modules
nextflow.enable.dsl = 2
def helpMessage() {
log.info ABIHeader()
log.info """
LAGOON-MCL
For more information, see the documentation:
=============================================================================================
--max_cpus
--max_memory
--max_time
--projectName
--outdir
--fasta
--scan_pfam
--pfam_db
--pfam_name
--alignment_file
--sensitivity
--matrix
--diamond_evalue
--I
--max_weight
--cluster_size
Examples:
Test parameters:
nextflow run main.nf -profile singularity [params]
Custom parameters:
nextflow run main.nf -profile singularity [params]
"""
}
if (params.help) {
helpMessage()
exit 0
}
// PIPELINE INFO
// Header log info
def summary = [:]
if (workflow.revision) summary['Pipeline Release'] = workflow.revision
summary['Run Name'] = workflow.runName
summary['Project Name'] = params.projectName
summary['Output dir'] = params.outdir
summary['Launch dir'] = workflow.launchDir
summary['Working dir'] = workflow.workDir
summary['Script dir'] = workflow.projectDir
summary['User'] = workflow.userName
summary['Execution profile'] = workflow.profile
log.info summary.collect { k,v -> "${k.padRight(18)}: $v" }.join("\n")
log.info "-\033[91m--------------------------------------------------\033[0m-"
// Import subworkflow
include { PFAM } from './subworkflow/workflow_pfam.nf'
include { SSN } from './subworkflow/workflow_ssn.nf'
include { REPORT } from './subworkflow/workflow_report.nf'
// Import modules
include { PreparationFasta } from './modules/preparation.nf'
include { PreparationAnnot } from './modules/preparation.nf'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN ALL WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
// Channel
proteome = Channel.fromPath(params.fasta, checkIfExists: true)
inflation = Channel.of(params.I.split(",")).distinct()
quarto_seqs_clst = Channel.fromPath("${projectDir}/bin/report_seqs_clst.qmd")
// concaténation de tous les fichiers FASTA
all_sequences = proteome.collectFile(name: "${params.outdir}/lagoon-mcl_output/diamond/all_sequences.fasta")
PreparationFasta(all_sequences)
all_sequences_rename = PreparationFasta.out.sequence_rename
split_fasta = all_sequences_rename.splitFasta(by: 1000000, file: true)
/* Pfam */
if (params.scan_pfam == true || params.annotation_files == null) {
PFAM(split_fasta)
}
/* Annotation */
if (params.annotation_files != null) {
annotation = Channel.fromPath(params.annotation_files, checkIfExists: true)
PreparationAnnot(annotation)
}
/* Create channel */
if (params.scan_pfam == true && params.annotation_files != null) {
label_network = PFAM.out.label_pfam.concat(PreparationAnnot.out.label_annotation).collect()
}
else if (params.scan_pfam == false && params.annotation_files != null) {
label_network = PreparationAnnot.out.label_annotation.collect()
}
else if (params.scan_pfam == true && params.annotation_files == null) {
label_network = PFAM.out.label_pfam.collect()
}
/* Sequence Similarity Sequence */
SSN(all_sequences_rename, split_fasta, params.alignment_file, inflation)
diamond_ssn = SSN.out.diamond_ssn
REPORT(quarto_seqs_clst, all_sequences_rename, SSN.out.network, SSN.out.tuple_network, label_network)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow.onComplete {
println "- Workflow info: LAGOON-MCL workflow completed successfully -"
log.info ABIHeader()
}
workflow.onError = {
println "- Workflow info: LAGOON-MCL workflow completed with errors -"
log.info ABIHeader()
}
def ABIHeader() {
return """
========================================
╔═══╗ ╔═══╗ ╔═╗
║╔═╗║ ║╔═╗║ ╚═╝
║╚═╝║ ║╚═╝╚═╗ ╔═╗
╠═══╣ ║ ╔═╗ ║ ║ ║
║ ║ ║ ╚═╝ ║ ║ ║
╩ ╩ ╚═════╝ ╚═╝
(https://bioinfo.mnhn.fr/abi/)
========================================
"""
.stripIndent()
}