Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::anvio-minimal=9
39 changes: 39 additions & 0 deletions modules/nf-core/anvio/anvi-gen-contigs-database/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
process ANVIO_ANVI_GEN_CONTIGS_DATABASE {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/anvio-minimal:9--pyhdfd78af_0':
'quay.io/biocontainers/anvio-minimal:9--pyhdfd78af_0' }"

input:
tuple val(meta), path(fasta), path(external_gene_calls)

output:
tuple val(meta), path("*.CONTIGS.db"), emit: contigs_db
tuple val("${task.process}"), val('anvio'), eval("anvi-gen-contigs-database --version 2>&1 | head -n 1 | cut -f 2 -d : | cut -c 2- | sed 's/.*(v//; s/).*//'"), emit: versions_anvio, topic: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def external_gene_calls_arg = external_gene_calls ? "--external-gene-calls ${external_gene_calls}" : ''
"""
anvi-gen-contigs-database \\
$args \\
--num-threads $task.cpus \\
--contigs-fasta $fasta \\
--project-name "$prefix" \\
--output-db-path ${prefix}.CONTIGS.db \\
$external_gene_calls_arg
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.CONTIGS.db
"""
}
77 changes: 77 additions & 0 deletions modules/nf-core/anvio/anvi-gen-contigs-database/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "anvio_anvi_gen_contigs_database"
description: Generate an anvi'o contigs database from FASTA sequences.
keywords:
- anvio
- contigs
- database
- metagenomics
- fasta
tools:
- "anvio":
description: "Anvi'o is an analysis and visualization platform for 'omics data."
homepage: "https://merenlab.org/software/anvio/"
documentation: "https://anvio.org/help/9/programs/anvi-gen-contigs-database/"
tool_dev_url: "https://github.com/merenlab/anvio"
doi: "10.1038/s41564-020-00834-3"
licence:
- "GPL-3.0-or-later"
identifier: biotools:anvio
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- fasta:
type: file
description: FASTA file containing contigs or genome sequences.
pattern: "*.{fa,fasta,fna,fa.gz,fasta.gz,fna.gz}"
ontologies:
- edam: http://edamontology.org/format_1929 # FASTA
- external_gene_calls:
type: file
optional: true
description: Optional TAB-delimited external gene calls file for anvi'o.
pattern: "*.{txt,tsv}"
ontologies:
- edam: http://edamontology.org/format_3475 # TSV
output:
contigs_db:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.CONTIGS.db":
type: file
description: Anvi'o contigs database.
pattern: "*.CONTIGS.db"
ontologies:
- edam: http://edamontology.org/format_3621 # SQLite format
versions_anvio:
- - "${task.process}":
type: string
description: The name of the process
- anvio:
type: string
description: The name of the tool
- "anvi-gen-contigs-database --version 2>&1 | head -n 1 | cut -f 2 -d : | cut -c 2- | sed 's/.*(v//; s/).*//'":
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - "${task.process}":
type: string
description: The name of the process
- anvio:
type: string
description: The name of the tool
- "anvi-gen-contigs-database --version 2>&1 | head -n 1 | cut -f 2 -d : | cut -c 2- | sed 's/.*(v//; s/).*//'":
type: eval
description: The expression to obtain the version of the tool
authors:
- "@telatin"
maintainers:
- "@telatin"
67 changes: 67 additions & 0 deletions modules/nf-core/anvio/anvi-gen-contigs-database/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
nextflow_process {

name "Test Process ANVIO_ANVI_GEN_CONTIGS_DATABASE"
script "../main.nf"
process "ANVIO_ANVI_GEN_CONTIGS_DATABASE"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "anvio"
tag "anvio/anvi-gen-contigs-database"

test("anvi-gen-contigs-database - synthetic fasta") {

when {
process {
"""
input[0] = Channel.of(
">contig_1",
"ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT",
"ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT",
">contig_2",
"TTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGC",
"TTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGCTTGCAAGC"
)
.collectFile(name: "contigs.fa", newLine: true, sort: false)
.map { fasta -> [ [ id:'test' ], fasta, [] ] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.contigs_db.size() == 1 },
{ assert file(process.out.contigs_db[0][1]).name == "test.CONTIGS.db" },
{ assert file(process.out.contigs_db[0][1]).length() > 0 },
{ assert snapshot(process.out.versions_anvio).match("versions") }
)
}
}

test("anvi-gen-contigs-database - stub") {

options "-stub"

when {
process {
"""
input[0] = Channel.of(
">contig_1",
"ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT"
)
.collectFile(name: "contigs.fa", newLine: true, sort: false)
.map { fasta -> [ [ id:'test' ], fasta, [] ] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"versions": {
"content": [
[
[
"ANVIO_ANVI_GEN_CONTIGS_DATABASE",
"anvio",
"9"
]
]
],
"timestamp": "2026-05-20T10:37:17.429792",
"meta": {
"nf-test": "0.9.4",
"nextflow": "25.10.4"
}
},
"anvi-gen-contigs-database - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.CONTIGS.db:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
"ANVIO_ANVI_GEN_CONTIGS_DATABASE",
"anvio",
"9"
]
],
"contigs_db": [
[
{
"id": "test"
},
"test.CONTIGS.db:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_anvio": [
[
"ANVIO_ANVI_GEN_CONTIGS_DATABASE",
"anvio",
"9"
]
]
}
],
"timestamp": "2026-05-20T10:37:28.314211",
"meta": {
"nf-test": "0.9.4",
"nextflow": "25.10.4"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: 'ANVIO_ANVI_GEN_CONTIGS_DATABASE' {
ext.args = '--skip-gene-calling'
}
}
Loading