diff --git a/CHANGELOG.md b/CHANGELOG.md index 75bb2021..39bc4205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Changed` +- [#111](https://github.com/nf-core/bacass/pull/111) - Update nf-core/bacass to 2.12, and [#117](https://github.com/nf-core/bacass/pull/117) to 2.13.1 `TEMPLATE`. +- [#120](https://github.com/nf-core/bacass/pull/120) - Update local and nf-core modules (version update an minnor code changes). + ### `Added` - [#104](https://github.com/nf-core/bacass/pull/104), [#106](https://github.com/nf-core/bacass/pull/106) - Added dragonflye module and enbled draft genome polishing with short-reads. -- [#111](https://github.com/nf-core/bacass/pull/111) - Update nf-core/bacass to 2.12, and [#117](https://github.com/nf-core/bacass/pull/117) to 2.13.1 `TEMPLATE`. ### `Fixed` diff --git a/modules.json b/modules.json index d52cac22..1a559c15 100644 --- a/modules.json +++ b/modules.json @@ -7,12 +7,12 @@ "nf-core": { "bakta/bakta": { "branch": "master", - "git_sha": "f05fa7c6753f92be861d606378860dcd5c828880", + "git_sha": "9d0f89b445e1f5b2fb30476f4be9a8b519c07846", "installed_by": ["modules"] }, "bakta/baktadbdownload": { "branch": "master", - "git_sha": "516189e968feb4ebdd9921806988b4c12b4ac2dc", + "git_sha": "7c06e6820fa3918bc28a040e794f8a2b39fabadb", "installed_by": ["modules"] }, "canu": { @@ -22,13 +22,13 @@ }, "dragonflye": { "branch": "master", - "git_sha": "516189e968feb4ebdd9921806988b4c12b4ac2dc", + "git_sha": "a3ae45e99f68e513b0feb8d5f27e2fdd0d0f083d", "installed_by": ["modules"], "patch": "modules/nf-core/dragonflye/dragonflye.diff" }, "fastp": { "branch": "master", - "git_sha": "003920c7f9a8ae19b69a97171922880220bedf56", + "git_sha": "95cf5fe0194c7bf5cb0e3027a2eb7e7c89385080", "installed_by": ["fastq_trim_fastp_fastqc"] }, "fastqc": { @@ -38,22 +38,22 @@ }, "gunzip": { "branch": "master", - "git_sha": "e06548bfa36ee31869b81041879dd6b3a83b1d57", + "git_sha": "3a5fef109d113b4997c9822198664ca5f2716208", "installed_by": ["modules"] }, "kraken2/kraken2": { "branch": "master", - "git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220", + "git_sha": "653218e79ffa76fde20319e9062f8b8da5cf7555", "installed_by": ["modules"] }, "miniasm": { "branch": "master", - "git_sha": "911696ea0b62df80e900ef244d7867d177971f73", + "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", "installed_by": ["modules"] }, "minimap2/align": { "branch": "master", - "git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220", + "git_sha": "2c2d1cf80866dbd6dd0ea5d61ddd59533a72d41e", "installed_by": ["modules"] }, "multiqc": { @@ -63,43 +63,43 @@ }, "nanoplot": { "branch": "master", - "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", + "git_sha": "a31407dfaf0cb0d04768d5cb439fc6f4523a6981", "installed_by": ["modules"], "patch": "modules/nf-core/nanoplot/nanoplot.diff" }, "porechop/porechop": { "branch": "master", - "git_sha": "911696ea0b62df80e900ef244d7867d177971f73", + "git_sha": "1d68c7f248d1a480c5959548a9234602b771199e", "installed_by": ["modules"] }, "prokka": { "branch": "master", - "git_sha": "911696ea0b62df80e900ef244d7867d177971f73", + "git_sha": "49ebda931c36c2b282f7958d00e1236b751f1031", "installed_by": ["modules"] }, "quast": { "branch": "master", - "git_sha": "344638191a5d6b3526556410819dfcf24e98039e", + "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", "installed_by": ["modules"] }, "racon": { "branch": "master", - "git_sha": "911696ea0b62df80e900ef244d7867d177971f73", + "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", "installed_by": ["modules"] }, "samtools/index": { "branch": "master", - "git_sha": "911696ea0b62df80e900ef244d7867d177971f73", + "git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62", "installed_by": ["modules"] }, "samtools/sort": { "branch": "master", - "git_sha": "a0f7be95788366c1923171e358da7d049eb440f9", + "git_sha": "4352dbdb09ec40db71e9b172b97a01dcf5622c26", "installed_by": ["modules"] }, "untar": { "branch": "master", - "git_sha": "d0b4fc03af52a1cc8c6fb4493b921b57352b1dd8", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", "installed_by": ["modules"] } } diff --git a/modules/local/dfast/environment.yml b/modules/local/dfast/environment.yml new file mode 100644 index 00000000..f5542598 --- /dev/null +++ b/modules/local/dfast/environment.yml @@ -0,0 +1,7 @@ +name: dfast +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::dfast=1.2.20 diff --git a/modules/local/dfast.nf b/modules/local/dfast/main.nf similarity index 96% rename from modules/local/dfast.nf rename to modules/local/dfast/main.nf index db7be3da..3d82b660 100644 --- a/modules/local/dfast.nf +++ b/modules/local/dfast/main.nf @@ -2,7 +2,7 @@ process DFAST { tag "$meta.id" label 'process_medium' - conda "bioconda::dfast=1.2.20" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/dfast:1.2.20--h43eeafb_0' : 'biocontainers/dfast:1.2.20--h43eeafb_0' }" diff --git a/modules/local/kraken2_db_preparation/environment.yml b/modules/local/kraken2_db_preparation/environment.yml new file mode 100644 index 00000000..01258158 --- /dev/null +++ b/modules/local/kraken2_db_preparation/environment.yml @@ -0,0 +1,7 @@ +name: kraken2_db_preparation +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::sed=4.7 diff --git a/modules/local/kraken2_db_preparation.nf b/modules/local/kraken2_db_preparation/main.nf similarity index 56% rename from modules/local/kraken2_db_preparation.nf rename to modules/local/kraken2_db_preparation/main.nf index d2af01b6..110383e6 100644 --- a/modules/local/kraken2_db_preparation.nf +++ b/modules/local/kraken2_db_preparation/main.nf @@ -2,16 +2,17 @@ process KRAKEN2_DB_PREPARATION { tag "${db.simpleName}" label 'process_low' - conda 'conda-forge::sed=4.7' + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://containers.biocontainers.pro/s3/SingImgsRepo/biocontainers/v1.2.0_cv1/biocontainers_v1.2.0_cv1.img' : - 'docker.io/biocontainers/biocontainers:v1.2.0_cv1' }" + 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : + 'nf-core/ubuntu:20.04' }" input: path db output: tuple val("${db.simpleName}"), path("database"), emit: db + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -22,5 +23,10 @@ process KRAKEN2_DB_PREPARATION { tar -xf "${db}" -C db_tmp mkdir database mv `find db_tmp/ -name "*.k2d"` database/ + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + tar: \$(tar --version | sed -n 's/^tar (GNU tar) \$([0-9.]*\$).*/\$1/p') + END_VERSIONS """ } diff --git a/modules/local/medaka/environment.yml b/modules/local/medaka/environment.yml new file mode 100644 index 00000000..4b9b96bd --- /dev/null +++ b/modules/local/medaka/environment.yml @@ -0,0 +1,7 @@ +name: medaka +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - medaka=1.4.3-0 diff --git a/modules/local/medaka.nf b/modules/local/medaka/main.nf similarity index 97% rename from modules/local/medaka.nf rename to modules/local/medaka/main.nf index e57666a8..7cc540be 100644 --- a/modules/local/medaka.nf +++ b/modules/local/medaka/main.nf @@ -2,7 +2,7 @@ process MEDAKA { tag "$meta.id" label 'process_high' - conda 'medaka=1.4.3-0' + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/medaka:1.4.3--py38h130def0_0' : 'biocontainers/medaka:1.4.3--py38h130def0_0' }" diff --git a/modules/local/nanopolish/environment.yml b/modules/local/nanopolish/environment.yml new file mode 100644 index 00000000..ef8827ae --- /dev/null +++ b/modules/local/nanopolish/environment.yml @@ -0,0 +1,7 @@ +name: nanopolish +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::nanopolish=0.14.0 diff --git a/modules/local/nanopolish.nf b/modules/local/nanopolish/main.nf similarity index 96% rename from modules/local/nanopolish.nf rename to modules/local/nanopolish/main.nf index 34ca78d3..59f4f166 100644 --- a/modules/local/nanopolish.nf +++ b/modules/local/nanopolish/main.nf @@ -2,7 +2,7 @@ process NANOPOLISH { tag "$meta.id" label 'process_high' - conda "bioconda::nanopolish=0.14.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/nanopolish:0.14.0--h773013f_3' : 'biocontainers/nanopolish:0.14.0--h773013f_3' }" diff --git a/modules/local/pycoqc/environment.yml b/modules/local/pycoqc/environment.yml new file mode 100644 index 00000000..c2a3a4d1 --- /dev/null +++ b/modules/local/pycoqc/environment.yml @@ -0,0 +1,7 @@ +name: pycoqc +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::pycoqc=2.5.2 diff --git a/modules/local/pycoqc.nf b/modules/local/pycoqc/main.nf similarity index 97% rename from modules/local/pycoqc.nf rename to modules/local/pycoqc/main.nf index c3edb434..d2db37a1 100644 --- a/modules/local/pycoqc.nf +++ b/modules/local/pycoqc/main.nf @@ -1,7 +1,7 @@ process PYCOQC { label 'process_medium' - conda "bioconda::pycoqc=2.5.2" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/pycoqc:2.5.2--py_0' : 'biocontainers/pycoqc:2.5.2--py_0' }" diff --git a/modules/local/unicycler/environment.yml b/modules/local/unicycler/environment.yml new file mode 100644 index 00000000..9e32bbc5 --- /dev/null +++ b/modules/local/unicycler/environment.yml @@ -0,0 +1,7 @@ +name: unicycler +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - unicycler=0.4.8 diff --git a/modules/local/unicycler.nf b/modules/local/unicycler/main.nf similarity index 97% rename from modules/local/unicycler.nf rename to modules/local/unicycler/main.nf index 8a045827..eea72381 100644 --- a/modules/local/unicycler.nf +++ b/modules/local/unicycler/main.nf @@ -2,7 +2,7 @@ process UNICYCLER { tag "$meta.id" label 'process_high' - conda "bioconda::unicycler=0.4.8" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/unicycler:0.4.8--py38h8162308_3' : 'biocontainers/unicycler:0.4.8--py38h8162308_3' }" diff --git a/modules/nf-core/bakta/bakta/environment.yml b/modules/nf-core/bakta/bakta/environment.yml new file mode 100644 index 00000000..efb92265 --- /dev/null +++ b/modules/nf-core/bakta/bakta/environment.yml @@ -0,0 +1,7 @@ +name: bakta_bakta +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::bakta=1.9.3 diff --git a/modules/nf-core/bakta/bakta/main.nf b/modules/nf-core/bakta/bakta/main.nf index fd0b76f2..9a32c3da 100644 --- a/modules/nf-core/bakta/bakta/main.nf +++ b/modules/nf-core/bakta/bakta/main.nf @@ -2,10 +2,10 @@ process BAKTA_BAKTA { tag "$meta.id" label 'process_medium' - conda "bioconda::bakta=1.8.2" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bakta:1.8.2--pyhdfd78af_0' : - 'biocontainers/bakta:1.8.2--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/bakta:1.9.3--pyhdfd78af_0' : + 'biocontainers/bakta:1.9.3--pyhdfd78af_0' }" input: tuple val(meta), path(fasta) diff --git a/modules/nf-core/bakta/bakta/meta.yml b/modules/nf-core/bakta/bakta/meta.yml index 0dfa07e2..c0e53e2a 100644 --- a/modules/nf-core/bakta/bakta/meta.yml +++ b/modules/nf-core/bakta/bakta/meta.yml @@ -12,7 +12,6 @@ tools: tool_dev_url: https://github.com/oschwengers/bakta doi: "10.1099/mgen.0.000685" licence: ["GPL v3"] - input: - meta: type: map @@ -33,7 +32,6 @@ input: - prodigal_tf: type: file description: Training file to use for Prodigal (optional) - output: - meta: type: map @@ -84,8 +82,11 @@ output: type: file description: hypothetical protein CDS amino acid sequences as FASTA pattern: "*.hypotheticals.faa" - authors: - "@rpetit3" - "@oschwengers" - "@jfy133" +maintainers: + - "@rpetit3" + - "@oschwengers" + - "@jfy133" diff --git a/modules/nf-core/bakta/bakta/tests/main.nf.test b/modules/nf-core/bakta/bakta/tests/main.nf.test new file mode 100644 index 00000000..bdceb16e --- /dev/null +++ b/modules/nf-core/bakta/bakta/tests/main.nf.test @@ -0,0 +1,83 @@ +nextflow_process { + + name "Test Process BAKTA_BAKTA" + script "../main.nf" + config "./nextflow.config" + process "BAKTA_BAKTA" + + tag "modules" + tag "modules_nfcore" + tag "bakta" + tag "bakta/bakta" + tag "bakta/baktadbdownload" + + test("Bakta - bacteroides_fragilis - genome.fasta") { + + setup { + run("BAKTA_BAKTADBDOWNLOAD") { + script "../../baktadbdownload/main.nf" + process { + """ + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['bacteroides_fragilis']['illumina']['test1_contigs_fa_gz'], checkIfExists: true) + ] + input[1] = BAKTA_BAKTADBDOWNLOAD.out.db + input[2] = [] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.embl.get(0).get(1)).text.contains("/translation=\"MKNTLKIAILLIAIISMGHWMPVKQVCDLNSLSLQNVEALANGET") }, + { assert path(process.out.faa.get(0).get(1)).text.contains("MKNTLKIAILLIAIISMGHWMPVKQVCDLNSLSLQNVEALANGETPNYTFCIGAGSVDCPIQHDKVKYVSQGFSLDY") }, + { assert path(process.out.ffn.get(0).get(1)).text.contains("ATGAAAAACACTTTAAAAATAGCTATTCTTCTTATTGCTATTATTTCTATGGGGCATTGGATGCCTGTAAAACAAGT") }, + { assert path(process.out.fna.get(0).get(1)).text.contains("TCTTTTTACTCATAATCTACTTTTATGATGTTAATTATTTTTTCCGTGTCTCTCTTTCGG") }, + { assert path(process.out.gbff.get(0).get(1)).text.contains("/translation=\"MKNTLKIAILLIAIISMGHWMPVKQVCDLNSLSLQNVEALANGET") }, + { assert path(process.out.gff.get(0).get(1)).text.contains("##sequence-region contig_1 1 2926") }, + { assert path(process.out.hypotheticals_tsv.get(0).get(1)).text.contains("#Annotated with Bakta") }, + { assert path(process.out.hypotheticals_faa.get(0).get(1)).text.contains("MKNLILVLGCFFFLISCQQTEKEKLEELVKNWNGKEVLL") }, + { assert path(process.out.tsv.get(0).get(1)).text.contains("SO:0001217, UniRef:UniRef50_A0A0I9S7A3") }, + { assert path(process.out.txt.get(0).get(1)).text.contains("Length: 1739120") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + test("Bakta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [[id: 'stub'],file('stub')] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/bakta/bakta/tests/main.nf.test.snap b/modules/nf-core/bakta/bakta/tests/main.nf.test.snap new file mode 100644 index 00000000..40e30c36 --- /dev/null +++ b/modules/nf-core/bakta/bakta/tests/main.nf.test.snap @@ -0,0 +1,191 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,f8b70ceb2a328c25a190699384e6152d" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-14T09:11:06.657602394" + }, + "Bakta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "stub" + }, + "stub.embl:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "stub" + }, + "stub.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "10": [ + "versions.yml:md5,f8b70ceb2a328c25a190699384e6152d" + ], + "2": [ + [ + { + "id": "stub" + }, + "stub.ffn:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "stub" + }, + "stub.fna:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "stub" + }, + "stub.gbff:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "stub" + }, + "stub.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + [ + { + "id": "stub" + }, + "stub.hypotheticals.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "stub" + }, + "stub.hypotheticals.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + [ + { + "id": "stub" + }, + "stub.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "9": [ + [ + { + "id": "stub" + }, + "stub.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "embl": [ + [ + { + "id": "stub" + }, + "stub.embl:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "faa": [ + [ + { + "id": "stub" + }, + "stub.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "ffn": [ + [ + { + "id": "stub" + }, + "stub.ffn:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fna": [ + [ + { + "id": "stub" + }, + "stub.fna:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "gbff": [ + [ + { + "id": "stub" + }, + "stub.gbff:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "gff": [ + [ + { + "id": "stub" + }, + "stub.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "hypotheticals_faa": [ + [ + { + "id": "stub" + }, + "stub.hypotheticals.faa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "hypotheticals_tsv": [ + [ + { + "id": "stub" + }, + "stub.hypotheticals.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tsv": [ + [ + { + "id": "stub" + }, + "stub.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "txt": [ + [ + { + "id": "stub" + }, + "stub.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,f8b70ceb2a328c25a190699384e6152d" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-14T09:11:15.532858932" + } +} \ No newline at end of file diff --git a/modules/nf-core/bakta/bakta/tests/nextflow.config b/modules/nf-core/bakta/bakta/tests/nextflow.config new file mode 100644 index 00000000..9af0dde1 --- /dev/null +++ b/modules/nf-core/bakta/bakta/tests/nextflow.config @@ -0,0 +1,11 @@ +process { + + withName: 'BAKTA_BAKTADBDOWNLOAD' { + ext.args = "--type light" + } + + withName: 'BAKTA_BAKTA' { + memory = 7.GB + } + +} diff --git a/modules/nf-core/bakta/bakta/tests/tags.yml b/modules/nf-core/bakta/bakta/tests/tags.yml new file mode 100644 index 00000000..ecb08c45 --- /dev/null +++ b/modules/nf-core/bakta/bakta/tests/tags.yml @@ -0,0 +1,2 @@ +bakta/bakta: + - "modules/nf-core/bakta/bakta/**" diff --git a/modules/nf-core/bakta/baktadbdownload/environment.yml b/modules/nf-core/bakta/baktadbdownload/environment.yml index 102348df..f6a53ff7 100644 --- a/modules/nf-core/bakta/baktadbdownload/environment.yml +++ b/modules/nf-core/bakta/baktadbdownload/environment.yml @@ -1,6 +1,7 @@ +name: bakta_baktadbdownload channels: - conda-forge - bioconda - defaults dependencies: - - bioconda::bakta=1.8.2 + - bioconda::bakta=1.9.3 diff --git a/modules/nf-core/bakta/baktadbdownload/main.nf b/modules/nf-core/bakta/baktadbdownload/main.nf index 4c111045..e512d77d 100644 --- a/modules/nf-core/bakta/baktadbdownload/main.nf +++ b/modules/nf-core/bakta/baktadbdownload/main.nf @@ -1,10 +1,10 @@ process BAKTA_BAKTADBDOWNLOAD { label 'process_single' - conda 'modules/nf-core/bakta/baktadbdownload/environment.yml' + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bakta:1.8.2--pyhdfd78af_0' : - 'biocontainers/bakta:1.8.2--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/bakta:1.9.3--pyhdfd78af_0' : + 'biocontainers/bakta:1.9.3--pyhdfd78af_0' }" output: path "db*" , emit: db diff --git a/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test new file mode 100644 index 00000000..a5f827f9 --- /dev/null +++ b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test @@ -0,0 +1,55 @@ +nextflow_process { + + name "Test Process BAKTA_BAKTADBDOWNLOAD" + script "../main.nf" + process "BAKTA_BAKTADBDOWNLOAD" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "bakta" + tag "bakta/baktadbdownload" + + test("Bakta database download") { + + when { + process { + """ + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.db.get(0)).exists() }, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("Bakta database download - stub") { + + options "-stub" + + when { + process { + """ + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.db + + process.out.versions + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap new file mode 100644 index 00000000..b1c82267 --- /dev/null +++ b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap @@ -0,0 +1,29 @@ +{ + "Bakta database download": { + "content": [ + [ + "versions.yml:md5,df9b091b08a41b7d5eef95727b7eac29" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T11:34:41.812416438" + }, + "Bakta database download - stub": { + "content": [ + [ + [ + + ], + "versions.yml:md5,df9b091b08a41b7d5eef95727b7eac29" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T11:35:01.082923401" + } +} \ No newline at end of file diff --git a/modules/nf-core/bakta/baktadbdownload/tests/nextflow.config b/modules/nf-core/bakta/baktadbdownload/tests/nextflow.config new file mode 100644 index 00000000..8b99646a --- /dev/null +++ b/modules/nf-core/bakta/baktadbdownload/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: 'BAKTA_BAKTADBDOWNLOAD' { + ext.args = "--type light" + } + +} diff --git a/modules/nf-core/bakta/baktadbdownload/tests/tags.yml b/modules/nf-core/bakta/baktadbdownload/tests/tags.yml new file mode 100644 index 00000000..c469fa48 --- /dev/null +++ b/modules/nf-core/bakta/baktadbdownload/tests/tags.yml @@ -0,0 +1,2 @@ +bakta/baktadbdownload: + - "modules/nf-core/bakta/baktadbdownload/**" diff --git a/modules/nf-core/dragonflye/environment.yml b/modules/nf-core/dragonflye/environment.yml index 7899d46d..21a90517 100644 --- a/modules/nf-core/dragonflye/environment.yml +++ b/modules/nf-core/dragonflye/environment.yml @@ -1,3 +1,4 @@ +name: dragonflye channels: - conda-forge - bioconda diff --git a/modules/nf-core/dragonflye/main.nf b/modules/nf-core/dragonflye/main.nf index 4ed9f7f0..f4339c91 100644 --- a/modules/nf-core/dragonflye/main.nf +++ b/modules/nf-core/dragonflye/main.nf @@ -2,7 +2,7 @@ process DRAGONFLYE { tag "$meta.id" label 'process_medium' - conda 'modules/nf-core/dragonflye/environment.yml' + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/dragonflye:1.1.2--hdfd78af_0' : 'biocontainers/dragonflye:1.1.2--hdfd78af_0' }" @@ -11,27 +11,27 @@ process DRAGONFLYE { tuple val(meta), path(shortreads), path(longreads) output: - tuple val(meta), path("*.contigs.fa") , emit: contigs - tuple val(meta), path("dragonflye.log") , emit: log - tuple val(meta), path("{flye,miniasm,raven}.fasta") , emit: raw_contigs - tuple val(meta), path("{flye,miniasm,raven}-unpolished.gfa"), optional:true, emit: gfa - tuple val(meta), path("flye-info.txt"), optional:true , emit: txt - path "versions.yml" , emit: versions + tuple val(meta), path("*.fa") , emit: contigs + tuple val(meta), path("dragonflye.log") , emit: log + tuple val(meta), path("{flye,miniasm,raven}.fasta") , emit: raw_contigs + tuple val(meta), path("{flye,miniasm,raven}-unpolished.gfa"), optional:true , emit: gfa + tuple val(meta), path("flye-info.txt") , optional:true , emit: txt + 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 memory = task.memory.toGiga() - def short_polishing = shortreads ? "--R1 ${shortreads[0]} --R2 ${shortreads[1]}" : '' + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def memory = task.memory.toGiga() + def shortreads_polishing = shortreads ? "--R1 ${shortreads[0]} --R2 ${shortreads[1]}" : '' """ dragonflye \\ --reads ${longreads} \\ - $short_polishing \\ + $shortreads_polishing \\ $args \\ - --prefix ${prefix}.contigs \\ + --prefix ${prefix} \\ --cpus $task.cpus \\ --ram $memory \\ --outdir ./ \\ diff --git a/modules/nf-core/dragonflye/meta.yml b/modules/nf-core/dragonflye/meta.yml index 4c3b9405..60ccad45 100644 --- a/modules/nf-core/dragonflye/meta.yml +++ b/modules/nf-core/dragonflye/meta.yml @@ -16,9 +16,14 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - reads: + - shortreads: type: file - description: Input Nanopore FASTQ file. Optional, additional Illumina FASTQ files can be provided to perform short reads polishing. + description: | + Optional. List of FastQ files of short reads (paired-end data) that will be used to polish the draft genome. + pattern: "*.fastq.gz" + - longreads: + type: file + description: Input Nanopore FASTQ file pattern: "*.fastq.gz" output: - meta: @@ -33,7 +38,7 @@ output: - contigs: type: file description: The final assembly produced by Dragonflye - pattern: "contigs.fa" + pattern: "*.fa" - log: type: file description: Full log file for bug reporting @@ -49,7 +54,7 @@ output: - gfa: type: file description: Assembly graph produced by Miniasm, or Raven - pattern: "{miniasm,raven}-unpolished.gfa" + pattern: "{flye,miniasm,raven}-unpolished.gfa" authors: - "@rpetit3" maintainers: diff --git a/modules/nf-core/dragonflye/tests/main.nf.test b/modules/nf-core/dragonflye/tests/main.nf.test index 1eadc7f4..46f2a550 100644 --- a/modules/nf-core/dragonflye/tests/main.nf.test +++ b/modules/nf-core/dragonflye/tests/main.nf.test @@ -19,7 +19,8 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - [ file("https://github.com/nf-core/test-datasets/raw/bacass/nanopore/subset15000.fq.gz", checkIfExists: true) ] + [], + file("https://github.com/nf-core/test-datasets/raw/bacass/nanopore/subset15000.fq.gz", checkIfExists: true) ] """ } @@ -32,7 +33,7 @@ nextflow_process { { assert snapshot(process.out.gfa).match("miniasm_gfa") }, { assert snapshot(process.out.versions).match("versions") }, // MD5sum not reproducible (timestamp, contig order) - { assert new File("${outputDir}/dragonflye/contigs.fa").exists() }, + { assert new File("${outputDir}/dragonflye/test.fa").exists() }, { assert new File("${outputDir}/dragonflye/dragonflye.log").exists() } ) @@ -53,7 +54,8 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - [ file("https://github.com/nf-core/test-datasets/raw/bacass/nanopore/subset15000.fq.gz", checkIfExists: true) ] + [], + file("https://github.com/nf-core/test-datasets/raw/bacass/nanopore/subset15000.fq.gz", checkIfExists: true) ] """ } @@ -64,7 +66,7 @@ nextflow_process { { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, // MD5sum not reproducible (timestamp, contig order) - { assert new File("${outputDir}/dragonflye/contigs.fa").exists() }, + { assert new File("${outputDir}/dragonflye/test.fa").exists() }, { assert new File("${outputDir}/dragonflye/dragonflye.log").exists() }, { assert new File("${outputDir}/dragonflye/raven.fasta").exists() }, { assert new File("${outputDir}/dragonflye/raven-unpolished.gfa").exists() }, @@ -75,4 +77,36 @@ nextflow_process { } + test("Dragonflye hybrid") { + config "./nextflow.hybrid.config" + + when { + params { + outdir = "$outputDir" + } + process { + """ + + input[0] = [ [ id:'test', single_end:false ], // meta map + [ file("https://github.com/nf-core/test-datasets/raw/bacass/A1403KPN_R1.fastq.gz"), file("https://github.com/nf-core/test-datasets/raw/bacass/A1403KPN_R2.fastq.gz") ], // short reads for polishing + file("https://github.com/nf-core/test-datasets/raw/bacass/nanopore/A1403KPN.fq.gz", checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.raw_contigs).match("hybrid_raw_contigs") }, + { assert snapshot(process.out.gfa).match("hybrid_gfa") }, + { assert snapshot(process.out.versions).match("versions") }, + // MD5sum not reproducible (timestamp, contig order) + { assert new File("${outputDir}/dragonflye/test.fa").exists() }, + { assert new File("${outputDir}/dragonflye/dragonflye.log").exists() } + + ) + } + + } } diff --git a/modules/nf-core/dragonflye/tests/main.nf.test.snap b/modules/nf-core/dragonflye/tests/main.nf.test.snap index 64acac41..64461756 100644 --- a/modules/nf-core/dragonflye/tests/main.nf.test.snap +++ b/modules/nf-core/dragonflye/tests/main.nf.test.snap @@ -2,10 +2,10 @@ "versions": { "content": [ [ - "versions.yml:md5,96447a7a742e9ea4f497dd4d19bf5d1b" + "versions.yml:md5,308f2552548d82b74ed923e3b7fd0c87" ] ], - "timestamp": "2023-10-19T08:04:24.882463835" + "timestamp": "2023-11-10 13:25:06.318835345+0100" }, "miniasm_raw_contigs": { "content": [ @@ -34,5 +34,33 @@ ] ], "timestamp": "2023-10-19T08:04:24.863920486" + }, + "hybrid_raw_contigs": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "miniasm.fasta:md5,2975f61771d44f9f5758be05391e95bb" + ] + ] + ], + "timestamp": "2023-11-10 13:55:33.902108477+0100" + }, + "hybrid_gfa": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "miniasm-unpolished.gfa:md5,582c59bd7eb9af1fec673d4ecf1772e9" + ] + ] + ], + "timestamp": "2023-11-10 13:54:30.857934106+0100" } -} \ No newline at end of file +} diff --git a/modules/nf-core/dragonflye/tests/nextflow.hybrid.config b/modules/nf-core/dragonflye/tests/nextflow.hybrid.config new file mode 100644 index 00000000..683cf8ab --- /dev/null +++ b/modules/nf-core/dragonflye/tests/nextflow.hybrid.config @@ -0,0 +1,4 @@ +process { + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + ext.args = '--assembler miniasm -gsize 5000000' +} diff --git a/modules/nf-core/fastp/main.nf b/modules/nf-core/fastp/main.nf index 2a3b679e..4fc19b74 100644 --- a/modules/nf-core/fastp/main.nf +++ b/modules/nf-core/fastp/main.nf @@ -29,7 +29,7 @@ process FASTP { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def adapter_list = adapter_fasta ? "--adapter_fasta ${adapter_fasta}" : "" - def fail_fastq = save_trimmed_fail && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : save_trimmed_fail && !meta.single_end ? "--unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : '' + def fail_fastq = save_trimmed_fail && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : save_trimmed_fail && !meta.single_end ? "--failed_out ${prefix}.paired.fail.fastq.gz --unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : '' // Added soft-links to original fastqs for consistent naming in MultiQC // Use single ended for interleaved. Add --interleaved_in in config. if ( task.ext.args?.contains('--interleaved_in') ) { diff --git a/modules/nf-core/fastp/tests/main.nf.test b/modules/nf-core/fastp/tests/main.nf.test index 9b3f9a38..6f1f4897 100644 --- a/modules/nf-core/fastp/tests/main.nf.test +++ b/modules/nf-core/fastp/tests/main.nf.test @@ -251,7 +251,8 @@ nextflow_process { } test("fastp test_fastp_interleaved") { - config './nextflow.config' + + config './nextflow.interleaved.config' when { params { outdir = "$outputDir" @@ -277,7 +278,7 @@ nextflow_process { def html_text = [ "Q20 bases:25.719000 K (93.033098%)", "paired end (151 cycles + 151 cycles)"] def log_text = [ "Q20 bases: 12922(92.9841%)", - "reads passed filter: 198"] + "reads passed filter: 162"] def read_lines = [ "@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads_fail.get(0).get(1).get(1)).linesGzip.contains(failed_read2_line) } + { assert path(process.out.reads_fail.get(0).get(1).get(2)).linesGzip.contains(failed_read2_line) } } }, { html_text.each { html_part -> diff --git a/modules/nf-core/fastp/tests/main.nf.test.snap b/modules/nf-core/fastp/tests/main.nf.test.snap index b4c0e1dd..3e876288 100644 --- a/modules/nf-core/fastp/tests/main.nf.test.snap +++ b/modules/nf-core/fastp/tests/main.nf.test.snap @@ -7,7 +7,7 @@ "id": "test", "single_end": true }, - "test.fastp.json:md5,168f516f7bd4b7b6c32da7cba87299a4" + "test.fastp.json:md5,b24e0624df5cc0b11cd5ba21b726fb22" ] ] ], @@ -15,7 +15,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-17T18:08:06.123035" + "timestamp": "2024-03-18T16:19:15.063001" }, "test_fastp_paired_end_merged-for_stub_match": { "content": [ @@ -65,7 +65,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-17T18:06:00.223817" + "timestamp": "2024-03-18T16:18:43.526412" }, "versions_paired_end": { "content": [ @@ -112,7 +112,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-01T12:03:37.827323085" + "timestamp": "2024-03-18T16:19:15.111894" }, "test_fastp_paired_end_merged_match": { "content": [ @@ -283,7 +283,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-01T11:57:30.791982648" + "timestamp": "2024-03-18T16:18:43.580336" }, "versions_paired_end_merged_adapterlist": { "content": [ diff --git a/modules/nf-core/fastp/tests/nextflow.interleaved.config b/modules/nf-core/fastp/tests/nextflow.interleaved.config new file mode 100644 index 00000000..4be8dbd2 --- /dev/null +++ b/modules/nf-core/fastp/tests/nextflow.interleaved.config @@ -0,0 +1,5 @@ +process { + withName: FASTP { + ext.args = "--interleaved_in -e 30" + } +} diff --git a/modules/nf-core/fastp/tests/nextflow.config b/modules/nf-core/fastp/tests/nextflow.save_failed.config similarity index 50% rename from modules/nf-core/fastp/tests/nextflow.config rename to modules/nf-core/fastp/tests/nextflow.save_failed.config index 0f7849ad..53b61b0c 100644 --- a/modules/nf-core/fastp/tests/nextflow.config +++ b/modules/nf-core/fastp/tests/nextflow.save_failed.config @@ -1,6 +1,5 @@ process { - withName: FASTP { - ext.args = "--interleaved_in" + ext.args = "-e 30" } } diff --git a/modules/nf-core/gunzip/environment.yml b/modules/nf-core/gunzip/environment.yml new file mode 100644 index 00000000..25910b34 --- /dev/null +++ b/modules/nf-core/gunzip/environment.yml @@ -0,0 +1,7 @@ +name: gunzip +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::sed=4.7 diff --git a/modules/nf-core/gunzip/main.nf b/modules/nf-core/gunzip/main.nf index 73bf08cd..468a6f28 100644 --- a/modules/nf-core/gunzip/main.nf +++ b/modules/nf-core/gunzip/main.nf @@ -2,7 +2,7 @@ process GUNZIP { tag "$archive" label 'process_single' - conda "conda-forge::sed=4.7" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : 'nf-core/ubuntu:20.04' }" diff --git a/modules/nf-core/gunzip/meta.yml b/modules/nf-core/gunzip/meta.yml index 4cdcdf4c..231034f2 100644 --- a/modules/nf-core/gunzip/meta.yml +++ b/modules/nf-core/gunzip/meta.yml @@ -33,3 +33,7 @@ authors: - "@joseespinosa" - "@drpatelh" - "@jfy133" +maintainers: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" diff --git a/modules/nf-core/gunzip/tests/main.nf.test b/modules/nf-core/gunzip/tests/main.nf.test new file mode 100644 index 00000000..6406008e --- /dev/null +++ b/modules/nf-core/gunzip/tests/main.nf.test @@ -0,0 +1,36 @@ +nextflow_process { + + name "Test Process GUNZIP" + script "../main.nf" + process "GUNZIP" + tag "gunzip" + tag "modules_nfcore" + tag "modules" + + test("Should run without failures") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gunzip/tests/main.nf.test.snap b/modules/nf-core/gunzip/tests/main.nf.test.snap new file mode 100644 index 00000000..720fd9ff --- /dev/null +++ b/modules/nf-core/gunzip/tests/main.nf.test.snap @@ -0,0 +1,31 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "1": [ + "versions.yml:md5,54376d32aca20e937a4ec26dac228e84" + ], + "gunzip": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "versions": [ + "versions.yml:md5,54376d32aca20e937a4ec26dac228e84" + ] + } + ], + "timestamp": "2023-10-17T15:35:37.690477896" + } +} \ No newline at end of file diff --git a/modules/nf-core/gunzip/tests/tags.yml b/modules/nf-core/gunzip/tests/tags.yml new file mode 100644 index 00000000..fd3f6915 --- /dev/null +++ b/modules/nf-core/gunzip/tests/tags.yml @@ -0,0 +1,2 @@ +gunzip: + - modules/nf-core/gunzip/** diff --git a/modules/nf-core/kraken2/kraken2/environment.yml b/modules/nf-core/kraken2/kraken2/environment.yml new file mode 100644 index 00000000..63be419b --- /dev/null +++ b/modules/nf-core/kraken2/kraken2/environment.yml @@ -0,0 +1,8 @@ +name: kraken2_kraken2 +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::kraken2=2.1.2 + - conda-forge::pigz=2.6 diff --git a/modules/nf-core/kraken2/kraken2/main.nf b/modules/nf-core/kraken2/kraken2/main.nf index da8d8c6d..92cd9c34 100644 --- a/modules/nf-core/kraken2/kraken2/main.nf +++ b/modules/nf-core/kraken2/kraken2/main.nf @@ -2,7 +2,7 @@ process KRAKEN2_KRAKEN2 { tag "$meta.id" label 'process_high' - conda "bioconda::kraken2=2.1.2 conda-forge::pigz=2.6" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/mulled-v2-5799ab18b5fc681e75923b2450abaa969907ec98:87fc08d11968d081f3e8a37131c1f1f6715b6542-0' : 'biocontainers/mulled-v2-5799ab18b5fc681e75923b2450abaa969907ec98:87fc08d11968d081f3e8a37131c1f1f6715b6542-0' }" @@ -55,4 +55,31 @@ process KRAKEN2_KRAKEN2 { pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def paired = meta.single_end ? "" : "--paired" + def classified = meta.single_end ? "${prefix}.classified.fastq.gz" : "${prefix}.classified_1.fastq.gz ${prefix}.classified_2.fastq.gz" + def unclassified = meta.single_end ? "${prefix}.unclassified.fastq.gz" : "${prefix}.unclassified_1.fastq.gz ${prefix}.unclassified_2.fastq.gz" + def readclassification_option = save_reads_assignment ? "--output ${prefix}.kraken2.classifiedreads.txt" : "--output /dev/null" + def compress_reads_command = save_output_fastqs ? "pigz -p $task.cpus *.fastq" : "" + + """ + touch ${prefix}.kraken2.report.txt + if [ "$save_output_fastqs" == "true" ]; then + touch $classified + touch $unclassified + fi + if [ "$save_reads_assignment" == "true" ]; then + touch ${prefix}.kraken2.classifiedreads.txt + fi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kraken2: \$(echo \$(kraken2 --version 2>&1) | sed 's/^.*Kraken version //; s/ .*\$//') + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ + } diff --git a/modules/nf-core/kraken2/kraken2/meta.yml b/modules/nf-core/kraken2/kraken2/meta.yml index 4721f45b..7909ffe7 100644 --- a/modules/nf-core/kraken2/kraken2/meta.yml +++ b/modules/nf-core/kraken2/kraken2/meta.yml @@ -73,3 +73,6 @@ output: authors: - "@joseespinosa" - "@drpatelh" +maintainers: + - "@joseespinosa" + - "@drpatelh" diff --git a/modules/nf-core/kraken2/kraken2/tests/main.nf.test b/modules/nf-core/kraken2/kraken2/tests/main.nf.test new file mode 100644 index 00000000..4c513021 --- /dev/null +++ b/modules/nf-core/kraken2/kraken2/tests/main.nf.test @@ -0,0 +1,143 @@ +nextflow_process { + name "Test Process KRAKEN2_KRAKEN2" + script "../main.nf" + process "KRAKEN2_KRAKEN2" + tag "modules" + tag "modules_nfcore" + tag "untar" + tag "kraken2" + tag "kraken2/kraken2" + + setup { + run("UNTAR") { + script "modules/nf-core/untar/main.nf" + process { + """ + input[0] = Channel.of([ + [], + file( + params.test_data['sarscov2']['genome']['kraken2_tar_gz'], + checkIfExists: true + ) + ]) + """ + } + } + } + + test("sarscov2 illumina single end [fastq]") { + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + [ file( + params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], + checkIfExists: true + )] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + input[2] = true + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.report, + process.out.versions, + ).match() + }, + { assert process.out.classified_reads_fastq.get(0).get(1) ==~ ".*/test.classified.fastq.gz" }, + { assert process.out.unclassified_reads_fastq.get(0).get(1) ==~ ".*/test.unclassified.fastq.gz" }, + ) + } + } + + test("sarscov2 illumina paired end [fastq]") { + when { + params { + outdir = "$outputDir" + } + + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file( + params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], + checkIfExists: true + ), + file( + params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], + checkIfExists: true + ) + + ] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + input[2] = true + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.report, + process.out.versions, + ).match() + }, + { assert process.out.classified_reads_fastq.get(0).get(1).get(0) + ==~ ".*/test.classified_1.fastq.gz" }, + { assert process.out.classified_reads_fastq.get(0).get(1).get(1) + ==~ ".*/test.classified_2.fastq.gz" }, + { assert process.out.unclassified_reads_fastq.get(0).get(1).get(0) + ==~ ".*/test.unclassified_1.fastq.gz" }, + { assert process.out.unclassified_reads_fastq.get(0).get(1).get(1) + ==~ ".*/test.unclassified_2.fastq.gz" }, + ) + } + } + + test("sarscov2 illumina single end [fastq] + save_reads_assignment") { + when { + params { + outdir = "$outputDir" + } + + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + [ file( + params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], + checkIfExists: true + )] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + input[2] = false + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.report, + process.out.classified_reads_assignment, + process.out.versions, + ).match() + }, + ) + } + } +} diff --git a/modules/nf-core/kraken2/kraken2/tests/main.nf.test.snap b/modules/nf-core/kraken2/kraken2/tests/main.nf.test.snap new file mode 100644 index 00000000..c1bdd0c6 --- /dev/null +++ b/modules/nf-core/kraken2/kraken2/tests/main.nf.test.snap @@ -0,0 +1,62 @@ +{ + "sarscov2 illumina single end [fastq]": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test.kraken2.report.txt:md5,4227755fe40478b8d7dc8634b489761e" + ] + ], + [ + "versions.yml:md5,bcb3e2520685846df02bb27cc6b1794b" + ] + ], + "timestamp": "2023-10-25T09:01:29.775797" + }, + "sarscov2 illumina paired end [fastq]": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.kraken2.report.txt:md5,4227755fe40478b8d7dc8634b489761e" + ] + ], + [ + "versions.yml:md5,bcb3e2520685846df02bb27cc6b1794b" + ] + ], + "timestamp": "2023-10-25T09:01:37.025389" + }, + "sarscov2 illumina single end [fastq] + save_reads_assignment": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test.kraken2.report.txt:md5,4227755fe40478b8d7dc8634b489761e" + ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "test.kraken2.classifiedreads.txt:md5,e7a90531f0d8d777316515c36fe4cae0" + ] + ], + [ + "versions.yml:md5,bcb3e2520685846df02bb27cc6b1794b" + ] + ], + "timestamp": "2023-10-25T09:01:45.775262" + } +} \ No newline at end of file diff --git a/modules/nf-core/kraken2/kraken2/tests/tags.yml b/modules/nf-core/kraken2/kraken2/tests/tags.yml new file mode 100644 index 00000000..9ebfd7ab --- /dev/null +++ b/modules/nf-core/kraken2/kraken2/tests/tags.yml @@ -0,0 +1,3 @@ +kraken2/kraken2: + - modules/nf-core/kraken2/kraken2/** + - modules/nf-core/untar/** diff --git a/modules/nf-core/miniasm/environment.yml b/modules/nf-core/miniasm/environment.yml new file mode 100644 index 00000000..34a35e5d --- /dev/null +++ b/modules/nf-core/miniasm/environment.yml @@ -0,0 +1,7 @@ +name: miniasm +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::miniasm=0.3_r179 diff --git a/modules/nf-core/miniasm/main.nf b/modules/nf-core/miniasm/main.nf index 99b44992..d4ee470e 100644 --- a/modules/nf-core/miniasm/main.nf +++ b/modules/nf-core/miniasm/main.nf @@ -2,7 +2,7 @@ process MINIASM { tag "$meta.id" label 'process_high' - conda "bioconda::miniasm=0.3_r179" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/miniasm:0.3_r179--h5bf99c6_2' : 'biocontainers/miniasm:0.3_r179--h5bf99c6_2' }" diff --git a/modules/nf-core/miniasm/meta.yml b/modules/nf-core/miniasm/meta.yml index 59865945..9387eea6 100644 --- a/modules/nf-core/miniasm/meta.yml +++ b/modules/nf-core/miniasm/meta.yml @@ -12,7 +12,6 @@ tools: tool_dev_url: https://github.com/lh3/miniasm doi: "10.1093/bioinformatics/btw152" licence: ["MIT"] - input: - meta: type: map @@ -27,7 +26,6 @@ input: type: file description: Alignment in PAF format pattern: "*{.paf,.paf.gz}" - output: - meta: type: map @@ -46,6 +44,7 @@ output: type: file description: Genome assembly pattern: "*.fasta.gz" - authors: - "@avantonder" +maintainers: + - "@avantonder" diff --git a/modules/nf-core/minimap2/align/environment.yml b/modules/nf-core/minimap2/align/environment.yml new file mode 100644 index 00000000..cf6e775f --- /dev/null +++ b/modules/nf-core/minimap2/align/environment.yml @@ -0,0 +1,9 @@ +name: minimap2_align +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::minimap2=2.24 + - bioconda::samtools=1.18 + - bioconda::htslib=1.18 diff --git a/modules/nf-core/minimap2/align/main.nf b/modules/nf-core/minimap2/align/main.nf index 4da47c18..661bd23d 100644 --- a/modules/nf-core/minimap2/align/main.nf +++ b/modules/nf-core/minimap2/align/main.nf @@ -3,14 +3,14 @@ process MINIMAP2_ALIGN { label 'process_medium' // Note: the versions here need to match the versions used in the mulled container below and minimap2/index - conda "bioconda::minimap2=2.24 bioconda::samtools=1.14" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:1679e915ddb9d6b4abda91880c4b48857d471bd8-0' : - 'biocontainers/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:1679e915ddb9d6b4abda91880c4b48857d471bd8-0' }" + 'https://depot.galaxyproject.org/singularity/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:365b17b986c1a60c1b82c6066a9345f38317b763-0' : + 'biocontainers/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:365b17b986c1a60c1b82c6066a9345f38317b763-0' }" input: tuple val(meta), path(reads) - path reference + tuple val(meta2), path(reference) val bam_format val cigar_paf_format val cigar_bam @@ -24,22 +24,35 @@ process MINIMAP2_ALIGN { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def bam_output = bam_format ? "-a | samtools sort | samtools view -@ ${task.cpus} -b -h -o ${prefix}.bam" : "-o ${prefix}.paf" + def bam_output = bam_format ? "-a | samtools sort -@ ${task.cpus} -o ${prefix}.bam ${args2}" : "-o ${prefix}.paf" def cigar_paf = cigar_paf_format && !bam_format ? "-c" : '' def set_cigar_bam = cigar_bam && bam_format ? "-L" : '' """ minimap2 \\ $args \\ -t $task.cpus \\ - "${reference ?: reads}" \\ - "$reads" \\ + ${reference ?: reads} \\ + $reads \\ $cigar_paf \\ $set_cigar_bam \\ $bam_output + cat <<-END_VERSIONS > versions.yml + "${task.process}": + minimap2: \$(minimap2 --version 2>&1) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + def output_file = bam_format ? "${prefix}.bam" : "${prefix}.paf" + """ + touch $output_file + cat <<-END_VERSIONS > versions.yml "${task.process}": minimap2: \$(minimap2 --version 2>&1) diff --git a/modules/nf-core/minimap2/align/meta.yml b/modules/nf-core/minimap2/align/meta.yml index 991b39a0..408522d5 100644 --- a/modules/nf-core/minimap2/align/meta.yml +++ b/modules/nf-core/minimap2/align/meta.yml @@ -25,6 +25,11 @@ input: description: | List of input FASTA or FASTQ files of size 1 and 2 for single-end and paired-end data, respectively. + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test_ref'] - reference: type: file description: | @@ -63,3 +68,8 @@ authors: - "@sofstam" - "@sateeshperi" - "@jfy133" +maintainers: + - "@heuermh" + - "@sofstam" + - "@sateeshperi" + - "@jfy133" diff --git a/modules/nf-core/minimap2/align/tests/main.nf.test b/modules/nf-core/minimap2/align/tests/main.nf.test new file mode 100644 index 00000000..4d77e0d9 --- /dev/null +++ b/modules/nf-core/minimap2/align/tests/main.nf.test @@ -0,0 +1,179 @@ +nextflow_process { + + name "Test Process MINIMAP2_ALIGN" + script "../main.nf" + process "MINIMAP2_ALIGN" + + tag "modules" + tag "modules_nfcore" + tag "minimap2" + tag "minimap2/align" + + test("sarscov2 - fastq, fasta, true, false, false") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + input[1] = [ + [ id:'test_ref' ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + input[2] = true + input[3] = false + input[4] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - [fastq1, fastq2], fasta, true, false, false") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) + ] + ] + input[1] = [ + [ id:'test_ref' ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + input[2] = true + input[3] = false + input[4] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastq, [], true, false, false") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + input[1] = [ + [ id:'test_ref' ], // meta map + [] + ] + input[2] = true + input[3] = false + input[4] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastq, fasta, true, false, false - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + input[1] = [ + [ id:'test_ref' ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + input[2] = true + input[3] = false + input[4] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastq, fasta, false, false, false - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + input[1] = [ + [ id:'test_ref' ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + input[2] = false + input[3] = false + input[4] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.paf[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/minimap2/align/tests/main.nf.test.snap b/modules/nf-core/minimap2/align/tests/main.nf.test.snap new file mode 100644 index 00000000..ec99d13e --- /dev/null +++ b/modules/nf-core/minimap2/align/tests/main.nf.test.snap @@ -0,0 +1,67 @@ +{ + "sarscov2 - fastq, fasta, true, false, false": { + "content": [ + "test.bam", + [ + "versions.yml:md5,9e9eeae0002d466d580a9d6e0d003eb1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2023-12-04T12:07:06.01315354" + }, + "sarscov2 - fastq, fasta, true, false, false - stub": { + "content": [ + "test.bam", + [ + "versions.yml:md5,9e9eeae0002d466d580a9d6e0d003eb1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2023-12-04T12:07:24.487175659" + }, + "sarscov2 - fastq, fasta, false, false, false - stub": { + "content": [ + "test.paf", + [ + "versions.yml:md5,9e9eeae0002d466d580a9d6e0d003eb1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-01T11:06:54.090105" + }, + "sarscov2 - [fastq1, fastq2], fasta, true, false, false": { + "content": [ + "test.bam", + [ + "versions.yml:md5,9e9eeae0002d466d580a9d6e0d003eb1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2023-12-04T12:07:12.50816279" + }, + "sarscov2 - fastq, [], true, false, false": { + "content": [ + "test.bam", + [ + "versions.yml:md5,9e9eeae0002d466d580a9d6e0d003eb1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2023-12-04T12:07:18.414974788" + } +} \ No newline at end of file diff --git a/modules/nf-core/minimap2/align/tests/tags.yml b/modules/nf-core/minimap2/align/tests/tags.yml new file mode 100644 index 00000000..39dba374 --- /dev/null +++ b/modules/nf-core/minimap2/align/tests/tags.yml @@ -0,0 +1,2 @@ +minimap2/align: + - "modules/nf-core/minimap2/align/**" diff --git a/modules/nf-core/nanoplot/main.nf b/modules/nf-core/nanoplot/main.nf index c011ae72..1124dfa7 100644 --- a/modules/nf-core/nanoplot/main.nf +++ b/modules/nf-core/nanoplot/main.nf @@ -32,6 +32,26 @@ process NANOPLOT { mv NanoStats.txt ${prefix}.txt + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nanoplot: \$(echo \$(NanoPlot --version 2>&1) | sed 's/^.*NanoPlot //; s/ .*\$//') + END_VERSIONS + """ + + stub: + """ + touch LengthvsQualityScatterPlot_dot.html + touch LengthvsQualityScatterPlot_kde.html + touch NanoPlot-report.html + touch NanoPlot_20240301_1130.log + touch NanoStats.txt + touch Non_weightedHistogramReadlength.html + touch Non_weightedLogTransformed_HistogramReadlength.html + touch WeightedHistogramReadlength.html + touch WeightedLogTransformed_HistogramReadlength.html + touch Yield_By_Length.html + + cat <<-END_VERSIONS > versions.yml "${task.process}": nanoplot: \$(echo \$(NanoPlot --version 2>&1) | sed 's/^.*NanoPlot //; s/ .*\$//') diff --git a/modules/nf-core/nanoplot/tests/main.nf.test b/modules/nf-core/nanoplot/tests/main.nf.test index d8dc6bc0..29b57c10 100644 --- a/modules/nf-core/nanoplot/tests/main.nf.test +++ b/modules/nf-core/nanoplot/tests/main.nf.test @@ -32,7 +32,7 @@ nextflow_process { with(process.out.html.get(0)) { assert get(1).collect { p -> file(p).getName() }.contains("NanoPlot-report.html") } - } + } ) } @@ -63,7 +63,30 @@ nextflow_process { with(process.out.html.get(0)) { assert get(1).collect { p -> file(p).getName() }.contains("NanoPlot-report.html") } - } + } + ) + } + + } + + test("NanoPlot - stub") { + + options "-stub" + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['nanopore']['test_sequencing_summary'], checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/nanoplot/tests/main.nf.test.snap b/modules/nf-core/nanoplot/tests/main.nf.test.snap index 1df28066..f7f8028a 100644 --- a/modules/nf-core/nanoplot/tests/main.nf.test.snap +++ b/modules/nf-core/nanoplot/tests/main.nf.test.snap @@ -1,4 +1,93 @@ { + "NanoPlot - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "LengthvsQualityScatterPlot_dot.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "LengthvsQualityScatterPlot_kde.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "NanoPlot-report.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Yield_By_Length.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test" + }, + "NanoStats.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "NanoPlot_20240301_1130.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" + ], + "html": [ + [ + { + "id": "test" + }, + [ + "LengthvsQualityScatterPlot_dot.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "LengthvsQualityScatterPlot_kde.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "NanoPlot-report.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Yield_By_Length.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "log": [ + [ + { + "id": "test" + }, + "NanoPlot_20240301_1130.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "png": [ + + ], + "txt": [ + [ + { + "id": "test" + }, + "NanoStats.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-01T14:54:18.083198" + }, "NanoPlot FASTQ": { "content": [ [ @@ -13,6 +102,10 @@ "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" ] ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, "timestamp": "2023-10-17T16:18:44.848688965" }, "NanoPlot summary": { @@ -29,6 +122,10 @@ "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" ] ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, "timestamp": "2023-10-17T16:18:31.104601192" } } \ No newline at end of file diff --git a/modules/nf-core/porechop/porechop/environment.yml b/modules/nf-core/porechop/porechop/environment.yml new file mode 100644 index 00000000..28b67c16 --- /dev/null +++ b/modules/nf-core/porechop/porechop/environment.yml @@ -0,0 +1,7 @@ +name: porechop_porechop +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::porechop=0.2.4 diff --git a/modules/nf-core/porechop/porechop/main.nf b/modules/nf-core/porechop/porechop/main.nf index 8fe0dd2e..1ff02a12 100644 --- a/modules/nf-core/porechop/porechop/main.nf +++ b/modules/nf-core/porechop/porechop/main.nf @@ -2,7 +2,7 @@ process PORECHOP_PORECHOP { tag "$meta.id" label 'process_medium' - conda "bioconda::porechop=0.2.4" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/porechop:0.2.4--py39h7cff6ad_2' : 'biocontainers/porechop:0.2.4--py39h7cff6ad_2' }" @@ -33,4 +33,16 @@ process PORECHOP_PORECHOP { porechop: \$( porechop --version ) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fastq + gzip ${prefix}.fastq + touch ${prefix}.log + cat <<-END_VERSIONS > versions.yml + "${task.process}": + porechop: \$( porechop --version ) + END_VERSIONS + """ } diff --git a/modules/nf-core/porechop/porechop/meta.yml b/modules/nf-core/porechop/porechop/meta.yml index 98b838f6..13be76f2 100644 --- a/modules/nf-core/porechop/porechop/meta.yml +++ b/modules/nf-core/porechop/porechop/meta.yml @@ -12,7 +12,6 @@ tools: tool_dev_url: "https://github.com/rrwick/Porechop" doi: "10.1099/mgen.0.000132" licence: ["GPL v3"] - input: - meta: type: map @@ -23,7 +22,6 @@ input: type: file description: fastq/fastq.gz file pattern: "*.{fastq,fastq.gz,fq,fq.gz}" - output: - meta: type: map @@ -42,7 +40,6 @@ output: type: file description: Log file containing stdout information pattern: "*.log" - authors: - "@ggabernet" - "@jasmezz" @@ -53,3 +50,13 @@ authors: - "@jonoave" - "@GokceOGUZ" - "@jfy133" +maintainers: + - "@ggabernet" + - "@jasmezz" + - "@d4straub" + - "@LaurenceKuhl" + - "@SusiJo" + - "@jonasscheid" + - "@jonoave" + - "@GokceOGUZ" + - "@jfy133" diff --git a/modules/nf-core/porechop/porechop/tests/main.nf.test b/modules/nf-core/porechop/porechop/tests/main.nf.test new file mode 100644 index 00000000..4c3c3d65 --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process PORECHOP_PORECHOP" + script "../main.nf" + process "PORECHOP_PORECHOP" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "porechop" + tag "porechop/porechop" + + test("sarscov2 - nanopore - fastq") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:true ], + file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.reads).match("reads") }, + { assert snapshot(process.out.versions).match("versions") }, + // complete log is not stable. These first lines should be stable + { assert snapshot(path(process.out.log.get(0).get(1)).readLines()[0..7]).match("log")} + ) + } + + } + + + test("stub") { + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:true ], + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + +} diff --git a/modules/nf-core/porechop/porechop/tests/main.nf.test.snap b/modules/nf-core/porechop/porechop/tests/main.nf.test.snap new file mode 100644 index 00000000..cf544d2d --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/main.nf.test.snap @@ -0,0 +1,88 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,712c0753b56d0fb530092dfb5bdf2e5c" + ] + ], + "timestamp": "2023-12-18T07:47:16.83444" + }, + "log": { + "content": [ + [ + "", + "\u001b[1m\u001b[4mLoading reads\u001b[0m", + "test.fastq.gz", + "100 reads loaded", + "", + "", + "\u001b[1m\u001b[4mLooking for known adapter sets\u001b[0m", + "" + ] + ], + "timestamp": "2023-12-18T07:47:16.853899" + }, + "reads": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.fastq.gz:md5,886fdb859fb50e0dddd35007bcff043e" + ] + ] + ], + "timestamp": "2023-12-18T07:47:16.811393" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.fastq.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,712c0753b56d0fb530092dfb5bdf2e5c" + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.fastq.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,712c0753b56d0fb530092dfb5bdf2e5c" + ] + } + ], + "timestamp": "2023-12-18T07:47:37.814949" + } +} \ No newline at end of file diff --git a/modules/nf-core/porechop/porechop/tests/nextflow.config b/modules/nf-core/porechop/porechop/tests/nextflow.config new file mode 100644 index 00000000..a9ecf7b6 --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/nextflow.config @@ -0,0 +1,9 @@ +process { + + + withName: PORECHOP_PORECHOP { + ext.args = '' + ext.prefix = { "${meta.id}_porechop" } + } + +} diff --git a/modules/nf-core/porechop/porechop/tests/tags.yml b/modules/nf-core/porechop/porechop/tests/tags.yml new file mode 100644 index 00000000..743645c2 --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/tags.yml @@ -0,0 +1,2 @@ +porechop/porechop: + - "modules/nf-core/porechop/porechop/**" diff --git a/modules/nf-core/prokka/environment.yml b/modules/nf-core/prokka/environment.yml new file mode 100644 index 00000000..d7c44d5a --- /dev/null +++ b/modules/nf-core/prokka/environment.yml @@ -0,0 +1,7 @@ +name: prokka +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::prokka=1.14.6 diff --git a/modules/nf-core/prokka/main.nf b/modules/nf-core/prokka/main.nf index 60fbe232..adfda037 100644 --- a/modules/nf-core/prokka/main.nf +++ b/modules/nf-core/prokka/main.nf @@ -2,9 +2,9 @@ process PROKKA { tag "$meta.id" label 'process_low' - conda "bioconda::prokka=1.14.6" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/prokka%3A1.14.6--pl5321hdfd78af_4' : + 'https://depot.galaxyproject.org/singularity/prokka:1.14.6--pl5321hdfd78af_4' : 'biocontainers/prokka:1.14.6--pl5321hdfd78af_4' }" input: diff --git a/modules/nf-core/prokka/meta.yml b/modules/nf-core/prokka/meta.yml index 7fc9e185..9d82ffac 100644 --- a/modules/nf-core/prokka/meta.yml +++ b/modules/nf-core/prokka/meta.yml @@ -10,7 +10,6 @@ tools: homepage: https://github.com/tseemann/prokka doi: "10.1093/bioinformatics/btu153" licence: ["GPL v2"] - input: - meta: type: map @@ -27,7 +26,6 @@ input: - prodigal_tf: type: file description: Training file to use for Prodigal (optional) - output: - meta: type: map @@ -86,6 +84,7 @@ output: type: file description: tab-separated file of all features (locus_tag,ftype,len_bp,gene,EC_number,COG,product) pattern: "*.{tsv}" - authors: - "@rpetit3" +maintainers: + - "@rpetit3" diff --git a/modules/nf-core/prokka/tests/main.nf.test b/modules/nf-core/prokka/tests/main.nf.test new file mode 100644 index 00000000..3b59ef3a --- /dev/null +++ b/modules/nf-core/prokka/tests/main.nf.test @@ -0,0 +1,46 @@ +nextflow_process { + + name "Test Process PROKKA" + script "../main.nf" + process "PROKKA" + + tag "modules" + tag "modules_nfcore" + tag "prokka" + + test("Prokka - sarscov2 - genome.fasta") { + + when { + process { + """ + input[0] = Channel.fromList([ + tuple([ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)) + ]) + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.gff).match("gff") }, + { assert snapshot(process.out.fna).match("fna") }, + { assert snapshot(process.out.faa).match("faa") }, + { assert snapshot(process.out.ffn).match("ffn") }, + { assert snapshot(process.out.fsa).match("fsa") }, + { assert snapshot(process.out.tbl).match("tbl") }, + { assert snapshot(process.out.err).match("err") }, + { assert snapshot(process.out.txt).match("txt") }, + { assert snapshot(process.out.tsv).match("tsv") }, + { assert path(process.out.gbk.get(0).get(1)).exists() }, + { assert path(process.out.log.get(0).get(1)).exists() }, + { assert path(process.out.sqn.get(0).get(1)).exists() } + ) + } + + } + +} diff --git a/modules/nf-core/prokka/tests/main.nf.test.snap b/modules/nf-core/prokka/tests/main.nf.test.snap new file mode 100644 index 00000000..859e8df8 --- /dev/null +++ b/modules/nf-core/prokka/tests/main.nf.test.snap @@ -0,0 +1,128 @@ +{ + "txt": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,b40e485ffc8eaf1feacf8d79d9751a33" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.84139118" + }, + "err": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.err:md5,b3daedc646fddd422824e2b3e5e9229d" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.837204155" + }, + "fsa": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fsa:md5,71bbefcb7f12046bcd3263f58cfd5404" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.803513721" + }, + "gff": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.gff:md5,5dbfb8fcf2db020564c16045976a0933" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.710100529" + }, + "tsv": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,da7c720c3018c5081d6a70b517b7d450" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.846026731" + }, + "faa": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.faa:md5,a4ceda83262b3c222a6b1f508fb9e24b" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.722112433" + }, + "fna": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fna:md5,787307f29a263e5657cc276ebbf7e2b3" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.717325796" + }, + "ffn": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.ffn:md5,80f474b5367b7ea5ed23791935f65e34" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.727149899" + }, + "tbl": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.tbl:md5,d8f816a066ced94b62d9618b13fb8add" + ] + ] + ], + "timestamp": "2023-12-14T15:19:54.831206944" + } +} \ No newline at end of file diff --git a/modules/nf-core/prokka/tests/tags.yml b/modules/nf-core/prokka/tests/tags.yml new file mode 100644 index 00000000..a2dc7bdc --- /dev/null +++ b/modules/nf-core/prokka/tests/tags.yml @@ -0,0 +1,2 @@ +prokka: + - "modules/nf-core/prokka/**" diff --git a/modules/nf-core/quast/environment.yml b/modules/nf-core/quast/environment.yml new file mode 100644 index 00000000..0f9e3079 --- /dev/null +++ b/modules/nf-core/quast/environment.yml @@ -0,0 +1,7 @@ +name: quast +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::quast=5.2.0 diff --git a/modules/nf-core/quast/main.nf b/modules/nf-core/quast/main.nf index e265df73..d8f36284 100644 --- a/modules/nf-core/quast/main.nf +++ b/modules/nf-core/quast/main.nf @@ -2,7 +2,7 @@ process QUAST { tag "$meta.id" label 'process_medium' - conda "bioconda::quast=5.2.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/quast:5.2.0--py39pl5321h2add14b_1' : 'biocontainers/quast:5.2.0--py39pl5321h2add14b_1' }" diff --git a/modules/nf-core/quast/meta.yml b/modules/nf-core/quast/meta.yml index 78e94f8e..5850ff98 100644 --- a/modules/nf-core/quast/meta.yml +++ b/modules/nf-core/quast/meta.yml @@ -25,7 +25,6 @@ input: - gff: type: file description: The genome GFF file. Has to contain at least a non-empty string dummy value. - output: - quast: type: directory @@ -54,7 +53,9 @@ output: type: file description: File containing software versions pattern: "versions.yml" - authors: - "@drpatelh" - "@kevinmenden" +maintainers: + - "@drpatelh" + - "@kevinmenden" diff --git a/modules/nf-core/racon/environment.yml b/modules/nf-core/racon/environment.yml new file mode 100644 index 00000000..abc5d784 --- /dev/null +++ b/modules/nf-core/racon/environment.yml @@ -0,0 +1,7 @@ +name: racon +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::racon=1.4.20 diff --git a/modules/nf-core/racon/main.nf b/modules/nf-core/racon/main.nf index 6d0cceb2..de29e355 100644 --- a/modules/nf-core/racon/main.nf +++ b/modules/nf-core/racon/main.nf @@ -2,7 +2,7 @@ process RACON { tag "$meta.id" label 'process_high' - conda "bioconda::racon=1.4.20" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/racon:1.4.20--h9a82719_1' : 'biocontainers/racon:1.4.20--h9a82719_1' }" diff --git a/modules/nf-core/racon/meta.yml b/modules/nf-core/racon/meta.yml index 2e7737d9..9698c0a8 100644 --- a/modules/nf-core/racon/meta.yml +++ b/modules/nf-core/racon/meta.yml @@ -13,7 +13,6 @@ tools: tool_dev_url: https://github.com/lbcb-sci/racon doi: 10.1101/gr.214270.116 licence: ["MIT"] - input: - meta: type: map @@ -32,7 +31,6 @@ input: type: file description: Alignment in PAF format pattern: "*.paf" - output: - meta: type: map @@ -47,6 +45,7 @@ output: type: file description: Improved genome assembly pattern: "*_assembly_consensus.fasta.gz" - authors: - "@avantonder" +maintainers: + - "@avantonder" diff --git a/modules/nf-core/samtools/index/environment.yml b/modules/nf-core/samtools/index/environment.yml new file mode 100644 index 00000000..a5e50649 --- /dev/null +++ b/modules/nf-core/samtools/index/environment.yml @@ -0,0 +1,8 @@ +name: samtools_index +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::samtools=1.19.2 + - bioconda::htslib=1.19.1 diff --git a/modules/nf-core/samtools/index/main.nf b/modules/nf-core/samtools/index/main.nf index 0b20aa4b..dc14f98d 100644 --- a/modules/nf-core/samtools/index/main.nf +++ b/modules/nf-core/samtools/index/main.nf @@ -2,10 +2,10 @@ process SAMTOOLS_INDEX { tag "$meta.id" label 'process_low' - conda "bioconda::samtools=1.17" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0' : - 'biocontainers/samtools:1.17--h00cdaf9_0' }" + 'https://depot.galaxyproject.org/singularity/samtools:1.19.2--h50ea8bc_0' : + 'biocontainers/samtools:1.19.2--h50ea8bc_0' }" input: tuple val(meta), path(input) diff --git a/modules/nf-core/samtools/index/meta.yml b/modules/nf-core/samtools/index/meta.yml index 8bd2fa6f..01a4ee03 100644 --- a/modules/nf-core/samtools/index/meta.yml +++ b/modules/nf-core/samtools/index/meta.yml @@ -51,3 +51,7 @@ authors: - "@drpatelh" - "@ewels" - "@maxulysse" +maintainers: + - "@drpatelh" + - "@ewels" + - "@maxulysse" diff --git a/modules/nf-core/samtools/index/tests/csi.nextflow.config b/modules/nf-core/samtools/index/tests/csi.nextflow.config new file mode 100644 index 00000000..0ed260ef --- /dev/null +++ b/modules/nf-core/samtools/index/tests/csi.nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: SAMTOOLS_INDEX { + ext.args = '-c' + } + +} diff --git a/modules/nf-core/samtools/index/tests/main.nf.test b/modules/nf-core/samtools/index/tests/main.nf.test new file mode 100644 index 00000000..bb7756d1 --- /dev/null +++ b/modules/nf-core/samtools/index/tests/main.nf.test @@ -0,0 +1,87 @@ +nextflow_process { + + name "Test Process SAMTOOLS_INDEX" + script "../main.nf" + process "SAMTOOLS_INDEX" + tag "modules" + tag "modules_nfcore" + tag "samtools" + tag "samtools/index" + + test("bai") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out.bai).match("bai") }, + { assert snapshot(process.out.versions).match("bai_versions") } + ) + } + } + + test("crai") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out.crai).match("crai") }, + { assert snapshot(process.out.versions).match("crai_versions") } + ) + } + } + + test("csi") { + + config "./csi.nextflow.config" + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert path(process.out.csi.get(0).get(1)).exists() }, + { assert snapshot(process.out.versions).match("csi_versions") } + ) + } + } +} diff --git a/modules/nf-core/samtools/index/tests/main.nf.test.snap b/modules/nf-core/samtools/index/tests/main.nf.test.snap new file mode 100644 index 00000000..3dc8e7de --- /dev/null +++ b/modules/nf-core/samtools/index/tests/main.nf.test.snap @@ -0,0 +1,74 @@ +{ + "crai_versions": { + "content": [ + [ + "versions.yml:md5,cc4370091670b64bba7c7206403ffb3e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.01.0" + }, + "timestamp": "2024-02-13T16:12:00.324667957" + }, + "csi_versions": { + "content": [ + [ + "versions.yml:md5,cc4370091670b64bba7c7206403ffb3e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.01.0" + }, + "timestamp": "2024-02-13T16:12:07.885103162" + }, + "crai": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.paired_end.recalibrated.sorted.cram.crai:md5,14bc3bd5c89cacc8f4541f9062429029" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.3" + }, + "timestamp": "2024-02-12T18:41:38.446424" + }, + "bai": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.paired_end.sorted.bam.bai:md5,704c10dd1326482448ca3073fdebc2f4" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.3" + }, + "timestamp": "2024-02-12T18:40:46.579747" + }, + "bai_versions": { + "content": [ + [ + "versions.yml:md5,cc4370091670b64bba7c7206403ffb3e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.01.0" + }, + "timestamp": "2024-02-13T16:11:51.641425452" + } +} \ No newline at end of file diff --git a/modules/nf-core/samtools/index/tests/tags.yml b/modules/nf-core/samtools/index/tests/tags.yml new file mode 100644 index 00000000..e0f58a7a --- /dev/null +++ b/modules/nf-core/samtools/index/tests/tags.yml @@ -0,0 +1,2 @@ +samtools/index: + - modules/nf-core/samtools/index/** diff --git a/modules/nf-core/samtools/sort/environment.yml b/modules/nf-core/samtools/sort/environment.yml new file mode 100644 index 00000000..4d898e48 --- /dev/null +++ b/modules/nf-core/samtools/sort/environment.yml @@ -0,0 +1,8 @@ +name: samtools_sort +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::samtools=1.19.2 + - bioconda::htslib=1.19.1 diff --git a/modules/nf-core/samtools/sort/main.nf b/modules/nf-core/samtools/sort/main.nf index 2b7753fd..fc374f98 100644 --- a/modules/nf-core/samtools/sort/main.nf +++ b/modules/nf-core/samtools/sort/main.nf @@ -2,17 +2,20 @@ process SAMTOOLS_SORT { tag "$meta.id" label 'process_medium' - conda "bioconda::samtools=1.17" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0' : - 'biocontainers/samtools:1.17--h00cdaf9_0' }" + 'https://depot.galaxyproject.org/singularity/samtools:1.19.2--h50ea8bc_0' : + 'biocontainers/samtools:1.19.2--h50ea8bc_0' }" input: - tuple val(meta), path(bam) + tuple val(meta) , path(bam) + tuple val(meta2), path(fasta) output: - tuple val(meta), path("*.bam"), emit: bam - tuple val(meta), path("*.csi"), emit: csi, optional: true + tuple val(meta), path("*.bam"), emit: bam, optional: true + tuple val(meta), path("*.cram"), emit: cram, optional: true + tuple val(meta), path("*.crai"), emit: crai, optional: true + tuple val(meta), path("*.csi"), emit: csi, optional: true path "versions.yml" , emit: versions when: @@ -21,14 +24,24 @@ process SAMTOOLS_SORT { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def extension = args.contains("--output-fmt sam") ? "sam" : + args.contains("--output-fmt cram") ? "cram" : + "bam" + def reference = fasta ? "--reference ${fasta}" : "" if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + """ + samtools cat \\ + --threads $task.cpus \\ + ${bam} \\ + | \\ samtools sort \\ $args \\ - -@ $task.cpus \\ - -o ${prefix}.bam \\ - -T $prefix \\ - $bam + -T ${prefix} \\ + --threads $task.cpus \\ + ${reference} \\ + -o ${prefix}.${extension} \\ + - cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -40,6 +53,7 @@ process SAMTOOLS_SORT { def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.bam + touch ${prefix}.bam.csi cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/samtools/sort/meta.yml b/modules/nf-core/samtools/sort/meta.yml index 07328431..341a7d0e 100644 --- a/modules/nf-core/samtools/sort/meta.yml +++ b/modules/nf-core/samtools/sort/meta.yml @@ -23,8 +23,18 @@ input: e.g. [ id:'test', single_end:false ] - bam: type: file - description: BAM/CRAM/SAM file + description: BAM/CRAM/SAM file(s) pattern: "*.{bam,cram,sam}" + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference genome FASTA file + pattern: "*.{fa,fasta,fna}" + optional: true output: - meta: type: map @@ -33,16 +43,29 @@ output: e.g. [ id:'test', single_end:false ] - bam: type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - - versions: + description: Sorted BAM file + pattern: "*.{bam}" + - cram: type: file - description: File containing software versions - pattern: "versions.yml" + description: Sorted CRAM file + pattern: "*.{cram}" + - crai: + type: file + description: CRAM index file (optional) + pattern: "*.crai" - csi: type: file description: BAM index file (optional) pattern: "*.csi" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" - "@ewels" + - "@matthdsm" +maintainers: + - "@drpatelh" + - "@ewels" + - "@matthdsm" diff --git a/modules/nf-core/samtools/sort/tests/main.nf.test b/modules/nf-core/samtools/sort/tests/main.nf.test new file mode 100644 index 00000000..8360e2b1 --- /dev/null +++ b/modules/nf-core/samtools/sort/tests/main.nf.test @@ -0,0 +1,96 @@ +nextflow_process { + + name "Test Process SAMTOOLS_SORT" + script "../main.nf" + process "SAMTOOLS_SORT" + tag "modules" + tag "modules_nfcore" + tag "samtools" + tag "samtools/sort" + + test("bam") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) + ]) + input[1] = Channel.of([ + [ id:'fasta' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("cram") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) + ]) + input[1] = Channel.of([ + [ id:'fasta' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("bam_stub") { + + config "./nextflow.config" + options "-stub" + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) + ]) + input[1] = Channel.of([ + [ id:'fasta' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(file(process.out.bam[0][1]).name).match("bam_stub_bam") }, + { assert snapshot(process.out.versions).match("bam_stub_versions") } + ) + } + } +} diff --git a/modules/nf-core/samtools/sort/tests/main.nf.test.snap b/modules/nf-core/samtools/sort/tests/main.nf.test.snap new file mode 100644 index 00000000..38477656 --- /dev/null +++ b/modules/nf-core/samtools/sort/tests/main.nf.test.snap @@ -0,0 +1,154 @@ +{ + "cram": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "4": [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "versions": [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-04T15:08:00.830294" + }, + "bam_stub_bam": { + "content": [ + "test.sorted.bam" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.3" + }, + "timestamp": "2024-02-12T19:21:04.364044" + }, + "bam_stub_versions": { + "content": [ + [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.01.0" + }, + "timestamp": "2024-02-13T16:15:00.20800281" + }, + "bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "4": [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "versions": [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-04T15:07:48.773803" + } +} \ No newline at end of file diff --git a/modules/nf-core/samtools/sort/tests/nextflow.config b/modules/nf-core/samtools/sort/tests/nextflow.config new file mode 100644 index 00000000..f642771f --- /dev/null +++ b/modules/nf-core/samtools/sort/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + + withName: SAMTOOLS_SORT { + ext.prefix = { "${meta.id}.sorted" } + ext.args = "--write-index" + } + +} diff --git a/modules/nf-core/samtools/sort/tests/tags.yml b/modules/nf-core/samtools/sort/tests/tags.yml new file mode 100644 index 00000000..cd63ea20 --- /dev/null +++ b/modules/nf-core/samtools/sort/tests/tags.yml @@ -0,0 +1,3 @@ +samtools/sort: + - modules/nf-core/samtools/sort/** + - tests/modules/nf-core/samtools/sort/** diff --git a/modules/nf-core/untar/environment.yml b/modules/nf-core/untar/environment.yml new file mode 100644 index 00000000..0c9cbb10 --- /dev/null +++ b/modules/nf-core/untar/environment.yml @@ -0,0 +1,11 @@ +name: untar + +channels: + - conda-forge + - bioconda + - defaults + +dependencies: + - conda-forge::grep=3.11 + - conda-forge::sed=4.7 + - conda-forge::tar=1.34 diff --git a/modules/nf-core/untar/main.nf b/modules/nf-core/untar/main.nf index 61461c39..8a75bb95 100644 --- a/modules/nf-core/untar/main.nf +++ b/modules/nf-core/untar/main.nf @@ -2,7 +2,7 @@ process UNTAR { tag "$archive" label 'process_single' - conda "conda-forge::sed=4.7 conda-forge::grep=3.11 conda-forge::tar=1.34" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : 'nf-core/ubuntu:20.04' }" diff --git a/modules/nf-core/untar/meta.yml b/modules/nf-core/untar/meta.yml index db241a6e..a9a2110f 100644 --- a/modules/nf-core/untar/meta.yml +++ b/modules/nf-core/untar/meta.yml @@ -39,3 +39,8 @@ authors: - "@drpatelh" - "@matthdsm" - "@jfy133" +maintainers: + - "@joseespinosa" + - "@drpatelh" + - "@matthdsm" + - "@jfy133" diff --git a/modules/nf-core/untar/tests/main.nf.test b/modules/nf-core/untar/tests/main.nf.test new file mode 100644 index 00000000..2a7c97bf --- /dev/null +++ b/modules/nf-core/untar/tests/main.nf.test @@ -0,0 +1,47 @@ +nextflow_process { + + name "Test Process UNTAR" + script "../main.nf" + process "UNTAR" + tag "modules" + tag "modules_nfcore" + tag "untar" + test("test_untar") { + + when { + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kraken2.tar.gz', checkIfExists: true) ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out.untar).match("test_untar") }, + ) + } + + } + + test("test_untar_onlyfiles") { + + when { + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true) ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out.untar).match("test_untar_onlyfiles") }, + ) + } + + } + +} diff --git a/modules/nf-core/untar/tests/main.nf.test.snap b/modules/nf-core/untar/tests/main.nf.test.snap new file mode 100644 index 00000000..64550292 --- /dev/null +++ b/modules/nf-core/untar/tests/main.nf.test.snap @@ -0,0 +1,42 @@ +{ + "test_untar_onlyfiles": { + "content": [ + [ + [ + [ + + ], + [ + "hello.txt:md5,e59ff97941044f85df5297e1c302d260" + ] + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T11:49:41.320643" + }, + "test_untar": { + "content": [ + [ + [ + [ + + ], + [ + "hash.k2d:md5,8b8598468f54a7087c203ad0190555d9", + "opts.k2d:md5,a033d00cf6759407010b21700938f543", + "taxo.k2d:md5,094d5891cdccf2f1468088855c214b2c" + ] + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T11:49:33.795172" + } +} \ No newline at end of file diff --git a/modules/nf-core/untar/tests/tags.yml b/modules/nf-core/untar/tests/tags.yml new file mode 100644 index 00000000..feb6f15c --- /dev/null +++ b/modules/nf-core/untar/tests/tags.yml @@ -0,0 +1,2 @@ +untar: + - modules/nf-core/untar/** diff --git a/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf b/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf index 0b617a34..e02fe978 100644 --- a/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf @@ -197,7 +197,6 @@ def genomeExistsError() { // Generate methods description for MultiQC // def toolCitationText() { - // TODO nf-core: Optionally add in-text citation tools to this list. // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "Tool (Foo et al. 2023)" : "", // Uncomment function in methodsDescriptionText to render in MultiQC report def citation_text = [ @@ -226,7 +225,6 @@ def toolCitationText() { } def toolBibliographyText() { - // TODO nf-core: Optionally add bibliographic entries to this list. // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "
  • Author (2023) Pub name, Journal, DOI
  • " : "", // Uncomment function in methodsDescriptionText to render in MultiQC report def reference_text = [ diff --git a/workflows/bacass.nf b/workflows/bacass.nf index a38fc0d6..ca644cc5 100644 --- a/workflows/bacass.nf +++ b/workflows/bacass.nf @@ -26,12 +26,12 @@ if(! params.skip_kraken2){ // // MODULE: Local to the pipeline // -include { PYCOQC } from '../modules/local/pycoqc' -include { UNICYCLER } from '../modules/local/unicycler' -include { NANOPOLISH } from '../modules/local/nanopolish' -include { MEDAKA } from '../modules/local/medaka' -include { KRAKEN2_DB_PREPARATION } from '../modules/local/kraken2_db_preparation' -include { DFAST } from '../modules/local/dfast' +include { PYCOQC } from '../modules/local/pycoqc/main' +include { UNICYCLER } from '../modules/local/unicycler/main' +include { NANOPOLISH } from '../modules/local/nanopolish/main' +include { MEDAKA } from '../modules/local/medaka/main' +include { KRAKEN2_DB_PREPARATION } from '../modules/local/kraken2_db_preparation/main' +include { DFAST } from '../modules/local/dfast/main' // // SUBWORKFLOW: Consisting of a mix of local and nf-core/modules @@ -240,7 +240,7 @@ workflow BACASS { if ( params.assembler == 'miniasm' ) { MINIMAP2_ALIGN ( ch_for_assembly.map{ meta,sr,lr -> tuple(meta,lr) }, - [], + [[:],[]], false, false, false @@ -259,7 +259,7 @@ workflow BACASS { MINIMAP2_CONSENSUS ( ch_for_assembly.map{ meta,sr,lr -> tuple(meta,lr) }, - MINIASM.out.assembly.map { meta, assembly -> assembly }, + MINIASM.out.assembly, false, false, false @@ -347,6 +347,7 @@ workflow BACASS { KRAKEN2_DB_PREPARATION ( kraken2db ) + ch_versions = ch_versions.mix(KRAKEN2_DB_PREPARATION.out.versions) KRAKEN2 ( ch_for_kraken2_short.dump(tag: 'kraken2_short'), KRAKEN2_DB_PREPARATION.out.db.map { info, db -> db }.dump(tag: 'kraken2_db_preparation'),