-
Notifications
You must be signed in to change notification settings - Fork 0
/
excavator2_detection.sh
237 lines (161 loc) · 6.45 KB
/
excavator2_detection.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# Author: Julie BOGOIN
source ~/miniconda3/etc/profile.d/conda.sh
conda activate excavator2_env
TARGETS_AUTO="/media/jbogoin/Data1/jbogoin/ref/gencode/v36_hg38/autosomes/gencode.v36.basic.annotation.autosomes.bed"
TARGETS_XY="/media/Data1/jbogoin/ref/gencode/v36_hg38/XY/gencode.v36.basic.annotation.XY.bed"
TARGETS_ALL="/media/jbogoin/Data1/jbogoin/ref/gencode/v34_hg38/all/gencode.v36.basic.annotation.all.bed"
DATA=$PWD
echo ""
echo "******************************"
echo "EXCAVATOR2 CNV DETECTION start"
echo "******************************"
echo ""
rm -Rf excavator2_output/
mkdir excavator2_output
cd excavator2_output
mkdir all
mkdir female
mkdir male
cd ..
# BAM list file
ls *.dedup.bam > $DATA/excavator2_output/all/bam_list.txt
# female list file
FEMALE=""
while read line
do
FEMALE+="$line.dedup.bam "
done < female_list.txt
echo -e $FEMALE > $DATA/excavator2_output/female/bam_list.txt
# male list file
MALE=""
while read line
do
MALE+="$line.dedup.bam "
done < male_list.txt
echo -e $MALE > $DATA/excavator2_output/male/bam_list.txt
# echo ""
# echo "Targets initialization..."
# rm -Rf ~/EXCAVATOR2_Package_v1.1.2/data/targets/hg38/all_w10K
# rm -Rf ~/EXCAVATOR2_Package_v1.1.2/data/targets/hg38/autosomes_w10K
# rm -Rf ~/EXCAVATOR2_Package_v1.1.2/data/targets/hg38/XY_w10K
# cd ~/EXCAVATOR2_Package_v1.1.2
# perl TargetPerla.pl SourceTarget.txt $TARGETS_ALL all_w10K 10000 hg38
# perl TargetPerla.pl SourceTarget.txt $TARGETS_AUTO autosomes_w10K 10000 hg38
# perl TargetPerla.pl SourceTarget.txt $TARGETS_XY XY_w10K 10000 hg38
##################################################################################
echo ""
echo "Working on female..."
echo ""
# Data Prepare Module
cd $DATA
for sample_id in $FEMALE; \
do SAMPLE=${sample_id%%.dedup.bam}
echo $DATA/$SAMPLE.dedup.bam $DATA/excavator2_output/female/$SAMPLE $SAMPLE >> $DATA/excavator2_output/female/ExperimentalFilePrepare.w10K.txt;
done
# RC calculations
cd ~/EXCAVATOR2_Package_v1.1.2
perl EXCAVATORDataPrepare.pl $DATA/excavator2_output/female/ExperimentalFilePrepare.w10K.txt --processors 12 --target XY_w10K --assembly hg38
# Experimental analysis file
labels=("C1" "C2" "C3" "C4" "C5" "C6" "C7" "C8" "C9" "C10" "C11")
rm $DATA/excavator2_output/female/ExperimentalFileAnalysis.w10K.*
cd $DATA
for sample_id in $FEMALE; do
SAMPLE=${sample_id%%.dedup.bam};
echo 'T1' $DATA/excavator2_output/female/$SAMPLE $SAMPLE > $DATA/excavator2_output/female/ExperimentalFileAnalysis.w10K.$SAMPLE.txt;
others=$(ls *.dedup.bam | grep -v $SAMPLE);
# TRansformer la liste others en tableau indicable table
table=( ${others// / } )
table_clean=${table[@]/.dedup.bam/}
NORMAL=( ${table_clean// / } )
for i in `seq 0 10`; do
echo ${labels[$i]} $DATA/excavator2_output/female/${NORMAL[$i]} ${NORMAL[$i]}\
>> $DATA/excavator2_output/female/ExperimentalFileAnalysis.w10K.$SAMPLE.txt;
done
# Segmentation of the WMRC
cd ~/EXCAVATOR2_Package_v1.1.2;
perl EXCAVATORDataAnalysis.pl $DATA/excavator2_output/female/ExperimentalFileAnalysis.w10K.$SAMPLE.txt\
--processors 12 --target XY_w10K\
--assembly hg38\
--output $DATA/excavator2_output/female/w10K_results.$SAMPLE\
--mode pooling;
cd $DATA
done
##################################################################################
echo ""
echo "Working on male..."
echo ""
# Data Prepare Module
cd $DATA
for sample_id in $MALE; \
do SAMPLE=${sample_id%%.dedup.bam}
echo $DATA/$SAMPLE.dedup.bam $DATA/excavator2_output/male/$SAMPLE $SAMPLE >> $DATA/excavator2_output/male/ExperimentalFilePrepare.w10K.txt;
done
# RC calculations
cd ~/EXCAVATOR2_Package_v1.1.2
perl EXCAVATORDataPrepare.pl $DATA/excavator2_output/male/ExperimentalFilePrepare.w10K.txt --processors 12 --target XY_w10K --assembly hg38
# Experimental analysis file
labels=("C1" "C2" "C3" "C4" "C5" "C6" "C7" "C8" "C9" "C10" "C11")
rm $DATA/excavator2_output/male/ExperimentalFileAnalysis.w10K.*
cd $DATA
for sample_id in $FEMALE; do
SAMPLE=${sample_id%%.dedup.bam};
echo 'T1' $DATA/excavator2_output/male/$SAMPLE $SAMPLE > $DATA/excavator2_output/male/ExperimentalFileAnalysis.w10K.$SAMPLE.txt;
others=$(ls *.dedup.bam | grep -v $SAMPLE);
# TRansformer la liste others en tableau indicable table
table=( ${others// / } )
table_clean=${table[@]/.dedup.bam/}
NORMAL=( ${table_clean// / } )
for i in `seq 0 10`; do
echo ${labels[$i]} $DATA/excavator2_output/male/${NORMAL[$i]} ${NORMAL[$i]}\
>> $DATA/excavator2_output/male/ExperimentalFileAnalysis.w10K.$SAMPLE.txt;
done
# Segmentation of the WMRC
cd ~/EXCAVATOR2_Package_v1.1.2;
perl EXCAVATORDataAnalysis.pl $DATA/excavator2_output/male/ExperimentalFileAnalysis.w10K.$SAMPLE.txt\
--processors 12 --target XY_w10K\
--assembly hg38\
--output $DATA/excavator2_output/male/w10K_results.$SAMPLE\
--mode pooling;
cd $DATA
done
##################################################################################
echo ""
echo "Working on all..."
echo ""
# Data Prepare Module
cd $DATA
for sample_id in *.dedup.bam; \
do SAMPLE=${sample_id%%.dedup.bam}
echo $DATA/$SAMPLE.dedup.bam $DATA/excavator2_output/all/$SAMPLE $SAMPLE >> $DATA/excavator2_output/all/ExperimentalFilePrepare.w10K.txt;
done
# RC calculations
cd ~/EXCAVATOR2_Package_v1.1.2
perl EXCAVATORDataPrepare.pl $DATA/excavator2_output/all/ExperimentalFilePrepare.w10K.txt --processors 12 --target autosomes_w10K --assembly hg38
# Experimental analysis file
labels=("C1" "C2" "C3" "C4" "C5" "C6" "C7" "C8" "C9" "C10" "C11")
rm $DATA/excavator2_output/all/ExperimentalFileAnalysis.w10K.*
cd $DATA
for sample_id in *.dedup.bam; do
SAMPLE=${sample_id%%.dedup.bam};
echo 'T1' $DATA/excavator2_output/all/$SAMPLE $SAMPLE > $DATA/excavator2_output/all/ExperimentalFileAnalysis.w10K.$SAMPLE.txt;
others=$(ls *.dedup.bam | grep -v $SAMPLE);
# TRansformer la liste others en tableau indicable table
table=( ${others// / } )
table_clean=${table[@]/.dedup.bam/}
NORMAL=( ${table_clean// / } )
for i in `seq 0 10`; do
echo ${labels[$i]} $DATA/excavator2_output/all/${NORMAL[$i]} ${NORMAL[$i]}\
>> $DATA/excavator2_output/all/ExperimentalFileAnalysis.w10K.$SAMPLE.txt;
done
# Segmentation of the WMRC
cd ~/EXCAVATOR2_Package_v1.1.2;
perl EXCAVATORDataAnalysis.pl $DATA/excavator2_output/all/ExperimentalFileAnalysis.w10K.$SAMPLE.txt\
--processors 12 --target autosomes_w10K\
--assembly hg38\
--output $DATA/excavator2_output/all/w10K_results.$SAMPLE\
--mode pooling;
cd $DATA
done
echo ""
echo "EXCAVATOR2 CNV DETECTION job done!"
echo ""