diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d476ac..21eaa7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## v2.4.0 nf-core/bacass + +### `Changed` + +- [#150](https://github.com/nf-core/bacass/pull/150) Replace local unicycler module with nf-core module + bump version + +### `Added` + +### `Fixed` + +### `Dependencies` + +### `Deprecated` + ## v2.3.1 nf-core/bacass: "Navy Iron Oyster" 2024/06/24 ### `Changed` diff --git a/conf/test.config b/conf/test.config index 0b422f0..90115da 100644 --- a/conf/test.config +++ b/conf/test.config @@ -23,7 +23,6 @@ params { input = params.pipelines_testdata_base_path + 'bacass/bacass_short.tsv' // some extra args to speed tests up - unicycler_args = "--no_correct --no_pilon" prokka_args = " --fast" assembly_type = 'short' skip_pycoqc = true diff --git a/conf/test_dfast.config b/conf/test_dfast.config index 9edc4a7..e2d0afe 100644 --- a/conf/test_dfast.config +++ b/conf/test_dfast.config @@ -23,7 +23,6 @@ params { input = params.pipelines_testdata_base_path + 'bacass/bacass_short.tsv' // some extra args to speed tests up - unicycler_args = "--no_correct --no_pilon" annotation_tool = 'dfast' assembly_type = 'short' skip_pycoqc = true diff --git a/modules.json b/modules.json index 6dc814a..90f8413 100644 --- a/modules.json +++ b/modules.json @@ -92,6 +92,11 @@ "git_sha": "4352dbdb09ec40db71e9b172b97a01dcf5622c26", "installed_by": ["modules"] }, + "unicycler": { + "branch": "master", + "git_sha": "5f65b5398f3fe4b8d51d77ed90b0a8cd8c89bba7", + "installed_by": ["modules"] + }, "untar": { "branch": "master", "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", diff --git a/modules/local/unicycler/environment.yml b/modules/nf-core/unicycler/environment.yml similarity index 73% rename from modules/local/unicycler/environment.yml rename to modules/nf-core/unicycler/environment.yml index 9e32bbc..ffe491b 100644 --- a/modules/local/unicycler/environment.yml +++ b/modules/nf-core/unicycler/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - unicycler=0.4.8 + - bioconda::unicycler=0.5.0 diff --git a/modules/local/unicycler/main.nf b/modules/nf-core/unicycler/main.nf similarity index 64% rename from modules/local/unicycler/main.nf rename to modules/nf-core/unicycler/main.nf index eea7238..f897180 100644 --- a/modules/local/unicycler/main.nf +++ b/modules/nf-core/unicycler/main.nf @@ -4,8 +4,8 @@ process UNICYCLER { 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' }" + 'https://depot.galaxyproject.org/singularity/unicycler:0.5.0--py312hc60241a_5' : + 'biocontainers/unicycler:0.5.0--py312hc60241a_5' }" input: tuple val(meta), path(shortreads), path(longreads) @@ -22,18 +22,14 @@ process UNICYCLER { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - if(params.assembly_type == 'long'){ - input_reads = "-l $longreads" - } else if (params.assembly_type == 'short'){ - input_reads = "-1 ${shortreads[0]} -2 ${shortreads[1]}" - } else if (params.assembly_type == 'hybrid'){ - input_reads = "-1 ${shortreads[0]} -2 ${shortreads[1]} -l $longreads" - } + def short_reads = shortreads ? ( meta.single_end ? "-s $shortreads" : "-1 ${shortreads[0]} -2 ${shortreads[1]}" ) : "" + def long_reads = longreads ? "-l $longreads" : "" """ unicycler \\ --threads $task.cpus \\ $args \\ - $input_reads \\ + $short_reads \\ + $long_reads \\ --out ./ mv assembly.fasta ${prefix}.scaffolds.fa @@ -47,4 +43,19 @@ process UNICYCLER { unicycler: \$(echo \$(unicycler --version 2>&1) | sed 's/^.*Unicycler v//; s/ .*\$//') END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + + cat "" | gzip > ${prefix}.scaffolds.fa.gz + cat "" | gzip > ${prefix}.assembly.gfa.gz + touch ${prefix}.unicycler.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + unicycler: \$(echo \$(unicycler --version 2>&1) | sed 's/^.*Unicycler v//; s/ .*\$//') + END_VERSIONS + """ + } diff --git a/modules/nf-core/unicycler/meta.yml b/modules/nf-core/unicycler/meta.yml new file mode 100644 index 0000000..406b147 --- /dev/null +++ b/modules/nf-core/unicycler/meta.yml @@ -0,0 +1,64 @@ +name: unicycler +description: Assembles bacterial genomes +keywords: + - genome + - assembly + - genome assembler + - small genome +tools: + - unicycler: + description: Hybrid assembly pipeline for bacterial genomes + homepage: https://github.com/rrwick/Unicycler + documentation: https://github.com/rrwick/Unicycler + tool_dev_url: https://github.com/rrwick/Unicycler + doi: 10.1371/journal.pcbi.1005595 + licence: ["GPL v3"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - shortreads: + type: file + description: | + List of input Illumina FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + - longreads: + type: file + description: | + List of input FastQ files of size 1, PacBio or Nanopore long reads. +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - scaffolds: + type: file + description: Fasta file containing scaffolds + pattern: "*.{scaffolds.fa.gz}" + - gfa: + type: file + description: gfa file containing assembly + pattern: "*.{assembly.gfa.gz}" + - log: + type: file + description: unicycler log file + pattern: "*.{log}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@JoseEspinosa" + - "@drpatelh" + - "@d4straub" +maintainers: + - "@JoseEspinosa" + - "@drpatelh" + - "@d4straub" diff --git a/modules/nf-core/unicycler/tests/main.nf.test b/modules/nf-core/unicycler/tests/main.nf.test new file mode 100644 index 0000000..416b50b --- /dev/null +++ b/modules/nf-core/unicycler/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process UNICYCLER" + script "../main.nf" + process "UNICYCLER" + + tag "modules" + tag "modules_nfcore" + tag "unicycler" + + test("bacteroides_fragilis - nanopore") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [], + [ file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/nanopore/fastq/test.fastq.gz', checkIfExists: true)] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out.scaffolds, + process.out.gfa, + file(process.out.log.get(0).get(1)).name, + process.out.versions).match() + } + ) + } + } + + test("bacteroides_fragilis - nanopore - stub") { + + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [], + [ file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/nanopore/fastq/test.fastq.gz', checkIfExists: true)] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() + } + ) + } + } + +} diff --git a/modules/nf-core/unicycler/tests/main.nf.test.snap b/modules/nf-core/unicycler/tests/main.nf.test.snap new file mode 100644 index 0000000..4e627b3 --- /dev/null +++ b/modules/nf-core/unicycler/tests/main.nf.test.snap @@ -0,0 +1,104 @@ +{ + "bacteroides_fragilis - nanopore": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test.scaffolds.fa.gz:md5,8f2b98020361b047eec9dc4c23792d37" + ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "test.assembly.gfa.gz:md5,849cec81b0ebf8b34554cf56ce0939d2" + ] + ], + "test.unicycler.log", + [ + "versions.yml:md5,3a81549d1e874ec0214fd1a08384b8b5" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-18T18:40:42.723547744" + }, + "bacteroides_fragilis - nanopore - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.scaffolds.fa.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.assembly.gfa.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test.unicycler.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,3a81549d1e874ec0214fd1a08384b8b5" + ], + "gfa": [ + [ + { + "id": "test", + "single_end": true + }, + "test.assembly.gfa.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test.unicycler.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "scaffolds": [ + [ + { + "id": "test", + "single_end": true + }, + "test.scaffolds.fa.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,3a81549d1e874ec0214fd1a08384b8b5" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-18T18:40:59.5110618" + } +} \ No newline at end of file diff --git a/modules/nf-core/unicycler/tests/tags.yml b/modules/nf-core/unicycler/tests/tags.yml new file mode 100644 index 0000000..25b2cf2 --- /dev/null +++ b/modules/nf-core/unicycler/tests/tags.yml @@ -0,0 +1,2 @@ +unicycler: + - "modules/nf-core/unicycler/**" diff --git a/workflows/bacass.nf b/workflows/bacass.nf index 448d0cb..faa9524 100644 --- a/workflows/bacass.nf +++ b/workflows/bacass.nf @@ -27,7 +27,7 @@ for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true // MODULE: Local to the pipeline // include { PYCOQC } from '../modules/local/pycoqc' -include { UNICYCLER } from '../modules/local/unicycler' +include { UNICYCLER } from '../modules/nf-core/unicycler/main' include { NANOPOLISH } from '../modules/local/nanopolish' include { MEDAKA } from '../modules/local/medaka' include { KRAKEN2_DB_PREPARATION } from '../modules/local/kraken2_db_preparation'