Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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/bcftools/pluginvcf2table/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::bcftools=1.23.1"
45 changes: 45 additions & 0 deletions modules/nf-core/bcftools/pluginvcf2table/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
process BCFTOOLS_PLUGINVCF2TABLE {
tag "${meta.id}"
label 'process_medium'
Comment thread
emmcauley marked this conversation as resolved.
Outdated

conda "${moduleDir}/environment.yml"
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'oras://community.wave.seqera.io/library/bcftools:1.23.1--16b1a31e5dc795f7'
: 'community.wave.seqera.io/library/bcftools:1.23.1--4d193a5f61d4aed7'}"

input:
tuple val(meta), path(vcf), path(tbi)
tuple val(meta2), path(regions)
tuple val(meta3), path(targets)
tuple val(meta4), path(samples)
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.

Are these likely to be the same file for every sample, or depend on the sample?

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.

they can be either shared or per-sample depending on the context

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.

Hmm, this might be a moot point when we end up using record types SOON (TM), but currently it is probably easier if they are all part of the same tuple I think.

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.

fixed


output:
tuple val(meta), path("*.txt"), emit: txt
tuple val("${task.process}"), val('bcftools'), eval("bcftools --version"), topic: versions, emit: versions_bcftools

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def regions_file = regions ? "--regions-file ${regions}" : ''
def targets_file = targets ? "--targets-file ${targets}" : ''
def samples_file = samples ? "--samples-file ${samples}" : ''
"""
bcftools \\
+vcf2table \\
${args} \\
${regions_file} \\
${targets_file} \\
${samples_file} \\
${vcf} \\
> ${prefix}.txt
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.txt
"""
}
119 changes: 119 additions & 0 deletions modules/nf-core/bcftools/pluginvcf2table/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: bcftools_pluginvcf2table
description: |
Converts VCF/BCF files into a tab-delimited table using the bcftools +vcf2table plugin.
Each variant is output as one row, with INFO and FORMAT fields as columns.
keywords:
- bcftools
- vcf
- table
- variant calling
tools:
- bcftools:
description: |
BCFtools is a set of utilities for variant calling and manipulating VCF/BCF files.
The +vcf2table plugin converts VCF records into a tab-delimited table format.
homepage: http://samtools.github.io/bcftools/bcftools.html
documentation: http://www.htslib.org/doc/bcftools.html
doi: "10.1093/gigascience/giab008"
licence:
- "MIT"
identifier: biotools:bcftools
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
ontologies: []
- vcf:
type: file
description: VCF/BCF file to be converted (optionally bgzipped).
pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}"
ontologies:
- edam: "http://edamontology.org/format_3016" # VCF
- tbi:
type: file
description: Index of the VCF/BCF file (required when vcf is bgzipped).
pattern: "*.{tbi,csi}"
ontologies: []
- - meta2:
type: map
description: |
Groovy Map containing regions file information
e.g. [ id:'test' ]
ontologies: []
- regions:
type: file
description: |
Optional. Restrict the operation to regions listed in this BED or VCF file.
Relies on a tabix index.
pattern: "*.{bed,vcf,vcf.gz}"
ontologies:
- edam: "http://edamontology.org/format_3003" # BED
- edam: "http://edamontology.org/format_3016" # VCF
- - meta3:
type: map
description: |
Groovy Map containing targets file information
e.g. [ id:'test' ]
ontologies: []
- targets:
type: file
description: |
Optional. Restrict the operation to regions listed in this file
(does not rely on index files).
pattern: "*.{bed,vcf,vcf.gz}"
ontologies:
- edam: "http://edamontology.org/format_3003" # BED
- edam: "http://edamontology.org/format_3016" # VCF
- - meta4:
type: map
description: |
Groovy Map containing samples file information
e.g. [ id:'test' ]
ontologies: []
- samples:
type: file
description: |
Optional. File of sample names to include or exclude.
pattern: "*.txt"
ontologies: []
output:
txt:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
ontologies: []
- "*.txt":
type: file
description: Tab-delimited table output from bcftools +vcf2table.
pattern: "*.txt"
ontologies:
- edam: "http://edamontology.org/format_3475" # TSV
versions_bcftools:
- - ${task.process}:
type: string
description: The name of the process
- bcftools:
type: string
description: The name of the tool
- "bcftools --version":
type: string
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- bcftools:
type: string
description: The name of the tool
- "bcftools --version":
type: string
description: The expression to obtain the version of the tool
authors:
- "@emmcauley"
maintainers:
- "@emmcauley"
119 changes: 119 additions & 0 deletions modules/nf-core/bcftools/pluginvcf2table/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "bcftools"
tag "bcftools/pluginvcf2table"

test("homo_sapiens - vcf_gz - tbi") {

when {
process {
"""
input[0] = [
[ id:'test' ],
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true)
]
input[1] = [ [], [] ]
input[2] = [ [], [] ]
input[3] = [ [], [] ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
Comment thread
emmcauley marked this conversation as resolved.
Outdated
)
}

}

test("homo_sapiens - vcf_gz - tbi - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ],
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true)
]
input[1] = [ [], [] ]
input[2] = [ [], [] ]
input[3] = [ [], [] ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
Comment thread
emmcauley marked this conversation as resolved.
Outdated
)
}


}
test("homo_sapiens - vcf_gz - tbi - regions") {

when {
process {
"""
input[0] = [
[ id:'test' ],
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true)
Comment thread
emmcauley marked this conversation as resolved.
Outdated
]
input[1] = [ ['test_regions'], [file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/bed/test.bed', checkIfExists: true) ] ]
input[2] = [ [], [] ]
input[3] = [ [], [] ]
"""
}
}

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

}

test("homo_sapiens - vcf_gz - tbi - regions - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ],
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true)
]
input[1] = [ ['test_regions'], [file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/bed/test.bed', checkIfExists: true) ] ]
input[2] = [ [], [] ]
input[3] = [ [], [] ]
"""
}
}

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

}
}
Loading
Loading