Merge pull request #1610 from nvnieuwk/new-module-hap.py

New module hap.py
This commit is contained in:
nvnieuwk 2022-05-04 15:00:45 +02:00 committed by GitHub
commit 994cd6d171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 189 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
"""
}

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

@ -0,0 +1,63 @@
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/GVCF 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 ]
- summary:
type: file
description: A CSV file containing the summary of the benchmarking
pattern: "*.summary.csv"
- extended:
type: file
description: A CSV file containing extended info of the benchmarking
pattern: "*.extended.csv"
- runinfo:
type: file
description: A JSON file containing the run info
pattern: "*.runinfo.json"
- 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,25 @@
- name: happy test_happy_vcf
command: nextflow run tests/modules/happy -entry test_happy_vcf -c tests/config/nextflow.config
tags:
- happy
files:
- path: output/happy/test.extended.csv
md5sum: ef79c7c789ef4f146ca2e50dafaf22b3
- path: output/happy/test.runinfo.json
- path: output/happy/test.summary.csv
md5sum: f8aa5d36d3c48dede2f607fd565894ad
- path: output/happy/versions.yml
md5sum: 2c2b8249f9f52194da7f09076dbb5019
- name: happy test_happy_gvcf
command: nextflow run tests/modules/happy -entry test_happy_gvcf -c tests/config/nextflow.config
tags:
- happy
files:
- path: output/happy/test.extended.csv
md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3
- path: output/happy/test.runinfo.json
- path: output/happy/test.summary.csv
md5sum: 03044e9bb5a0c6f0947b7e910fc8a558
- path: output/happy/versions.yml
md5sum: 75331161af9ec046d045ffcba83abddf