diff --git a/CHANGELOG.md b/CHANGELOG.md index e5d26623..e1ffeea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Do not stash unexistent files, use empty lists instead. Fixes AWS tests ([#67](https://github.com/nf-core/crisprseq/pull/67)) + ### Deprecated ## [v2.0.0 - Paprika Lovelace](https://github.com/nf-core/crisprseq/releases/tag/2.0.0) - [05.07.2023] diff --git a/templates/merging_summary.py b/templates/merging_summary.py index 804a5be3..ffc7d277 100755 --- a/templates/merging_summary.py +++ b/templates/merging_summary.py @@ -7,7 +7,7 @@ with gzip.open("${raw_reads[0]}", "rt") as handle: raw_reads_count = len(list(SeqIO.parse(handle, "fastq"))) -if "$assembled_reads" == "null_a": +if "$assembled_reads" == "": assembled_reads_count = 0 else: with gzip.open("$assembled_reads", "rt") as handle: @@ -16,7 +16,7 @@ with gzip.open("$trimmed_reads", "rt") as handle: trimmed_reads_count = len(list(SeqIO.parse(handle, "fastq"))) # Filtered reads -if "$trimmed_adapters" == "null_t": +if "$trimmed_adapters" == "": adapters_count = 0 adapters_percentage = "(0.0%)" else: @@ -41,7 +41,7 @@ f"merged-reads, {assembled_reads_count} ({round(assembled_reads_count * 100 / raw_reads_count,1)}%)\\n" ) output_file.write(f"reads-with-adapters, {adapters_count} {adapters_percentage}\\n") - if "$assembled_reads" == "null_a": + if "$assembled_reads" == "": output_file.write( f"quality-filtered-reads, {trimmed_reads_count} ({round(trimmed_reads_count * 100 / raw_reads_count,1)}%)\\n" ) diff --git a/workflows/crisprseq_targeted.nf b/workflows/crisprseq_targeted.nf index 6556d79d..ebc07552 100644 --- a/workflows/crisprseq_targeted.nf +++ b/workflows/crisprseq_targeted.nf @@ -341,21 +341,23 @@ workflow CRISPRSEQ_TARGETED { .join(PEAR.out.assembled, remainder: true) .join(SEQTK_SEQ_MASK.out.fastx) .join(CUTADAPT.out.log) + .map { meta, reads, assembled, masked, trimmed -> + if (assembled == null) { + assembled = [] + } + return [ meta, reads, assembled, masked, trimmed ] + } .set { ch_merging_summary_data } } else { ch_cat_fastq.paired .mix(ch_cat_fastq.single) .join(PEAR.out.assembled, remainder: true) .join(SEQTK_SEQ_MASK.out.fastx) - .combine(Channel.value("null")) - .map { meta, reads, assembled, masked, trimmed -> + .map { meta, reads, assembled, masked -> if (assembled == null) { - assembled = file('null_a') + assembled = [] } - if (trimmed == "null") { - trimmed = file('null_t') - } - return [ meta, reads, assembled, masked, trimmed ] + return [ meta, reads, assembled, masked, [] ] } .set { ch_merging_summary_data } } @@ -705,13 +707,13 @@ workflow CRISPRSEQ_TARGETED { .join(ALIGNMENT_SUMMARY.out.summary) .map { meta, reads, index, reference, protospacer, template, template_bam, reference_template, summary -> if (template == null) { - template = file('null_t') + template = [] } if (template_bam == null) { - template_bam = file('null_b') + template_bam = [] } if (reference_template == null) { - reference_template = file('null_r') + reference_template = [] } return [meta, reads, index, reference, protospacer, template, template_bam, reference_template, summary] }