forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
369 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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::metamdbg=1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
process METAMDBG_ASM { | ||
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/metamdbg:1.0--hdcf5f25_1': | ||
'biocontainers/metamdbg:1.0--hdcf5f25_1' }" | ||
|
||
input: | ||
tuple val(meta), path(reads) | ||
val(input_type) | ||
|
||
output: | ||
tuple val(meta), path("*.contigs.fasta.gz"), emit: contigs | ||
tuple val(meta), path("*.metaMDBG.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}" | ||
switch(input_type) { | ||
case "hifi": input = "--in-hifi ${reads}"; break | ||
case "ont" : input = "--in-ont ${reads}" ; break | ||
default: | ||
error("ERROR: input_type must be one of either 'hifi' or 'ont'.") | ||
break | ||
} | ||
""" | ||
metaMDBG asm \\ | ||
--threads ${task.cpus} \\ | ||
--out-dir . \\ | ||
${args} \\ | ||
${input} | ||
rm -r tmp/ | ||
mv contigs.fasta.gz ${prefix}.contigs.fasta.gz | ||
mv metaMDBG.log ${prefix}.metaMDBG.log | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
metamdbg: \$(metaMDBG | grep "Version" | sed 's/ Version: //') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch ${prefix}.metaMDBG.log | ||
touch ${prefix}.contigs.fasta.gz | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
metamdbg: \$(metaMDBG | grep "Version" | sed 's/ Version: //') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "METAMDBG_ASM" | ||
description: Metagenome assembler for long-read sequences (HiFi and ONT). | ||
keywords: | ||
- assembly | ||
- long reads | ||
- metagenome | ||
- metagenome assembler | ||
tools: | ||
- "metamdbg": | ||
description: "MetaMDBG: a lightweight assembler for long and accurate metagenomics | ||
reads." | ||
homepage: "https://github.com/GaetanBenoitDev/metaMDBG" | ||
documentation: "https://github.com/GaetanBenoitDev/metaMDBG" | ||
tool_dev_url: "https://github.com/GaetanBenoitDev/metaMDBG" | ||
doi: "10.1038/s41587-023-01983-6" | ||
licence: ["MIT"] | ||
identifier: "" | ||
|
||
input: | ||
- - meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- reads: | ||
type: file | ||
description: Long read sequence data from ONT or HiFi in fasta format (can be | ||
gzipped) | ||
pattern: "*.{fa,fasta,fa.gz,fasta.gz}" | ||
|
||
- - input_type: | ||
type: string | ||
description: Sequencing technology for reads - either "hifi" for PacBio HiFi | ||
reads or "ont" for Oxford Nanopore reads. | ||
|
||
output: | ||
- contigs: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- "*.contigs.fasta.gz": | ||
type: file | ||
description: | | ||
Gzipped fasta file containing the assembled contigs from the input | ||
reads. | ||
- log: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- "*.metaMDBG.log": | ||
type: file | ||
description: Log file describing the metaMDBG run. | ||
- versions: | ||
- versions.yml: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
authors: | ||
- "@prototaxites" | ||
maintainers: | ||
- "@prototaxites" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
nextflow_process { | ||
|
||
name "Test Process METAMDBG_ASM" | ||
script "../main.nf" | ||
process "METAMDBG_ASM" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "metamdbg" | ||
tag "metamdbg/asm" | ||
|
||
test("metamdbg_asm - ont") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test', single_end:false ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/nanopore/fastq/test.fastq.gz', checkIfExists: true), | ||
] | ||
input[1] = "ont" | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
// output is stochastic - contig names differ per run | ||
// log file contains nextflow work dir paths | ||
{ assert snapshot( | ||
file(process.out.contigs[0][1]).name, | ||
file(process.out.log[0][1]).name, | ||
process.out.versions | ||
).match() }, | ||
{ assert path(process.out.log[0][1]).readLines().last().contains("Done!") } | ||
) | ||
} | ||
} | ||
test("metamdbg_asm - hifi") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test', single_end:false ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true), | ||
] | ||
input[1] = "hifi" | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
// output is stochastic - contig names differ per run | ||
// log file contains nextflow work dir paths | ||
{ assert snapshot( | ||
file(process.out.contigs[0][1]).name, | ||
file(process.out.log[0][1]).name, | ||
process.out.versions | ||
).match() }, | ||
{ assert path(process.out.log[0][1]).readLines().last().contains("Done!") } | ||
) | ||
} | ||
} | ||
|
||
test("metamdbg_asm - wrong format") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test', single_end:false ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true), | ||
] | ||
input[1] = "wrong" | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.failed }, | ||
{ assert process.errorReport.contains("ERROR: input_type must be one of either 'hifi' or 'ont'.") } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("metamdbg_asm - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test', single_end:false ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true), | ||
] | ||
input[1] = "hifi" | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out.versions).match("stub_versions") } | ||
) | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.