From c517ce9b4d3f09f2d49cf0c6795019a6e78938b3 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 13:42:12 +0200 Subject: [PATCH 01/10] Added the module and some simple testing --- modules/happy/main.nf | 53 +++++++++++++++++++++++++++++ modules/happy/meta.yml | 51 +++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/modules/happy/main.nf | 39 +++++++++++++++++++++ tests/modules/happy/nextflow.config | 5 +++ tests/modules/happy/test.yml | 7 ++++ 6 files changed, 159 insertions(+) create mode 100644 modules/happy/main.nf create mode 100644 modules/happy/meta.yml create mode 100644 tests/modules/happy/main.nf create mode 100644 tests/modules/happy/nextflow.config create mode 100644 tests/modules/happy/test.yml diff --git a/modules/happy/main.nf b/modules/happy/main.nf new file mode 100644 index 00000000..68059dd8 --- /dev/null +++ b/modules/happy/main.nf @@ -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 + """ +} diff --git a/modules/happy/meta.yml b/modules/happy/meta.yml new file mode 100644 index 00000000..52d98e04 --- /dev/null +++ b/modules/happy/meta.yml @@ -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" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index f4feb844..c14ffc8e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -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/** diff --git a/tests/modules/happy/main.nf b/tests/modules/happy/main.nf new file mode 100644 index 00000000..0ce23b50 --- /dev/null +++ b/tests/modules/happy/main.nf @@ -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 ) +} diff --git a/tests/modules/happy/nextflow.config b/tests/modules/happy/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/happy/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/test.yml b/tests/modules/happy/test.yml new file mode 100644 index 00000000..d85d42a2 --- /dev/null +++ b/tests/modules/happy/test.yml @@ -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 From 37338ecee30a7210e9a40d993370fd25bddf003d Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:00:02 +0200 Subject: [PATCH 02/10] Finished the module --- modules/happy/meta.yml | 12 ++++++++++++ tests/modules/happy/test.yml | 26 +++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/modules/happy/meta.yml b/modules/happy/meta.yml index 52d98e04..28142d9b 100644 --- a/modules/happy/meta.yml +++ b/modules/happy/meta.yml @@ -42,6 +42,18 @@ output: 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 diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/test.yml index d85d42a2..7dddca17 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/test.yml @@ -1,7 +1,27 @@ -- name: happy test_happy - command: nextflow run tests/modules/happy -entry test_happy -c tests/config/nextflow.config +- 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 + contains: '"name": "hap.py"' + - path: output/happy/test.summary.csv + md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml - md5sum: ab8944c1b24e55bab311a9d389c75c90 + 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 + contains: '"name": "hap.py"' + - path: output/happy/test.summary.csv + md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 + - path: output/happy/versions.yml + md5sum: 75331161af9ec046d045ffcba83abddf From 065a5d6a7f13a50ad7965fdc770df50363bde3d7 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:05:21 +0200 Subject: [PATCH 03/10] Fixed a linting issue --- modules/happy/main.nf | 2 +- modules/happy/meta.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/happy/main.nf b/modules/happy/main.nf index 68059dd8..1338686e 100644 --- a/modules/happy/main.nf +++ b/modules/happy/main.nf @@ -25,7 +25,7 @@ process HAPPY { def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - + """ pre.py \\ $args \\ diff --git a/modules/happy/meta.yml b/modules/happy/meta.yml index 28142d9b..aba9410b 100644 --- a/modules/happy/meta.yml +++ b/modules/happy/meta.yml @@ -45,7 +45,7 @@ output: - summary: type: file description: A CSV file containing the summary of the benchmarking - pattern: "*.summary.csv" + pattern: "*.summary.csv" - extended: type: file description: A CSV file containing extended info of the benchmarking @@ -60,4 +60,4 @@ output: pattern: "versions.yml" authors: - - "@nvnieuwk" + - "@nvnieuwk" \ No newline at end of file From 177a7e49f249952d8b3271c454529a768f16af43 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:06:42 +0200 Subject: [PATCH 04/10] Fixed a linting issue --- modules/happy/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/happy/meta.yml b/modules/happy/meta.yml index aba9410b..d732df22 100644 --- a/modules/happy/meta.yml +++ b/modules/happy/meta.yml @@ -60,4 +60,4 @@ output: pattern: "versions.yml" authors: - - "@nvnieuwk" \ No newline at end of file + - "@nvnieuwk" From c1393bf999e4e967d24d7ec3d2e864c5d0a856e3 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:14:01 +0200 Subject: [PATCH 05/10] Possible fix for the pytest errors? --- tests/modules/happy/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/test.yml index 7dddca17..f5bdef52 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/test.yml @@ -6,7 +6,7 @@ - path: output/happy/test.extended.csv md5sum: ef79c7c789ef4f146ca2e50dafaf22b3 - path: output/happy/test.runinfo.json - contains: '"name": "hap.py"' + contains: 'hap.py' - path: output/happy/test.summary.csv md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml @@ -20,7 +20,7 @@ - path: output/happy/test.extended.csv md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3 - path: output/happy/test.runinfo.json - contains: '"name": "hap.py"' + contains: 'hap.py' - path: output/happy/test.summary.csv md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 - path: output/happy/versions.yml From 505ab038037df6a7d7af1db1cae3354b8f713364 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:14:53 +0200 Subject: [PATCH 06/10] fixed a description --- modules/happy/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/happy/meta.yml b/modules/happy/meta.yml index d732df22..6b5b86cf 100644 --- a/modules/happy/meta.yml +++ b/modules/happy/meta.yml @@ -25,7 +25,7 @@ input: pattern: "*.{vcf,vcf.gz}" - query_vcf: type: file - description: VCF file to query + description: VCF/GVCF file to query pattern: "*.{vcf,vcf.gz}" - bed: type: file From 17dbd2bb82093cd6ca1d1439c5c7815eb0b9a2a6 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:18:56 +0200 Subject: [PATCH 07/10] Linting issue fixed --- tests/modules/happy/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/test.yml index f5bdef52..937df32e 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/test.yml @@ -6,7 +6,7 @@ - path: output/happy/test.extended.csv md5sum: ef79c7c789ef4f146ca2e50dafaf22b3 - path: output/happy/test.runinfo.json - contains: 'hap.py' + contains: hap.py - path: output/happy/test.summary.csv md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml @@ -20,7 +20,7 @@ - path: output/happy/test.extended.csv md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3 - path: output/happy/test.runinfo.json - contains: 'hap.py' + contains: hap.py - path: output/happy/test.summary.csv md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 - path: output/happy/versions.yml From 583ea138006d8c49d4821bbfaeba81408ff57053 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:22:55 +0200 Subject: [PATCH 08/10] Another try to fix the pytest issues --- tests/modules/happy/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/test.yml index 937df32e..c0a34387 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/test.yml @@ -6,7 +6,7 @@ - path: output/happy/test.extended.csv md5sum: ef79c7c789ef4f146ca2e50dafaf22b3 - path: output/happy/test.runinfo.json - contains: hap.py + contains: dist - path: output/happy/test.summary.csv md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml @@ -20,7 +20,7 @@ - path: output/happy/test.extended.csv md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3 - path: output/happy/test.runinfo.json - contains: hap.py + contains: dist - path: output/happy/test.summary.csv md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 - path: output/happy/versions.yml From 5889d6c9233fae612dbce8d333773f1a8b1d47e9 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:46:15 +0200 Subject: [PATCH 09/10] Another possible fix for the pytest issues --- tests/modules/happy/test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/test.yml index c0a34387..9af6cc83 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/test.yml @@ -6,7 +6,9 @@ - path: output/happy/test.extended.csv md5sum: ef79c7c789ef4f146ca2e50dafaf22b3 - path: output/happy/test.runinfo.json - contains: dist + contains: + - 'dist' + - 'python_version' - path: output/happy/test.summary.csv md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml @@ -20,7 +22,9 @@ - path: output/happy/test.extended.csv md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3 - path: output/happy/test.runinfo.json - contains: dist + contains: + - 'dist' + - 'python_version' - path: output/happy/test.summary.csv md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 - path: output/happy/versions.yml From 3c661386728c3552da55db5252ef2bae8f113220 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Wed, 4 May 2022 14:49:17 +0200 Subject: [PATCH 10/10] Linting issue + removed the contains lines --- tests/modules/happy/test.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/modules/happy/test.yml b/tests/modules/happy/test.yml index 9af6cc83..0fd26e5b 100644 --- a/tests/modules/happy/test.yml +++ b/tests/modules/happy/test.yml @@ -6,9 +6,6 @@ - path: output/happy/test.extended.csv md5sum: ef79c7c789ef4f146ca2e50dafaf22b3 - path: output/happy/test.runinfo.json - contains: - - 'dist' - - 'python_version' - path: output/happy/test.summary.csv md5sum: f8aa5d36d3c48dede2f607fd565894ad - path: output/happy/versions.yml @@ -22,9 +19,6 @@ - path: output/happy/test.extended.csv md5sum: 3d5c21b67a259a3f6dcb088d55b86cd3 - path: output/happy/test.runinfo.json - contains: - - 'dist' - - 'python_version' - path: output/happy/test.summary.csv md5sum: 03044e9bb5a0c6f0947b7e910fc8a558 - path: output/happy/versions.yml