Skip to content

Commit 0d2241d

Browse files
committed
Handle unzipping more logically
1 parent 47ad6f4 commit 0d2241d

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

main.nf

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -216,30 +216,30 @@ output_docs = file("$baseDir/docs/output.md")
216216
wherearemyfiles = file("$baseDir/assets/where_are_my_files.txt")
217217

218218
// Validate inputs
219-
if(!"${params.fasta}".indexOf(".gz")){
220-
Channel.fromPath("${params.fasta}")
221-
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
222-
.into {ch_fasta_for_bwa_indexing;ch_fasta_for_faidx_indexing;ch_fasta_for_dict_indexing; ch_fasta_for_bwa_mapping; ch_fasta_for_damageprofiler; ch_fasta_for_qualimap; ch_fasta_for_pmdtools; ch_fasta_for_circularmapper; ch_fasta_for_circularmapper_index;ch_fasta_for_bwamem_mapping}
223-
} else {
224-
//Put the zip into a channel, then unzip it and forward to downstream processes. DONT unzip in all steps, this is inefficient as NXF links the files anyways from work to work dir
225-
Channel.fromPath("${params.fasta}")
226-
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
227-
.set {ch_unzip_fasta}
219+
if("${params.fasta}".endsWith(".gz")){
220+
//Put the zip into a channel, then unzip it and forward to downstream processes. DONT unzip in all steps, this is inefficient as NXF links the files anyways from work to work dir
221+
Channel.fromPath("${params.fasta}")
222+
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
223+
.set {ch_unzip_fasta}
228224

229-
process unzip_reference{
230-
tag "$zipfasta"
225+
process unzip_reference{
226+
tag "$zipfasta"
231227

232-
input:
233-
file zipfasta from ch_unzip_fasta
228+
input:
229+
file zipfasta from ch_unzip_fasta
234230

235-
output:
236-
file "*.fasta" into (ch_fasta_for_bwa_indexing, ch_fasta_for_faidx_indexing, ch_fasta_for_dict_indexing, ch_fasta_for_bwa_mapping, ch_fasta_for_damageprofiler, ch_fasta_for_qualimap, ch_fasta_for_pmdtools, ch_fasta_for_circularmapper, ch_fasta_for_circularmapper_index,ch_fasta_for_bwamem_mapping)
231+
output:
232+
file "*.fasta" into (ch_fasta_for_bwa_indexing, ch_fasta_for_faidx_indexing, ch_fasta_for_dict_indexing, ch_fasta_for_bwa_mapping, ch_fasta_for_damageprofiler, ch_fasta_for_qualimap, ch_fasta_for_pmdtools, ch_fasta_for_circularmapper, ch_fasta_for_circularmapper_index,ch_fasta_for_bwamem_mapping)
237233

238-
script:
239-
"""
240-
pigz -f -d -p ${task.cpus} $zipfasta
241-
"""
242-
}
234+
script:
235+
"""
236+
pigz -f -d -p ${task.cpus} $zipfasta
237+
"""
238+
}
239+
} else {
240+
Channel.fromPath("${params.fasta}")
241+
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
242+
.into {ch_fasta_for_bwa_indexing;ch_fasta_for_faidx_indexing;ch_fasta_for_dict_indexing; ch_fasta_for_bwa_mapping; ch_fasta_for_damageprofiler; ch_fasta_for_qualimap; ch_fasta_for_pmdtools; ch_fasta_for_circularmapper; ch_fasta_for_circularmapper_index;ch_fasta_for_bwamem_mapping}
243243
}
244244

245245

0 commit comments

Comments
 (0)