Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
283cabb
tabix/tabix: update module to support region-based VCF extraction
luisas Mar 27, 2026
d0071a8
tabix/extract: add new module for region-based VCF extraction
luisas Mar 27, 2026
f6c4dac
tabix/extract: make both vcf and tbi outputs optional
luisas Mar 27, 2026
30ab6ea
tabix/tabix: add region extraction with optional vcf/tbi outputs
luisas Mar 27, 2026
24f25b5
add tabix/tabix
luisas Mar 27, 2026
39c5bd6
update tests
luisas Mar 27, 2026
b54b602
fix test
luisas Mar 27, 2026
d5d6fa1
fix downstream tests
luisas Mar 27, 2026
0be1e03
update snapshot
luisas Mar 27, 2026
44dd019
add tai input for the regions
luisas Mar 27, 2026
067bffc
emit bgzipped
luisas Mar 27, 2026
116bfca
add regions to the same input channel
luisas Mar 30, 2026
03a80c4
Merge branch 'master' into tabix-tabix-update
famosab Mar 31, 2026
958601e
Update modules/nf-core/tabix/tabix/meta.yml
luisas Mar 31, 2026
b238a9e
Update modules/nf-core/tabix/tabix/main.nf
luisas Mar 31, 2026
c8f6234
Update modules/nf-core/tabix/tabix/meta.yml
luisas Mar 31, 2026
e689684
Update modules/nf-core/tabix/tabix/main.nf
luisas Mar 31, 2026
349c817
Update modules/nf-core/tabix/tabix/tests/main.nf.test
luisas Mar 31, 2026
56846d4
add ntf-vcf
luisas Mar 31, 2026
288fee0
add regions
luisas Mar 31, 2026
54a15c2
add new test
luisas Mar 31, 2026
603d2b2
add flexible tab suffix detection
luisas Apr 1, 2026
c33a3f6
Merge branch 'master' into tabix-tabix-update
famosab Apr 13, 2026
69fa761
Merge branch 'master' into tabix-tabix-update
famosab Apr 13, 2026
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
21 changes: 16 additions & 5 deletions modules/nf-core/tabix/tabix/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,39 @@ process TABIX_TABIX {
'community.wave.seqera.io/library/htslib:1.21--ff8e28a189fbecaa' }"

input:
tuple val(meta), path(tab)
tuple val(meta), path(tab), path(tai), path(regions)

output:
tuple val(meta), path("*.{tbi,csi}"), emit: index
tuple val(meta), path("*.{tbi,csi}"), emit: index, optional: true
tuple val(meta), path("${prefix}.vcf.gz"), emit: vcf, optional: true
tuple val("${task.process}"), val('tabix'), eval("tabix -h 2>&1 | grep -oP 'Version:\\s*\\K[^\\s]+'") , topic: versions , emit: versions_tabix

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def regions_arg = regions ? "-R ${regions}" : ""
def output_arg = regions ? "| bgzip --threads ${task.cpus} > ${prefix}.vcf.gz" : ""

"""
tabix \\
${regions_arg} \\
--threads $task.cpus \\
$args \\
$tab
$tab \\
${output_arg}

"""
stub:
def args = task.ext.args ?: ''
def index = args.contains("-C ") || args.contains("--csi") ? "csi" : "tbi"
prefix = task.ext.prefix ?: "${meta.id}"
def ext = args.contains("-C ") || args.contains("--csi") ? "csi" : "tbi"
def index = regions ? "" : "touch ${tab}.${ext}"
def vcf = regions ? "touch ${prefix}.vcf.gz" : ""
"""
touch ${tab}.${index}
${index}
${vcf}
"""
}
34 changes: 32 additions & 2 deletions modules/nf-core/tabix/tabix/meta.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: tabix_tabix
description: create tabix index from a sorted bgzip tab-delimited genome file
description: |
Create a tabix index from a sorted bgzip TAB-delimited genome file, or
extract regions from a bgzipped VCF file using an optional regions file.
keywords:
- index
- tabix
- vcf
- extract
- regions
tools:
- tabix:
description: Generic indexer for TAB-delimited genome position files.
Expand All @@ -23,6 +27,20 @@ input:
description: TAB-delimited genome position file compressed with bgzip
pattern: "*.{bed.gz,gff.gz,sam.gz,vcf.gz}"
ontologies: []
- tai:
type: file
description: |
Tabix index for the input file. Required when extracting regions.
Pass [] when creating an index instead.
pattern: "*.{tbi,csi}"
ontologies: []
- regions:
type: file
description: |
Optional file of regions to extract (BED or chr:start-end format).
Pass [] to create an index instead of extracting regions.
pattern: "*.{bed,txt,tsv}"
ontologies: []
output:
index:
- - meta:
Expand All @@ -32,9 +50,21 @@ output:
e.g. [ id:'test', single_end:false ]
- "*.{tbi,csi}":
type: file
description: Tabix index file (either tbi or csi)
description: Tabix index file (tbi or csi). Emitted when no regions file is provided.
pattern: "*.{tbi,csi}"
ontologies: []
vcf:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "${prefix}.vcf.gz":
type: file
description: bgzipped VCF of extracted regions. Emitted when a regions file is provided.
pattern: "*.vcf.gz"
ontologies:
- edam: http://edamontology.org/format_3016 # VCF
versions_tabix:
- - ${task.process}:
type: string
Expand Down
71 changes: 66 additions & 5 deletions modules/nf-core/tabix/tabix/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ nextflow_process {
"""
input[0] = [
[ id:'tbi_bed' ],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed.gz', checkIfExists: true) ]
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed.gz', checkIfExists: true),
[],
[]
]
"""
}
Expand All @@ -43,7 +45,9 @@ nextflow_process {
"""
input[0] = [
[ id:'tbi_gff' ],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3.gz', checkIfExists: true) ]
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3.gz', checkIfExists: true),
[],
[]
]
"""
}
Expand All @@ -67,7 +71,9 @@ nextflow_process {
"""
input[0] = [
[ id:'tbi_vcf' ],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true) ]
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
[],
[]
]
"""
}
Expand All @@ -91,7 +97,9 @@ nextflow_process {
"""
input[0] = [
[ id:'vcf_csi' ],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true) ]
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
[],
[]
]
"""
}
Expand All @@ -106,6 +114,57 @@ nextflow_process {

}

test("sarscov2_vcf_tbi_regions") {
when {
params {
module_args = ''
}
process {
"""
input[0] = [
[ id:'vcf_regions' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true)
]
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys: ["vcf"])).match() }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we not use nft-vcf to test the md5sum of the vcf?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did not know about that - thank you! Will add now

)
}
}

test("sarscov2_vcf_tbi_regions_stub") {
options "-stub"
when {
params {
module_args = ''
}
process {
"""
input[0] = [
[ id:'vcf_regions_stub' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true)
]
"""
}
}

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

test("sarscov2_vcf_csi_stub") {
options "-stub"
when {
Expand All @@ -116,7 +175,9 @@ nextflow_process {
"""
input[0] = [
[ id:'vcf_csi_stub' ],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true) ]
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
[],
[]
]
"""
}
Expand Down
Loading
Loading