-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add anvi-gen-contigs-database module #11713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| process ANVIO_ANVI_GEN_CONTIGS_DATABASE { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please stick to the naming scheme described here: module specifications |
||
| 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 \\ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to let the module user decide about the output file naming in their pipeline via |
||
| $external_gene_calls_arg | ||
| """ | ||
|
|
||
| stub: | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
| touch ${prefix}.CONTIGS.db | ||
| """ | ||
| } | ||
| 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" |
| 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") } | ||
|
Comment on lines
+35
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have these asswertions be part of the snapshot? |
||
| ) | ||
| } | ||
| } | ||
|
|
||
| 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' | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can run
on this file to clean this up nicely.