diff --git a/modules/nf-core/dastool/dastool/environment.yml b/modules/nf-core/dastool/dastool/environment.yml index 0ede57bfb27..48ee9e0c5ab 100644 --- a/modules/nf-core/dastool/dastool/environment.yml +++ b/modules/nf-core/dastool/dastool/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::das_tool=1.1.6 + - bioconda::das_tool=1.1.7 diff --git a/modules/nf-core/dastool/dastool/main.nf b/modules/nf-core/dastool/dastool/main.nf index 463ae519e1d..88c1dad8fd4 100644 --- a/modules/nf-core/dastool/dastool/main.nf +++ b/modules/nf-core/dastool/dastool/main.nf @@ -4,12 +4,11 @@ process DASTOOL_DASTOOL { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/das_tool:1.1.6--r42hdfd78af_0' : - 'biocontainers/das_tool:1.1.6--r42hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/das_tool:1.1.7--r43hdfd78af_0' : + 'biocontainers/das_tool:1.1.7--r43hdfd78af_0' }" input: - tuple val(meta), path(contigs), path(bins) - path(proteins) + tuple val(meta), path(contigs), path(bins), path(proteins) path(db_directory) output: @@ -19,8 +18,8 @@ process DASTOOL_DASTOOL { tuple val(meta), path("*.eval") , optional: true, emit: eval tuple val(meta), path("*_DASTool_bins/*.fa") , optional: true, emit: bins tuple val(meta), path("*.pdf") , optional: true, emit: pdfs - tuple val(meta), path("*.candidates.faa") , optional: true, emit: fasta_proteins - tuple val(meta), path("*.faa") , optional: true, emit: candidates_faa + tuple val(meta), path("*.candidates.faa") , optional: true, emit: candidates_faa + tuple val(meta), path("*_proteins.faa") , optional: true, emit: fasta_proteins tuple val(meta), path("*.archaea.scg") , optional: true, emit: fasta_archaea_scg tuple val(meta), path("*.bacteria.scg") , optional: true, emit: fasta_bacteria_scg tuple val(meta), path("*.b6") , optional: true, emit: b6 @@ -38,9 +37,8 @@ process DASTOOL_DASTOOL { def clean_contigs = contigs.toString() - ".gz" def decompress_contigs = contigs.toString() == clean_contigs ? "" : "gunzip -q -f $contigs" def clean_proteins = proteins ? proteins.toString() - ".gz" : "" - def decompress_proteins = proteins ? "gunzip -f $proteins" : "" + def decompress_proteins = (proteins && (proteins.toString() != clean_proteins)) ? "gunzip -f $proteins" : "" def proteins_pred = proteins ? "-p $clean_proteins" : "" - """ $decompress_proteins $decompress_contigs @@ -59,4 +57,26 @@ process DASTOOL_DASTOOL { dastool: \$( DAS_Tool --version 2>&1 | grep "DAS Tool" | sed 's/DAS Tool //' ) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_DASTool.log + touch ${prefix}_DASTool_summary.tsv + touch ${prefix}_DASTool_contig2bin.tsv + touch ${prefix}_allBins.eval + touch ${prefix}_proteins.faa.scg.candidates.faa + touch ${prefix}_proteins.faa + touch ${prefix}_proteins.faa.archaea.scg + touch ${prefix}_proteins.faa.bacteria.scg + touch ${prefix}_proteins.faa.findSCG.b6 + touch ${prefix}.seqlength + mkdir ${prefix}_DASTool_bins + touch ${prefix}_DASTool_bins/${prefix}.1.fa + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + dastool: \$( DAS_Tool --version 2>&1 | grep "DAS Tool" | sed 's/DAS Tool //' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/dastool/dastool/meta.yml b/modules/nf-core/dastool/dastool/meta.yml index 7eab655a842..a327524e456 100644 --- a/modules/nf-core/dastool/dastool/meta.yml +++ b/modules/nf-core/dastool/dastool/meta.yml @@ -31,11 +31,12 @@ input: type: file description: fasta file pattern: "*.{fa.gz,fas.gz,fasta.gz}" + - bins: type: file description: "FastaToContig2Bin tabular file generated with dastool/fastatocontig2bin" pattern: "*.tsv" - - - proteins: + - proteins: type: file description: Predicted proteins in prodigal fasta format (>scaffoldID_geneNo) pattern: "*.{fa.gz,fas.gz,fasta.gz}" @@ -110,20 +111,20 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - "*.candidates.faa": + - "*_proteins.faa": type: file description: Output from prodigal if not already supplied - pattern: "*.proteins.faa" + pattern: "*_proteins.faa" - candidates_faa: - meta: type: map description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - "*.faa": + - "*.candidates.faa": type: file description: FAA file - pattern: "*.faa" + pattern: "*.candidates.faa" - fasta_archaea_scg: - meta: type: map diff --git a/modules/nf-core/dastool/dastool/tests/main.nf.test b/modules/nf-core/dastool/dastool/tests/main.nf.test new file mode 100644 index 00000000000..fcf9a77d7dc --- /dev/null +++ b/modules/nf-core/dastool/dastool/tests/main.nf.test @@ -0,0 +1,177 @@ +nextflow_process { + + name "Test Process DASTOOL_DASTOOL" + script "../main.nf" + process "DASTOOL_DASTOOL" + + tag "modules" + tag "modules_nfcore" + tag "dastool" + tag "dastool/dastool" + tag "dastool/fastatocontig2bin" + tag "metabat2/metabat2" + tag "metabat2/jgisummarizebamcontigdepths" + tag "prodigal" + + setup { + run("METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS") { + script "../../../metabat2/jgisummarizebamcontigdepths/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam.bai", checkIfExists: true), + ] + """ + } + } + run("METABAT2_METABAT2") { + script "../../../metabat2/metabat2/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]).join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) + """ + } + } + run("DASTOOL_FASTATOCONTIG2BIN") { + script "../../fastatocontig2bin/main.nf" + process { + """ + input[0] = METABAT2_METABAT2.out.fasta.collect() + input[1] = "fa" + """ + } + } + run("PRODIGAL") { + script "../../../prodigal/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]) + input[1] = "gff" + """ + } + } + } + + test("dastool dastool - bacteroides fragilis - noproteins") { + + config "./nextflow.config" + + when { + params { + module_args = '--write_bins --write_bin_evals' + } + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]).join(DASTOOL_FASTATOCONTIG2BIN.out.fastatocontig2bin) + .map { meta, contigs, c2b -> [ meta, contigs, c2b, [] ]} + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.log.get(0).get(1)).text.contains("Dereplicating, aggregating, and scoring bins") }, + { assert path(process.out.fasta_proteins.get(0).get(1)).text.contains("MKIGIITICKVNNYGAELQAFATQKKLEQMGHNAEIINYLYYKDWHFKDTPLSQPFVPLD") }, + { assert snapshot( + process.out.summary, + process.out.contig2bin, + process.out.eval, + process.out.bins, + process.out.pdfs, + process.out.candidates_faa, + process.out.fasta_archaea_scg, + process.out.fasta_bacteria_scg, + process.out.b6, + process.out.seqlength, + process.out.versions + ).match() } + ) + } + + } + + test("dastool dastool - bacteroides fragilis - proteins") { + + config "./nextflow.config" + + when { + params { + module_args = '--write_bins --write_bin_evals' + } + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]) + .join(DASTOOL_FASTATOCONTIG2BIN.out.fastatocontig2bin) + .join(PRODIGAL.out.amino_acid_fasta) + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.log.get(0).get(1)).text.contains("Dereplicating, aggregating, and scoring bins") }, + { assert snapshot( + process.out.summary, + process.out.contig2bin, + process.out.eval, + process.out.bins, + process.out.pdfs, + process.out.fasta_proteins, + process.out.candidates_faa, + process.out.fasta_archaea_scg, + process.out.fasta_bacteria_scg, + process.out.b6, + process.out.seqlength, + process.out.versions + ).match() } + ) + } + + } + + test("dastool dastool - bacteroides fragilis - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]) + .join(DASTOOL_FASTATOCONTIG2BIN.out.fastatocontig2bin) + .join(PRODIGAL.out.amino_acid_fasta) + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } +} + diff --git a/modules/nf-core/dastool/dastool/tests/main.nf.test.snap b/modules/nf-core/dastool/dastool/tests/main.nf.test.snap new file mode 100644 index 00000000000..f927b3bd611 --- /dev/null +++ b/modules/nf-core/dastool/dastool/tests/main.nf.test.snap @@ -0,0 +1,424 @@ +{ + "dastool dastool - bacteroides fragilis - noproteins": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_summary.tsv:md5,ab9dd3709a59a69bc66030b9e0ff3d5b" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_contig2bin.tsv:md5,6e46c0be14dded7cb13af38f54feea47" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_allBins.eval:md5,ab9dd3709a59a69bc66030b9e0ff3d5b" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.1.fa:md5,70d2b1ddd4aaa89803c05fb7dba602d1" + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.scg.candidates.faa:md5,81599ff26de20528205cc654465a02f6" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.archaea.scg:md5,db2d0c086b57b76e1a63674dca437607" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.bacteria.scg:md5,847cd1729fd35956f5e0be4b977f0b64" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_proteins.faa.all.b6:md5,5d01f9cceaecfc52ae841d168f355fff", + "test_proteins.faa.findSCG.b6:md5,2d4159e486dc74bbe114752c61a4cb8b" + ] + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.seqlength:md5,b815a5811008c36808a59b1d0dcfab24" + ] + ], + [ + "versions.yml:md5,ea5c2d7e0c1be82784aaeb94d4038526" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-10T09:07:28.504635964" + }, + "dastool dastool - bacteroides fragilis - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_summary.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "10": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.findSCG.b6:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "11": [ + [ + { + "id": "test", + "single_end": false + }, + "test.seqlength:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "12": [ + "versions.yml:md5,ea5c2d7e0c1be82784aaeb94d4038526" + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_contig2bin.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test_allBins.eval:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.1.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + + ], + "6": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.scg.candidates.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.archaea.scg:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "9": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.bacteria.scg:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "b6": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.findSCG.b6:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bins": [ + [ + { + "id": "test", + "single_end": false + }, + "test.1.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "candidates_faa": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.scg.candidates.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "contig2bin": [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_contig2bin.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "eval": [ + [ + { + "id": "test", + "single_end": false + }, + "test_allBins.eval:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fasta_archaea_scg": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.archaea.scg:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fasta_bacteria_scg": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa.bacteria.scg:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fasta_proteins": [ + [ + { + "id": "test", + "single_end": false + }, + "test_proteins.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "pdfs": [ + + ], + "seqlength": [ + [ + { + "id": "test", + "single_end": false + }, + "test.seqlength:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "summary": [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_summary.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ea5c2d7e0c1be82784aaeb94d4038526" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-10T09:15:36.924260874" + }, + "dastool dastool - bacteroides fragilis - proteins": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_summary.tsv:md5,ab9dd3709a59a69bc66030b9e0ff3d5b" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_DASTool_contig2bin.tsv:md5,6e46c0be14dded7cb13af38f54feea47" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_allBins.eval:md5,ab9dd3709a59a69bc66030b9e0ff3d5b" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.1.fa:md5,70d2b1ddd4aaa89803c05fb7dba602d1" + ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.faa.scg.candidates.faa:md5,5cf97eab6da0a70cc4de01f31a8163c6" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.faa.archaea.scg:md5,561528a484afc60c0ff81bdb2a7486f8" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.faa.bacteria.scg:md5,82f6e2f23f76d8e782979b1a26da3f82" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.faa.all.b6:md5,f25a3c0945af01da9f50f992612ea86d", + "test.faa.findSCG.b6:md5,90bc9bbcfa579ca2b265b3c48f548725" + ] + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.seqlength:md5,b815a5811008c36808a59b1d0dcfab24" + ] + ], + [ + "versions.yml:md5,ea5c2d7e0c1be82784aaeb94d4038526" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-10T09:08:35.826716296" + } +} \ No newline at end of file diff --git a/tests/modules/nf-core/dastool/fastatocontig2bin/nextflow.config b/modules/nf-core/dastool/dastool/tests/nextflow.config similarity index 59% rename from tests/modules/nf-core/dastool/fastatocontig2bin/nextflow.config rename to modules/nf-core/dastool/dastool/tests/nextflow.config index 50f50a7a357..b8c11600093 100644 --- a/tests/modules/nf-core/dastool/fastatocontig2bin/nextflow.config +++ b/modules/nf-core/dastool/dastool/tests/nextflow.config @@ -1,5 +1,9 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file + + withName: DASTOOL_DASTOOL { + ext.args = params.module_args + } + +} diff --git a/modules/nf-core/dastool/fastatocontig2bin/environment.yml b/modules/nf-core/dastool/fastatocontig2bin/environment.yml index 0ede57bfb27..48ee9e0c5ab 100644 --- a/modules/nf-core/dastool/fastatocontig2bin/environment.yml +++ b/modules/nf-core/dastool/fastatocontig2bin/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::das_tool=1.1.6 + - bioconda::das_tool=1.1.7 diff --git a/modules/nf-core/dastool/fastatocontig2bin/main.nf b/modules/nf-core/dastool/fastatocontig2bin/main.nf index 0da450eceb9..371188c4a45 100644 --- a/modules/nf-core/dastool/fastatocontig2bin/main.nf +++ b/modules/nf-core/dastool/fastatocontig2bin/main.nf @@ -4,8 +4,8 @@ process DASTOOL_FASTATOCONTIG2BIN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/das_tool:1.1.6--r42hdfd78af_0' : - 'biocontainers/das_tool:1.1.6--r42hdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/das_tool:1.1.7--r43hdfd78af_0' : + 'biocontainers/das_tool:1.1.7--r43hdfd78af_0' }" input: tuple val(meta), path(fasta) @@ -38,4 +38,15 @@ process DASTOOL_FASTATOCONTIG2BIN { dastool: \$( DAS_Tool --version 2>&1 | grep "DAS Tool" | sed 's/DAS Tool //' ) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + dastool: \$( DAS_Tool --version 2>&1 | grep "DAS Tool" | sed 's/DAS Tool //' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/dastool/fastatocontig2bin/tests/main.nf.test b/modules/nf-core/dastool/fastatocontig2bin/tests/main.nf.test new file mode 100644 index 00000000000..f2901cb7ecf --- /dev/null +++ b/modules/nf-core/dastool/fastatocontig2bin/tests/main.nf.test @@ -0,0 +1,83 @@ +nextflow_process { + + name "Test Process DASTOOL_FASTATOCONTIG2BIN" + script "../main.nf" + process "DASTOOL_FASTATOCONTIG2BIN" + + tag "modules" + tag "modules_nfcore" + tag "dastool" + tag "dastool/fastatocontig2bin" + tag "metabat2/metabat2" + tag "metabat2/jgisummarizebamcontigdepths" + + setup { + run("METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS") { + script "../../../metabat2/jgisummarizebamcontigdepths/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam.bai", checkIfExists: true), + ] + """ + } + } + run("METABAT2_METABAT2") { + script "../../../metabat2/metabat2/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]).join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) + """ + } + } + } + + test("dastool fastatocontig2bin - bacteroides fragilis") { + + when { + process { + """ + input[0] = METABAT2_METABAT2.out.fasta.collect() + input[1] = 'fa' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("dastool fastatocontig2bin - bacteroides fragilis - stub") { + + options "-stub" + + when { + process { + """ + input[0] = METABAT2_METABAT2.out.fasta.collect() + input[1] = 'fa' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} + diff --git a/modules/nf-core/dastool/fastatocontig2bin/tests/main.nf.test.snap b/modules/nf-core/dastool/fastatocontig2bin/tests/main.nf.test.snap new file mode 100644 index 00000000000..32a05ba018e --- /dev/null +++ b/modules/nf-core/dastool/fastatocontig2bin/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "dastool fastatocontig2bin - bacteroides fragilis - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,902d9b18eee9c90141d379e80c1297b9" + ], + "fastatocontig2bin": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,902d9b18eee9c90141d379e80c1297b9" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-10T09:12:48.89685928" + }, + "dastool fastatocontig2bin - bacteroides fragilis": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,6e46c0be14dded7cb13af38f54feea47" + ] + ], + "1": [ + "versions.yml:md5,902d9b18eee9c90141d379e80c1297b9" + ], + "fastatocontig2bin": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,6e46c0be14dded7cb13af38f54feea47" + ] + ], + "versions": [ + "versions.yml:md5,902d9b18eee9c90141d379e80c1297b9" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-05T13:56:41.454584667" + } +} \ No newline at end of file diff --git a/modules/nf-core/dastool/scaffolds2bin/main.nf b/modules/nf-core/dastool/scaffolds2bin/main.nf index 1520aaf0515..459e495d1e3 100644 --- a/modules/nf-core/dastool/scaffolds2bin/main.nf +++ b/modules/nf-core/dastool/scaffolds2bin/main.nf @@ -1,3 +1,11 @@ +def deprecation_message = """ +WARNING: This module has been deprecated. Please use nf-core/modules/dastool/fastatocontig2bin + +Reason: +This tool has been renamed in newer versions of DAS_Tool, so any changes +to this tool will not be tracked by this module. +""" + process DASTOOL_SCAFFOLDS2BIN { tag "$meta.id" label 'process_single' @@ -20,23 +28,6 @@ process DASTOOL_SCAFFOLDS2BIN { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def file_extension = extension ? extension : "fasta" - def clean_fasta = fasta.toString() - ".gz" - def decompress_fasta = fasta.toString() == clean_fasta ? "" : "gunzip -q -f $fasta" - """ - $decompress_fasta - - Fasta_to_Scaffolds2Bin.sh \\ - $args \\ - -i . \\ - -e $file_extension \\ - > ${prefix}.tsv - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - dastool: \$( DAS_Tool --version 2>&1 | grep "DAS Tool" | sed 's/DAS Tool version //' ) - END_VERSIONS + assert false: deprecation_message """ } diff --git a/modules/nf-core/dastool/scaffolds2bin/tests/main.nf.test b/modules/nf-core/dastool/scaffolds2bin/tests/main.nf.test new file mode 100644 index 00000000000..f6cf02b86df --- /dev/null +++ b/modules/nf-core/dastool/scaffolds2bin/tests/main.nf.test @@ -0,0 +1,59 @@ +nextflow_process { + + name "Test Process DASTOOL_SCAFFOLDS2BIN" + script "../main.nf" + process "DASTOOL_SCAFFOLDS2BIN" + + tag "modules" + tag "modules_nfcore" + tag "dastool" + tag "dastool/scaffolds2bin" + tag "metabat2/metabat2" + tag "metabat2/jgisummarizebamcontigdepths" + + setup { + run("METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS") { + script "../../../metabat2/jgisummarizebamcontigdepths/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam.bai", checkIfExists: true), + ] + """ + } + } + run("METABAT2_METABAT2") { + script "../../../metabat2/metabat2/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz", checkIfExists: true) + ]).join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) + """ + } + } + } + + test("dastool fastatocontig2bin - bacteroides fragilis") { + + when { + process { + """ + input[0] = METABAT2_METABAT2.out.fasta.collect() + input[1] = 'fa' + """ + } + } + + then { + assertAll( + { assert process.failed }, + ) + } + + } +} + diff --git a/modules/nf-core/dastool/scaffolds2bin/tests/main.nf.test.snap b/modules/nf-core/dastool/scaffolds2bin/tests/main.nf.test.snap new file mode 100644 index 00000000000..c6cdb48f99a --- /dev/null +++ b/modules/nf-core/dastool/scaffolds2bin/tests/main.nf.test.snap @@ -0,0 +1,37 @@ +{ + "dastool fastatocontig2bin - bacteroides fragilis": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,6e46c0be14dded7cb13af38f54feea47" + ] + ], + "1": [ + "versions.yml:md5,a29d3534d93feaca7daf85dc8b6e4e8c" + ], + "scaffolds2bin": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,6e46c0be14dded7cb13af38f54feea47" + ] + ], + "versions": [ + "versions.yml:md5,a29d3534d93feaca7daf85dc8b6e4e8c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-05T13:59:19.402878557" + } +} \ No newline at end of file diff --git a/modules/nf-core/metabat2/metabat2/main.nf b/modules/nf-core/metabat2/metabat2/main.nf index aa7ff9a5dca..89f4e7fa569 100644 --- a/modules/nf-core/metabat2/metabat2/main.nf +++ b/modules/nf-core/metabat2/metabat2/main.nf @@ -51,7 +51,6 @@ process METABAT2_METABAT2 { def prefix = task.ext.prefix ?: "${meta.id}" def decompress_depth = depth ? "gzip -d -f $depth" : "" def depth_file = depth ? "-a ${depth.baseName}" : "" - """ echo "" | gzip -c > ${prefix}.1.fa.gz echo "" | gzip -c > ${prefix}.1.tooShort.fa.gz diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 1147031e8b3..eb7872b4eca 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -124,15 +124,6 @@ cutesv: damageprofiler: - modules/nf-core/damageprofiler/** - tests/modules/nf-core/damageprofiler/** -dastool/dastool: - - modules/nf-core/dastool/dastool/** - - tests/modules/nf-core/dastool/dastool/** -dastool/fastatocontig2bin: - - modules/nf-core/dastool/fastatocontig2bin/** - - tests/modules/nf-core/dastool/fastatocontig2bin/** -dastool/scaffolds2bin: - - modules/nf-core/dastool/scaffolds2bin/** - - tests/modules/nf-core/dastool/scaffolds2bin/** dedup: - modules/nf-core/dedup/** - tests/modules/nf-core/dedup/** diff --git a/tests/modules/nf-core/dastool/dastool/main.nf b/tests/modules/nf-core/dastool/dastool/main.nf deleted file mode 100644 index efea6dc8436..00000000000 --- a/tests/modules/nf-core/dastool/dastool/main.nf +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env nextflow -nextflow.enable.dsl = 2 - -include { METABAT2_METABAT2 } from '../../../../../modules/nf-core/metabat2/metabat2/main.nf' -include { METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS } from '../../../../../modules/nf-core/metabat2/jgisummarizebamcontigdepths/main.nf' -include { DASTOOL_FASTATOCONTIG2BIN } from '../../../../../modules/nf-core/dastool/fastatocontig2bin/main.nf' -include { DASTOOL_DASTOOL } from '../../../../../modules/nf-core/dastool/dastool/main.nf' - -workflow test_dastool_dastool { - - input_depth = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam_bai'], checkIfExists: true) ] - - METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS ( input_depth ) - - Channel.fromPath(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) - .map { it -> [[ id:'test', single_end:false ], it] } - .join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) - .set { input_metabat2 } - - METABAT2_METABAT2 ( input_metabat2 ) - - DASTOOL_FASTATOCONTIG2BIN ( METABAT2_METABAT2.out.fasta.collect(), "fa") - - Channel.of([ [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true)]) - .join( DASTOOL_FASTATOCONTIG2BIN.out.fastatocontig2bin ) - .set {input_dastool} - - - DASTOOL_DASTOOL ( input_dastool, [], [] ) -} diff --git a/tests/modules/nf-core/dastool/dastool/nextflow.config b/tests/modules/nf-core/dastool/dastool/nextflow.config deleted file mode 100644 index e306b4b4fc8..00000000000 --- a/tests/modules/nf-core/dastool/dastool/nextflow.config +++ /dev/null @@ -1,13 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: METABAT2_METABAT2 { - ext.args = '--minContig 1500 --minCV 0.1 --minCVSum 0.1 --minClsSize 10 --minS 2' - } - - withName: DASTOOL_DASTOOL { - ext.args = '--score_threshold 0 --debug' - } - -} diff --git a/tests/modules/nf-core/dastool/dastool/test.yml b/tests/modules/nf-core/dastool/dastool/test.yml deleted file mode 100644 index 9b85c5db442..00000000000 --- a/tests/modules/nf-core/dastool/dastool/test.yml +++ /dev/null @@ -1,27 +0,0 @@ -- name: dastool dastool test_dastool_dastool - command: nextflow run ./tests/modules/nf-core/dastool/dastool -entry test_dastool_dastool -c ./tests/config/nextflow.config - tags: - - dastool/dastool - - dastool - files: - - path: output/dastool/test.seqlength - md5sum: b815a5811008c36808a59b1d0dcfab24 - - path: output/dastool/test.tsv - md5sum: 6e46c0be14dded7cb13af38f54feea47 - - path: output/dastool/test_DASTool.log - - path: output/dastool/test_DASTool_contig2bin.tsv - md5sum: 6e46c0be14dded7cb13af38f54feea47 - - path: output/dastool/test_DASTool_summary.tsv - md5sum: ab9dd3709a59a69bc66030b9e0ff3d5b - - path: output/dastool/test_proteins.faa - - path: output/dastool/test_proteins.faa.all.b6 - md5sum: 39c11237ef22ac73109aaac267e185d0 - - path: output/dastool/test_proteins.faa.archaea.scg - md5sum: e79d82eecee25821d1658ea4f082601d - - path: output/dastool/test_proteins.faa.bacteria.scg - md5sum: 8132cfb17cf398d41c036ead55c96ffe - - path: output/dastool/test_proteins.faa.findSCG.b6 - md5sum: 48e90e12cd6c88d00608777dbc48a82a - - path: output/dastool/test_proteins.faa.scg.candidates.faa - md5sum: d94b7bed0f8aa9cf2824d72c548c537c - - path: output/dastool/versions.yml diff --git a/tests/modules/nf-core/dastool/fastatocontig2bin/main.nf b/tests/modules/nf-core/dastool/fastatocontig2bin/main.nf deleted file mode 100644 index 70ea9bdafa8..00000000000 --- a/tests/modules/nf-core/dastool/fastatocontig2bin/main.nf +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GUNZIP } from '../../../../../modules/nf-core/gunzip/main.nf' -include { METABAT2_METABAT2 } from '../../../../../modules/nf-core/metabat2/metabat2/main.nf' -include { METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS } from '../../../../../modules/nf-core/metabat2/jgisummarizebamcontigdepths/main.nf' -include { DASTOOL_FASTATOCONTIG2BIN } from '../../../../../modules/nf-core/dastool/fastatocontig2bin/main.nf' - -workflow test_dastool_fastatocontig2bin { - - input_depth = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam_bai'], checkIfExists: true) ] - - METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS ( input_depth ) - - Channel.fromPath(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) - .map { it -> [[ id:'test', single_end:false ], it] } - .join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) - .set { input_metabat2 } - - METABAT2_METABAT2 ( input_metabat2 ) - - DASTOOL_FASTATOCONTIG2BIN ( METABAT2_METABAT2.out.fasta.collect(), "fa") -} - -workflow test_dastool_fastatocontig2bin_ungzipped { - - input_depth = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam_bai'], checkIfExists: true) ] - - - METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS ( input_depth ) - - Channel.fromPath(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) - .map { it -> [[ id:'test', single_end:false ], it] } - .join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) - .set { input_metabat2 } - - METABAT2_METABAT2 ( input_metabat2 ) - - // TODO test unzipped input files - ch_input_2_fastatocontig2bin = GUNZIP( METABAT2_METABAT2.out.fasta ).gunzip - - DASTOOL_FASTATOCONTIG2BIN ( ch_input_2_fastatocontig2bin, "fa") -} diff --git a/tests/modules/nf-core/dastool/fastatocontig2bin/test.yml b/tests/modules/nf-core/dastool/fastatocontig2bin/test.yml deleted file mode 100644 index 0cb94930329..00000000000 --- a/tests/modules/nf-core/dastool/fastatocontig2bin/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: dastool fastatocontig2bin test_dastool_fastatocontig2bin - command: nextflow run ./tests/modules/nf-core/dastool/fastatocontig2bin -entry test_dastool_fastatocontig2bin -c ./tests/config/nextflow.config - tags: - - dastool - - dastool/fastatocontig2bin - files: - - path: output/dastool/test.tsv - md5sum: 6e46c0be14dded7cb13af38f54feea47 - - path: output/dastool/versions.yml - -- name: dastool fastatocontig2bin test_dastool_fastatocontig2bin_ungzipped - command: nextflow run ./tests/modules/nf-core/dastool/fastatocontig2bin -entry test_dastool_fastatocontig2bin_ungzipped -c ./tests/config/nextflow.config - tags: - - dastool - - dastool/fastatocontig2bin - files: - - path: output/dastool/test.tsv - md5sum: 6e46c0be14dded7cb13af38f54feea47 - - path: output/dastool/versions.yml diff --git a/tests/modules/nf-core/dastool/scaffolds2bin/main.nf b/tests/modules/nf-core/dastool/scaffolds2bin/main.nf deleted file mode 100644 index 272b7abf685..00000000000 --- a/tests/modules/nf-core/dastool/scaffolds2bin/main.nf +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GUNZIP } from '../../../../../modules/nf-core/gunzip/main.nf' -include { METABAT2_METABAT2 } from '../../../../../modules/nf-core/metabat2/metabat2/main.nf' -include { METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS } from '../../../../../modules/nf-core/metabat2/jgisummarizebamcontigdepths/main.nf' -include { DASTOOL_SCAFFOLDS2BIN } from '../../../../../modules/nf-core/dastool/scaffolds2bin/main.nf' - -workflow test_dastool_scaffolds2bin { - - input_depth = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam_bai'], checkIfExists: true) ] - - METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS ( input_depth ) - - Channel.fromPath(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) - .map { it -> [[ id:'test', single_end:false ], it] } - .join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) - .set { input_metabat2 } - - METABAT2_METABAT2 ( input_metabat2 ) - - DASTOOL_SCAFFOLDS2BIN ( METABAT2_METABAT2.out.fasta.collect(), "fa") -} - -workflow test_dastool_scaffolds2bin_ungzipped { - - input_depth = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_sorted_bam_bai'], checkIfExists: true) ] - - - METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS ( input_depth ) - - Channel.fromPath(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) - .map { it -> [[ id:'test', single_end:false ], it] } - .join(METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth) - .set { input_metabat2 } - - METABAT2_METABAT2 ( input_metabat2 ) - - // TODO test unzipped input files - ch_input_2_scaffolds2bin = GUNZIP( METABAT2_METABAT2.out.fasta ).gunzip - - DASTOOL_SCAFFOLDS2BIN ( ch_input_2_scaffolds2bin, "fa") -} diff --git a/tests/modules/nf-core/dastool/scaffolds2bin/nextflow.config b/tests/modules/nf-core/dastool/scaffolds2bin/nextflow.config deleted file mode 100644 index 83754d8b100..00000000000 --- a/tests/modules/nf-core/dastool/scaffolds2bin/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: METABAT2_METABAT2 { - ext.args = '--minContig 1500 --minCV 0.1 --minCVSum 0.1 --minClsSize 10 --minS 2' - } - -} diff --git a/tests/modules/nf-core/dastool/scaffolds2bin/test.yml b/tests/modules/nf-core/dastool/scaffolds2bin/test.yml deleted file mode 100644 index 462a6f180a7..00000000000 --- a/tests/modules/nf-core/dastool/scaffolds2bin/test.yml +++ /dev/null @@ -1,18 +0,0 @@ -- name: dastool scaffolds2bin test_dastool_scaffolds2bin - command: nextflow run ./tests/modules/nf-core/dastool/scaffolds2bin -entry test_dastool_scaffolds2bin -c ./tests/config/nextflow.config - tags: - - dastool - - dastool/scaffolds2bin - files: - - path: output/dastool/test.tsv - md5sum: 6e46c0be14dded7cb13af38f54feea47 - - path: output/dastool/versions.yml -- name: dastool scaffolds2bin test_dastool_scaffolds2bin_ungzipped - command: nextflow run ./tests/modules/nf-core/dastool/scaffolds2bin -entry test_dastool_scaffolds2bin_ungzipped -c ./tests/config/nextflow.config - tags: - - dastool - - dastool/scaffolds2bin - files: - - path: output/dastool/test.tsv - md5sum: 6e46c0be14dded7cb13af38f54feea47 - - path: output/dastool/versions.yml