From 8e5eaf1fa442225f8d24e95bba2a19a7e2fc9ce9 Mon Sep 17 00:00:00 2001 From: Benjamin Wingfield Date: Wed, 2 Mar 2022 00:43:28 +0000 Subject: [PATCH] Update plink2/vcf to output zstandard compressed data automatically (#1258) * update plink2/vcf to output zstandard compressed data automatically * update meta * set plink CPU and memory usage Co-authored-by: Sateesh <33637490+sateeshperi@users.noreply.github.com> --- modules/plink2/vcf/main.nf | 12 ++++++++---- modules/plink2/vcf/meta.yml | 2 +- tests/modules/plink2/vcf/test.yml | 10 ++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/plink2/vcf/main.nf b/modules/plink2/vcf/main.nf index 041cb4b9..090851a8 100644 --- a/modules/plink2/vcf/main.nf +++ b/modules/plink2/vcf/main.nf @@ -11,10 +11,10 @@ process PLINK2_VCF { tuple val(meta), path(vcf) output: - tuple val(meta), path("*.pgen"), emit: pgen - tuple val(meta), path("*.psam"), emit: psam - tuple val(meta), path("*.pvar"), emit: pvar - path "versions.yml" , emit: versions + tuple val(meta), path("*.pgen") , emit: pgen + tuple val(meta), path("*.psam") , emit: psam + tuple val(meta), path("*.pvar.zst"), emit: pvar + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -22,10 +22,14 @@ process PLINK2_VCF { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def mem_mb = task.memory.toMega() """ plink2 \\ + --threads $task.cpus \\ + --memory $mem_mb \\ $args \\ --vcf $vcf \\ + --make-pgen vzs \\ --out ${prefix} cat <<-END_VERSIONS > versions.yml diff --git a/modules/plink2/vcf/meta.yml b/modules/plink2/vcf/meta.yml index 5697ebef..3c776daf 100644 --- a/modules/plink2/vcf/meta.yml +++ b/modules/plink2/vcf/meta.yml @@ -46,7 +46,7 @@ output: - pvar: type: file description: PLINK 2 variant information file - pattern: "*.{psam}" + pattern: "*.{pvar.zst}" authors: - "@nebfield" diff --git a/tests/modules/plink2/vcf/test.yml b/tests/modules/plink2/vcf/test.yml index 52f58a42..d354af48 100644 --- a/tests/modules/plink2/vcf/test.yml +++ b/tests/modules/plink2/vcf/test.yml @@ -1,12 +1,14 @@ - name: plink2 vcf test_plink2_vcf - command: nextflow run ./tests/modules/plink2/vcf -entry test_plink2_vcf -c ./tests/config/nextflow.config -c ./tests/modules/plink2/vcf/nextflow.config + command: nextflow run tests/modules/plink2/vcf -entry test_plink2_vcf -c tests/config/nextflow.config tags: - - plink2/vcf - plink2 + - plink2/vcf files: - path: output/plink2/test.pgen md5sum: d66d3cd4a6c9cca1a4073d7f4b277041 - path: output/plink2/test.psam md5sum: dc3b77d7753a7bed41734323e3549b10 - - path: output/plink2/test.pvar - md5sum: d61e53f847a6335138b584216b4e45d0 + - path: output/plink2/test.pvar.zst + md5sum: b53cccb83e024a39789af5eab8de1c28 + - path: output/plink2/versions.yml + md5sum: 82ada74bc81473b7cba377f696acf54c