From 7f205d0a044b031655bbcbe2c3d8c21588a2f854 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Tue, 26 Mar 2024 10:14:01 +0100 Subject: [PATCH] Update table stats selection --- docs/development.md | 1 + modules/local/addcolumns/main.nf | 7 ++++++- .../tests/main.nf.test.snap | 16 +++------------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docs/development.md b/docs/development.md index 33051d56..5b358bec 100644 --- a/docs/development.md +++ b/docs/development.md @@ -41,6 +41,7 @@ All channel need to be identified by a meta map as follow: - T : tool used - G : reference genome used (is it needed ?) - S : simulation (depth or genotype array) + ## Open questions How to use different schema ? diff --git a/modules/local/addcolumns/main.nf b/modules/local/addcolumns/main.nf index 54da94a6..2fbe882c 100644 --- a/modules/local/addcolumns/main.nf +++ b/modules/local/addcolumns/main.nf @@ -14,7 +14,12 @@ process ADD_COLUMNS { script: def prefix = task.ext.prefix ?: "${meta.id}" """ - awk '(NR>=2) && (NR<=10)' $input | \\ + # Find the header line + HEADER_STR="#Genotype concordance by allele frequency bin (Variants: SNPs + indels)" + HEADER_LINE=\$(grep -n -m 1 "^\${HEADER_STR}" $input | cut -d: -f1 ) + HEADER_START=\$((HEADER_LINE + 1)) + + tail -n +\$HEADER_START $input | \\ awk 'NR==1{\$(NF+1)="ID"} NR>1{\$(NF+1)="${meta.id}"}1' | \\ awk 'NR==1{\$(NF+1)="Region"} NR>1{\$(NF+1)="${meta.region}"}1' | \\ awk 'NR==1{\$(NF+1)="Depth"} NR>1{\$(NF+1)="${meta.depth}"}1' | \\ diff --git a/subworkflows/local/vcf_concordance_glimpse/tests/main.nf.test.snap b/subworkflows/local/vcf_concordance_glimpse/tests/main.nf.test.snap index 608ceca5..94785ba1 100644 --- a/subworkflows/local/vcf_concordance_glimpse/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_concordance_glimpse/tests/main.nf.test.snap @@ -3,23 +3,13 @@ "content": [ { "0": [ - [ - { - "id": "TestQuality" - }, - "TestQuality.txt:md5,910b294df62dbe64e8f16379428d93ad" - ] + ], "1": [ ], "stats": [ - [ - { - "id": "TestQuality" - }, - "TestQuality.txt:md5,910b294df62dbe64e8f16379428d93ad" - ] + ], "versions": [ @@ -30,6 +20,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-25T12:44:54.967846019" + "timestamp": "2024-03-26T10:07:33.413253799" } } \ No newline at end of file