diff --git a/modules/happy/main.nf b/modules/happy/happy/main.nf similarity index 74% rename from modules/happy/main.nf rename to modules/happy/happy/main.nf index 1338686e..1bb99117 100644 --- a/modules/happy/main.nf +++ b/modules/happy/happy/main.nf @@ -1,7 +1,6 @@ -def VERSION_HAP = '0.3.14' -def VERSION_PRE = '0.3.14' +def VERSION = '0.3.14' -process HAPPY { +process HAPPY_HAPPY { tag "$meta.id" label 'process_medium' @@ -23,22 +22,13 @@ process HAPPY { 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 \\ + $query_vcf \\ + $args \\ --reference $fasta \\ --threads $task.cpus \\ -R $bed \\ @@ -46,8 +36,7 @@ process HAPPY { cat <<-END_VERSIONS > versions.yml "${task.process}": - hap.py: $VERSION_HAP - pre.py: $VERSION_PRE + hap.py: $VERSION END_VERSIONS """ } diff --git a/modules/happy/meta.yml b/modules/happy/happy/meta.yml similarity index 93% rename from modules/happy/meta.yml rename to modules/happy/happy/meta.yml index 6b5b86cf..8ec762d5 100644 --- a/modules/happy/meta.yml +++ b/modules/happy/happy/meta.yml @@ -1,4 +1,4 @@ -name: "happy" +name: "happy_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 @@ -35,6 +35,10 @@ input: type: file description: FASTA file of the reference genome pattern: "*.{fa,fasta}" + - fasta_fai: + type: file + description: The index of the reference FASTA + pattern: "*.fai" output: - meta: diff --git a/modules/happy/prepy/main.nf b/modules/happy/prepy/main.nf new file mode 100644 index 00000000..936f56ea --- /dev/null +++ b/modules/happy/prepy/main.nf @@ -0,0 +1,41 @@ +def VERSION = '0.3.14' + +process HAPPY_PREPY { + 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(vcf), path(bed) + tuple path(fasta), path(fasta_fai) + + output: + tuple val(meta), path('*.vcf.gz') , emit: preprocessed_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}" + + """ + pre.py \\ + $args \\ + -R $bed \\ + --reference $fasta \\ + --threads $task.cpus \\ + $vcf \\ + ${prefix}.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pre.py: $VERSION + END_VERSIONS + """ +} diff --git a/modules/happy/prepy/meta.yml b/modules/happy/prepy/meta.yml new file mode 100644 index 00000000..7e27a652 --- /dev/null +++ b/modules/happy/prepy/meta.yml @@ -0,0 +1,55 @@ +name: "happy_prepy" +description: Pre.py is a preprocessing tool made to preprocess VCF files for Hap.py +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 ] + - vcf: + type: file + description: VCF file to preprocess + 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}" + - fasta_fai: + type: file + description: The index of the reference FASTA + pattern: "*.fai" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - vcf: + type: file + description: A preprocessed VCF file + pattern: "*.vcf.gz" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@nvnieuwk" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index c14ffc8e..32a28477 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -891,9 +891,13 @@ hamronization/summarize: - modules/hamronization/summarize/** - tests/modules/hamronization/summarize/** -happy: - - modules/happy/** - - tests/modules/happy/** +happy/happy: + - modules/happy/happy/** + - tests/modules/happy/happy/** + +happy/prepy: + - modules/happy/prepy/** + - tests/modules/happy/prepy/** hicap: - modules/hicap/** diff --git a/tests/modules/happy/main.nf b/tests/modules/happy/happy/main.nf similarity index 90% rename from tests/modules/happy/main.nf rename to tests/modules/happy/happy/main.nf index 0ce23b50..515a657b 100644 --- a/tests/modules/happy/main.nf +++ b/tests/modules/happy/happy/main.nf @@ -2,7 +2,7 @@ nextflow.enable.dsl = 2 -include { HAPPY } from '../../../modules/happy/main.nf' +include { HAPPY_HAPPY } from '../../../../modules/happy/happy/main.nf' workflow test_happy_vcf { @@ -18,7 +18,7 @@ workflow test_happy_vcf { file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) ]) - HAPPY ( input, fasta ) + HAPPY_HAPPY ( input, fasta ) } workflow test_happy_gvcf { @@ -35,5 +35,5 @@ workflow test_happy_gvcf { file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) ]) - HAPPY ( input, fasta ) + HAPPY_HAPPY ( input, fasta ) } diff --git a/tests/modules/happy/nextflow.config b/tests/modules/happy/happy/nextflow.config similarity index 100% rename from tests/modules/happy/nextflow.config rename to tests/modules/happy/happy/nextflow.config diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/happy/test.yml similarity index 58% rename from tests/modules/happy/test.yml rename to tests/modules/happy/happy/test.yml index 0fd26e5b..89a1f012 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/happy/test.yml @@ -1,7 +1,8 @@ -- name: happy test_happy_vcf - command: nextflow run tests/modules/happy -entry test_happy_vcf -c tests/config/nextflow.config +- name: happy happy test_happy_vcf + command: nextflow run tests/modules/happy/happy -entry test_happy_vcf -c tests/config/nextflow.config tags: - happy + - happy/happy files: - path: output/happy/test.extended.csv md5sum: ef79c7c789ef4f146ca2e50dafaf22b3 @@ -9,12 +10,13 @@ - path: output/happy/test.summary.csv md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml - md5sum: 2c2b8249f9f52194da7f09076dbb5019 + md5sum: 82243bf6dbdc71aa63211ee2a89f47f2 -- name: happy test_happy_gvcf - command: nextflow run tests/modules/happy -entry test_happy_gvcf -c tests/config/nextflow.config +- name: happy happy test_happy_gvcf + command: nextflow run tests/modules/happy/happy -entry test_happy_gvcf -c tests/config/nextflow.config tags: - happy + - happy/happy files: - path: output/happy/test.extended.csv md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3 @@ -22,4 +24,4 @@ - path: output/happy/test.summary.csv md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 - path: output/happy/versions.yml - md5sum: 75331161af9ec046d045ffcba83abddf + md5sum: 551fa216952d6f5de78e6e453b92aaab diff --git a/tests/modules/happy/prepy/main.nf b/tests/modules/happy/prepy/main.nf new file mode 100644 index 00000000..0b511104 --- /dev/null +++ b/tests/modules/happy/prepy/main.nf @@ -0,0 +1,37 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { HAPPY_PREPY } from '../../../../modules/happy/prepy/main.nf' + +workflow test_happy_prepy_vcf { + + input = [ + [ id:'test' ], // meta map + 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_PREPY ( input, fasta ) +} + +workflow test_happy_prepy_gvcf { + + input = [ + [ id:'test' ], // meta map + 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_PREPY ( input, fasta ) +} diff --git a/tests/modules/happy/prepy/nextflow.config b/tests/modules/happy/prepy/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/happy/prepy/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/happy/prepy/test.yml b/tests/modules/happy/prepy/test.yml new file mode 100644 index 00000000..a0a45c38 --- /dev/null +++ b/tests/modules/happy/prepy/test.yml @@ -0,0 +1,19 @@ +- name: happy prepy test_happy_prepy_vcf + command: nextflow run tests/modules/happy/prepy -entry test_happy_prepy_vcf -c tests/config/nextflow.config + tags: + - happy/prepy + - happy + files: + - path: output/happy/test.vcf.gz + - path: output/happy/versions.yml + md5sum: 814d20f1f29f23a3d21012748a5d6393 + +- name: happy prepy test_happy_prepy_gvcf + command: nextflow run tests/modules/happy/prepy -entry test_happy_prepy_gvcf -c tests/config/nextflow.config + tags: + - happy/prepy + - happy + files: + - path: output/happy/test.vcf.gz + - path: output/happy/versions.yml + md5sum: 970a54de46e68ef6d5228a26eaa4c8e7