Skip to content

Commit ed39720

Browse files
mkatsantoMaria KatsantonifamosabSPPearce
authored
feat: addition of vembrane table module (#9285)
* fix: linting error * fix: add conda snapshot * fix: test path specification and removed test prefix * fix: add explicit version displayed * fix: revert the snapshot syntax * fix: explicit version snapshot retry * fix: remove newline * Update modules/nf-core/vembrane/table/tests/main.nf.test Co-authored-by: Famke Bäuerle <[email protected]> * Apply suggestions from code review Co-authored-by: Famke Bäuerle <[email protected]> * fix: apply formatting code review changes * Update modules/nf-core/vembrane/table/main.nf * Update modules/nf-core/vembrane/table/main.nf --------- Co-authored-by: Maria Katsantoni <[email protected]> Co-authored-by: Famke Bäuerle <[email protected]> Co-authored-by: Simon Pearce <[email protected]>
1 parent 40d96d5 commit ed39720

File tree

6 files changed

+431
-0
lines changed

6 files changed

+431
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- bioconda::vembrane=2.4.0
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
process VEMBRANE_TABLE {
2+
tag "${meta.id}"
3+
label 'process_low'
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
7+
? 'https://depot.galaxyproject.org/singularity/vembrane:2.4.0--pyhdfd78af_0'
8+
: 'biocontainers/vembrane:2.4.0--pyhdfd78af_0'}"
9+
10+
input:
11+
tuple val(meta), path(vcf)
12+
val expression
13+
14+
output:
15+
tuple val(meta), path("*.tsv"), emit: table
16+
path "versions.yml", emit: versions
17+
18+
when:
19+
task.ext.when == null || task.ext.when
20+
21+
script:
22+
def args = task.ext.args ?: ''
23+
def prefix = task.ext.prefix ?: "${meta.id}"
24+
"""
25+
vembrane table \\
26+
${args} \\
27+
--output ${prefix}.tsv \\
28+
'${expression}' \\
29+
${vcf}
30+
31+
cat <<-END_VERSIONS > versions.yml
32+
"${task.process}":
33+
vembrane: \$(vembrane --version | sed '1!d;s/.* //')
34+
END_VERSIONS
35+
"""
36+
37+
stub:
38+
def prefix = task.ext.prefix ?: "${meta.id}"
39+
"""
40+
touch ${prefix}.tsv
41+
42+
cat <<-END_VERSIONS > versions.yml
43+
"${task.process}":
44+
vembrane: \$(vembrane --version | sed '1!d;s/.* //')
45+
END_VERSIONS
46+
"""
47+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
2+
name: "vembrane_table"
3+
description: Creates tabular (TSV) files from VCF/BCF data with flexible Python expressions
4+
keywords:
5+
- vcf
6+
- bcf
7+
- table
8+
- genomics
9+
- variant
10+
- annotation
11+
tools:
12+
- "vembrane":
13+
description: "Filter VCF/BCF files with Python expressions"
14+
homepage: "https://vembrane.github.io/"
15+
documentation: "https://github.com/vembrane/vembrane/blob/main/docs/table.md"
16+
tool_dev_url: "https://github.com/vembrane/vembrane"
17+
doi: "10.1093/bioinformatics/btac810"
18+
licence: ["MIT"]
19+
identifier: biotools:vembrane
20+
args_id: "$args"
21+
22+
input:
23+
- - meta:
24+
type: map
25+
description: |
26+
Groovy Map containing sample information
27+
e.g. `[ id:'sample1', single_end:false ]`
28+
- vcf:
29+
type: file
30+
description: VCF/BCF file to extract tabular data from
31+
pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}"
32+
ontologies:
33+
- edam: http://edamontology.org/format_3016 # VCF
34+
- expression:
35+
type: string
36+
description: A comma-separated tuple of expressions that define the table column contents
37+
38+
output:
39+
table:
40+
- - meta:
41+
type: map
42+
description: |
43+
Groovy Map containing sample information
44+
e.g. `[ id:'sample1', single_end:false ]`
45+
- "*.tsv":
46+
type: file
47+
description: TSV file containing tabular data from VCF/BCF
48+
pattern: "*.tsv"
49+
ontologies:
50+
- edam: http://edamontology.org/format_3475 # TSV
51+
versions:
52+
- versions.yml:
53+
type: file
54+
description: File containing software versions
55+
pattern: "versions.yml"
56+
ontologies:
57+
- edam: http://edamontology.org/format_3750 # YAML
58+
authors:
59+
- "@mkatsanto"
60+
- "@trangdo-hsc"
61+
maintainers:
62+
- "@mkatsanto"
63+
- "@trangdo-hsc"
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
nextflow_process {
2+
3+
name "Test Process VEMBRANE_TABLE"
4+
script "../main.nf"
5+
process "VEMBRANE_TABLE"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "vembrane"
10+
tag "vembrane/table"
11+
12+
test("homo_sapiens - [vcf] - tsv") {
13+
14+
when {
15+
process {
16+
"""
17+
input[0] = [
18+
[ id:'test' ], // meta map
19+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true)
20+
]
21+
input[1] = 'CHROM, POS, REF, ALT, QUAL'
22+
"""
23+
}
24+
}
25+
26+
then {
27+
assertAll(
28+
{ assert process.success },
29+
{ assert snapshot(process.out).match() }
30+
)
31+
}
32+
}
33+
34+
test("homo_sapiens - [bcf.gz] - tsv") {
35+
36+
when {
37+
process {
38+
"""
39+
input[0] = [
40+
[ id:'test' ], // meta map
41+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bcf.gz', checkIfExists: true)
42+
]
43+
input[1] = 'CHROM, POS, REF, ALT, QUAL'
44+
"""
45+
}
46+
}
47+
48+
then {
49+
assertAll(
50+
{ assert process.success },
51+
{ assert snapshot(process.out).match() }
52+
)
53+
}
54+
}
55+
56+
test("homo_sapiens - [vcf] - csv - custom_separator") {
57+
58+
config "./nextflow.config"
59+
60+
when {
61+
params {
62+
vembrane_args = '--separator ,'
63+
}
64+
process {
65+
"""
66+
input[0] = [
67+
[ id:'test' ], // meta map
68+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true)
69+
]
70+
input[1] = 'CHROM, POS, REF, ALT'
71+
"""
72+
}
73+
}
74+
75+
then {
76+
assertAll(
77+
{ assert process.success },
78+
{ assert snapshot(process.out).match() }
79+
)
80+
}
81+
}
82+
83+
test("homo_sapiens - [vcf] - tsv - custom_header") {
84+
85+
config "./nextflow.config"
86+
87+
when {
88+
params {
89+
vembrane_args = '--header "Chromosome,Position,Variant_ID,Quality"'
90+
}
91+
process {
92+
"""
93+
input[0] = [
94+
[ id:'test' ], // meta map
95+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true)
96+
]
97+
input[1] = 'CHROM, POS, ID, QUAL'
98+
"""
99+
}
100+
}
101+
102+
then {
103+
assertAll(
104+
{ assert process.success },
105+
{ assert snapshot(process.out).match() }
106+
)
107+
}
108+
}
109+
110+
test("homo_sapiens - [vcf] - tsv - stub") {
111+
112+
options "-stub"
113+
114+
when {
115+
process {
116+
"""
117+
input[0] = [
118+
[ id:'test' ], // meta map
119+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true)
120+
]
121+
input[1] = 'CHROM, POS, REF, ALT, QUAL'
122+
"""
123+
}
124+
}
125+
126+
then {
127+
assertAll(
128+
{ assert process.success },
129+
{ assert snapshot(
130+
process.out,
131+
path(process.out.versions[0]).yaml
132+
).match() }
133+
)
134+
}
135+
}
136+
137+
}

0 commit comments

Comments
 (0)