From 6db74cd48c22304d01b1c665ba698de4c568dd1e Mon Sep 17 00:00:00 2001 From: "Michael G. Campana" Date: Thu, 19 Jan 2023 11:39:35 -0500 Subject: [PATCH 1/3] summarizeDNM glitch fix Potential fix to summarizeDNM when no candidates found --- CHANGELOG.Md | 3 +++ ratestools.nf | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.Md b/CHANGELOG.Md index ca42e1f..0f1e7b2 100644 --- a/CHANGELOG.Md +++ b/CHANGELOG.Md @@ -315,6 +315,9 @@ First version integrated into pipeline Initial script (plotDPGQ-clean.R) ## ratestools +### Version 0.5.11 +Fixed glitch in summarizeDNM when no candidate sites found + ### Version 0.5.10 Update file headers Contig length filtration diff --git a/ratestools.nf b/ratestools.nf index 60884f8..7f7ad0b 100755 --- a/ratestools.nf +++ b/ratestools.nf @@ -1,6 +1,6 @@ #!/usr/bin/env nextflow -/* RatesTools version 0.5.10 +/* RatesTools version 0.5.11 Michael G. Campana and Ellie E. Armstrong, 2020-2023 Smithsonian Institution and Stanford University @@ -932,8 +932,13 @@ process summarizeDNM { val=`grep -n \'#CHROM\' \$sumlog | cut -d \':\' -f 1` total=`wc -l \$sumlog | cut -d \' \' -f 1` let lncount=\$total-\$val - tail -n \$lncount \$sumlog > tmp.txt - cat header.txt tmp.txt | gzip > \${sumlog/_summary.log/_candidates.vcf.gz} + if [ $lncount -gt 0 ]; then + tail -n \$lncount \$sumlog > tmp.txt + cat header.txt tmp.txt | gzip > \${sumlog/_summary.log/_candidates.vcf.gz} + else + mv header.txt \${sumlog/_summary.log/_candidates.vcf} + gzip \${sumlog/_summary.log/_candidates.vcf} + fi done """ From d499b502f4e7465551700f723fc30ccccf21eb80 Mon Sep 17 00:00:00 2001 From: "Michael G. Campana" Date: Thu, 19 Jan 2023 11:48:43 -0500 Subject: [PATCH 2/3] escaping --- ratestools.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ratestools.nf b/ratestools.nf index 7f7ad0b..b9ad078 100755 --- a/ratestools.nf +++ b/ratestools.nf @@ -932,7 +932,7 @@ process summarizeDNM { val=`grep -n \'#CHROM\' \$sumlog | cut -d \':\' -f 1` total=`wc -l \$sumlog | cut -d \' \' -f 1` let lncount=\$total-\$val - if [ $lncount -gt 0 ]; then + if [ \$lncount -gt 0 ]; then tail -n \$lncount \$sumlog > tmp.txt cat header.txt tmp.txt | gzip > \${sumlog/_summary.log/_candidates.vcf.gz} else From 0558933aa417528cf011d91e8d45a6f35b4dc72d Mon Sep 17 00:00:00 2001 From: "Michael G. Campana" Date: Thu, 19 Jan 2023 11:58:47 -0500 Subject: [PATCH 3/3] explicit bash --- ratestools.nf | 1 + 1 file changed, 1 insertion(+) diff --git a/ratestools.nf b/ratestools.nf index b9ad078..6fab23b 100755 --- a/ratestools.nf +++ b/ratestools.nf @@ -916,6 +916,7 @@ process summarizeDNM { path "${params.prefix}*_candidates.vcf.gz" into candidates_vcf_ch """ + #!/usr/bin/env bash for file in ${params.prefix}*.log; do if [ ! -d \${file%_chr*.log} ]; then mkdir \${file%_chr*.log}