From fd16ef885be73e53b72aa36aea65cf7d862eed97 Mon Sep 17 00:00:00 2001 From: "Lee - spacestation4.cdc.gov" Date: Tue, 8 Sep 2015 10:04:17 -0400 Subject: [PATCH] fixed racing condition --- scripts/launch_varscan.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/launch_varscan.pl b/scripts/launch_varscan.pl index 0d8b27b..092f924 100755 --- a/scripts/launch_varscan.pl +++ b/scripts/launch_varscan.pl @@ -99,7 +99,8 @@ sub mpileup{ # Multithread a pileup so that each region gets piped into a file. # Then, these individual files can be combined at a later step. - my $command="echo \"$regions\" | xargs -P $$settings{numcpus} -n 1 -I {} sh -c 'echo \"MPileup on {}\" >&2; rm -fv $$settings{tempdir}/$b.*.mpileup >&2; samtools mpileup -f $reference $xopts --region \"{}\" $bam > $$settings{tempdir}/$b.\$\$.mpileup' "; + system("rm -fv $$settings{tempdir}/$b.*.mpileup >&2"); + my $command="echo \"$regions\" | xargs -P $$settings{numcpus} -n 1 -I {} sh -c 'echo \"MPileup on {}\" >&2; samtools mpileup -f $reference $xopts --region \"{}\" $bam > $$settings{tempdir}/$b.\$\$.mpileup' "; logmsg "Running mpileup:\n $command"; system($command); die "ERROR with xargs and samtools mpileup" if $?;