added gvcftools/extractvariants (#1924)

* added gvcftools/extractvariants

* linting

* Update modules/gvcftools/extractvariants/meta.yml

Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>

* Update modules/gvcftools/extractvariants/main.nf

Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>

* added uncompressed input handling

Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>
This commit is contained in:
nvnieuwk 2022-07-25 13:30:35 +02:00 committed by GitHub
parent a8b0fce8ce
commit c363d8c37c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 131 additions and 0 deletions

View file

@ -0,0 +1,37 @@
process GVCFTOOLS_EXTRACTVARIANTS {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::gvcftools=0.17.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gvcftools:0.17.0--he941832_3':
'quay.io/biocontainers/gvcftools:0.17.0--he941832_3' }"
input:
tuple val(meta), path(gvcf)
output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
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}"
def open_gvcf = gvcf.extension == "gz" ? "gzip -dc $gvcf" : "cat $gvcf"
"""
$open_gvcf |
extract_variants \\
$args \\
$gvcf |
gzip -c > ${prefix}.vcf.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gvcftools: \$(extract_variants --help 2>&1 | grep version | sed 's/version: //')
END_VERSIONS
"""
}

View file

@ -0,0 +1,45 @@
name: "gvcftools_extractvariants"
description: Removes all non-variant blocks from a gVCF file to produce a smaller variant-only VCF file.
keywords:
- gvcftools
- extract_variants
- extractvariants
- gvcf
- vcf
tools:
- "gvcftools":
description: "gvcftools is a package of small utilities for creating and analyzing gVCF files"
homepage: "{https://sites.google.com/site/gvcftools/home}"
documentation: "{https://sites.google.com/site/gvcftools/home/configuration-and-analysis}"
tool_dev_url: "{https://github.com/sequencing/gvcftools}"
doi: ""
licence: "['MIT']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- gvcf:
type: file
description: GVCF file
pattern: "*.{g.vcf,gvcf}.gz"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- vcf:
type: file
description: Converted variant-only VCF file
pattern: "*.vcf.gz"
authors:
- "@nvnieuwk"

View file

@ -1031,6 +1031,10 @@ gunzip:
- modules/gunzip/** - modules/gunzip/**
- tests/modules/gunzip/** - tests/modules/gunzip/**
gvcftools/extractvariants:
- modules/gvcftools/extractvariants/**
- tests/modules/gvcftools/extractvariants/**
hamronization/amrfinderplus: hamronization/amrfinderplus:
- modules/hamronization/amrfinderplus/** - modules/hamronization/amrfinderplus/**
- tests/modules/hamronization/amrfinderplus/** - tests/modules/hamronization/amrfinderplus/**

View file

@ -0,0 +1,25 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { GVCFTOOLS_EXTRACTVARIANTS } from '../../../../modules/gvcftools/extractvariants/main.nf'
workflow test_gvcftools_extractvariants {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf_gz'], checkIfExists: true)
]
GVCFTOOLS_EXTRACTVARIANTS ( input )
}
workflow test_gvcftools_extractvariants_uncompressed {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true)
]
GVCFTOOLS_EXTRACTVARIANTS ( input )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,15 @@
- name: gvcftools extractvariants test_gvcftools_extractvariants
command: nextflow run ./tests/modules/gvcftools/extractvariants -entry test_gvcftools_extractvariants -c ./tests/config/nextflow.config -c ./tests/modules/gvcftools/extractvariants/nextflow.config
tags:
- gvcftools
- gvcftools/extractvariants
files:
- path: output/gvcftools/test.vcf.gz
- name: gvcftools extractvariants test_gvcftools_extractvariants_uncompressed
command: nextflow run ./tests/modules/gvcftools/extractvariants -entry test_gvcftools_extractvariants_uncompressed -c ./tests/config/nextflow.config -c ./tests/modules/gvcftools/extractvariants/nextflow.config
tags:
- gvcftools
- gvcftools/extractvariants
files:
- path: output/gvcftools/test.vcf.gz