From cfe82532f6f5251ad821c48de717cdd4c958d08e Mon Sep 17 00:00:00 2001 From: Florian Wuennemann Date: Wed, 26 Jun 2024 16:34:08 +0000 Subject: [PATCH 1/4] Replaced local unicycler module with nf-core module. --- conf/test.config | 2 +- modules.json | 5 + modules/nf-core/unicycler/environment.yml | 7 ++ modules/nf-core/unicycler/main.nf | 61 ++++++++++ modules/nf-core/unicycler/meta.yml | 64 +++++++++++ modules/nf-core/unicycler/tests/main.nf.test | 61 ++++++++++ .../nf-core/unicycler/tests/main.nf.test.snap | 104 ++++++++++++++++++ modules/nf-core/unicycler/tests/tags.yml | 2 + workflows/bacass.nf | 2 +- 9 files changed, 306 insertions(+), 2 deletions(-) create mode 100644 modules/nf-core/unicycler/environment.yml create mode 100644 modules/nf-core/unicycler/main.nf create mode 100644 modules/nf-core/unicycler/meta.yml create mode 100644 modules/nf-core/unicycler/tests/main.nf.test create mode 100644 modules/nf-core/unicycler/tests/main.nf.test.snap create mode 100644 modules/nf-core/unicycler/tests/tags.yml diff --git a/conf/test.config b/conf/test.config index 0b422f0..ad3ac83 100644 --- a/conf/test.config +++ b/conf/test.config @@ -23,7 +23,7 @@ params { input = params.pipelines_testdata_base_path + 'bacass/bacass_short.tsv' // some extra args to speed tests up - unicycler_args = "--no_correct --no_pilon" + unicycler_args = "" prokka_args = " --fast" 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/nf-core/unicycler/environment.yml b/modules/nf-core/unicycler/environment.yml new file mode 100644 index 0000000..ffe491b --- /dev/null +++ b/modules/nf-core/unicycler/environment.yml @@ -0,0 +1,7 @@ +name: unicycler +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::unicycler=0.5.0 diff --git a/modules/nf-core/unicycler/main.nf b/modules/nf-core/unicycler/main.nf new file mode 100644 index 0000000..f897180 --- /dev/null +++ b/modules/nf-core/unicycler/main.nf @@ -0,0 +1,61 @@ +process UNICYCLER { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + '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) + + output: + tuple val(meta), path('*.scaffolds.fa.gz'), emit: scaffolds + tuple val(meta), path('*.assembly.gfa.gz'), emit: gfa + tuple val(meta), path('*.log') , emit: log + 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 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 \\ + $short_reads \\ + $long_reads \\ + --out ./ + + mv assembly.fasta ${prefix}.scaffolds.fa + gzip -n ${prefix}.scaffolds.fa + mv assembly.gfa ${prefix}.assembly.gfa + gzip -n ${prefix}.assembly.gfa + mv unicycler.log ${prefix}.unicycler.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + 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' From 24f0cbc74ab8782db1e15a29fc49429324c542bc Mon Sep 17 00:00:00 2001 From: Florian Wuennemann Date: Thu, 27 Jun 2024 14:09:09 +0000 Subject: [PATCH 2/4] Removed deprecated unicycler parameters from test_dfast. --- conf/test.config | 1 - conf/test_dfast.config | 1 - 2 files changed, 2 deletions(-) diff --git a/conf/test.config b/conf/test.config index ad3ac83..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 = "" 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 From 2baeb3b7c53f2642e44d9a99bd56463f952fbb4b Mon Sep 17 00:00:00 2001 From: Florian Wuennemann Date: Thu, 27 Jun 2024 14:18:51 +0000 Subject: [PATCH 3/4] Updated CHANGELOG. --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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` From e9228123f49651f663632799177b39067cfb639c Mon Sep 17 00:00:00 2001 From: Florian Wuennemann Date: Thu, 27 Jun 2024 15:38:47 +0000 Subject: [PATCH 4/4] Removed no longer needed unicycler local files. --- modules/local/unicycler/environment.yml | 7 ---- modules/local/unicycler/main.nf | 50 ------------------------- 2 files changed, 57 deletions(-) delete mode 100644 modules/local/unicycler/environment.yml delete mode 100644 modules/local/unicycler/main.nf diff --git a/modules/local/unicycler/environment.yml b/modules/local/unicycler/environment.yml deleted file mode 100644 index 9e32bbc..0000000 --- a/modules/local/unicycler/environment.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: unicycler -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - unicycler=0.4.8 diff --git a/modules/local/unicycler/main.nf b/modules/local/unicycler/main.nf deleted file mode 100644 index eea7238..0000000 --- a/modules/local/unicycler/main.nf +++ /dev/null @@ -1,50 +0,0 @@ -process UNICYCLER { - tag "$meta.id" - label 'process_high' - - 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' }" - - input: - tuple val(meta), path(shortreads), path(longreads) - - output: - tuple val(meta), path('*.scaffolds.fa.gz'), emit: scaffolds - tuple val(meta), path('*.assembly.gfa.gz'), emit: gfa - tuple val(meta), path('*.log') , emit: log - 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}" - 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" - } - """ - unicycler \\ - --threads $task.cpus \\ - $args \\ - $input_reads \\ - --out ./ - - mv assembly.fasta ${prefix}.scaffolds.fa - gzip -n ${prefix}.scaffolds.fa - mv assembly.gfa ${prefix}.assembly.gfa - gzip -n ${prefix}.assembly.gfa - mv unicycler.log ${prefix}.unicycler.log - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - unicycler: \$(echo \$(unicycler --version 2>&1) | sed 's/^.*Unicycler v//; s/ .*\$//') - END_VERSIONS - """ -}