Skip to content

Commit 75ed250

Browse files
committed
bugs fixed
1 parent 8061f87 commit 75ed250

File tree

4 files changed

+48
-32
lines changed

4 files changed

+48
-32
lines changed

bin/PROPERseqTools

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ helpFunction()
1818
echo
1919
echo
2020
exit 1 # Exit script after printing help
21-
}s
21+
}
2222

2323
while getopts "a:b:t:o:i:h:r:p:d:c:g:" opt
2424
do
@@ -27,7 +27,7 @@ do
2727
b ) read2="$OPTARG" ;;
2828
t ) numT="$OPTARG" ;;
2929
o ) outputDir="$OPTARG" ;;
30-
i ) genomeFa="$OPTARG" ;;
30+
i ) bwaIndex="$OPTARG" ;;
3131
r ) removeFlag="$OPTARG" ;;
3232
p ) pCutoff="$OPTARG" ;;
3333
d ) oddsCutoff="$OPTARG" ;;
@@ -39,9 +39,27 @@ do
3939
done
4040

4141
# Print helpFunction in case parameters are empty
42-
if [ -z "$read1" ] || [ -z "$read2" ] || [ -z "$bwaIndex" ] || [ -z "$outputDir" ] || [ -z "$geneDic" ]
42+
if [ -z "$read1" ] || [ -z "$read2" ]
4343
then
44-
echo "Some or all of the parameters are empty";
44+
echo "read1 or read2 missing";
45+
helpFunction
46+
fi
47+
48+
if [ -z "$bwaIndex" ]
49+
then
50+
echo "bwa index file missing";
51+
helpFunction
52+
fi
53+
54+
if [ -z "$outputDir" ]
55+
then
56+
echo "ouput directory missing";
57+
helpFunction
58+
fi
59+
60+
if [ -z "$geneDic" ]
61+
then
62+
echo "transcript gene dictionary file missing";
4563
helpFunction
4664
fi
4765

@@ -84,70 +102,67 @@ wait
84102

85103
cutadapt -j $numT -a TGACCAAGACGCCAAAAACATAAAGAAAGGCCCGGCGCCATTGGTCA -a TGACCAATGGCGCCGGGCCTTTCTTTATGTTTTTGGCGTCTTGGTCA -g TTCACTGGAGGGGGGCTCACGAGTAAGGAGGATCCAACATG -g CATGTTGGATCCTCCTTACTCGTGAGCCCCCCTCCAGTGAA -O 23 $read1 > $outputDir/intermediateFiles/R1.cutadapt.fastq 2> $outputDir/intermediateFiles/R1.linkers.txt &
86104

87-
cutadapt -j $numT -a TGACCAAGACGCCAAAAACATAAAGAAAGGCCCGGCGCCATTGGTCA -a TGACCAATGGCGCCGGGCCTTTCTTTATGTTTTTGGCGTCTTGGTCA -g TTCACTGGAGGGGGGCTCACGAGTAAGGAGGATCCAACATG -g CATGTTGGATCCTCCTTACTCGTGAGCCCCCCTCCAGTGAA -O 23 $read1 > $outputDir/intermediateFiles/R2.cutadapt.fastq 2> $outputDir/intermediateFiles/R2.linkers.txt &
105+
cutadapt -j $numT -a TGACCAAGACGCCAAAAACATAAAGAAAGGCCCGGCGCCATTGGTCA -a TGACCAATGGCGCCGGGCCTTTCTTTATGTTTTTGGCGTCTTGGTCA -g TTCACTGGAGGGGGGCTCACGAGTAAGGAGGATCCAACATG -g CATGTTGGATCCTCCTTACTCGTGAGCCCCCCTCCAGTGAA -O 23 $read2 > $outputDir/intermediateFiles/R2.cutadapt.fastq 2> $outputDir/intermediateFiles/R2.linkers.txt &
88106
wait
89107

90108

91-
python processFastq_pub.py $outputDir/intermediateFiles/R1.cutadapt.lengthFiltered.fastq $outputDir/intermediateFiles/R1.cutadapt.fastq $outputDir 2> $outputDir/errorLog.txt &
92-
python processFastq_pub.py $outputDir/intermediateFiles/R2.cutadapt.lengthFiltered.fastq $outputDir/intermediateFiles/R2.cutadapt.fastq $outputDir 2> $outputDir/errorLog.txt &
109+
python processFastq_pub.py $outputDir/intermediateFiles/R1.cutadapt.lengthFiltered.fastq $outputDir/intermediateFiles/R1.cutadapt.fastq $outputDir yes 2>> $outputDir/errorLog.txt &
110+
python processFastq_pub.py $outputDir/intermediateFiles/R2.cutadapt.lengthFiltered.fastq $outputDir/intermediateFiles/R2.cutadapt.fastq $outputDir no 2>> $outputDir/errorLog.txt &
93111
wait
94112

