From e91788533b03bf0b09fb1d57cdc24da37154f64d Mon Sep 17 00:00:00 2001 From: rsrivas Date: Wed, 8 Aug 2018 11:00:04 -0700 Subject: [PATCH 1/2] Add multi-threading + temporary directory assignment for sorting BAMs. --- bin/getHaplo_PE_cgOnly.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/getHaplo_PE_cgOnly.pl b/bin/getHaplo_PE_cgOnly.pl index ce664ea..9a61924 100755 --- a/bin/getHaplo_PE_cgOnly.pl +++ b/bin/getHaplo_PE_cgOnly.pl @@ -46,8 +46,9 @@ sub main{ readCGTable($ARGV[1]); my $bamfile = $ARGV[0]; my $start_time = time; + my $TEMP_PREFIX = $ARGV[2]; my ($last_list_pos, $last_list_calls, $last_id, $last_chr) = ("NA", "NA", "NA", "NA"); - open(INFILE, "$samtools sort -n -O SAM $bamfile |") || die("Error running samtools to convert BAM file\n"); + open(INFILE, "$samtools sort -T $TEMP_PREFIX -@ 4 -n -O SAM $bamfile |") || die("Error running samtools to convert BAM file\n"); while(my $line = ){ next if($line =~ m/^@/); chomp($line); @@ -249,7 +250,7 @@ sub getAlignmentInfo{ sub printUsage{ print " Usage: \n"; - print " getHaplo_PE_cgOnly.pl [cpg position list] < [sam file sorted by name] \n"; + print " getHaplo_PE_cgOnly.pl [cpg position list] [sam file sorted by name] [temp_prefix]\n"; exit 0; } From be365f03768b21e35fecd8557e53c870f0568762 Mon Sep 17 00:00:00 2001 From: rsrivas Date: Wed, 8 Aug 2018 12:35:11 -0700 Subject: [PATCH 2/2] Added temporary directory path for use with samtools. --- bin/getHaplo_PE_cgOnly.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/getHaplo_PE_cgOnly.pl b/bin/getHaplo_PE_cgOnly.pl index 9a61924..d778c05 100755 --- a/bin/getHaplo_PE_cgOnly.pl +++ b/bin/getHaplo_PE_cgOnly.pl @@ -46,9 +46,9 @@ sub main{ readCGTable($ARGV[1]); my $bamfile = $ARGV[0]; my $start_time = time; - my $TEMP_PREFIX = $ARGV[2]; + my $TEMP_PREFIX2 = $ARGV[2]; my ($last_list_pos, $last_list_calls, $last_id, $last_chr) = ("NA", "NA", "NA", "NA"); - open(INFILE, "$samtools sort -T $TEMP_PREFIX -@ 4 -n -O SAM $bamfile |") || die("Error running samtools to convert BAM file\n"); + open(INFILE, "$samtools sort -T $TEMP_PREFIX2 -@ 4 -n -O SAM $bamfile |") || die("Error running samtools to convert BAM file\n"); while(my $line = ){ next if($line =~ m/^@/); chomp($line);