diff --git a/modules/nf-core/hifiadapterfilt/environment.yml b/modules/nf-core/hifiadapterfilt/environment.yml new file mode 100644 index 000000000000..f7954e9d254f --- /dev/null +++ b/modules/nf-core/hifiadapterfilt/environment.yml @@ -0,0 +1,8 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # renovate: datasource=conda depName=bioconda/hifiadapterfilt + - bioconda::hifiadapterfilt=3.0.0 diff --git a/modules/nf-core/hifiadapterfilt/main.nf b/modules/nf-core/hifiadapterfilt/main.nf new file mode 100644 index 000000000000..eec4c54c1320 --- /dev/null +++ b/modules/nf-core/hifiadapterfilt/main.nf @@ -0,0 +1,43 @@ +process HIFIADAPTERFILT { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hifiadapterfilt:3.0.0--hdfd78af_0': + 'quay.io/biocontainers/hifiadapterfilt:3.0.0--hdfd78af_0' }" + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("${prefix}.filt.fastq.gz") , emit: fastq + tuple val(meta), path("${prefix}.stats") , emit: stats + tuple val(meta), path("${prefix}.contaminant.blastout"), emit: blastout + tuple val(meta), path("${prefix}.blocklist") , emit: blocklist + tuple val("${task.process}"), val('hifiadapterfilt'), eval("hifiadapterfilt.sh --version 2>&1 | head -1"), topic: versions, emit: versions_hifiadapterfilt + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + ln -s \$(realpath ${bam}) ${prefix}.bam + + hifiadapterfilt.sh \\ + -t ${task.cpus} \\ + -o . \\ + ${args} + """ + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + echo "" | gzip > ${prefix}.filt.fastq.gz + touch ${prefix}.stats + touch ${prefix}.contaminant.blastout + touch ${prefix}.blocklist + """ +} diff --git a/modules/nf-core/hifiadapterfilt/meta.yml b/modules/nf-core/hifiadapterfilt/meta.yml new file mode 100644 index 000000000000..7c1e38ca343b --- /dev/null +++ b/modules/nf-core/hifiadapterfilt/meta.yml @@ -0,0 +1,108 @@ +name: hifiadapterfilt +description: | + Remove adapter sequences from PacBio HiFi (CCS) reads using BLAST-based + detection. Produces filtered FASTQ output, filtering statistics, BLAST hits, + and a list of blocked read IDs. +keywords: + - pacbio + - hifi + - adapter + - filtering + - long reads + - ccs +tools: + - hifiadapterfilt: + description: | + HiFiAdapterFilt uses BLAST to identify and remove adapter sequences + from PacBio HiFi reads, producing adapter-filtered FASTQ output along + with detailed statistics. + homepage: https://github.com/sheinasim/HiFiAdapterFilt + documentation: https://github.com/sheinasim/HiFiAdapterFilt + tool_dev_url: https://github.com/sheinasim/HiFiAdapterFilt + licence: + - "MIT" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - bam: + type: file + description: PacBio HiFi reads in BAM format + pattern: "*.bam" + ontologies: [] +output: + fastq: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - ${prefix}.filt.fastq.gz: + type: file + description: Adapter-filtered reads in gzipped FASTQ format + pattern: "*.filt.fastq.gz" + ontologies: + - edam: http://edamontology.org/format_1930 # FASTQ + stats: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - ${prefix}.stats: + type: file + description: Filtering statistics file + pattern: "*.stats" + ontologies: + - edam: http://edamontology.org/format_3671 # Plain text + blastout: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - ${prefix}.contaminant.blastout: + type: file + description: BLAST tabular output for reads containing adapter sequences + pattern: "*.contaminant.blastout" + ontologies: [] + blocklist: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - ${prefix}.blocklist: + type: file + description: List of read IDs blocked due to adapter contamination + pattern: "*.blocklist" + ontologies: + - edam: http://edamontology.org/format_3671 # Plain text + versions_hifiadapterfilt: + - - ${task.process}: + type: string + description: The name of the process + - hifiadapterfilt: + type: string + description: The name of the tool + - hifiadapterfilt.sh --version 2>&1 | head -1: + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - hifiadapterfilt: + type: string + description: The name of the tool + - hifiadapterfilt.sh --version 2>&1 | head -1: + type: eval + description: The expression to obtain the version of the tool +authors: + - "@vagkaratzas" +maintainers: + - "@vagkaratzas" diff --git a/modules/nf-core/hifiadapterfilt/tests/main.nf.test b/modules/nf-core/hifiadapterfilt/tests/main.nf.test new file mode 100644 index 000000000000..47bda77dfa9a --- /dev/null +++ b/modules/nf-core/hifiadapterfilt/tests/main.nf.test @@ -0,0 +1,63 @@ +nextflow_process { + + name "Test Process HIFIADAPTERFILT" + script "../main.nf" + process "HIFIADAPTERFILT" + + tag "modules" + tag "modules_nfcore" + tag "hifiadapterfilt" + + test("homo_sapiens - pacbio ccs bam - fastq") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/alz.ccs.bam', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.fastq, + path(process.out.blastout[0][1]).exists(), + path(process.out.blocklist[0][1]).exists(), + path(process.out.stats[0][1]).exists(), + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + + } + + test("homo_sapiens - pacbio ccs bam - fastq - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/alz.ccs.bam', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + + } + +} diff --git a/modules/nf-core/hifiadapterfilt/tests/main.nf.test.snap b/modules/nf-core/hifiadapterfilt/tests/main.nf.test.snap new file mode 100644 index 000000000000..a3f19592fab8 --- /dev/null +++ b/modules/nf-core/hifiadapterfilt/tests/main.nf.test.snap @@ -0,0 +1,81 @@ +{ + "homo_sapiens - pacbio ccs bam - fastq": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.filt.fastq.gz:md5,ce026e6b05113c474da0ef6570fbb04c" + ] + ], + true, + true, + true, + { + "versions_hifiadapterfilt": [ + [ + "HIFIADAPTERFILT", + "hifiadapterfilt", + "3.0.1" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-04-25T10:08:26.23596593" + }, + "homo_sapiens - pacbio ccs bam - fastq - stub": { + "content": [ + { + "blastout": [ + [ + { + "id": "test" + }, + "test.contaminant.blastout:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "blocklist": [ + [ + { + "id": "test" + }, + "test.blocklist:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastq": [ + [ + { + "id": "test" + }, + "test.filt.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "stats": [ + [ + { + "id": "test" + }, + "test.stats:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_hifiadapterfilt": [ + [ + "HIFIADAPTERFILT", + "hifiadapterfilt", + "3.0.1" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-04-25T10:08:33.302793639" + } +} \ No newline at end of file