diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7922da..c0a0bcdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The split into clincial and research VCFs is now done before ranking the varaints [#485](https://github.com/nf-core/raredisease/pull/485) - Installed the nf-core version of ensemblvep/vep module [#482](https://github.com/nf-core/raredisease/pull/482) - The filenames of the ranked output VCF files have been changed. See [output.md](docs/output.md#filtering-and-ranking) for more information[#485](https://github.com/nf-core/raredisease/pull/485) +- Patched cnvnator module so that the processes didn't have to rerun after a failed run [#503](https://github.com/nf-core/raredisease/pull/503). ### `Fixed` diff --git a/modules.json b/modules.json index e33ea340..f7eae8be 100644 --- a/modules.json +++ b/modules.json @@ -88,7 +88,8 @@ "cnvnator/cnvnator": { "branch": "master", "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", - "installed_by": ["modules"] + "installed_by": ["modules"], + "patch": "modules/nf-core/cnvnator/cnvnator/cnvnator-cnvnator.diff" }, "cnvnator/convert2vcf": { "branch": "master", diff --git a/modules/nf-core/cnvnator/cnvnator/cnvnator-cnvnator.diff b/modules/nf-core/cnvnator/cnvnator/cnvnator-cnvnator.diff new file mode 100644 index 00000000..f06d7f6c --- /dev/null +++ b/modules/nf-core/cnvnator/cnvnator/cnvnator-cnvnator.diff @@ -0,0 +1,50 @@ +Changes in module 'nf-core/cnvnator/cnvnator' +--- modules/nf-core/cnvnator/cnvnator/main.nf ++++ modules/nf-core/cnvnator/cnvnator/main.nf +@@ -12,11 +12,12 @@ + tuple val(meta2), path(root) + tuple val(meta3), path(fasta) + tuple val(meta4), path(fai) ++ val step + + output: +- tuple val(output_meta), path("${prefix}.root"), emit: root +- tuple val(output_meta), path("${prefix}.tab") , emit: tab, optional: true +- path "versions.yml" , emit: versions ++ tuple val(output_meta), path("${output_meta.id}_${step}.root"), emit: root ++ tuple val(output_meta), path("*.tab") , emit: tab, optional: true ++ path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when +@@ -32,7 +33,11 @@ + reference = '' + } + calls_cmd = args.contains("-call") ? "> ${prefix}.tab" : '' ++ mv_cmd = "mv ${prefix}.root ${prefix}_${step}.root" ++ steps = ["his", "stat", "partition", "call"] ++ cp_cmd = steps.contains(step) ? "cp ${root} ${prefix}.root" :"" + """ ++ $cp_cmd + cnvnator \\ + -root ${prefix}.root \\ + $args \\ +@@ -40,6 +45,7 @@ + $input_cmd \\ + $calls_cmd + ++ $mv_cmd + cat <<-END_VERSIONS > versions.yml + "${task.process}": + CNVnator: \$(echo \$(cnvnator 2>&1 | sed -n '3p' | sed 's/CNVnator v//')) +@@ -52,7 +58,7 @@ + output_meta = bam ? meta : meta2 + def calls_cmd = args.contains("-call") ? "touch ${prefix}.tab" : '' + """ +- touch ${prefix}.root ++ touch ${prefix}_${step}.root + $calls_cmd + + cat <<-END_VERSIONS > versions.yml + +************************************************************ diff --git a/modules/nf-core/cnvnator/cnvnator/main.nf b/modules/nf-core/cnvnator/cnvnator/main.nf index 07393639..66427cd1 100644 --- a/modules/nf-core/cnvnator/cnvnator/main.nf +++ b/modules/nf-core/cnvnator/cnvnator/main.nf @@ -12,11 +12,12 @@ process CNVNATOR_CNVNATOR { tuple val(meta2), path(root) tuple val(meta3), path(fasta) tuple val(meta4), path(fai) + val step output: - tuple val(output_meta), path("${prefix}.root"), emit: root - tuple val(output_meta), path("${prefix}.tab") , emit: tab, optional: true - path "versions.yml" , emit: versions + tuple val(output_meta), path("${output_meta.id}_${step}.root"), emit: root + tuple val(output_meta), path("*.tab") , emit: tab, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -32,7 +33,11 @@ process CNVNATOR_CNVNATOR { reference = '' } calls_cmd = args.contains("-call") ? "> ${prefix}.tab" : '' + mv_cmd = "mv ${prefix}.root ${prefix}_${step}.root" + steps = ["his", "stat", "partition", "call"] + cp_cmd = steps.contains(step) ? "cp ${root} ${prefix}.root" :"" """ + $cp_cmd cnvnator \\ -root ${prefix}.root \\ $args \\ @@ -40,6 +45,7 @@ process CNVNATOR_CNVNATOR { $input_cmd \\ $calls_cmd + $mv_cmd cat <<-END_VERSIONS > versions.yml "${task.process}": CNVnator: \$(echo \$(cnvnator 2>&1 | sed -n '3p' | sed 's/CNVnator v//')) @@ -52,7 +58,7 @@ process CNVNATOR_CNVNATOR { output_meta = bam ? meta : meta2 def calls_cmd = args.contains("-call") ? "touch ${prefix}.tab" : '' """ - touch ${prefix}.root + touch ${prefix}_${step}.root $calls_cmd cat <<-END_VERSIONS > versions.yml diff --git a/subworkflows/local/variant_calling/call_sv_cnvnator.nf b/subworkflows/local/variant_calling/call_sv_cnvnator.nf index 0d5c5423..995b6919 100644 --- a/subworkflows/local/variant_calling/call_sv_cnvnator.nf +++ b/subworkflows/local/variant_calling/call_sv_cnvnator.nf @@ -22,11 +22,11 @@ workflow CALL_SV_CNVNATOR { main: ch_versions = Channel.empty() - CNVNATOR_RD ( ch_bam_bai, [[:],[]], [[:],[]], [[:],[]] ) - CNVNATOR_HIST ( [[:],[],[]], CNVNATOR_RD.out.root, ch_fasta, ch_fai ) - CNVNATOR_STAT ( [[:],[],[]], CNVNATOR_HIST.out.root, [[:],[]], [[:],[]] ) - CNVNATOR_PARTITION ( [[:],[],[]], CNVNATOR_STAT.out.root, [[:],[]], [[:],[]] ) - CNVNATOR_CALL ( [[:],[],[]], CNVNATOR_PARTITION.out.root, [[:],[]], [[:],[]] ) + CNVNATOR_RD ( ch_bam_bai, [[:],[]], [[:],[]], [[:],[]], "rd" ) + CNVNATOR_HIST ( [[:],[],[]], CNVNATOR_RD.out.root, ch_fasta, ch_fai, "his" ) + CNVNATOR_STAT ( [[:],[],[]], CNVNATOR_HIST.out.root, [[:],[]], [[:],[]], "stat" ) + CNVNATOR_PARTITION ( [[:],[],[]], CNVNATOR_STAT.out.root, [[:],[]], [[:],[]], "partition" ) + CNVNATOR_CALL ( [[:],[],[]], CNVNATOR_PARTITION.out.root, [[:],[]], [[:],[]], "call" ) CNVNATOR_CONVERT2VCF (CNVNATOR_CALL.out.tab).vcf .collect{it[1]} .toList()