From dc521f59c333724b29b7fb2874d510dfb1f09e48 Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 2 Feb 2024 17:20:14 +0000 Subject: [PATCH 01/13] Addressed assess_significance error when running controlfreec, updated makegraph module to 2 --- conf/modules/controlfreec.config | 2 +- modules.json | 5 ++ .../controlfreec/makegraph2/environment.yml | 7 +++ .../nf-core/controlfreec/makegraph2/main.nf | 54 +++++++++++++++++ .../nf-core/controlfreec/makegraph2/meta.yml | 58 +++++++++++++++++++ .../main.nf | 48 +++++++++++++-- 6 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 modules/nf-core/controlfreec/makegraph2/environment.yml create mode 100644 modules/nf-core/controlfreec/makegraph2/main.nf create mode 100644 modules/nf-core/controlfreec/makegraph2/meta.yml diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index 8ed3920c4..99a50ad4a 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -18,7 +18,7 @@ process { withName: 'ASSESS_SIGNIFICANCE' { publishDir = [ mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, + path: { (meta.id.contains("_tumor") || meta.id.contains("_normal")) ? "${params.outdir}/variant_calling/controlfreec/${meta.id}/".replaceAll(/_normal|_control/, "") : "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, pattern: "*{.p.value.txt}" ] } diff --git a/modules.json b/modules.json index eb2c5fa7d..1bd8fb78d 100644 --- a/modules.json +++ b/modules.json @@ -113,6 +113,11 @@ "installed_by": ["modules"], "patch": "modules/nf-core/controlfreec/makegraph/controlfreec-makegraph.diff" }, + "controlfreec/makegraph2": { + "branch": "master", + "git_sha": "a7bae48d8bccfae99e3b862fa07bbd50a8df6b82", + "installed_by": ["modules"] + }, "custom/dumpsoftwareversions": { "branch": "master", "git_sha": "8ec825f465b9c17f9d83000022995b4f7de6fe93", diff --git a/modules/nf-core/controlfreec/makegraph2/environment.yml b/modules/nf-core/controlfreec/makegraph2/environment.yml new file mode 100644 index 000000000..720c2e950 --- /dev/null +++ b/modules/nf-core/controlfreec/makegraph2/environment.yml @@ -0,0 +1,7 @@ +name: controlfreec_makegraph2 +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::control-freec=11.6b diff --git a/modules/nf-core/controlfreec/makegraph2/main.nf b/modules/nf-core/controlfreec/makegraph2/main.nf new file mode 100644 index 000000000..a85589d6f --- /dev/null +++ b/modules/nf-core/controlfreec/makegraph2/main.nf @@ -0,0 +1,54 @@ +process CONTROLFREEC_MAKEGRAPH2 { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/control-freec:11.6b--hdbdd923_0': + 'biocontainers/control-freec:11.6b--hdbdd923_0' }" + + input: + tuple val(meta), path(ratio), path(baf) + + output: + tuple val(meta), path("*_BAF.png") , emit: png_baf + tuple val(meta), path("*_ratio.log2.png"), emit: png_ratio_log2 + tuple val(meta), path("*_ratio.png") , emit: png_ratio + + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" + def baf = baf ?: "" + def VERSION = '11.6b' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + cat \$(which makeGraph2.0.R) | R --slave --args ${args} ${ratio} ${baf} + + mv *_BAF.txt.png ${prefix}_BAF.png + mv *_ratio.txt.log2.png ${prefix}_ratio.log2.png + mv *_ratio.txt.png ${prefix}_ratio.png + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + controlfreec: $VERSION + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + def VERSION = '11.6b' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + touch ${prefix}_BAF.png + touch ${prefix}_ratio.log2.png + touch ${prefix}_ratio.png + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + controlfreec: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/controlfreec/makegraph2/meta.yml b/modules/nf-core/controlfreec/makegraph2/meta.yml new file mode 100644 index 000000000..1325da4a8 --- /dev/null +++ b/modules/nf-core/controlfreec/makegraph2/meta.yml @@ -0,0 +1,58 @@ +name: controlfreec_makegraph2 +description: Plot Freec output +keywords: + - cna + - cnv + - somatic + - single + - tumor-only +tools: + - controlfreec: + description: Copy number and genotype annotation from whole genome and whole exome sequencing data. + homepage: http://boevalab.inf.ethz.ch/FREEC + documentation: http://boevalab.inf.ethz.ch/FREEC/tutorial.html + tool_dev_url: https://github.com/BoevaLab/FREEC/ + doi: "10.1093/bioinformatics/btq635" + licence: ["GPL >=2"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ratio: + type: file + description: ratio file generated by FREEC + pattern: "*.ratio.txt" + - baf: + type: file + description: .BAF file generated by FREEC + pattern: "*.BAF" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - png_baf: + type: file + description: Image of BAF plot + pattern: "*_BAF.png" + - png_ratio_log2: + type: file + description: Image of ratio log2 plot + pattern: "*_ratio.log2.png" + - png_ratio: + type: file + description: Image of ratio plot + pattern: "*_ratio.png" + +authors: + - "@FriederikeHanssen" diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index a2e7e17cf..f6a9b7832 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -8,7 +8,7 @@ include { CONTROLFREEC_FREEC as FREEC_SOMATIC } from '../../. include { CONTROLFREEC_ASSESSSIGNIFICANCE as ASSESS_SIGNIFICANCE } from '../../../modules/nf-core/controlfreec/assesssignificance/main' include { CONTROLFREEC_FREEC2BED as FREEC2BED } from '../../../modules/nf-core/controlfreec/freec2bed/main' include { CONTROLFREEC_FREEC2CIRCOS as FREEC2CIRCOS } from '../../../modules/nf-core/controlfreec/freec2circos/main' -include { CONTROLFREEC_MAKEGRAPH as MAKEGRAPH } from '../../../modules/nf-core/controlfreec/makegraph/main' +include { CONTROLFREEC_MAKEGRAPH2 as MAKEGRAPH2 } from '../../../modules/nf-core/controlfreec/makegraph2/main' workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { take: @@ -25,18 +25,58 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { ch_versions = Channel.empty() + assess_significance_input = Channel.empty() + FREEC_SOMATIC(controlfreec_input, fasta, fasta_fai, [], dbsnp, dbsnp_tbi, chr_files, mappability, intervals_bed, []) - ASSESS_SIGNIFICANCE(FREEC_SOMATIC.out.CNV.join(FREEC_SOMATIC.out.ratio, failOnDuplicate: true, failOnMismatch: true)) + //Filter the files that come out of freec somatic as ASSESS_SIGNIFICANCE only takes one cnv and one ratio file, there should be one normal and one non normal pair? + //Creates empty channel if file is missing + cnv_files = FREEC_SOMATIC.out.CNV + .multiMap{ meta, cnv -> + def meta_clone_tumor = meta.clone() + def meta_clone_normal = meta.clone() + meta_clone_tumor.id = meta.id + "_tumor" //updating meta id so that the p.value file is named differently + meta_clone_normal.id = meta.id + "_normal" //updating meta id so that the p.value file is named differently + + def tumor_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_CNVs") } : cnv //only find if its a list, else it returns only the filename without the path + def normal_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_normal_CNVs") } : null //only find if its a list, else it returns only the filename without the path + + normal: normal_file == null ? [] : [meta_clone_normal,normal_file] //only fill channel if file was found, else leave it empty + tumor: tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //only fill channel if file was found, else leave it empty + } + + ratio_files = FREEC_SOMATIC.out.ratio + .multiMap{ meta, ratio -> + def meta_clone_tumor = meta.clone() + def meta_clone_normal = meta.clone() + meta_clone_tumor.id = meta.id + "_tumor" //updating meta id so that the p.value file is named differently + meta_clone_normal.id = meta.id + "_normal" //updating meta id so that the p.value file is named differently + + def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv + def normal_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_normal_ratio.txt") } : null //same here as cnv + + normal: normal_file == null ? [] : [meta_clone_normal,normal_file] //same here as ratio + tumor: tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //same here as ratio + } + + //Join the pairs + normal_files = cnv_files.normal.join(ratio_files.normal, failOnDuplicate: true, failOnMismatch: true) + tumor_files = cnv_files.tumor.join(ratio_files.tumor, failOnDuplicate: true, failOnMismatch: true) + + //Mix all the pairs into input channel + assess_significance_input = assess_significance_input.mix(tumor_files) + assess_significance_input = assess_significance_input.mix(normal_files) + + ASSESS_SIGNIFICANCE(assess_significance_input) FREEC2BED(FREEC_SOMATIC.out.ratio) FREEC2CIRCOS(FREEC_SOMATIC.out.ratio) - MAKEGRAPH(FREEC_SOMATIC.out.ratio.join(FREEC_SOMATIC.out.BAF, failOnDuplicate: true, failOnMismatch: true)) + MAKEGRAPH2(FREEC_SOMATIC.out.ratio.join(FREEC_SOMATIC.out.BAF, failOnDuplicate: true, failOnMismatch: true)) ch_versions = ch_versions.mix(FREEC_SOMATIC.out.versions) ch_versions = ch_versions.mix(ASSESS_SIGNIFICANCE.out.versions) ch_versions = ch_versions.mix(FREEC2BED.out.versions) ch_versions = ch_versions.mix(FREEC2CIRCOS.out.versions) - ch_versions = ch_versions.mix(MAKEGRAPH.out.versions) + ch_versions = ch_versions.mix(MAKEGRAPH2.out.versions) emit: versions = ch_versions From ebc8f705a18865c0169ad3787e74b4f350587b56 Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 2 Feb 2024 17:26:23 +0000 Subject: [PATCH 02/13] Fixed substring match value --- conf/modules/controlfreec.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index 99a50ad4a..389ba72bb 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -18,7 +18,7 @@ process { withName: 'ASSESS_SIGNIFICANCE' { publishDir = [ mode: params.publish_dir_mode, - path: { (meta.id.contains("_tumor") || meta.id.contains("_normal")) ? "${params.outdir}/variant_calling/controlfreec/${meta.id}/".replaceAll(/_normal|_control/, "") : "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, + path: { (meta.id.contains("_tumor") || meta.id.contains("_normal")) ? "${params.outdir}/variant_calling/controlfreec/${meta.id}/".replaceAll(/_tumor|_normal/, "") : "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, pattern: "*{.p.value.txt}" ] } From 3df81a9d08e9fedc9c41f7e83ca275c41dcf6108 Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 9 Feb 2024 15:22:44 +0000 Subject: [PATCH 03/13] Removed normal files from assess_significance --- CHANGELOG.md | 1 + conf/modules/controlfreec.config | 2 +- .../main.nf | 14 -------------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 766c417dc..8b55a11fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- [#1391](https://github.com/nf-core/sarek/pull/1391) - Fixed input channel for ASSESS_SIGNIFICANCE module, updated makegraph to makegraph2. - [#1334](https://github.com/nf-core/sarek/pull/1334) - Remove extra v, when reporting tower runs on slack - [#1335](https://github.com/nf-core/sarek/pull/1335) - Add docs and validation for bcftools annotation parameters - [#1345](https://github.com/nf-core/sarek/pull/1345) - Preserve STDERR for easier debugging diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index 389ba72bb..2a1ba8e3c 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -18,7 +18,7 @@ process { withName: 'ASSESS_SIGNIFICANCE' { publishDir = [ mode: params.publish_dir_mode, - path: { (meta.id.contains("_tumor") || meta.id.contains("_normal")) ? "${params.outdir}/variant_calling/controlfreec/${meta.id}/".replaceAll(/_tumor|_normal/, "") : "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, + path: { meta.id.contains("_normal") ? "${params.outdir}/variant_calling/controlfreec/${meta.id}/".replaceAll(/_normal/, "") : "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, pattern: "*{.p.value.txt}" ] } diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index f6a9b7832..074d44eaa 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -34,38 +34,24 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { cnv_files = FREEC_SOMATIC.out.CNV .multiMap{ meta, cnv -> def meta_clone_tumor = meta.clone() - def meta_clone_normal = meta.clone() - meta_clone_tumor.id = meta.id + "_tumor" //updating meta id so that the p.value file is named differently - meta_clone_normal.id = meta.id + "_normal" //updating meta id so that the p.value file is named differently - def tumor_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_CNVs") } : cnv //only find if its a list, else it returns only the filename without the path - def normal_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_normal_CNVs") } : null //only find if its a list, else it returns only the filename without the path - normal: normal_file == null ? [] : [meta_clone_normal,normal_file] //only fill channel if file was found, else leave it empty tumor: tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //only fill channel if file was found, else leave it empty } ratio_files = FREEC_SOMATIC.out.ratio .multiMap{ meta, ratio -> def meta_clone_tumor = meta.clone() - def meta_clone_normal = meta.clone() - meta_clone_tumor.id = meta.id + "_tumor" //updating meta id so that the p.value file is named differently - meta_clone_normal.id = meta.id + "_normal" //updating meta id so that the p.value file is named differently - def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv - def normal_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_normal_ratio.txt") } : null //same here as cnv - normal: normal_file == null ? [] : [meta_clone_normal,normal_file] //same here as ratio tumor: tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //same here as ratio } //Join the pairs - normal_files = cnv_files.normal.join(ratio_files.normal, failOnDuplicate: true, failOnMismatch: true) tumor_files = cnv_files.tumor.join(ratio_files.tumor, failOnDuplicate: true, failOnMismatch: true) //Mix all the pairs into input channel assess_significance_input = assess_significance_input.mix(tumor_files) - assess_significance_input = assess_significance_input.mix(normal_files) ASSESS_SIGNIFICANCE(assess_significance_input) FREEC2BED(FREEC_SOMATIC.out.ratio) From bac3885aa2d8478f18e19cdbff4b4770e2125655 Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 9 Feb 2024 18:17:07 +0000 Subject: [PATCH 04/13] Reverted change in assess_significance module config --- conf/modules/controlfreec.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index 2a1ba8e3c..8ed3920c4 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -18,7 +18,7 @@ process { withName: 'ASSESS_SIGNIFICANCE' { publishDir = [ mode: params.publish_dir_mode, - path: { meta.id.contains("_normal") ? "${params.outdir}/variant_calling/controlfreec/${meta.id}/".replaceAll(/_normal/, "") : "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, + path: { "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, pattern: "*{.p.value.txt}" ] } From 29c284f49d15725657ce96b3938e885a091934c5 Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 9 Feb 2024 18:18:06 +0000 Subject: [PATCH 05/13] Removed unnecesary comment --- .../local/bam_variant_calling_somatic_controlfreec/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 074d44eaa..2a9c13e30 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -29,7 +29,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { FREEC_SOMATIC(controlfreec_input, fasta, fasta_fai, [], dbsnp, dbsnp_tbi, chr_files, mappability, intervals_bed, []) - //Filter the files that come out of freec somatic as ASSESS_SIGNIFICANCE only takes one cnv and one ratio file, there should be one normal and one non normal pair? + //Filter the files that come out of freec somatic as ASSESS_SIGNIFICANCE only takes one cnv and one ratio file //Creates empty channel if file is missing cnv_files = FREEC_SOMATIC.out.CNV .multiMap{ meta, cnv -> From a12e03894ba0d4a09c177beda221582baaf64cb7 Mon Sep 17 00:00:00 2001 From: bioloni Date: Thu, 15 Feb 2024 17:28:02 +0000 Subject: [PATCH 06/13] Updated makegraph to makegraph2 --- CHANGELOG.md | 2 +- README.md | 1 + conf/modules/controlfreec.config | 2 +- modules.json | 6 -- .../makegraph/controlfreec-makegraph.diff | 23 ------- .../controlfreec/makegraph/environment.yml | 7 --- .../nf-core/controlfreec/makegraph/main.nf | 52 ---------------- .../nf-core/controlfreec/makegraph/meta.yml | 60 ------------------- .../main.nf | 6 +- tests/config/pytesttags.yml | 2 +- 10 files changed, 7 insertions(+), 154 deletions(-) delete mode 100644 modules/nf-core/controlfreec/makegraph/controlfreec-makegraph.diff delete mode 100644 modules/nf-core/controlfreec/makegraph/environment.yml delete mode 100644 modules/nf-core/controlfreec/makegraph/main.nf delete mode 100644 modules/nf-core/controlfreec/makegraph/meta.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b55a11fd..afe7020a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- [#1391](https://github.com/nf-core/sarek/pull/1391) - Fixed input channel for ASSESS_SIGNIFICANCE module, updated makegraph to makegraph2. +- [#1400](https://github.com/nf-core/sarek/pull/1400) - Fixed input channel for ASSESS_SIGNIFICANCE module, updated makegraph to makegraph2. - [#1334](https://github.com/nf-core/sarek/pull/1334) - Remove extra v, when reporting tower runs on slack - [#1335](https://github.com/nf-core/sarek/pull/1335) - Add docs and validation for bcftools annotation parameters - [#1345](https://github.com/nf-core/sarek/pull/1345) - Preserve STDERR for easier debugging diff --git a/README.md b/README.md index 770d39032..6df2cd5b0 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ We thank the following people for their extensive assistance in the development - [Malin Larsson](https://github.com/malinlarsson) - [Marcel Martin](https://github.com/marcelm) - [Nick Smith](https://github.com/nickhsmith) +- [Nicolas Schcolnicov](https://github.com/nschcolnicov) - [Nilesh Tawari](https://github.com/nilesh-tawari) - [Olga Botvinnik](https://github.com/olgabot) - [Oskar Wacker](https://github.com/WackerO) diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index 8ed3920c4..d177b1c45 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -50,7 +50,7 @@ process { ] } - withName: 'MAKEGRAPH' { + withName: 'MAKEGRAPH2' { ext.args = { "${params.cf_ploidy}" } publishDir = [ mode: params.publish_dir_mode, diff --git a/modules.json b/modules.json index 1bd8fb78d..a8f8a7e43 100644 --- a/modules.json +++ b/modules.json @@ -107,12 +107,6 @@ "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", "installed_by": ["modules"] }, - "controlfreec/makegraph": { - "branch": "master", - "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", - "installed_by": ["modules"], - "patch": "modules/nf-core/controlfreec/makegraph/controlfreec-makegraph.diff" - }, "controlfreec/makegraph2": { "branch": "master", "git_sha": "a7bae48d8bccfae99e3b862fa07bbd50a8df6b82", diff --git a/modules/nf-core/controlfreec/makegraph/controlfreec-makegraph.diff b/modules/nf-core/controlfreec/makegraph/controlfreec-makegraph.diff deleted file mode 100644 index 13f4208a0..000000000 --- a/modules/nf-core/controlfreec/makegraph/controlfreec-makegraph.diff +++ /dev/null @@ -1,23 +0,0 @@ -Changes in module 'nf-core/controlfreec/makegraph' ---- modules/nf-core/controlfreec/makegraph/main.nf -+++ modules/nf-core/controlfreec/makegraph/main.nf -@@ -8,7 +8,7 @@ - 'biocontainers/control-freec:11.6b--hdbdd923_0' }" - - input: -- tuple val(meta), path(ratio), path(baf), val(ploidy) -+ tuple val(meta), path(ratio), path(baf) - - output: - tuple val(meta), path("*_BAF.png") , emit: png_baf -@@ -25,7 +25,7 @@ - def prefix = task.ext.prefix ?: "${meta.id}" - def baf = baf ?: "" - """ -- cat \$(which makeGraph.R) | R --slave --args ${ploidy} ${args} ${ratio} ${baf} -+ cat \$(which makeGraph.R) | R --slave --args ${args} ${ratio} ${baf} - - mv *_BAF.txt.png ${prefix}_BAF.png - mv *_ratio.txt.log2.png ${prefix}_ratio.log2.png - -************************************************************ diff --git a/modules/nf-core/controlfreec/makegraph/environment.yml b/modules/nf-core/controlfreec/makegraph/environment.yml deleted file mode 100644 index 897eadf3b..000000000 --- a/modules/nf-core/controlfreec/makegraph/environment.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: controlfreec_makegraph -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - bioconda::control-freec=11.6b diff --git a/modules/nf-core/controlfreec/makegraph/main.nf b/modules/nf-core/controlfreec/makegraph/main.nf deleted file mode 100644 index 8d489f71f..000000000 --- a/modules/nf-core/controlfreec/makegraph/main.nf +++ /dev/null @@ -1,52 +0,0 @@ -process CONTROLFREEC_MAKEGRAPH { - tag "$meta.id" - label 'process_low' - - conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/control-freec:11.6b--hdbdd923_0' : - 'biocontainers/control-freec:11.6b--hdbdd923_0' }" - - input: - tuple val(meta), path(ratio), path(baf) - - output: - tuple val(meta), path("*_BAF.png") , emit: png_baf - tuple val(meta), path("*_ratio.log2.png"), emit: png_ratio_log2 - tuple val(meta), path("*_ratio.png") , emit: png_ratio - - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: "" - def prefix = task.ext.prefix ?: "${meta.id}" - def baf = baf ?: "" - """ - cat \$(which makeGraph.R) | R --slave --args ${args} ${ratio} ${baf} - - mv *_BAF.txt.png ${prefix}_BAF.png - mv *_ratio.txt.log2.png ${prefix}_ratio.log2.png - mv *_ratio.txt.png ${prefix}_ratio.png - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - controlfreec: \$(echo \$(freec -version 2>&1) | sed 's/^.*Control-FREEC //; s/:.*\$//' | sed -e "s/Control-FREEC v//g" ) - END_VERSIONS - """ - - stub: - def prefix = task.ext.prefix ?: "${meta.id}" - """ - touch ${prefix}_BAF.png - touch ${prefix}_ratio.log2.png - touch ${prefix}_ratio.png - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - controlfreec: \$(echo \$(freec -version 2>&1) | sed 's/^.*Control-FREEC //; s/:.*\$//' | sed -e "s/Control-FREEC v//g" ) - END_VERSIONS - """ -} diff --git a/modules/nf-core/controlfreec/makegraph/meta.yml b/modules/nf-core/controlfreec/makegraph/meta.yml deleted file mode 100644 index 6f91db38a..000000000 --- a/modules/nf-core/controlfreec/makegraph/meta.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: controlfreec_makegraph -description: Plot Freec output -keywords: - - cna - - cnv - - somatic - - single - - tumor-only -tools: - - controlfreec: - description: Copy number and genotype annotation from whole genome and whole exome sequencing data. - homepage: http://boevalab.inf.ethz.ch/FREEC - documentation: http://boevalab.inf.ethz.ch/FREEC/tutorial.html - tool_dev_url: https://github.com/BoevaLab/FREEC/ - doi: "10.1093/bioinformatics/btq635" - licence: ["GPL >=2"] -input: - # Only when we have meta - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - ratio: - type: file - description: ratio file generated by FREEC - pattern: "*.ratio.txt" - - baf: - type: file - description: .BAF file generated by FREEC - pattern: "*.BAF" - - ploidy: - type: integer - description: Ploidy value for which graph should be created -output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" - - png_baf: - type: file - description: Image of BAF plot - pattern: "*_BAF.png" - - png_ratio_log2: - type: file - description: Image of ratio log2 plot - pattern: "*_ratio.log2.png" - - png_ratio: - type: file - description: Image of ratio plot - pattern: "*_ratio.png" -authors: - - "@FriederikeHanssen" -maintainers: - - "@FriederikeHanssen" diff --git a/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf index 993faf127..e7178cbaa 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_controlfreec/main.nf @@ -8,7 +8,7 @@ include { CONTROLFREEC_FREEC as FREEC_TUMORONLY } from '../../. include { CONTROLFREEC_ASSESSSIGNIFICANCE as ASSESS_SIGNIFICANCE } from '../../../modules/nf-core/controlfreec/assesssignificance/main' include { CONTROLFREEC_FREEC2BED as FREEC2BED } from '../../../modules/nf-core/controlfreec/freec2bed/main' include { CONTROLFREEC_FREEC2CIRCOS as FREEC2CIRCOS } from '../../../modules/nf-core/controlfreec/freec2circos/main' -include { CONTROLFREEC_MAKEGRAPH as MAKEGRAPH } from '../../../modules/nf-core/controlfreec/makegraph/main' +include { CONTROLFREEC_MAKEGRAPH2 as MAKEGRAPH2 } from '../../../modules/nf-core/controlfreec/makegraph2/main' workflow BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC { take: @@ -30,13 +30,13 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC { ASSESS_SIGNIFICANCE(FREEC_TUMORONLY.out.CNV.join(FREEC_TUMORONLY.out.ratio, failOnDuplicate: true, failOnMismatch: true)) FREEC2BED(FREEC_TUMORONLY.out.ratio) FREEC2CIRCOS(FREEC_TUMORONLY.out.ratio) - MAKEGRAPH(FREEC_TUMORONLY.out.ratio.join(FREEC_TUMORONLY.out.BAF, failOnDuplicate: true, failOnMismatch: true)) + MAKEGRAPH2(FREEC_TUMORONLY.out.ratio.join(FREEC_TUMORONLY.out.BAF, failOnDuplicate: true, failOnMismatch: true)) ch_versions = ch_versions.mix(FREEC_TUMORONLY.out.versions) ch_versions = ch_versions.mix(ASSESS_SIGNIFICANCE.out.versions) ch_versions = ch_versions.mix(FREEC2BED.out.versions) ch_versions = ch_versions.mix(FREEC2CIRCOS.out.versions) - ch_versions = ch_versions.mix(MAKEGRAPH.out.versions) + ch_versions = ch_versions.mix(MAKEGRAPH2.out.versions) emit: versions = ch_versions diff --git a/tests/config/pytesttags.yml b/tests/config/pytesttags.yml index f33e55023..1612a9bb1 100644 --- a/tests/config/pytesttags.yml +++ b/tests/config/pytesttags.yml @@ -248,7 +248,7 @@ controlfreec: - modules/nf-core/controlfreec/freec/** - modules/nf-core/controlfreec/freec2bed/** - modules/nf-core/controlfreec/freec2circos/** - - modules/nf-core/controlfreec/makegraph/** + - modules/nf-core/controlfreec/makegraph2/** - modules/nf-core/samtools/mpileup/** - subworkflows/local/bam_variant_calling_mpileup/** - subworkflows/local/bam_variant_calling_somatic_all/** From 2c6ab3a8b9de87cb276cb1609fd1cc225c16a44f Mon Sep 17 00:00:00 2001 From: bioloni Date: Thu, 22 Feb 2024 12:27:53 +0000 Subject: [PATCH 07/13] Testing changes to dev branch --- .../main.nf | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 2a9c13e30..6dcd8e389 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -25,35 +25,32 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { ch_versions = Channel.empty() - assess_significance_input = Channel.empty() - FREEC_SOMATIC(controlfreec_input, fasta, fasta_fai, [], dbsnp, dbsnp_tbi, chr_files, mappability, intervals_bed, []) //Filter the files that come out of freec somatic as ASSESS_SIGNIFICANCE only takes one cnv and one ratio file //Creates empty channel if file is missing cnv_files = FREEC_SOMATIC.out.CNV - .multiMap{ meta, cnv -> + .map{ meta, cnv -> def meta_clone_tumor = meta.clone() def tumor_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_CNVs") } : cnv //only find if its a list, else it returns only the filename without the path + def tumor = tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //only fill channel if file was found, else leave it empty - tumor: tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //only fill channel if file was found, else leave it empty + tumor } ratio_files = FREEC_SOMATIC.out.ratio - .multiMap{ meta, ratio -> + .map{ meta, ratio -> def meta_clone_tumor = meta.clone() def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv + def tumor = tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //same here as ratio - tumor: tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //same here as ratio + tumor } //Join the pairs - tumor_files = cnv_files.tumor.join(ratio_files.tumor, failOnDuplicate: true, failOnMismatch: true) - - //Mix all the pairs into input channel - assess_significance_input = assess_significance_input.mix(tumor_files) + tumor_files = cnv_files.join(ratio_files, failOnDuplicate: true, failOnMismatch: true) - ASSESS_SIGNIFICANCE(assess_significance_input) + ASSESS_SIGNIFICANCE(tumor_files) FREEC2BED(FREEC_SOMATIC.out.ratio) FREEC2CIRCOS(FREEC_SOMATIC.out.ratio) MAKEGRAPH2(FREEC_SOMATIC.out.ratio.join(FREEC_SOMATIC.out.BAF, failOnDuplicate: true, failOnMismatch: true)) From 847799e1489528d060d98dfe6f063b1efd3ba0fe Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 23 Feb 2024 15:39:00 +0000 Subject: [PATCH 08/13] Addressed PR comments --- CHANGELOG.md | 2 +- conf/modules/controlfreec.config | 1 - .../bam_variant_calling_somatic_controlfreec/main.nf | 8 +++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd648ec62..5d582e20a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- [#1400](https://github.com/nf-core/sarek/pull/1400) - Fixed input channel for ASSESS_SIGNIFICANCE module, updated makegraph to makegraph2. - [#1334](https://github.com/nf-core/sarek/pull/1334) - Remove extra v, when reporting tower runs on slack - [#1335](https://github.com/nf-core/sarek/pull/1335) - Add docs and validation for bcftools annotation parameters - [#1345](https://github.com/nf-core/sarek/pull/1345) - Preserve STDERR for easier debugging @@ -37,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#1381](https://github.com/nf-core/sarek/pull/1381) - Swap NGSCheckMate bed file for GATK.GRCh37 to one without the `chr` prefix - [#1383](https://github.com/nf-core/sarek/pull/1383) - Fix `--three_prime_clip_r{1,2}` parameter documentation - [#1390](https://github.com/nf-core/sarek/pull/1390) - Fix badges in README +- [#1400](https://github.com/nf-core/sarek/pull/1400) - Fixed input channel for ASSESS_SIGNIFICANCE module, updated makegraph to makegraph2. - [#1403](https://github.com/nf-core/sarek/pull/1403) - Fix intervals usage with dot in chromosome names ### Removed diff --git a/conf/modules/controlfreec.config b/conf/modules/controlfreec.config index d177b1c45..b6fa043d0 100644 --- a/conf/modules/controlfreec.config +++ b/conf/modules/controlfreec.config @@ -51,7 +51,6 @@ process { } withName: 'MAKEGRAPH2' { - ext.args = { "${params.cf_ploidy}" } publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/variant_calling/controlfreec/${meta.id}/" }, diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 6dcd8e389..3944e7759 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -31,24 +31,22 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { //Creates empty channel if file is missing cnv_files = FREEC_SOMATIC.out.CNV .map{ meta, cnv -> - def meta_clone_tumor = meta.clone() def tumor_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_CNVs") } : cnv //only find if its a list, else it returns only the filename without the path - def tumor = tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //only fill channel if file was found, else leave it empty + def tumor = tumor_file == null ? [] : [meta,tumor_file] //only fill channel if file was found, else leave it empty tumor } ratio_files = FREEC_SOMATIC.out.ratio .map{ meta, ratio -> - def meta_clone_tumor = meta.clone() def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv - def tumor = tumor_file == null ? [] : [meta_clone_tumor,tumor_file] //same here as ratio + def tumor = tumor_file == null ? [] : [meta,tumor_file] //same here as ratio tumor } //Join the pairs - tumor_files = cnv_files.join(ratio_files, failOnDuplicate: true, failOnMismatch: true) + assess_significance_input = cnv_files.join(ratio_files, failOnDuplicate: true, failOnMismatch: true) ASSESS_SIGNIFICANCE(tumor_files) FREEC2BED(FREEC_SOMATIC.out.ratio) From 7c5d3deb4a515bc81f1d5182120e967ce7c2675b Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 23 Feb 2024 15:42:28 +0000 Subject: [PATCH 09/13] Fixed input channel name --- .../local/bam_variant_calling_somatic_controlfreec/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 3944e7759..b18cd5136 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -48,7 +48,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { //Join the pairs assess_significance_input = cnv_files.join(ratio_files, failOnDuplicate: true, failOnMismatch: true) - ASSESS_SIGNIFICANCE(tumor_files) + ASSESS_SIGNIFICANCE(assess_significance_input) FREEC2BED(FREEC_SOMATIC.out.ratio) FREEC2CIRCOS(FREEC_SOMATIC.out.ratio) MAKEGRAPH2(FREEC_SOMATIC.out.ratio.join(FREEC_SOMATIC.out.BAF, failOnDuplicate: true, failOnMismatch: true)) From dc5da4435991b5a712c95ccaf1971d3792b569e1 Mon Sep 17 00:00:00 2001 From: bioloni Date: Fri, 23 Feb 2024 16:01:12 +0000 Subject: [PATCH 10/13] Updated subworkflow code --- .../main.nf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index b18cd5136..5ad8f24f9 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -32,17 +32,19 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { cnv_files = FREEC_SOMATIC.out.CNV .map{ meta, cnv -> def tumor_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_CNVs") } : cnv //only find if its a list, else it returns only the filename without the path - def tumor = tumor_file == null ? [] : [meta,tumor_file] //only fill channel if file was found, else leave it empty - - tumor + if (!tumor_file){ + log.error "CNVs tumor file not found for sample $meta.id" + } + [meta,tumor_file] } ratio_files = FREEC_SOMATIC.out.ratio .map{ meta, ratio -> def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv - def tumor = tumor_file == null ? [] : [meta,tumor_file] //same here as ratio - - tumor + if (!tumor_file){ + log.error "Ratio tumor file not found for sample $meta.id" + } + [meta,tumor_file] } //Join the pairs From 165cefd5a6e357281aa2031ec0624fafd5663363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Schcolnicov?= <90359308+nschcolnicov@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:04:35 -0300 Subject: [PATCH 11/13] Update subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf Co-authored-by: Friederike Hanssen --- .../local/bam_variant_calling_somatic_controlfreec/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 5ad8f24f9..563371ca3 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -33,7 +33,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { .map{ meta, cnv -> def tumor_file = cnv instanceof List ? cnv.find { it.toString().endsWith("gz_CNVs") } : cnv //only find if its a list, else it returns only the filename without the path if (!tumor_file){ - log.error "CNVs tumor file not found for sample $meta.id" + error("CNVs tumor file not found for sample $meta.id") } [meta,tumor_file] } From 4e66d7d4954fa3b8009dd81762baf604972632c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Schcolnicov?= <90359308+nschcolnicov@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:04:45 -0300 Subject: [PATCH 12/13] Update subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf Co-authored-by: Friederike Hanssen --- .../local/bam_variant_calling_somatic_controlfreec/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 563371ca3..203fefd31 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -42,7 +42,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { .map{ meta, ratio -> def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv if (!tumor_file){ - log.error "Ratio tumor file not found for sample $meta.id" + error ("Ratio tumor file not found for sample $meta.id") } [meta,tumor_file] } From 16055ad4f987c4b9b1f6deb257c6110b29d82ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Schcolnicov?= <90359308+nschcolnicov@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:05:42 -0300 Subject: [PATCH 13/13] Removed extra space --- .../local/bam_variant_calling_somatic_controlfreec/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf index 203fefd31..3be4da8e4 100644 --- a/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_controlfreec/main.nf @@ -42,7 +42,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC { .map{ meta, ratio -> def tumor_file = ratio instanceof List ? ratio.find { it.toString().endsWith("gz_ratio.txt") } : ratio //same here as cnv if (!tumor_file){ - error ("Ratio tumor file not found for sample $meta.id") + error("Ratio tumor file not found for sample $meta.id") } [meta,tumor_file] }