From e34912871a0c51b928e24855f2ddc85676c2f160 Mon Sep 17 00:00:00 2001 From: Keiran Raine Date: Thu, 21 Feb 2019 13:04:42 +0000 Subject: [PATCH] Fix regression - ability handle chr with no pindel mapped reads, introduced in 3.x tree Also samtools can read the header from a gz sam file modified to make this more normalised so that no issues would occur if the first file is the only one with reads. --- perl/lib/Sanger/CGP/Pindel/OutputGen/BamUtil.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perl/lib/Sanger/CGP/Pindel/OutputGen/BamUtil.pm b/perl/lib/Sanger/CGP/Pindel/OutputGen/BamUtil.pm index 78030cd..25a2d3d 100644 --- a/perl/lib/Sanger/CGP/Pindel/OutputGen/BamUtil.pm +++ b/perl/lib/Sanger/CGP/Pindel/OutputGen/BamUtil.pm @@ -64,9 +64,9 @@ sub sam_to_sorted_bam { $command .= sprintf ' zcat %s | ', $sam_files->[0]; } else { - my $first_file = shift @{$sam_files}; + my $header_from = $sam_files->[0]; $command .= "cd $base_dir; "; - $command .= sprintf q{ (zcat %s ; zgrep -v '^@' %s) | }, $first_file, join q{ }, @{$sam_files}; + $command .= sprintf q{ (samtools view -H %s ; zcat %s | grep -v '^@' ) | }, $header_from, join q{ }, @{$sam_files}; } $command .= which('bamsort');