diff --git a/modules.json b/modules.json index 06400f3..07aaaee 100644 --- a/modules.json +++ b/modules.json @@ -42,7 +42,7 @@ }, "svanalyzer/svbenchmark": { "branch": "master", - "git_sha": "419065b3a66b857af8b49d41dc1ba3858821da22", + "git_sha": "8a2dd9e84cde68ebba45fb2c602c312c999c02a0", "installed_by": ["modules"] }, "svync": { diff --git a/modules/nf-core/survivor/filter/main.nf b/modules/nf-core/survivor/filter/main.nf index d14ba0a..c806104 100644 --- a/modules/nf-core/survivor/filter/main.nf +++ b/modules/nf-core/survivor/filter/main.nf @@ -8,15 +8,15 @@ process SURVIVOR_FILTER { 'biocontainers/survivor:1.0.7--h9a82719_1' }" input: - tuple val(meta),path(vcf_file), path(bed) // VCF file to filter and BED file with regions to ignore (NA to disable) + tuple val(meta), path(vcf_file), path(bed) // VCF file to filter and BED file with regions to ignore (NA to disable) val(minsv) // Min SV size (-1 to disable) val(maxsv) // Max SV size (-1 to disable) val(minallelefreq) // Min allele frequency (0-1) val(minnumreads) // Min number of reads support: RE flag (-1 to disable) output: - tuple val(meta),path("*.vcf"), emit: vcf - path "versions.yml" , emit: versions + tuple val(meta), path("*.vcf"), emit: vcf + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/svanalyzer/svbenchmark/environment.yml b/modules/nf-core/svanalyzer/svbenchmark/environment.yml index 12cac54..2e20a2c 100644 --- a/modules/nf-core/svanalyzer/svbenchmark/environment.yml +++ b/modules/nf-core/svanalyzer/svbenchmark/environment.yml @@ -6,5 +6,4 @@ channels: - defaults dependencies: - - bioconda::edlib=1.2.3 - - bioconda::svanalyzer=0.35 + - bioconda::svanalyzer=0.36 diff --git a/modules/nf-core/svanalyzer/svbenchmark/main.nf b/modules/nf-core/svanalyzer/svbenchmark/main.nf index 5d2d079..e76829e 100644 --- a/modules/nf-core/svanalyzer/svbenchmark/main.nf +++ b/modules/nf-core/svanalyzer/svbenchmark/main.nf @@ -1,33 +1,40 @@ process SVANALYZER_SVBENCHMARK { tag "$meta.id" - label 'process_medium' + label 'process_single' - conda "bioconda::svanalyzer=0.35" + //Conda is not supported at the moment: https://github.com/bioconda/bioconda-recipes/issues/37646 + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/svanalyzer:0.35--pl526_0': - 'biocontainers/svanalyzer:0.35--pl526_0' }" + 'https://depot.galaxyproject.org/singularity/svanalyzer:0.36--pl526_0': + 'biocontainers/svanalyzer:0.36--pl526_0' }" input: - tuple val(meta),path(test), path(test_index), path(truth), path(truth_index), path(bed) - tuple path(fasta), path(fai) + tuple val(meta), path(test), path(test_tbi), path(truth), path(truth_tbi), path(bed) + tuple val(meta2),path(fasta) + tuple val(meta3),path(fai) output: - tuple val(meta),path("*.falsenegatives.vcf"), emit: fns - tuple val(meta),path("*.falsepositives.vcf"), emit: fps - tuple val(meta),path("*.distances") , emit: distances - tuple val(meta),path("*.log") , emit: log - tuple val(meta), path("*.report") , emit: report - path "versions.yml" , emit: versions + tuple val(meta), path("*.falsenegatives.vcf.gz"), emit: fns + tuple val(meta), path("*.falsepositives.vcf.gz"), emit: fps + tuple val(meta), path("*.distances") , emit: distances + tuple val(meta), path("*.log") , emit: log + tuple val(meta), path("*.report") , emit: report + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "SVANALYZER_SVBENCHMARK module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def bed = bed ? "-includebed $bed" : "" - def VERSION = '0.35' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def VERSION = '0.36' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. """ svanalyzer \\ @@ -39,6 +46,9 @@ process SVANALYZER_SVBENCHMARK { --prefix $prefix \\ $bed + bgzip ${args2} --threads ${task.cpus} -c ${prefix}.falsenegatives.vcf > ${prefix}.falsenegatives.vcf.gz + bgzip ${args2} --threads ${task.cpus} -c ${prefix}.falsepositives.vcf > ${prefix}.falsepositives.vcf.gz + cat <<-END_VERSIONS > versions.yml "${task.process}": svanalyzer: ${VERSION} @@ -46,13 +56,17 @@ process SVANALYZER_SVBENCHMARK { """ stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "SVANALYZER_SVBENCHMARK module does not support Conda. Please use Docker / Singularity / Podman instead." + } def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = '0.35' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def VERSION = '0.36' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. """ - touch ${prefix}.falsenegatives.vcf - touch ${prefix}.falsepositives.vcf + touch ${prefix}.falsenegatives.vcf.gz + touch ${prefix}.falsepositives.vcf.gz touch ${prefix}.distances touch ${prefix}.log touch ${prefix}.report diff --git a/modules/nf-core/svanalyzer/svbenchmark/meta.yml b/modules/nf-core/svanalyzer/svbenchmark/meta.yml index ba72c3d..c8a76ac 100644 --- a/modules/nf-core/svanalyzer/svbenchmark/meta.yml +++ b/modules/nf-core/svanalyzer/svbenchmark/meta.yml @@ -23,21 +23,29 @@ input: - meta2: type: map description: | - Groovy Map containing truth sample information + Groovy Map containing reference genome information for fasta e.g. `[ id:'test2' ]` - meta3: type: map description: | - Groovy Map containing reference genome information + Groovy Map containing reference genome information for fai e.g. `[ id:'test3' ]` - test: type: file description: A VCF-formatted file of structural variants to test (required) pattern: "*.{vcf,vcf.gz}" + - test_tbi: + type: file + description: A VCF-formatted file index of structural variants to test only for zipped files + pattern: "*.{vcf.gz.tbi}" - truth: type: file description: A VCF-formatted file of variants to compare against (required) pattern: "*.{vcf,vcf.gz}" + - truth_tbi: + type: file + description: A VCF-formatted file of variants to compare against only for zipped files + pattern: "*.{vcf.gz.tbi}" - fasta: type: file description: The reference FASTA file for the supplied VCF file or files (required) @@ -59,11 +67,11 @@ output: - fns: type: file description: VCF file with False Negatives - pattern: "*.{vcf}" + pattern: "*.{vcf.gz}" - fps: type: file description: VCF file with False Positives - pattern: "*.{vcf}" + pattern: "*.{vcf.gz}" - distances: type: file description: TSV file with genomic distances and size differences between structural variants compared @@ -75,6 +83,6 @@ output: - report: type: file description: Text file reporting RECALL, PRECISION and F1. - pattern: "*.{log}" + pattern: "*.{report}" authors: - "@kubranarci" diff --git a/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test b/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test index 51466f7..469fe8c 100644 --- a/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test +++ b/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test @@ -3,31 +3,36 @@ nextflow_process { name "Test Process SVANALYZER_SVBENCHMARK" script "../main.nf" process "SVANALYZER_SVBENCHMARK" + tag "modules" tag "modules_nfcore" tag "svanalyzer" tag "svanalyzer/svbenchmark" - test("homo_sapiens - illumina - vcf.gz") { + test("homo_sapiens - illumina - vcf.gz - bed") { when { + params { + outdir = $outputDir + } process { """ input[0] = [ [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz'], checkIfExists: true) + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true) ] input[1] = [ [ id:'test2' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true) - ] - input[2] = [ file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) ] - input[3] = [ + input[2] = [ + [ id:'test4' ], // meta map file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) ] - input[4] = [] """ } } @@ -41,32 +46,34 @@ nextflow_process { { assert snapshot(process.out.report).match("report") }, { assert snapshot(process.out.versions).match("versions") } ) + } } - - test("homo_sapiens - illumina - vcf.gz - bed") { + test("homo_sapiens - illumina - vcf.gz") { when { + params { + outdir = $outputDir + } process { """ input[0] = [ [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz'], checkIfExists: true) + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz_tbi'], checkIfExists: true), + [] ] input[1] = [ [ id:'test2' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true) - ] - input[2] = [ file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) ] - input[3] = [ + input[2] = [ + [ id:'test3' ], // meta map file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) ] - input[4] = [ - file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true) - ] """ } } @@ -81,5 +88,7 @@ nextflow_process { { assert snapshot(process.out.versions).match("bed_versions") } ) } + } -} \ No newline at end of file + +} diff --git a/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test.snap b/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test.snap index 599697d..f31af23 100644 --- a/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test.snap +++ b/modules/nf-core/svanalyzer/svbenchmark/tests/main.nf.test.snap @@ -1,188 +1,162 @@ { - "homo_sapiens - illumina - vcf.gz": { + "distances": { "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "test.falsenegatives.vcf:md5,7a574ad3c614f0c38a6dccb5901ddc05" - ] - ], - "1": [ - [ - { - "id": "test" - }, - "test.falsepositives.vcf:md5,146f05125330a9c0c4581a5a581744a7" - ] - ], - "2": [ - [ - { - "id": "test" - }, - "test.distances:md5,b6a908b1187f159429dc8c6beb6e6f57" - ] - ], - "3": [ - [ - { - "id": "test" - }, - "test.log:md5,16fd250ae2adcb07c8f101f640fdce81" - ] - ], - "4": [ - [ - { - "id": "test" - }, - "test.report:md5,d0c7db2466442cbdd4f87ad516e00d32" - ] - ], - "5": [ - "versions.yml:md5,6ac08491dbe591d24615c131658cf771" - ], - "distances": [ - [ - { - "id": "test" - }, - "test.distances:md5,b6a908b1187f159429dc8c6beb6e6f57" - ] - ], - "fns": [ - [ - { - "id": "test" - }, - "test.falsenegatives.vcf:md5,7a574ad3c614f0c38a6dccb5901ddc05" - ] - ], - "fps": [ - [ - { - "id": "test" - }, - "test.falsepositives.vcf:md5,146f05125330a9c0c4581a5a581744a7" - ] - ], - "log": [ - [ - { - "id": "test" - }, - "test.log:md5,16fd250ae2adcb07c8f101f640fdce81" - ] - ], - "report": [ - [ - { - "id": "test" - }, - "test.report:md5,d0c7db2466442cbdd4f87ad516e00d32" - ] - ], - "versions": [ - "versions.yml:md5,6ac08491dbe591d24615c131658cf771" + [ + [ + { + "id": "test" + }, + "test.distances:md5,95f7b1679e805979f0c9a4a322cb77f4" ] - } + ] ], - "timestamp": "2023-11-24T15:28:29.422156227" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:11.509970731" }, - "homo_sapiens - illumina - vcf.gz - bed": { + "bed_fps": { "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "test.falsenegatives.vcf:md5,c04105833d5f9acb5ec50af0b89a6b0f" - ] - ], - "1": [ - [ - { - "id": "test" - }, - "test.falsepositives.vcf:md5,146f05125330a9c0c4581a5a581744a7" - ] - ], - "2": [ - [ - { - "id": "test" - }, - "test.distances:md5,95f7b1679e805979f0c9a4a322cb77f4" - ] - ], - "3": [ - [ - { - "id": "test" - }, - "test.log:md5,75f05aac48afd818f2d5e8a3144116ea" - ] - ], - "4": [ - [ - { - "id": "test" - }, - "test.report:md5,aaa9225dd6e261951c020e23473375b9" - ] - ], - "5": [ - "versions.yml:md5,6ac08491dbe591d24615c131658cf771" - ], - "distances": [ - [ - { - "id": "test" - }, - "test.distances:md5,95f7b1679e805979f0c9a4a322cb77f4" - ] - ], - "fns": [ - [ - { - "id": "test" - }, - "test.falsenegatives.vcf:md5,c04105833d5f9acb5ec50af0b89a6b0f" - ] - ], - "fps": [ - [ - { - "id": "test" - }, - "test.falsepositives.vcf:md5,146f05125330a9c0c4581a5a581744a7" - ] - ], - "log": [ - [ - { - "id": "test" - }, - "test.log:md5,75f05aac48afd818f2d5e8a3144116ea" - ] - ], - "report": [ - [ - { - "id": "test" - }, - "test.report:md5,aaa9225dd6e261951c020e23473375b9" - ] - ], - "versions": [ - "versions.yml:md5,6ac08491dbe591d24615c131658cf771" + [ + [ + { + "id": "test" + }, + "test.falsepositives.vcf.gz:md5,146f05125330a9c0c4581a5a581744a7" ] - } + ] ], - "timestamp": "2023-11-24T15:29:05.547215282" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:50.064755761" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,b9248741a9510f3e9d231d94ee27eb77" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:11.662700758" + }, + "bed_distances": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.distances:md5,b6a908b1187f159429dc8c6beb6e6f57" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:50.134445649" + }, + "bed_versions": { + "content": [ + [ + "versions.yml:md5,b9248741a9510f3e9d231d94ee27eb77" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:50.348992284" + }, + "bed_fns": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.falsenegatives.vcf.gz:md5,7a574ad3c614f0c38a6dccb5901ddc05" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:49.998007508" + }, + "fps": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.falsepositives.vcf.gz:md5,146f05125330a9c0c4581a5a581744a7" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:11.432409299" + }, + "report": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.report:md5,aaa9225dd6e261951c020e23473375b9" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:11.587407703" + }, + "fns": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.falsenegatives.vcf.gz:md5,c04105833d5f9acb5ec50af0b89a6b0f" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:11.334428964" + }, + "bed_report": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.report:md5,d0c7db2466442cbdd4f87ad516e00d32" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-11T12:16:50.202872842" } } \ No newline at end of file diff --git a/modules/nf-core/truvari/bench/main.nf b/modules/nf-core/truvari/bench/main.nf index 4e1a104..8b0c509 100644 --- a/modules/nf-core/truvari/bench/main.nf +++ b/modules/nf-core/truvari/bench/main.nf @@ -5,11 +5,12 @@ process TRUVARI_BENCH { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/truvari:4.1.0--pyhdfd78af_0': - 'quay.io/biocontainers/truvari:4.1.0--pyhdfd78af_0' }" + 'biocontainers/truvari:4.1.0--pyhdfd78af_0' }" input: - tuple val(meta),path(vcf), path(tbi), path(truth_vcf), path(truth_tbi), path(bed) - tuple path(fasta), path(fai) + tuple val(meta), path(vcf), path(tbi), path(truth_vcf), path(truth_tbi), path(bed) + tuple val(meta2), path(fasta) + tuple val(meta3), path(fai) output: tuple val(meta), path("*.fn.vcf.gz") , emit: fn_vcf @@ -30,7 +31,6 @@ process TRUVARI_BENCH { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def regions = bed ? "--includebed $bed" : "" - def convert_type = params.dup_to_ins ? "--dup-to-ins" : "" """ truvari bench \\ @@ -38,8 +38,6 @@ process TRUVARI_BENCH { --comp ${vcf} \\ --reference ${fasta} \\ --output ${prefix} \\ - --pctseq $params.similarity \\ - $convert_type \\ ${regions} \\ ${args} @@ -58,4 +56,25 @@ process TRUVARI_BENCH { truvari: \$(echo \$(truvari version 2>&1) | sed 's/^Truvari v//' )) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}.fn.vcf.gz + touch ${prefix}.fn.vcf.gz.tbi + touch ${prefix}.fp.vcf.gz + touch ${prefix}.fp.vcf.gz.tbi + touch ${prefix}.tp-base.vcf.gz + touch ${prefix}.tp-base.vcf.gz.tbi + touch ${prefix}.tp-comp.vcf.gz + touch ${prefix}.tp-comp.vcf.gz.tbi + touch ${prefix}.summary.json + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + truvari: \$(echo \$(truvari version 2>&1) | sed 's/^Truvari v//' )) + END_VERSIONS + """ } diff --git a/subworkflows/local/sv_germline_benchmark.nf b/subworkflows/local/sv_germline_benchmark.nf index 2e4cc0c..75be720 100644 --- a/subworkflows/local/sv_germline_benchmark.nf +++ b/subworkflows/local/sv_germline_benchmark.nf @@ -38,7 +38,8 @@ workflow SV_GERMLINE_BENCHMARK { // TRUVARI_BENCH( input_ch, - ref + ref.map { it -> tuple([id: it[0].getSimpleName()], it[0]) }, + ref.map { it -> tuple([id: it[0].getSimpleName()], it[1]) } ) versions = versions.mix(TRUVARI_BENCH.out.versions) @@ -51,7 +52,8 @@ workflow SV_GERMLINE_BENCHMARK { // slower than truvari SVANALYZER_SVBENCHMARK( input_ch, - ref + ref.map { it -> tuple([id: it[0].getSimpleName()], it[0]) }, + ref.map { it -> tuple([id: it[0].getSimpleName()], it[1]) } ) versions = versions.mix(SVANALYZER_SVBENCHMARK.out.versions)