Skip to content

Commit 488a964

Browse files
authored
Now using multiMap and regexp for post-fix removal (#9287)
1 parent 46dc23b commit 488a964

File tree

1 file changed

+42
-25
lines changed
  • subworkflows/nf-core/fasta_gxf_busco_plot

1 file changed

+42
-25
lines changed

subworkflows/nf-core/fasta_gxf_busco_plot/main.nf

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ workflow FASTA_GXF_BUSCO_PLOT {
2626
val_busco_cleanup // val(boolean); Set to true to remove BUSCO intermediate files
2727

2828
main:
29-
ch_versions = Channel.empty()
29+
ch_versions = channel.empty()
3030
ch_db_path = val_busco_lineages_path
31-
? Channel.of(file(val_busco_lineages_path, checkIfExists: true))
32-
: Channel.of( [ [] ] )
31+
? channel.of(file(val_busco_lineages_path, checkIfExists: true))
32+
: channel.of( [ [] ] )
3333
ch_config_path = val_busco_config
34-
? Channel.of(file(val_busco_config, checkIfExists: true))
35-
: Channel.of( [ [] ] )
36-
ch_busco_cleanup = Channel.of([val_busco_cleanup])
34+
? channel.of(file(val_busco_config, checkIfExists: true))
35+
: channel.of( [ [] ] )
36+
ch_busco_cleanup = channel.of([val_busco_cleanup])
3737

3838
// MODULE: BUSCO_BUSCO as BUSCO_ASSEMBLY
3939
ch_busco_assembly_inputs = ch_fasta
4040
| combine(
41-
Channel.of(val_mode)
41+
channel.of(val_mode)
4242
)
4343
| combine(
44-
Channel.fromList(val_lineages)
44+
channel.fromList(val_lineages)
4545
)
4646
| map { meta, fasta, mode, lineage ->
4747
[
@@ -58,14 +58,22 @@ workflow FASTA_GXF_BUSCO_PLOT {
5858
| combine(
5959
ch_busco_cleanup
6060
)
61+
| multiMap { meta, fasta, mode, lineage, db, config, cleanup ->
62+
fasta: [ meta, fasta ]
63+
mode: mode
64+
lineage: lineage
65+
db: db
66+
config: config
67+
cleanup: cleanup
68+
}
6169

6270
BUSCO_ASSEMBLY(
63-
ch_busco_assembly_inputs.map { meta, fasta, _mode, _lineage, _db, _config, _cleanup -> [ meta, fasta ] },
64-
ch_busco_assembly_inputs.map { _meta, _fasta, mode, _lineage, _db, _config, _cleanup -> mode },
65-
ch_busco_assembly_inputs.map { _meta, _fasta, _mode, lineage, _db, _config, _cleanup -> lineage },
66-
ch_busco_assembly_inputs.map { _meta, _fasta, _mode, _lineage, db, _config, _cleanup -> db },
67-
ch_busco_assembly_inputs.map { _meta, _fasta, _mode, _lineage, _db, config, _cleanup -> config },
68-
ch_busco_assembly_inputs.map { _meta, _fasta, _mode, _lineage, _db, _config, cleanup -> cleanup }
71+
ch_busco_assembly_inputs.fasta,
72+
ch_busco_assembly_inputs.mode,
73+
ch_busco_assembly_inputs.lineage,
74+
ch_busco_assembly_inputs.db,
75+
ch_busco_assembly_inputs.config,
76+
ch_busco_assembly_inputs.cleanup
6977
)
7078

7179
ch_assembly_batch_summary = BUSCO_ASSEMBLY.out.batch_summary
@@ -77,7 +85,7 @@ workflow FASTA_GXF_BUSCO_PLOT {
7785
// MODULE: BUSCO_GENERATEPLOT as PLOT_ASSEMBLY
7886
ch_assembly_plot_summary = ch_assembly_short_summaries_txt
7987
| map { meta, txt ->
80-
def lineage_name = meta.lineage - '_odb'
88+
def lineage_name = meta.lineage - ~/'_odb[0-9]+$'/
8189
[
8290
"short_summary.specific.${meta.lineage}.${meta.id}_${lineage_name}.txt",
8391
txt.text
@@ -92,7 +100,7 @@ workflow FASTA_GXF_BUSCO_PLOT {
92100

93101
// MODULE: GFFREAD as EXTRACT_PROTEINS
94102
ch_gffread_inputs = val_mode !in [ 'geno', 'genome' ]
95-
? Channel.empty()
103+
? channel.empty()
96104
: ch_fasta
97105
| map { meta, fasta -> [ meta.id, meta, fasta ] }
98106
| join(
@@ -112,10 +120,10 @@ workflow FASTA_GXF_BUSCO_PLOT {
112120
// MODULE: BUSCO_BUSCO as BUSCO_ANNOTATION
113121
ch_busco_annotation_inputs = ch_proteins
114122
| combine(
115-
Channel.of('proteins')
123+
channel.of('proteins')
116124
)
117125
| combine(
118-
Channel.fromList(val_lineages)
126+
channel.fromList(val_lineages)
119127
)
120128
| map { meta, fasta, mode, lineage ->
121129
[
@@ -132,14 +140,23 @@ workflow FASTA_GXF_BUSCO_PLOT {
132140
| combine(
133141
ch_busco_cleanup
134142
)
143+
| multiMap { meta, fasta, mode, lineage, db, config, cleanup ->
144+
fasta: [ meta, fasta ]
145+
mode: mode
146+
lineage: lineage
147+
db: db
148+
config: config
149+
cleanup: cleanup
150+
}
151+
135152

136153
BUSCO_ANNOTATION(
137-
ch_busco_annotation_inputs.map { meta, fasta, _mode, _lineage, _db, _config, _cleanup -> [ meta, fasta ] },
138-
ch_busco_annotation_inputs.map { _meta, _fasta, mode, _lineage, _db, _config, _cleanup -> mode },
139-
ch_busco_annotation_inputs.map { _meta, _fasta, _mode, lineage, _db, _config, _cleanup -> lineage },
140-
ch_busco_annotation_inputs.map { _meta, _fasta, _mode, _lineage, db, _config, _cleanup -> db },
141-
ch_busco_annotation_inputs.map { _meta, _fasta, _mode, _lineage, _db, config, _cleanup -> config },
142-
ch_busco_annotation_inputs.map { _meta, _fasta, _mode, _lineage, _db, _config, cleanup -> cleanup }
154+
ch_busco_annotation_inputs.fasta,
155+
ch_busco_annotation_inputs.mode,
156+
ch_busco_annotation_inputs.lineage,
157+
ch_busco_annotation_inputs.db,
158+
ch_busco_annotation_inputs.config,
159+
ch_busco_annotation_inputs.cleanup
143160
)
144161

145162
ch_annotation_batch_summary = BUSCO_ANNOTATION.out.batch_summary
@@ -151,7 +168,7 @@ workflow FASTA_GXF_BUSCO_PLOT {
151168
// MODULE: BUSCO_GENERATEPLOT as PLOT_ANNOTATION
152169
ch_annotation_plot_summary = ch_annotation_short_summaries_txt
153170
| map { meta, txt ->
154-
def lineage_name = meta.lineage - '_odb'
171+
def lineage_name = meta.lineage - ~/'_odb[0-9]+$'/
155172
[
156173
"short_summary.specific.${meta.lineage}.${meta.id}_${lineage_name}.proteins.txt",
157174
txt.text

0 commit comments

Comments
 (0)