Add new vcflib/vcfuniq module (#1208)

* Add new vcflib/vcfuniq module

* Rename module from vcfutils to vcfuniq

* Fix tests

* Compress output by default

* Fix ECLint
This commit is contained in:
Harshil Patel 2022-01-14 18:18:11 +00:00 committed by GitHub
parent 3f9a028581
commit 280712419d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,32 @@
def VERSION = '1.0.2' // Version information not provided by tool on CLI
process VCFLIB_VCFUNIQ {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::vcflib=1.0.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/vcflib:1.0.2--h3198e80_5':
'quay.io/biocontainers/vcflib:1.0.2--h3198e80_5' }"
input:
tuple val(meta), path(vcf), path(tbi)
output:
tuple val(meta), path("*.gz"), emit: vcf
path "versions.yml" , emit: versions
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
vcfuniq \\
$vcf \\
| bgzip -c $args > ${prefix}.vcf.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
vcflib: $VERSION
END_VERSIONS
"""
}

View file

@ -0,0 +1,46 @@
name: vcflib_vcfuniq
description: List unique genotypes. Like GNU uniq, but for VCF records. Remove records which have the same position, ref, and alt as the previous record.
keywords:
- vcf
- uniq
- deduplicate
tools:
- vcflib:
description: Command-line tools for manipulating VCF files
homepage: https://github.com/vcflib/vcflib
documentation: https://github.com/vcflib/vcflib#USAGE
doi: "https://doi.org/10.1101/2021.05.21.445151"
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: Compressed VCF file
pattern: "*.vcf.gz"
- tbi:
type: file
description: Index of VCF file
pattern: "*.vcf.gz.tbi"
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: Compressed VCF file
pattern: "*.vcf.gz"
authors:
- "@drpatelh"

View file

@ -1485,6 +1485,10 @@ variantbam:
- modules/variantbam/** - modules/variantbam/**
- tests/modules/variantbam/** - tests/modules/variantbam/**
vcflib/vcfuniq:
- modules/vcflib/vcfuniq/**
- tests/modules/vcflib/vcfuniq/**
vcftools: vcftools:
- modules/vcftools/** - modules/vcftools/**
- tests/modules/vcftools/** - tests/modules/vcftools/**

View file

@ -0,0 +1,16 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { VCFLIB_VCFUNIQ } from '../../../../modules/vcflib/vcfuniq/main.nf'
workflow test_vcflib_vcfuniq {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true)
]
VCFLIB_VCFUNIQ ( input )
}

View file

@ -0,0 +1,9 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: VCFLIB_VCFUNIQ {
ext.prefix = { "${meta.id}.uniq" }
}
}

View file

@ -0,0 +1,8 @@
- name: vcflib vcfuniq
command: nextflow run ./tests/modules/vcflib/vcfuniq -entry test_vcflib_vcfuniq -c ./tests/config/nextflow.config -c ./tests/modules/vcflib/vcfuniq/nextflow.config
tags:
- vcflib
- vcflib/vcfuniq
files:
- path: output/vcflib/test.uniq.vcf.gz
md5sum: fc178eb342a91dc0d1d568601ad8f8e2