8000 Added fa-lint by GallVp · Pull Request #8488 · nf-core/modules · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added fa-lint #8488

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

Merged
merged 3 commits into from
May 19, 2025
Merged
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
7 changes: 7 additions & 0 deletions modules/nf-core/falint/environment.yml
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::fa-lint=1.0.0
60 changes: 60 additions & 0 deletions modules/nf-core/falint/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
process FALINT {
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/fa-lint:1.0.0--he881be0_0':
'biocontainers/fa-lint:1.0.0--he881be0_0' }"

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

output:
tuple val(meta), path('*.success.log') , emit: success_log , optional: true
tuple val(meta), path('*.error.log') , emit: error_log , optional: true
path "versions.yml" , emit: versions

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

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def args = task.ext.args ?: ''
"""
fa-lint \\
-threads ${task.cpus} \\
$args \\
-fasta $fasta \\
> >(tee ${prefix}.success.log >&1) \\
2> >(tee ${prefix}.error.log >&2) \\
|| echo "Errors from fa-lint printed to ${prefix}.error.log"

if [ \$(cat ${prefix}.error.log | wc -l) -gt 0 ]; then
echo "Validation failed..."

rm ${prefix}.success.log
else
echo "Validation successful..."

rm ${prefix}.error.log
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
fa-lint: \$(fa-lint -version)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "Fasta is valid: $fasta" \\
> "${prefix}.success.log"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
fa-lint: \$(fa-lint -version)
END_VERSIONS
"""
}
61 changes: 61 additions & 0 deletions modules/nf-core/falint/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "falint"
description: A fasta linter/validator
keywords:
- fasta
- validation
- genome
tools:
- "falint":
description: "A Fasta linter/validator"
homepage: "https://github.com/GallVp/fa-lint"
documentation: "https://github.com/GallVp/fa-lint"
tool_dev_url: "https://github.com/GallVp/fa-lint"
licence: ["MIT"]
identifier: ""

input:
- - meta:
type: map
description: |
Groovy Map containing file information
e.g. [ id:'test' ]
- fasta:
type: file
description: Input fasta file
pattern: "*.fasta"
ontologies: []
output:
- success_log:
- meta:
type: map
description: |
Groovy Map containing file information
e.g. [ id:'test' ]
- "*.success.log":
type: file
description: Log file for successful validation
pattern: "*.success.log"
ontologies: []
- error_log:
- meta:
type: map
description: |
Groovy Map containing file information
e.g. [ id:'test' ]
- "*.error.log":
type: file
description: Log file for failed validation
pattern: "*.error.log"
ontologies: []
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
authors:
- "@gallvp"
maintainers:
- "@gallvp"
80 changes: 80 additions & 0 deletions modules/nf-core/falint/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
nextflow_process {

name "Test Process FALINT"
script "../main.nf"
process "FALINT"

tag "modules"
tag "modules_nfcore"
tag "falint"

test("sarscov2-fasta-valid") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2-fasta-valid-stub") {

options '-stub'

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2-gff3-invalid") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert process.out.success_log == [] },
{ assert file(process.out.error_log[0][1]).text.contains('Fasta file must start with a header line') }
)
}

}
}
96 changes: 96 additions & 0 deletions modules/nf-core/falint/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"sarscov2-fasta-valid": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.success.log:md5,7b9802635c4f44d1711e7132ccdb648e"
]
],
"1": [

],
"2": [
"versions.yml:md5,6edbfcd6e31e74c05778f1d48191b9f6"
],
"error_log": [

],
"success_log": [
[
{
"id": "test",
"single_end": false
},
"test.success.log:md5,7b9802635c4f44d1711e7132ccdb648e"
]
],
"versions": [
"versions.yml:md5,6edbfcd6e31e74c05778f1d48191b9f6"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.6"
},
"timestamp": "2025-05-16T14:55:29.853456"
},
"sarscov2-gff3-invalid": {
"content": [
[
"versions.yml:md5,6edbfcd6e31e74c05778f1d48191b9f6"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.6"
},
"timestamp": "2025-05-16T15:08:29.434346"
},
"sarscov2-fasta-valid-stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.success.log:md5,7b9802635c4f44d1711e7132ccdb648e"
]
],
"1": [

],
"2": [
"versions.yml:md5,6edbfcd6e31e74c05778f1d48191b9f6"
],
"error_log": [

],
"success_log": [
[
{
"id": "test",
"single_end": false
},
"test.success.log:md5,7b9802635c4f44d1711e7132ccdb648e"
]
],
"versions": [
"versions.yml:md5,6edbfcd6e31e74c05778f1d48191b9f6"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.6"
},
"timestamp": "2025-05-16T15:08:25.052305"
}
}
Loading
0