-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: BCFTOOLS_PLUGINVCF2TABLE #11219
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
base: master
Are you sure you want to change the base?
Changes from 7 commits
a504b29
f567cdd
70a3e6d
ca81087
526093c
d2a3d91
bcec421
6192b59
89c5fd6
3d62bd1
d3de5af
0fdc9c3
3c0fd25
5f860dd
ff5c6d4
a9e86e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| process BCFTOOLS_PLUGINVCF2TABLE { | ||
| tag "${meta.id}" | ||
| label 'process_medium' | ||
|
|
||
| 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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they can be either shared or per-sample depending on the context
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| """ | ||
| } | ||
| 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" |
| 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() }, | ||
|
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() }, | ||
|
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) | ||
|
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() }, | ||
| ) | ||
| } | ||
|
|
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.