-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMACARON_validate.sh
More file actions
executable file
·49 lines (35 loc) · 927 Bytes
/
MACARON_validate.sh
File metadata and controls
executable file
·49 lines (35 loc) · 927 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#sub1.chr22_21349676-21349677.sample02.bam
bam=$1;
name=$(echo $bam | cut -d'.' -f1)
region=$(echo $bam | cut -d'.' -f2)
sample=$(echo $bam | cut -d'.' -f3)
chr=$(echo $region | cut -d'_' -f1)
pos=$(echo $region | cut -d'_' -f2)
beg=$(echo $pos | cut -d'-' -f1)
end=$(echo $pos | cut -d'-' -f2)
#beg=$(($beg+50))
#end=$((end-50))
#echo "name $name"
#echo "region $region"
#echo "sample $sample"
echo "$name $chr:$beg-$end $sample"
echo "$name $chr:$beg-$end $sample" >> MACARON_validate.txt
samtools view $bam | awk -v start=$beg -v stop=$end '
{
pos=$4;
if(pos < start){
cstart=1+start-pos;
cstop=1+stop-pos;
print cstart"."cstop"."$10;
}
}' > tmp
while read line;
do
cb=$(echo $line | cut -d'.' -f1);
ce=$(echo $line | cut -d'.' -f2);
seq=$(echo $line | cut -d'.' -f3);
echo $seq | cut -c$cb-$ce;
done <tmp | sort | uniq -c | sort -n >> MACARON_validate.txt
rm tmp
exit 0