95-
fastp -w $numT -i $outputDir/intermediateFiles/R1.cutadapt.lengthFiltered.fastq -I $outputDir/intermediateFiles/R2.cutadapt.lengthFiltered.fastq -o $outputDir/processedFastq/R1.cutadapt.fastp.fastq -O $outputDir/processedFastq/R2.cutadapt.fastp.fastq -h $outputDir/intermediateFiles/fastp.html -j $outputDir/intermediateFiles/fastp.json 2> $outputDir/errorLog.txt
113+
fastp -w $numT -i $outputDir/intermediateFiles/R1.cutadapt.lengthFiltered.fastq -I $outputDir/intermediateFiles/R2.cutadapt.lengthFiltered.fastq -o $outputDir/processedFastq/R1.cutadapt.fastp.fastq -O $outputDir/processedFastq/R2.cutadapt.fastp.fastq -h $outputDir/intermediateFiles/fastp.html -j $outputDir/intermediateFiles/fastp.json 2>> $outputDir/errorLog.txt
96114
wait
97115

98-
python writeNumReadPairs_pub.py $outputDir 2> $outputDir/errorLog.txt
116+
python writeNumReadPairs_pub.py $outputDir 2>> $outputDir/errorLog.txt
99117
wait
100118

101119
mkdir $outputDir/alignment/read1_tx
102120
mkdir $outputDir/alignment/read2_tx
103-
#mkdir results/${condition}
104121
wait
105122

106123
source=$outputDir/processedFastq
107124
target=$outputDir/alignment/
108125
wait
109126

110127

111-
bwa mem -a -t $numT $genomeFa $source/R1.cutadapt.fastp.fastq > $target/read1_tx/alignment.sam 2> $outputDir/errorLog.txt &
112-
bwa mem -a -t $numT $genomeFa $source/R2.cutadapt.fastp.fastq > $target/read2_tx/alignment.sam 2> $outputDir/errorLog.txt &
128+
bwa mem -a -t $numT $bwaIndex $source/R1.cutadapt.fastp.fastq > $target/read1_tx/alignment.sam 2>> $outputDir/errorLog.txt &
129+
bwa mem -a -t $numT $bwaIndex $source/R2.cutadapt.fastp.fastq > $target/read2_tx/alignment.sam 2>> $outputDir/errorLog.txt &
113130
wait
114131

115-
samtools view -H $target/read1_tx/alignment.sam > $target/read1_tx/header.sam 2> $outputDir/errorLog.txt &
116-
samtools view -H $target/read2_tx/alignment.sam > $target/read2_tx/header.sam 2> $outputDir/errorLog.txt &
132+
samtools view -H $target/read1_tx/alignment.sam > $target/read1_tx/header.sam 2>> $outputDir/errorLog.txt &
133+
samtools view -H $target/read2_tx/alignment.sam > $target/read2_tx/header.sam 2>> $outputDir/errorLog.txt &
117134
wait
118135

119-
samtools view -F 4 $target/read1_tx/alignment.sam | cat $target/read1_tx/header.sam - | samtools view -b - > $target/read1_tx/mapped.bam 2> $outputDir/errorLog.txt &
120-
samtools view -F 4 $target/read2_tx/alignment.sam | cat $target/read2_tx/header.sam - | samtools view -b - > $target/read2_tx/mapped.bam 2> $outputDir/errorLog.txt &
136+
samtools view -F 4 $target/read1_tx/alignment.sam | cat $target/read1_tx/header.sam - | samtools view -b - > $target/read1_tx/mapped.bam 2>> $outputDir/errorLog.txt &
137+
samtools view -F 4 $target/read2_tx/alignment.sam | cat $target/read2_tx/header.sam - | samtools view -b - > $target/read2_tx/mapped.bam 2>> $outputDir/errorLog.txt &
121138
wait
122139

