Commit 4ac211d4 authored by Aiden Lab's avatar Aiden Lab
Browse files

Adding in the f field to the sort so that problems with .1 versus .10 are resolved appropriately

parent 76c63a19
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -57,11 +57,12 @@
#             script will not work. The error will often manifest itself
#             through a "*" in the name because the wildcard was not able to
#             match any files with the read1str.   
set -e
#set -e ## This is causing problems; need better error detection
shopt -s extglob
juicer_version="1.5.6" 
### LOAD BWA AND SAMTOOLS


# fastq files should look like filename_R1.fastq and filename_R2.fastq 
# if your fastq files look different, change this value
read1str="_R1" 
@@ -358,6 +359,7 @@ then
        then
            usegzip=1
        fi

	source ${juiceDir}/scripts/common/countligations.sh

        # Align read1 
@@ -407,7 +409,7 @@ then
            fi
	fi
        # sort read 1 aligned file by readname
	sort -T $tmpdir -k1,1 $name1$ext.sam > $name1${ext}_sort.sam
	sort -T $tmpdir -k1,1f $name1$ext.sam > $name1${ext}_sort.sam
	if [ $? -ne 0 ]
	then
            echo "***! Error while sorting $name1$ext.sam"
@@ -416,7 +418,7 @@ then
            echo "(-: Sort read 1 aligned file by readname completed."
	fi
        # sort read 2 aligned file by readname
	sort -T $tmpdir -k1,1 $name2$ext.sam > $name2${ext}_sort.sam
	sort -T $tmpdir -k1,1f $name2$ext.sam > $name2${ext}_sort.sam
	if [ $? -ne 0 ]
	then
            echo "***! Error while sorting $name2$ext.sam"
@@ -428,7 +430,7 @@ then
	awk 'BEGIN{OFS="\t"}NF>=11{$1=$1"/1"; print}' $name1${ext}_sort.sam > $name1${ext}_sort1.sam
	awk 'BEGIN{OFS="\t"}NF>=11{$1=$1"/2"; print}' $name2${ext}_sort.sam > $name2${ext}_sort1.sam
    
	sort -T $tmpdir -k1,1 -m $name1${ext}_sort1.sam $name2${ext}_sort1.sam > ${name}${ext}.sam
	sort -T $tmpdir -k1,1f -m $name1${ext}_sort1.sam $name2${ext}_sort1.sam > ${name}${ext}.sam
    
	if [ $? -ne 0 ]
	then