Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
additional_dependencies:
- [email protected]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand All @@ -22,7 +22,7 @@ repos:
)$

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.2
rev: 0.34.1
hooks:
- id: check-jsonschema
name: "Match meta.ymls in one of the subdirectories of modules/nf-core"
Expand All @@ -43,15 +43,15 @@ repos:

# use ruff for python files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.9
rev: v0.14.2
hooks:
- id: ruff
files: \.py$
args: [--fix, --exit-non-zero-on-fix, "--select", "I,E1,E4,E7,E9,F,UP,N"] # sort imports and fix (rules taken from nf-core/tools)
- id: ruff-format # formatter
# NOTE This runs with Docker instead of the binary. Hoping anyone messing with Dockerfiles has Docker installed
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
rev: v2.14.0
hooks:
- id: hadolint-docker
- repo: https://github.com/nf-core/tools
Expand Down
7 changes: 7 additions & 0 deletions modules/nf-core/vembrane/filter/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::vembrane=2.4.0"
56 changes: 56 additions & 0 deletions modules/nf-core/vembrane/filter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
process VEMBRANE_FILTER {
tag "$meta.id"
label 'process_single'

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

input:
tuple val(meta), path(variant)
val(expression)

output:
tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: filtered_variant
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}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

"""
vembrane filter \\
${args} \\
${expression} \\
-o ${prefix}_filtered.vcf \\
$variant

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

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

"""
echo $args

vembrane filter \\
${args} \\
${expression} \\
-o ${prefix}_filtered.vcf \\
$variant

cat <<-END_VERSIONS > versions.yml
"${task.process}":
vembrane: \$(vembrane --version)
END_VERSIONS
"""
}
60 changes: 60 additions & 0 deletions modules/nf-core/vembrane/filter/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "vembrane_filter"
description: write your description here
keywords:
- filter
- table
- sort
tools:
- "vembrane":
description: "Filter VCF/BCF files with Python expressions."
homepage: "https://github.com/vembrane/vembrane/tree/main"
documentation: "https://github.com/vembrane/vembrane/blob/main/docs/filter.md"
tool_dev_url: "https://github.com/vembrane/vembrane.git"
doi: "10.1093/bioinformatics/btac810"
licence: ["MIT"]
identifier: biotools:vembrane/filter

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- variant:
type: file
description: |
Path to the VCF/BCF file to be filtered.
e.g. 'file.vcf', 'file.vcf.gz', 'file.bcf', 'file.bcf.gz'
ontologies: []
- expression:
type: string
description: |
The filter expression can be any valid python expression that evaluates to a value of type bool.
e.g. 'ANN["SYMBOL"] == "CDH2"'
ontologies: []

output:
filtered_variant:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.{vcf,bcf,vcf.gz,bcf.gz}":
type: file
description: VCF normalized output file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

normalized?

pattern: "*.{vcf,bcf,vcf.gz,bcf.gz}"
ontologies: []
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
authors:
- "@trangdo-hsc"
- "@mkatsanto"
maintainers:
- "@trangdo-hsc"
108 changes: 108 additions & 0 deletions modules/nf-core/vembrane/filter/tests/main.nf.test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a stub test as well? :)

Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
nextflow_process {

name "Test Process VEMBRANE"
script "../main.nf"
process "VEMBRANE_FILTER"

tag "modules"
tag "modules_nfcore"
tag "vembrane"
tag "vembrane/filter"

test("homo sapiens - vcf") {

//
// (the module requires running more than one process to generate the required output)
// add the 'setup' method here.
// You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules).

Comment on lines +14 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//
// (the module requires running more than one process to generate the required output)
// add the 'setup' method here.
// You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules).

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[ id:'test', single_end:false ], // meta map
[ id:'test' ], // meta map

file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true),
]
input[1] = "'QUAL >= 30'"
"""
}
}

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

}

test("homo sapiens - vcf.gz") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[ id:'test', single_end:false ], // meta map
[ id:'test' ], // meta map

file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.vcf.gz', checkIfExists: true),
]
input[1] = "'QUAL >= 30'"
"""
}
}

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

}

test("homo sapiens - bcf") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[ id:'test', single_end:false ], // meta map
[ id:'test' ], // meta map

file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.bcf', checkIfExists: true),
]
input[1] = "'QUAL >= 30'"
"""
}
}

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

}

test("homo sapiens - bcf.gz") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[ id:'test', single_end:false ], // meta map
[ id:'test' ], // meta map

file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bcf.gz', checkIfExists: true),
]
input[1] = "'QUAL >= 30'"
"""
}
}

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

}

}
Loading
Loading