Skip to content

Commit

Permalink
Handle unzipping more logically
Browse files Browse the repository at this point in the history
  • Loading branch information
apeltzer committed Dec 15, 2018
1 parent 47ad6f4 commit 0d2241d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -216,30 +216,30 @@ output_docs = file("$baseDir/docs/output.md")
wherearemyfiles = file("$baseDir/assets/where_are_my_files.txt")

// Validate inputs
if(!"${params.fasta}".indexOf(".gz")){
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --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}
} else {
//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
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
.set {ch_unzip_fasta}
if("${params.fasta}".endsWith(".gz")){
//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
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
.set {ch_unzip_fasta}

process unzip_reference{
tag "$zipfasta"
process unzip_reference{
tag "$zipfasta"

input:
file zipfasta from ch_unzip_fasta
input:
file zipfasta from ch_unzip_fasta

output:
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)
output:
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)

script:
"""
pigz -f -d -p ${task.cpus} $zipfasta
"""
}
script:
"""
pigz -f -d -p ${task.cpus} $zipfasta
"""
}
} else {
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --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}
}


Expand Down

0 comments on commit 0d2241d

Please sign in to comment.