From faf85d1061ff941a5ba9810f7c5ceba64694e177 Mon Sep 17 00:00:00 2001 From: Lorenzo Sola <47034913+LorenzoS96@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:31:50 +0100 Subject: [PATCH] PLINK/GWAS additional output (#5387) * add correct output in the main.nf and change the extension of pheno file in the stub * add correct output in the meta.yml * adding additional output to the main.nf and to nf-test * passing prettier * output addition to the main.nf --------- Co-authored-by: Francesco Lescai <53608000+lescai@users.noreply.github.com> --- modules/nf-core/plink/gwas/main.nf | 10 +- modules/nf-core/plink/gwas/meta.yml | 10 +- modules/nf-core/plink/gwas/tests/main.nf.test | 33 +++++- .../plink/gwas/tests/main.nf.test.snap | 105 +++++++++++++++--- 4 files changed, 130 insertions(+), 28 deletions(-) diff --git a/modules/nf-core/plink/gwas/main.nf b/modules/nf-core/plink/gwas/main.nf index 1248db85ad4..cc9f9b27672 100644 --- a/modules/nf-core/plink/gwas/main.nf +++ b/modules/nf-core/plink/gwas/main.nf @@ -9,13 +9,15 @@ process PLINK_GWAS { 'biocontainers/plink:1.90b6.21--h031d066_5' }" input: - tuple val(meta), path(bed), path(bim), path(fam) + tuple val(meta), path(bed), path(bim), path(fam) tuple val(meta2), path(vcf) tuple val(meta3), path(bcf) tuple val(meta4), path(phe) output: tuple val(meta), path("*.assoc"), emit: assoc + tuple val(meta), path("*.log") , emit: log + tuple val(meta), path("*.nosex"), emit: nosex , optional:true path "versions.yml" , emit: versions when: @@ -69,10 +71,10 @@ process PLINK_GWAS { prefix = task.ext.prefix ?: "${meta.id}" } else if (vcf) { input_command = "--vcf ${vcf}" - prefix = task.ext.prefix ?: "${meta2.id} --pheno ${pheno}" + prefix = task.ext.prefix ?: "${meta2.id} --pheno ${phe}" meta = meta2 } else if (bcf) { - input_command = "--bcf ${bcf} --pheno ${pheno}" + input_command = "--bcf ${bcf} --pheno ${phe}" prefix = task.ext.prefix ?: "${meta3.id}" meta = meta3 } else { @@ -80,6 +82,8 @@ process PLINK_GWAS { } """ touch ${prefix}.assoc + touch ${prefix}.nosex + touch ${prefix}.log cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/plink/gwas/meta.yml b/modules/nf-core/plink/gwas/meta.yml index 0f6419cab0c..4bdb0ed0f0c 100644 --- a/modules/nf-core/plink/gwas/meta.yml +++ b/modules/nf-core/plink/gwas/meta.yml @@ -59,7 +59,7 @@ input: pattern: "*.{vcf}" - phe: type: file - description: PLINK file containing phenotype information. This phenotype information can be read from the third column with the --pheno option or from a specific column with the --pheno-name option. + description: PLINK file containing phenotype information. This phenotype information can be read from the third column with the --pheno option or from a specific column with the --pheno-name option pattern: "*.{phe}" output: @@ -72,6 +72,14 @@ output: type: file description: PLINK GWAS association file pattern: "*.{assoc}" + - log: + type: file + description: PLINK GWAS association log file + pattern: "*.{log}" + - nosex: + type: file + description: PLINK GWAS association file that retains phenotypes for samples with ambiguous sex. Produced with the option --allow-no-sex + pattern: "*.{nosex}" - versions: type: file description: File containing software versions diff --git a/modules/nf-core/plink/gwas/tests/main.nf.test b/modules/nf-core/plink/gwas/tests/main.nf.test index 505ffb24d0a..89529f3376c 100644 --- a/modules/nf-core/plink/gwas/tests/main.nf.test +++ b/modules/nf-core/plink/gwas/tests/main.nf.test @@ -31,11 +31,15 @@ nextflow_process { """ } } + then { assertAll( { assert process.success }, - { assert snapshot(process.out.version).match("version") }, - { assert snapshot(process.out.gwas).match() } + { assert snapshot( + process.out.assoc, + process.out.nosex + ).match() }, + { assert process.out.log.get(0).get(1) ==~ ".*/*.log" } ) } } @@ -63,10 +67,15 @@ nextflow_process { """ } } + then { assertAll( { assert process.success }, - { assert snapshot(process.out.gwas).match() } + { assert snapshot( + process.out.assoc, + process.out.nosex + ).match() }, + { assert process.out.log.get(0).get(1) ==~ ".*/*.log" } ) } } @@ -93,10 +102,12 @@ nextflow_process { """ } } + then { assertAll( { assert process.success }, - { assert snapshot(process.out.gwas).match() } + { assert snapshot(process.out.assoc).match() }, + { assert process.out.log.get(0).get(1) ==~ ".*/*.log" } ) } } @@ -124,10 +135,15 @@ nextflow_process { """ } } + then { assertAll( { assert process.success }, - { assert snapshot(process.out.gwas).match() } + { assert snapshot( + process.out.assoc, + process.out.nosex + ).match() }, + { assert process.out.log.get(0).get(1) ==~ ".*/*.log" } ) } } @@ -155,10 +171,15 @@ nextflow_process { """ } } + then { assertAll( { assert process.success }, - { assert snapshot(process.out.gwas).match() } + { assert snapshot( + process.out.assoc, + process.out.nosex + ).match() }, + { assert process.out.log.get(0).get(1) ==~ ".*/*.log" } ) } } diff --git a/modules/nf-core/plink/gwas/tests/main.nf.test.snap b/modules/nf-core/plink/gwas/tests/main.nf.test.snap index 8786c8865c9..7dc5749b175 100644 --- a/modules/nf-core/plink/gwas/tests/main.nf.test.snap +++ b/modules/nf-core/plink/gwas/tests/main.nf.test.snap @@ -1,50 +1,119 @@ { "plink - BCF": { - "content": null, + "content": [ + [ + [ + { + "id": "test" + }, + "test.assoc:md5,ab8f91519a605cd9f2b2f89e18c3df9b" + ] + ], + [ + [ + { + "id": "test" + }, + "test.nosex:md5,4f9aa36c44a417ff6d7caa9841e66ad9" + ] + ] + ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-20T14:14:55.241674269" + "timestamp": "2024-03-22T13:55:49.239817224" }, "plink - BCF with phenotype name": { - "content": null, + "content": [ + [ + [ + { + "id": "test" + }, + "test.assoc:md5,ab8f91519a605cd9f2b2f89e18c3df9b" + ] + ], + [ + [ + { + "id": "test" + }, + "test.nosex:md5,4f9aa36c44a417ff6d7caa9841e66ad9" + ] + ] + ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-20T14:15:16.532468809" + "timestamp": "2024-03-22T13:56:02.903429935" }, "plink - VCF with phenotype name": { - "content": null, + "content": [ + [ + [ + { + "id": "test" + }, + "test.assoc:md5,ab8f91519a605cd9f2b2f89e18c3df9b" + ] + ], + [ + [ + { + "id": "test" + }, + "test.nosex:md5,4f9aa36c44a417ff6d7caa9841e66ad9" + ] + ] + ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-20T14:14:21.727264753" + "timestamp": "2024-03-22T13:55:30.436423207" }, "plink - binary": { - "content": null, + "content": [ + [ + [ + { + "id": "test" + }, + "test.assoc:md5,ab8f91519a605cd9f2b2f89e18c3df9b" + ] + ] + ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-20T14:14:33.265238306" + "timestamp": "2024-03-22T13:55:40.069724205" }, "plink - VCF": { - "content": null, + "content": [ + [ + [ + { + "id": "test" + }, + "test.assoc:md5,ab8f91519a605cd9f2b2f89e18c3df9b" + ] + ], + [ + [ + { + "id": "test" + }, + "test.nosex:md5,4f9aa36c44a417ff6d7caa9841e66ad9" + ] + ] + ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-20T14:14:10.0127107" - }, - "version": { - "content": null, - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T14:14:10.003757161" + "timestamp": "2024-03-22T13:55:18.428110102" } } \ No newline at end of file