123-
124-
samtools sort -n -@ $numT -o $target/read1_tx/mapped.sorted.bam $target/read1_tx/mapped.bam 2> $outputDir/errorLog.txt &
125-
samtools sort -n -@ $numT -o $target/read2_tx/mapped.sorted.bam $target/read2_tx/mapped.bam 2> $outputDir/errorLog.txt &
140+
half=$((numT/2))
141+
samtools sort -n -@ $half -o $target/read1_tx/mapped.sorted.bam $target/read1_tx/mapped.bam 2>> $outputDir/errorLog.txt &
142+
samtools sort -n -@ $half -o $target/read2_tx/mapped.sorted.bam $target/read2_tx/mapped.bam 2>> $outputDir/errorLog.txt &
126143
wait
127144

128-
bedtools bamtobed -cigar -i $target/read1_tx/mapped.sorted.bam > $target/read1_tx/mapped.sorted.bed 2> $outputDir/errorLog.txt &
129-
bedtools bamtobed -cigar -i $target/read2_tx/mapped.sorted.bam > $target/read2_tx/mapped.sorted.bed 2> $outputDir/errorLog.txt &
145+
bedtools bamtobed -cigar -i $target/read1_tx/mapped.sorted.bam > $target/read1_tx/mapped.sorted.bed 2>> $outputDir/errorLog.txt &
146+
bedtools bamtobed -cigar -i $target/read2_tx/mapped.sorted.bam > $target/read2_tx/mapped.sorted.bed 2>> $outputDir/errorLog.txt &
130147
wait
131148

132-
python runBedFileSplit_pub.py $target 2> $outputDir/errorLog.txt
149+
python runBedFileSplit_pub.py $target 2>> $outputDir/errorLog.txt
133150
wait
134151

135152
for file in $target/read1_tx/mapped.sorted.bed_chunk*
136153
do
137154
i=${file#*chunk}
138-
python chimericIdentification_pub.py $outputDir ${i} $geneDic $outputDir/intermediateFiles/chimStats_${i}.txt 2> $outputDir/errorLog.txt
155+
python chimericIdentification_pub.py $outputDir ${i} $geneDic $outputDir/intermediateFiles/chimStats_${i}.txt 2>> $outputDir/errorLog.txt
139156
done
140157
wait
141158

159+
python runDeduplication_pub.py $outputDir 2>> $outputDir/errorLog.txt
142160

143161
rm $target/read1_tx/mapped.sorted.bed_chunk*
144162
rm $target/read2_tx/mapped.sorted.bed_chunk*
145163
wait
146164

147-
python runDeduplication_pub.py $outputDir 2> $outputDir/errorLog.txt
148-
wait
149-
150-
python callPPIs_pub.py $outputDir $pCutoff $oddsCutoff $rcCutoff 2> $outputDir/errorLog.txt
165+
python callPPIs_pub.py $outputDir $pCutoff $oddsCutoff $rcCutoff 2>> $outputDir/errorLog.txt
151166

152167

153168

bin/processFastq_pub.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
lineStore=[]
2525
targetFile.close()
2626
total=total/4
27-
targetFile==open('%s/summary.csv'%(sys.argv[1]),'w')
28-
targetFile.write('#input_read_pairs,%d\n'%(total))
29-
targetFile.close()
27+
if sys.argv[4]=='yes':
28+
targetFile=open('%s/summary.csv'%(sys.argv[3]),'w')
29+
targetFile.write('#input_read_pairs,%d\n'%(total))
30+
targetFile.close()

bin/runDeduplication_pub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
splitLine=line.strip().split(',')
3636
mapSum+=int(splitLine[0])
3737

38-
targetFile==open('%s/summary.csv'%(sys.argv[1]),'a')
38+
targetFile=open('%s/summary.csv'%(sys.argv[1]),'a')
3939
targetFile.write('#protein-coding_gene_mapped_read_pairs,%d\n'%(mapSum))
4040
targetFile.write('#chimeric_read_pairs,%d\n'%(chimNum))
4141
targetFile.close()

bin/writeNumReadPairs_pub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
bb= (len(set(haList1)&set(haList2)))
3434

3535

36-
targetFile==open('%s/summary.csv'%(sys.argv[1]),'a')
36+
targetFile=open('%s/summary.csv'%(sys.argv[1]),'a')
3737
targetFile.write('#read_pairs_used_for_alignment,%d\n'%(bb))
3838
targetFile.close()

0 commit comments

Comments
 (0)