-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBusco_Scoring_mod.sh
28 lines (26 loc) · 1.42 KB
/
Busco_Scoring_mod.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
for ((var=1; var<=$#; var++))
do
if [[ "${!var}" = "-i" ]]
then
var=$(($var+1))
i=${!var}
echo "Variable i is "$i
else
echo "Unrecognized input, exitting"
exit 1
fi
done
echo ">"$i > /local/scratch/jmattick/LongReadMapping/Temp.$i.fa
cat /local/scratch/jmattick/LongReadMapping/DirectRNA.sorted.stringtie.gtf | grep -v "#" | grep -w $i | awk '$3 == "exon" {print $0}' > /local/scratch/jmattick/LongReadMapping/Temp.$i.gtf
direction=$(cat /local/scratch/jmattick/LongReadMapping/Temp.$i.gtf | awk '{print $7}' | sort | uniq)
if [ $direction == "+" ]
then
/usr/local/packages/bedtools2/bin/bedtools getfasta -fi /local/scratch/jmattick/BrugiaPahangi.FINAL.V4.fasta -bed /local/scratch/jmattick/LongReadMapping/Temp.$i.gtf | grep -v ">" | tr -d '\n' >> /local/scratch/jmattick/LongReadMapping/Temp.$i.fa
else
/usr/local/packages/bedtools2/bin/bedtools getfasta -fi /local/scratch/jmattick/BrugiaPahangi.FINAL.V4.fasta -bed /local/scratch/jmattick/LongReadMapping/Temp.$i.gtf | grep -v ">" | tr -d '\n' | rev | tr ACGTacgt TGCAtgca >> /local/scratch/jmattick/LongReadMapping/Temp.$i.fa
fi
rm /local/scratch/jmattick/LongReadMapping/Temp.$i.gtf
samtools faidx /local/scratch/jmattick/LongReadMapping/Temp.$i.fa
samtools faidx /local/scratch/jmattick/LongReadMapping/Temp.$i.fa $i > /local/scratch/jmattick/LongReadMapping/$i.fa
rm /local/scratch/jmattick/LongReadMapping/Temp.$i.fa
rm /local/scratch/jmattick/LongReadMapping/Temp.$i.fa.fai