Skip to content

Commit

Permalink
don't stash unexistent files, use empty lists instead, fix AWS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Aug 3, 2023
1 parent 8dbbcfd commit 1d111f9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions templates/merging_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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"
)
Expand Down
22 changes: 12 additions & 10 deletions workflows/crisprseq_targeted.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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]
}
Expand Down

0 comments on commit 1d111f9

Please sign in to comment.