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
5 changes: 5 additions & 0 deletions modules/nf-core/fastaguard/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::fastaguard=0.6.0
34 changes: 34 additions & 0 deletions modules/nf-core/fastaguard/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
process FASTAGUARD {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/fastaguard:0.6.0--hfa8f182_0':
'quay.io/biocontainers/fastaguard:0.6.0--hfa8f182_0' }"

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

output:
tuple val(meta), path("*.fastaguard.html"), emit: html
tuple val(meta), path("*.fastaguard.json"), emit: json
tuple val(meta), path("*.fastaguard.tsv"), emit: tsv
tuple val(meta), path("*.fastaguard_mqc.json"), emit: mqc
tuple val("${task.process}"), val('fastaguard'), eval('fastaguard --version | cut -d " " -f 2'), emit: versions_fastaguard, topic: versions

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

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def args = task.ext.args ?: ''
"""
fastaguard ${fasta} \
${args} \
--out ${prefix}.fastaguard.html \
--json ${prefix}.fastaguard.json \
--tsv ${prefix}.fastaguard.tsv \
--multiqc ${prefix}.fastaguard_mqc.json
"""
}
97 changes: 97 additions & 0 deletions modules/nf-core/fastaguard/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: "fastaguard"
description: FASTA preflight QC for assembly pipelines
keywords:
- fasta
- assembly
- qc
tools:
- "fastaguard":
description: FASTA preflight QC for assembly pipelines
homepage: "https://github.com/ehsanestaji/FastaGuard"
documentation: "https://github.com/ehsanestaji/FastaGuard"
tool_dev_url: "https://github.com/ehsanestaji/FastaGuard"
licence:
- "MIT"
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'sample' ]
- fasta:
type: file
description: Assembly FASTA file
pattern: "*.{fa,fasta,fa.gz,fasta.gz}"
ontologies: []
output:
html:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'sample' ]
- "*.fastaguard.html":
type: file
description: FastaGuard HTML report
pattern: "*.fastaguard.html"
ontologies: []
json:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'sample' ]
- "*.fastaguard.json":
type: file
description: FastaGuard JSON report
pattern: "*.fastaguard.json"
ontologies:
- edam: http://edamontology.org/format_3464
tsv:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'sample' ]
- "*.fastaguard.tsv":
type: file
description: FastaGuard TSV summary
pattern: "*.fastaguard.tsv"
ontologies:
- edam: http://edamontology.org/format_3475
mqc:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'sample' ]
- "*.fastaguard_mqc.json":
type: file
description: MultiQC custom-content JSON
pattern: "*.fastaguard_mqc.json"
ontologies:
- edam: http://edamontology.org/format_3464
versions_fastaguard:
- - ${task.process}:
type: string
description: The process the versions were collected from
- fastaguard:
type: string
description: The tool name
- fastaguard --version | cut -d " " -f 2:
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The process the versions were collected from
- fastaguard:
type: string
description: The tool name
- fastaguard --version | cut -d " " -f 2:
type: eval
description: The expression to obtain the version of the tool
authors:
- "@ehsanestaji"
123 changes: 123 additions & 0 deletions modules/nf-core/fastaguard/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
nextflow_process {

name "Test FASTAGUARD"
script "../main.nf"
process "FASTAGUARD"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "fastaguard"
tag "fastaguard_single"

test("pass FASTA emits all reports") {
when {
process {
"""
def fasta = file(workDir.resolve("pass.fa").toString())
fasta.text = [
">clean",
("ACGT" * 60)
Comment thread
SPPearce marked this conversation as resolved.
].join("\\n") + "\\n"

input[0] = [
[ id:'pass' ],
fasta
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys: ["html", "json", "tsv", "mqc"])).match() }
)
}
Comment thread
SPPearce marked this conversation as resolved.
}

test("warn FASTA preserves reports") {
when {
process {
"""
def fasta = file(workDir.resolve("warn.fa").toString())
fasta.text = [
">long",
("ACGT" * 60),
">tiny",
"ACGT"
].join("\\n") + "\\n"

input[0] = [
[ id:'warn' ],
fasta
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys: ["html", "json", "tsv", "mqc"])).match() }
)
}
}

test("fail FASTA preserves reports for gate review") {
when {
process {
"""
def fasta = file(workDir.resolve("fail.fa").toString())
fasta.text = [
">dup",
"ACGTACGT",
">dup",
"ACGTACGT",
">bad",
"ACGTXYZ"
].join("\\n") + "\\n"

input[0] = [
[ id:'fail' ],
fasta
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys: ["html", "json", "tsv", "mqc"])).match() }
)
}
}

test("invalid FASTA is represented in the evidence path") {
when {
process {
"""
def fasta = file(workDir.resolve("invalid.fa").toString())
fasta.text = [
">empty_record",
">next_record",
"ACGT"
].join("\\n") + "\\n"

input[0] = [
[ id:'invalid' ],
fasta
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys: ["html", "json", "tsv", "mqc"])).match() }
)
}
}
}
Loading