diff --git a/CHANGELOG.md b/CHANGELOG.md index 59f50133..7e061055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Added` +- [#229](https://github.com/nf-core/bacass/pull/229) Add homopolish for nanopore-only assembly. - [#195](https://github.com/nf-core/bacass/pull/195) Update nf-core/bacass to the new nf-core 3.2.0 `TEMPLATE`. ### `Fixed` diff --git a/README.md b/README.md index 01c607d1..ae9724f0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ This pipeline is primarily for bacterial assembly of next-generation sequencing For users that only have Nanopore data, the pipeline quality trims these using [PoreChop](https://github.com/rrwick/Porechop) and assesses basic sequencing QC utilizing [NanoPlot](https://github.com/wdecoster/NanoPlot) and [PycoQC](https://github.com/a-slide/pycoQC). Contamination of the assembly is checked using [Kraken2](https://ccb.jhu.edu/software/kraken2/) and [Kmerfinder](https://bitbucket.org/genomicepidemiology/kmerfinder/src/master/) to verify sample purity. -The pipeline can then perform long read assembly utilizing [Unicycler](https://github.com/rrwick/Unicycler), [Miniasm](https://github.com/lh3/miniasm) in combination with [Racon](https://github.com/isovic/racon), [Canu](https://github.com/marbl/canu) or [Flye](https://github.com/fenderglass/Flye) by using the [Dragonflye](https://github.com/rpetit3/dragonflye)(\*) pipeline. Long reads assembly can be polished using [Medaka](https://github.com/nanoporetech/medaka) or [NanoPolish](https://github.com/jts/nanopolish) with Fast5 files. +The pipeline can then perform long read assembly utilizing [Unicycler](https://github.com/rrwick/Unicycler), [Miniasm](https://github.com/lh3/miniasm) in combination with [Racon](https://github.com/isovic/racon), [Canu](https://github.com/marbl/canu) or [Flye](https://github.com/fenderglass/Flye) by using the [Dragonflye](https://github.com/rpetit3/dragonflye)(\*) pipeline. Long reads assembly can be polished using [Medaka](https://github.com/nanoporetech/medaka), **Medaka** folowed by [Homopolish](https://github.com/ythuang0522/homopolish) or [NanoPolish](https://github.com/jts/nanopolish) with Fast5 files. > [!NOTE] > Dragonflye is a comprehensive pipeline designed for genome assembly of Oxford Nanopore Reads. It facilitates the utilization of Flye (default), Miniasm, and Raven assemblers, along with Racon (default) and Medaka polishers. For more information, visit the [Dragonflye GitHub](https://github.com/rpetit3/dragonflye) repository. diff --git a/conf/modules.config b/conf/modules.config index 2e2da16e..b86c2746 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -158,6 +158,24 @@ process { ] } + withName: 'HOMOPOLISH_SKETCH_PREPARATION' { + ext.args = '' + publishDir = [ + path: { "${params.outdir}/Homopolish_sketch" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: 'HOMOPOLISH' { + ext.args = '' + publishDir = [ + path: { "${params.outdir}/Homopolish" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + withName: 'KRAKEN2' { ext.args = '' publishDir = [ diff --git a/modules/local/homopolish/environment.yml b/modules/local/homopolish/environment.yml new file mode 100644 index 00000000..506c9996 --- /dev/null +++ b/modules/local/homopolish/environment.yml @@ -0,0 +1,8 @@ +name: homopolish +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::homopolish=0.4.1 + - conda-forge::more-itertools=9.1.0 diff --git a/modules/local/homopolish/main.nf b/modules/local/homopolish/main.nf new file mode 100644 index 00000000..b16baf43 --- /dev/null +++ b/modules/local/homopolish/main.nf @@ -0,0 +1,35 @@ +process HOMOPOLISH { + 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/homopolish:0.4.1--pyhdfd78af_1' : + 'biocontainers/homopolish:0.4.1--pyhdfd78af_0' }" + + input: + tuple val(meta), path(medaka_genome) + tuple val(meta_gunzip), path(bacteria_sketch) + + output: + tuple val(meta), path('*_genome_homopolished.fasta') , emit: assembly + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + homopolish polish \ + -a $medaka_genome \ + -s $bacteria_sketch \ + -m $params.homopolish_model \ + -o . + cat <<-END_VERSIONS > versions.yml + "${task.process}": + homopolish: \$( homopolish --version 2>&1 | sed 's/Homopolish VERSION: *//g' ) + END_VERSIONS + + """ +} diff --git a/modules/local/homopolish/sketch_preparation/environment.yml b/modules/local/homopolish/sketch_preparation/environment.yml new file mode 100644 index 00000000..93cd1cdd --- /dev/null +++ b/modules/local/homopolish/sketch_preparation/environment.yml @@ -0,0 +1,7 @@ +name: homopolish_sketch_preparation +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::sed=4.7 diff --git a/modules/local/homopolish/sketch_preparation/main.nf b/modules/local/homopolish/sketch_preparation/main.nf new file mode 100644 index 00000000..ee7d9ae8 --- /dev/null +++ b/modules/local/homopolish/sketch_preparation/main.nf @@ -0,0 +1,25 @@ +process HOMOPOLISH_SKETCH_PREPARATION { + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/curl:7.80.0' : + 'biocontainers/curl:7.80.0' }" + + input: + val(meta) + path(url) + + output: + tuple val(meta), path("bacteria.msh.gz"), emit: sketch + path "versions.yml" , emit: versions + + script: + """ + curl $params.homopolish_bacteria_sketch_url + cat <<-END_VERSIONS > versions.yml + "${task.process}": + Homopolish_Sketch Bacteria: $params.homopolish_bacteria_last + END_VERSIONS + """ +} diff --git a/nextflow.config b/nextflow.config index 00a777f6..be1af874 100644 --- a/nextflow.config +++ b/nextflow.config @@ -33,7 +33,11 @@ params { dragonflye_args = '' // Assembly polishing - polish_method = 'medaka' // Allowed: ['medaka', 'nanopolish'] + polish_method = 'medaka' // Allowed: ['medaka', 'nanopolish', 'medaka_homopolish'] + homopolish_bacteria_sketch_url = 'https://bioinfo.cs.ccu.edu.tw/bioinfo/downloads/Homopolish_Sketch/bacteria.msh.gz' + homopolish_bacteria_last = '2024-08-16' // From: https://bioinfo.cs.ccu.edu.tw/bioinfo/download.html + homopolish_model = 'R9.4.pkl' // Allowed: ['R9.4.pkl', 'R10.3.pkl', 'pb.pkl'] + homopolish_reload_sketch = false // Annotation annotation_tool = 'prokka' // Allowed: ['prokka', 'bakta','dfast'] diff --git a/nextflow_schema.json b/nextflow_schema.json index 45ac9f85..5ec772bf 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -153,7 +153,36 @@ "fa_icon": "fas fa-hotdog", "description": "Which assembly polishing method to use.", "help_text": "Can be used to define which polishing method is used by default for long reads.", - "enum": ["medaka", "nanopolish"] + "enum": ["medaka", "nanopolish", "medaka_homopolish"] + }, + "homopolish_model": { + "type": "string", + "default": "R9.4.pkl", + "fa_icon": "fas fa-hotdog", + "description": "Which homopolish polishing model to use.", + "help_text": "Used to define which homopolish polishing model is used for long reads after medaka.", + "enum": ["R9.4.pkl", "R10.3.pkl", "pb.pkl"] + }, + "homopolish_reload_sketch": { + "type": "boolean", + "default": false, + "fa_icon": "fas fa-hotdog", + "description": "Reload homopolish bacteria sketch.", + "help_text": "Used to define if homopolish bacteria sketch has to be reloaded from its download webpage." + }, + "homopolish_bacteria_sketch_url": { + "type": "string", + "default": "https://bioinfo.cs.ccu.edu.tw/bioinfo/downloads/Homopolish_Sketch/bacteria.msh.gz", + "fa_icon": "fas fa-hotdog", + "description": "Homopolish Bacteria Sketch download URL.", + "help_text": "Can be used to define the URL for downloading the bacteria Homopolish Sketch." + }, + "homopolish_bacteria_last": { + "type": "string", + "default": "2024-08-16", + "fa_icon": "fas fa-hotdog", + "description": "Homopolish Bacteria Sketch version date.", + "help_text": "Defines the Homopolish Sketch version date for version reporting." } } }, diff --git a/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf b/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf index 49a08558..3198ea75 100644 --- a/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_bacass_pipeline/main.nf @@ -221,6 +221,7 @@ def toolCitationText() { "Canu (Sergey Koren et al. 2017)", "Medaka (Heng Li)", "Nanopolish (Loman 2015)", + "Homopolish (Huang, Y.-T., Liu, P.-Y., and Shih, P.-W. 2021)", "Quast (Alexey Gurevich et al. 2013)", "Prokka (Torsten Seemann 2014)", "Bakta (Oliver Schwengers 2021)", @@ -249,6 +250,7 @@ def toolBibliographyText() { "