Added the module and some simple testing

This commit is contained in:
Nicolas Vannieuwkerke 2022-05-04 13:42:12 +02:00
parent 1baf143607
commit c517ce9b4d
6 changed files with 159 additions and 0 deletions

53
modules/happy/main.nf Normal file
View file

@ -0,0 +1,53 @@
def VERSION_HAP = '0.3.14'
def VERSION_PRE = '0.3.14'
process HAPPY {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::hap.py=0.3.14" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/hap.py:0.3.14--py27h5c5a3ab_0':
'quay.io/biocontainers/hap.py:0.3.14--py27h5c5a3ab_0' }"
input:
tuple val(meta), path(truth_vcf), path(query_vcf), path(bed)
tuple path(fasta), path(fasta_fai)
output:
tuple val(meta), path('*.csv'), path('*.json') , emit: metrics
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
pre.py \\
$args \\
-R $bed \\
--reference $fasta \\
--threads $task.cpus \\
$query_vcf \\
${prefix}_preprocessed.vcf.gz
hap.py \\
$truth_vcf \\
${prefix}_preprocessed.vcf.gz \\
$args2 \\
--reference $fasta \\
--threads $task.cpus \\
-R $bed \\
-o $prefix
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hap.py: $VERSION_HAP
pre.py: $VERSION_PRE
END_VERSIONS
"""
}

51
modules/happy/meta.yml Normal file
View file

@ -0,0 +1,51 @@
name: "happy"
description: Hap.py is a tool to compare diploid genotypes at haplotype level. Rather than comparing VCF records row by row, hap.py will generate and match alternate sequences in a superlocus. A superlocus is a small region of the genome (sized between 1 and around 1000 bp) that contains one or more variants.
keywords:
- happy
- benchmark
- haplotype
tools:
- "happy":
description: "Haplotype VCF comparison tools"
homepage: "https://www.illumina.com/products/by-type/informatics-products/basespace-sequence-hub/apps/hap-py-benchmarking.html"
documentation: "https://github.com/Illumina/hap.py"
tool_dev_url: "https://github.com/Illumina/hap.py"
doi: ""
licence: "['BSD-2-clause']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- truth_vcf:
type: file
description: gold standard VCF file
pattern: "*.{vcf,vcf.gz}"
- query_vcf:
type: file
description: VCF file to query
pattern: "*.{vcf,vcf.gz}"
- bed:
type: file
description: BED file
pattern: "*.bed"
- fasta:
type: file
description: FASTA file of the reference genome
pattern: "*.{fa,fasta}"
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"
authors:
- "@nvnieuwk"

View file

@ -891,6 +891,10 @@ hamronization/summarize:
- modules/hamronization/summarize/**
- tests/modules/hamronization/summarize/**
happy:
- modules/happy/**
- tests/modules/happy/**
hicap:
- modules/hicap/**
- tests/modules/hicap/**

View file

@ -0,0 +1,39 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { HAPPY } from '../../../modules/happy/main.nf'
workflow test_happy_vcf {
input = [
[ id:'test' ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_rnaseq_vcf'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_genome21_indels_vcf_gz'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)
]
fasta = Channel.value([
file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
])
HAPPY ( input, fasta )
}
workflow test_happy_gvcf {
input = [
[ id:'test' ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_rnaseq_vcf'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)
]
fasta = Channel.value([
file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
])
HAPPY ( input, fasta )
}

View file

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

View file

@ -0,0 +1,7 @@
- name: happy test_happy
command: nextflow run tests/modules/happy -entry test_happy -c tests/config/nextflow.config
tags:
- happy
files:
- path: output/happy/versions.yml
md5sum: ab8944c1b24e55bab311a9d389c75c90