-
Notifications
You must be signed in to change notification settings - Fork 0
/
CNVnator&RSEQ_7.Count.sh
76 lines (63 loc) · 2.53 KB
/
CNVnator&RSEQ_7.Count.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
## Script to tabulate variant counts of CNVnator after hard-filtering
##
## Date: 07 June 2019
## Modified
##
##
#SBATCH -A robinson
#SBATCH -p batch
#SBATCH -N 1
#SBATCH -n 8
#SBATCH --time=00:05:00
#SBATCH --mem=8GB
# Notification configuration
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH [email protected]
## Define Variables ##
INDIR=/fast/users/a1742674/outputs/Annotated/050619/DEL_DUP_70%_CNVnator
OUTDIR=/fast/users/a1742674/outputs/Annotated/050619/DEL_DUP_70%_CNVnator/COUNTS
## Check directories ##
if [ ! -d $INDIR ]; then
echo "$INDIR not found. Please check you have the right one."
exit 1
fi
if [ ! -d $OUTDIR ]; then
mkdir -p $OUTDIR
fi
## Start of the script
#creating table headers
echo -e "ALL possible variants-CNVnator after hardfiltering" > ${OUTDIR}/CNVnator_hardfiltered.txt
echo -e "Family\tDEL\t\t\t\t\t\t\t\tDUP\t\t\t\t\t\t\t" >> ${OUTDIR}/CNVnator_hardfiltered.txt
echo -e "\tDNV\t\t\t\tINH\t\t\t\tDNV\t\t\t\tINH\t\t\t" >> ${OUTDIR}/CNVnator_hardfiltered.txt
echo -e "\tDisc\t\tSha\t\tDisc\t\tSha\t\tDisc\t\tSha\t\tDisc\t\tSha\t" >> ${OUTDIR}/CNVnator_hardfiltered.txt
echo -e "\tBef\tAft\tBef\tAft\tBef\tAft\tBef\tAft\tBef\tAft\tBef\tAft\tBef\tAft\tBef\tAft" >> ${OUTDIR}/CNVnator_hardfiltered.txt
cd ${INDIR}
#define families needed
FAMILY=$(ls *.DEL.*.bed | cut -f2 -d "." | sort | uniq )
for F in $FAMILY;
do
(
#define variables
A1=$( cat 5.$F.DEL.*.bed | sort | uniq | wc -l )
B1=$( cat 6.$F.DEL.*.bed | sort | uniq | wc -l )
C1=$( cat 8.$F.DEL.*.bed | sort | uniq | wc -l )
D1=$( cat 9.$F.DEL.*.bed | sort | uniq | wc -l )
E1=$( cat 5.$F.DUP.*.bed | sort | uniq | wc -l )
F1=$( cat 6.$F.DUP.*.bed | sort | uniq | wc -l )
G1=$( cat 8.$F.DUP.*.bed | sort | uniq | wc -l )
H1=$( cat 9.$F.DUP.*.bed | sort | uniq | wc -l )
cd ${INDIR}/Final_Annotated/Filtered_060619
A2=$( grep "full" 5.$F.DEL.*.tsv | sort | uniq | wc -l )
B2=$( grep "full" 6.$F.DEL.*.tsv | sort | uniq | wc -l )
C2=$( grep "full" 8.$F.DEL.*.tsv | sort | uniq | wc -l )
D2=$( grep "full" 9.$F.DEL.*.tsv | sort | uniq | wc -l )
E2=$( grep "full" 5.$F.DUP.*.tsv | sort | uniq | wc -l )
F2=$( grep "full" 6.$F.DUP.*.tsv | sort | uniq | wc -l )
G2=$( grep "full" 8.$F.DUP.*.tsv | sort | uniq | wc -l )
H2=$( grep "full" 9.$F.DUP.*.tsv | sort | uniq | wc -l )
echo -e "$F\t$A1\t$A2\t$B1\t$B2\t$C1\t$C2\t$D1\t$D2\t$E1\t$E2\t$F1\t$F2\t$G1\t$G2\t$H1\t$H2" >> ${OUTDIR}/CNVnator_hardfiltered.txt
)
done
echo "done"