From a7c125b61a5e6a3d49bb519e5665c0cf99f69e05 Mon Sep 17 00:00:00 2001 From: Tyler Chafin Date: Thu, 11 Jul 2024 16:51:49 +0100 Subject: [PATCH] Update modules/local/samtools_replaceheader.nf Co-authored-by: Matthieu Muffato --- modules/local/samtools_replaceheader.nf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/local/samtools_replaceheader.nf b/modules/local/samtools_replaceheader.nf index 06e45f6..0a027c8 100644 --- a/modules/local/samtools_replaceheader.nf +++ b/modules/local/samtools_replaceheader.nf @@ -27,18 +27,18 @@ process SAMTOOLS_REHEADER { """ # Replace SQ lines with those from external template ( samtools view --no-PG --header-only ${file} | \\ - grep -v ^@SQ && grep ^@SQ ${header} ) > .temp.header.sam + grep -v ^@SQ && grep ^@SQ ${header} ) > temp.header.sam # custom sort for readability (retain order of insertion but sort groups by tag) - ( grep ^@HD .temp.header.sam || true && \ - grep ^@SQ .temp.header.sam || true && \ - grep ^@RG .temp.header.sam || true && \ - grep ^@PG .temp.header.sam || true && \ - grep -v -E '^@HD|^@SQ|^@RG|^@PG' .temp.header.sam || true; \ - ) > .temp.sorted.header.sam + ( grep ^@HD temp.header.sam || true && \ + grep ^@SQ temp.header.sam || true && \ + grep ^@RG temp.header.sam || true && \ + grep ^@PG temp.header.sam || true && \ + grep -v -E '^@HD|^@SQ|^@RG|^@PG' temp.header.sam || true; \ + ) > temp.sorted.header.sam # Insert new header into file - samtools reheader .temp.sorted.header.sam ${file} > ${prefix}.${suffix} + samtools reheader temp.sorted.header.sam ${file} > ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml "${task.process}":