-
Notifications
You must be signed in to change notification settings - Fork 1
/
stacks_step0.sh
executable file
·462 lines (409 loc) · 15.9 KB
/
stacks_step0.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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
#!/bin/sh
#$ -o [Project_path_dir]/SGE_out/stacks0.out
#$ -e [Project_path_dir]/SGE_out/stacks0.err
#$ -N [Proj_Name]_stacks0
#$ -S /bin/sh
#$ -q unlimitq
#$ -m bea
# WARNING
# dans le fichier data les lectures doivent être stockées dans du _1.fq.gz et _2.fq.gz ou _1.fastq.gz et _2.fastq.gz
date
date >&2
Proj_Name=[Proj_Name]
# VARIABLES GENERALES
stacks_dir=/usr/local/bioinfo/src/Stacks/stacks-1.35/bin
RAD_DIR=[Project_path_dir]
SCRIPT_DIR=[Script_path_dir]
# input
DATA_DIR=$RAD_DIR/data
INDIV_FILE=$RAD_DIR/indiv_barcode.txt
POP_FILE=$RAD_DIR/population.map
dos2unix $POP_FILE
# output
OUT_DIR=$RAD_DIR/preprocessing
SGE=$RAD_DIR/SGE_out/`basename $OUT_DIR`
STAT_DIR=$RAD_DIR/stat/`basename $OUT_DIR`
# VARIABLE DEDIEES
# enzyme utilisée, séparée par un espace en cas de double digestion.
# enzymes possibles:
# 'ageI', 'aluI', 'apeKI', 'apoI', 'bamHI', 'bgIII', 'bstYI', 'claI',
# 'ddeI', 'dpnII', 'eaeI', 'ecoRI', 'ecoRV', 'ecoT22I', 'hindIII', 'kpnI',
# 'mluCI', 'mseI', 'mspI', 'ndeI', 'nheI', 'nlaIII', 'notI', 'nsiI',
# 'pstI', 'rsaI', 'sacI', 'sau3AI', 'sbfI', 'sexAI', 'sgrAI', 'speI',
# 'sphI', 'taqI', 'xbaI', or 'xhoI'
Enzyme=""
#voulez vous travaillez sur des données alignées ou non. oui : align=1, non : align=0
align=0
#avez vous des données pairées ? oui : paired=1, non : paired=0
paired=1
# voulez vous supprimer les duplicats PCR oui : dereplication=1, non : dereplication=0.
# !! attention vallable uniquement sur single digest pair end!!
dereplication=0
# nombre de mismatch autorisé sur les barcodes BMM sur le tag de restriction qui suit TMM
BMM=0
# si le barcode n'est présent que sur la lecture 1 alors TRIM=1 sinon TRIM=2
TRIM=1
# Si vous avez des taille de barcodes différentes ou si vous avez du ddrad avec un barcode sur une seule extrémité, alors après trimming de barcodes vos lectures seront de taille différente. Il est nécessaire pour la suite d'avoir des lectures de même taille. Indiquez ici la taille maximum que vous souhaitez conserver.
LEN=
################### CHECKS ##################################
dos2unix $INDIV_FILE
check=`cut -f 2 $INDIV_FILE | sort | uniq -c | awk '$1>1'`
if [[ $check == "" ]]
then echo "all sample names are uniq"
else
echo "You have sample name(s) that are non uniq in your $INDIV_FILE file:"
echo $check | awk '{for (i =1;i<= NF; i+=2){name=i+1; print "\t"$name" is present "$i" times"}}'
exit 1
fi
check=`cut -f 2 $INDIV_FILE | grep "-" | wc -l`
if [[ $check -gt 0 ]]
then
echo "You use \"-\" in your sample names, please search and replace those with \"_\" in you sample names (only)"
fi
double_digest=`echo $Enzyme | awk '{if(NF>1){print "1"}else{print "0"}}'`
if [[ $double_digest = 1 && $paired = 0 ]]
then
echo "Error. You can not have double digest and single end sequencing"
fi
if [[ $double_digest = 1 && $dereplication = 1 ]]
then
echo "Error. You can not dereplicate double digest data"
exit 1
fi
if [[ $paired = 0 && $dereplication = 1 ]]
then
echo "Error. You can not dereplicate single end data"
exit 1
fi
mkdir -p $OUT_DIR
mkdir -p $SGE
mkdir -p $STAT_DIR
cd $OUT_DIR
Run=`cut -f 3 $INDIV_FILE | sort -u | awk '{dir=dir $1" "}END{print dir}'`
mkdir -p $Run
############################ DEMULTIPLEXAGE ##############################
rm -rf $SGE/*
echo "DEMULTIPLEXAGE"
echo "DEMULTIPLEXAGE" >&2
# Pour chaque run on va lancer le démultiplexage sur chaque fichier barcode en fonction de leur taille.
nj=0
for run in $Run
do
if [[ $(ls $run/ | grep -c barcode ) -gt 0 ]]
then
rm $run/barcode*
fi
awk -v R=$run '{if($3==R){bl=length($4); print $2,$4 >> R"/barcode_"bl}}' $INDIV_FILE
lastjobid=""
f1=`ls $DATA_DIR/${run}_1.f*q* | grep -v md5`
f2=`ls $DATA_DIR/${run}_2.f*q* | grep -v md5`
for bl in `ls $run/barcode_* | sed -e s%$run/barcode_%% | sort -nr `
do
name=${Proj_Name}_preprocessing_${run}_${bl}
if [ "$lastjobid" = "" ]
then
echo "CMD: qsub -N $name -o $SGE/${Proj_Name}_preprocessing_${run}_${bl}.out -e $SGE/${Proj_Name}_preprocessing_${run}_${bl}.err $SCRIPT_DIR/preprocessing.sh $SCRIPT_DIR $f1 $f2 $OUT_DIR/$run/ $run/barcode_${bl} $BMM $TRIM"
qsub -N $name -o $SGE/${Proj_Name}_preprocessing_${run}_${bl}.out -e $SGE/${Proj_Name}_preprocessing_${run}_${bl}.err $SCRIPT_DIR/preprocessing.sh $SCRIPT_DIR $f1 $f2 $OUT_DIR/$run/ $run/barcode_${bl} $BMM $TRIM
else
echo "CMD: qsub -hold_jid $lastjobid -N $name -o $SGE/${Proj_Name}_preprocessing_${run}_${bl}.out -e $SGE/${Proj_Name}_preprocessing_${run}_${bl}.err $SCRIPT_DIR/preprocessing.sh $SCRIPT_DIR $f1 $f2 $OUT_DIR/$run/ $run/barcode_${bl} $BMM $TRIM"
qsub -hold_jid $lastjobid -N $name -o $SGE/${Proj_Name}_preprocessing_${run}_${bl}.out -e $SGE/${Proj_Name}_preprocessing_${run}_${bl}.err $SCRIPT_DIR/preprocessing.sh $SCRIPT_DIR $f1 $f2 $OUT_DIR/$run/ $run/barcode_${bl} $BMM $TRIM
fi
lastjobid=$name
f1=$OUT_DIR/$run/unmatched_1.fq
f2=$OUT_DIR/$run/unmatched_2.fq
let nj=$nj+1
done
done
# nombre de jobs finis
finished=0
jf=0
# tant que tous les jobs ne sont pas terminés
until [[ $(ls $SGE/ | grep -c preprocessing_) -gt 0 && $jf -eq $nj ]]
do
# compter le nombre de jobs terminés
if [[ $(ls $SGE | grep preprocessing | wc -l) -gt 0 ]]
then
jf=`grep "Epilog" $SGE/${Proj_Name}_preprocessing*.out | wc -l`
else
jf=0
fi
# affiché le nombre de jobs terminés s'il est différent d'avant
if [[ "$finished" -ne "$jf" ]]
then
echo " $jf paire filtered among $nj"
finished=$jf
fi
sleep 10s
done
jf=`grep "Epilog" $SGE/${Proj_Name}_preprocessing*.out | wc -l`
if [[ "$finished" -ne "$jf" ]]
then
jf=`grep "Epilog" $SGE/${Proj_Name}_preprocessing*.out | wc -l`
echo " $jf paire filtered among $nj"
fi
for run in $Run
do
if [[ -e $OUT_DIR/$run/unmatched_1.fq ]]
then
qsub -N ${Proj_Name}_gzip_$run -o /dev/null -e /dev/null -b y "gzip $OUT_DIR/$run/ambiguous_* $OUT_DIR/$run/unmatched_* $OUT_DIR/$run/*2rad*"
fi
done
date
############################ FILTRE CLONE ##############################
if [[ $dereplication = 1 ]]
then
date
echo -e "\nFILTRE CLONE: clone_filter"
echo -e "\nFILTRE CLONE: clone_filter" >&2
if [[ $(ls $SGE/ | grep -c clone_filter) -gt 0 ]]
then
rm $SGE/*clone_filter*
rm $run/clone_filter/*
fi
cat $INDIV_FILE | while read line
do
run=`echo $line | awk '{print $3}'`
mkdir -p $run/clone_filter
indiv=`echo $line | awk '{print $2}'`
echo "sh $SCRIPT_DIR/clone_filter.sh `ls $run/${indiv}_1.fq*` `ls $run/${indiv}_2.fq*` $run/clone_filter $stacks_dir" >> $SGE/clone_filter_$run.qarray
done
job_id_clone_filter=""
for run in $Run
do
id=`qarray -terse -N ${Proj_Name}_clone_filter_$run -o $SGE -e $SGE $SGE/clone_filter_$run.qarray`
job_id_clone_filter=`echo $job_id_clone_filter $id`
done
for id in $job_id_clone_filter
do
r=0;
while [ $r == 0 ] ; do qstat -j $id >& /dev/null ; r=$? ; sleep 10s ; done
done
fi
############################ FILTRE QUAL ##############################
date
echo -e "\nFILTRE QUALITE: process_rad_tags"
echo -e "\nFILTRE QUALITE: process_rad_tags" >&2
if [[ $(ls $SGE/ | grep -c process_rad_tags) -gt 0 ]]
then
rm $SGE/*process_rad_tags*
fi
cat $INDIV_FILE | while read line
do
run=`echo $line | awk '{print $3}'`
mkdir -p $run/checkRAD
indiv=`echo $line | awk '{print $2}'`
if [[ $double_digest = 0 ]]
then
if [[ $dereplication = 1 ]]
then
echo "sh $SCRIPT_DIR/process_rad_tags.sh `ls $run/clone_filter/${indiv}_cloneF_1.fq.gz` $run/checkRAD $Enzyme $stacks_dir $LEN " >> $SGE/process_rad_tags_$run.qarray
else
echo "sh $SCRIPT_DIR/process_rad_tags.sh `ls $run/${indiv}_1.fq*` $run/checkRAD $Enzyme $stacks_dir $LEN " >> $SGE/process_rad_tags_$run.qarray
fi
else
echo "sh $SCRIPT_DIR/process_ddrad_tags.sh `ls $run/${indiv}_1.fq*` `ls $run/${indiv}_2.fq*` $run/checkRAD $Enzyme $stacks_dir $LEN " >> $SGE/process_rad_tags_$run.qarray
fi
done
job_id_process_rad_tags=""
for run in $Run
do
id=`qarray -terse -l mem=12G -l h_vmem=24G -N ${Proj_Name}_process_rad_tags_$run -o $SGE -e $SGE $SGE/process_rad_tags_$run.qarray`
job_id_process_rad_tags=`echo $job_id_process_rad_tags $id`
done
for id in $job_id_process_rad_tags
do
r=0;
while [ $r == 0 ] ; do qstat -j $id >& /dev/null ; r=$? ; sleep 10s ; done
done
############################ REGENERER LES PAIRES DE SEQUENCE ##############################
# le filtre qualité n'a été lancé que sur la lecture 1. Cela génère 2 fichiers par fastq. Il s'agit maintenant de reconstituer des fichiers pairés.
if [[ $paired = 1 && $double_digest = 0 ]]
then
date
echo -e "\nREORDONNANCEMENT DES PAIRES DE FICHIERS FASTQ"
echo -e "\nREORDONNANCEMENT DES PAIRES DE FICHIERS FASTQ" >&2
cd $RAD_DIR
if [[ $(ls $SGE/ | grep -c recoverMate) -gt 0 ]]
then
rm $SGE/*recoverMate*
fi
cat $INDIV_FILE | while read line
do
run=`echo $line | awk '{print $3}'`
indiv=`echo $line | awk '{print $2}'`
if [[ $dereplication = 1 ]]
then
echo "sh $SCRIPT_DIR/recover_mate.sh `ls $OUT_DIR/$run/checkRAD/${indiv}_cloneF_1*discards` `ls $OUT_DIR/$run/clone_filter/${indiv}_cloneF_2.fq*`" >> $SGE/recoverMateDiscards.qarray
echo "sh $SCRIPT_DIR/recover_mate.sh $OUT_DIR/$run/checkRAD/${indiv}_cloneF_1.fq `ls $OUT_DIR/$run/clone_filter/${indiv}_cloneF_2.fq* `" >> $SGE/recoverMate.qarray
else
echo "sh $SCRIPT_DIR/recover_mate.sh `ls $OUT_DIR/$run/checkRAD/${indiv}_1.fq*discards` `ls $OUT_DIR/$run/${indiv}_2.fq*`" >> $SGE/recoverMateDiscards.qarray
echo "sh $SCRIPT_DIR/recover_mate.sh $OUT_DIR/$run/checkRAD/${indiv}_1.fq `ls $OUT_DIR/$run/${indiv}_2.fq* `" >> $SGE/recoverMate.qarray
fi
done
job_id_recov_dis=`qarray -terse -N ${Proj_Name}_recoverMateDiscards -o $SGE -e $SGE $SGE/recoverMateDiscards.qarray`
job_id_recov_ok=`qarray -terse -N ${Proj_Name}_recoverMate -o $SGE -e $SGE $SGE/recoverMate.qarray`
r=0;
while [ $r == 0 ] ; do qstat -j $job_id_recov_dis >& /dev/null ; r=$? ; sleep 10s ; done
r=0;
while [ $r == 0 ] ; do qstat -j $job_id_recov_ok >& /dev/null ; r=$? ; sleep 10s ; done
else
cat $INDIV_FILE | while read line
do
run=`echo $line | awk '{print $3}'`
indiv=`echo $line | awk '{print $2}'`
echo "gzip $OUT_DIR/$run/checkRAD/${indiv}_*" >> $SGE/gzip_process_radtag.qarray
done
job_id_gzip=`qarray -terse -N ${Proj_Name}_gzip -o $SGE -e $SGE $SGE/gzip_process_radtag.qarray`
r=0;
while [ $r == 0 ] ; do qstat -j $job_id_gzip >& /dev/null ; r=$? ; sleep 10s ; done
fi
#~ ############################ CREATION DOSSIER INPUT u/pstacks #############################################
mkdir -p $OUT_DIR/stacks_input
cat $INDIV_FILE | while read line
do
run=`echo $line | awk '{print $3}'`
indiv=`echo $line | awk '{print $2}'`
if [[ $align == 1 ]]
then
if [[ $dereplication == 0 ]]
then
ln -s $OUT_DIR/$run/checkRAD/${indiv}_*.fq.gz $OUT_DIR/stacks_input/
else
for i in `ls $OUT_DIR/$run/checkRAD/${indiv}_cloneF_*.fq.gz`
do
s=`basename $i | sed 's/_cloneF//'`
ln -s $i $OUT_DIR/stacks_input/$s
done
fi
else
if [[ $double_digest == 1 ]]
then
zcat $OUT_DIR/$run/checkRAD/${indiv}_*.fq.gz > $OUT_DIR/stacks_input/${indiv}.fq
gzip -f $OUT_DIR/stacks_input/${indiv}.fq
else
if [[ $dereplication == 1 ]]
then
ln -s $OUT_DIR/$run/checkRAD/${indiv}_cloneF_1.fq.gz $OUT_DIR/stacks_input/${indiv}.fq.gz
else
ln -s $OUT_DIR/$run/checkRAD/${indiv}_1.fq.gz $OUT_DIR/stacks_input/${indiv}.fq.gz
fi
fi
fi
done
############################# STAT #############################
date
echo -e "\nSTATISTICS\n"
echo -e "\nSTATISTICS\n" >&2
echo -e "#run\tpop\tindiv\tdemultiplexed_pairs\tparis_duplicated_removed\tlowqual_read_removed\tbadTAG_read\tfinal_retained_reads" > $STAT_DIR/read_count.txt
for run in $Run
do
idx=1
type=`ls $OUT_DIR/$run/*_1.fq*|head -n 1 | awk '{if(match($1,".gz") > 0 ){print "gzfastq"}else{print "fastq"}}'`
grep $run $INDIV_FILE | while read line
do
indiv=`echo $line | cut -d ' ' -f 2`
pop=`awk -v I=$indiv '{if($1==I){print $2}}' $POP_FILE`
if [[ "$type" = "gzfastq" ]]
then
nb_read=`zcat $OUT_DIR/$run/${indiv}_1* | wc -l |awk '{print $1/4}'`
else
nb_read=`wc -l $OUT_DIR/$run/${indiv}_1* | awk '{print $1/4}' `
fi
if [[ $dereplication == 1 ]]
then
nb_dup=`tail -n 1 $SGE/${Proj_Name}_clone_filter_$run.e*.$idx | awk '{print $12}'`
else
nb_dup=0
fi
nb_lowqual=`tail -n 3 $SGE/${Proj_Name}_process_rad_tags_$run.e*.$idx | grep "low quality" | awk '{print $1}'`
nb_badRAD=`tail -n 6 $SGE/${Proj_Name}_process_rad_tags_$run.e*.$idx | grep 'ambiguous RAD-Tag drops' | awk '{print $1}'`
nb_retain=`tail -n 3 $SGE/${Proj_Name}_process_rad_tags_$run.e*.$idx | grep "retained" | awk '{print $1}'`
echo -e "$run\t$pop\t$indiv\t$nb_read\t$nb_dup\t$nb_lowqual\t$nb_badRAD\t$nb_retain" >> $STAT_DIR/read_count.txt
let idx+=1
done
Tdemult=`awk -v R=$run '$1==R' $STAT_DIR/read_count.txt | colstat.sh 4 | awk -v D=$double_digest '{if(D==1){print $4*2}else{print $4}}'`
Tdup=`awk -v R=$run '$1==R' $STAT_DIR/read_count.txt| colstat.sh 5 | awk -v D=$double_digest '{if(D==1){print $4*2}else{print $4}}'`
Tlowqual=`awk -v R=$run '$1==R' $STAT_DIR/read_count.txt | colstat.sh 6 | awk '{print $4}'`
TbadRAD=`awk -v R=$run '$1==R' $STAT_DIR/read_count.txt | colstat.sh 7 | awk '{print $4}'`
Tretained=`awk -v R=$run '$1==R' $STAT_DIR/read_count.txt | colstat.sh 8 | awk '{print $4}'`
if [[ "$type" = "gzfastq" && -e $OUT_DIR/$run/unmatched_1.fq.gz ]]
then
unmap=`zcat $OUT_DIR/$run/unmatched_1.fq.gz | wc -l | awk '{print $1/4}'`
else
if [[ "$type" = "fastq" && -e $OUT_DIR/$run/unmatched_1.fq ]]
then
unmap=`wc -l $OUT_DIR/$run/unmatched_1.fq | awk '{print $1/4}'`
else
unmap=0
fi
fi
if [[ "$type" = "gzfastq" && -e $OUT_DIR/$run/ambiguous_1.fq.gz ]]
then
ambiguous=`zcat $OUT_DIR/$run/ambiguous_1.fq.gz | wc -l | awk '{print $1/4}'`
else
if [[ "$type" = "fastq" && -e $OUT_DIR/$run/ambiguous_1.fq ]]
then
ambiguous=`wc -l $OUT_DIR/$run/ambiguous_1.fq | awk '{print $1/4}'`
else
ambiguous=0
fi
fi
if [[ "$type" = "gzfastq" && $(ls $OUT_DIR/$run/ | grep 2rad_1.fq.gz | wc -l ) -gt 0 ]]
then
dbrad=`zcat $OUT_DIR/$run/*2rad_1.fq.gz | wc -l | awk '{print $1/4}'`
else
if [[ "$type" = "fastq" && $(ls $OUT_DIR/$run/ | grep 2rad_1.fq.gz | wc -l ) -gt 0 ]]
then
dbrad=`wc -l $OUT_DIR/$run/*2rad_1.fq | grep total | awk '{print $1/4}'`
else
dbrad=0
fi
fi
let Ttot=$Tdemult+$unmap+$dbrad+$ambiguous
let per_demult=$Tdemult*100/$Ttot
if [[ $dereplication == 1 ]]
then
let per_cloneF=$Tdup*100/$Ttot
fi
let per_lowQual=$Tlowqual*100/$Ttot
let per_badRAD=$TbadRAD*100/$Ttot
let per_qualFil=$Tretained*100/$Ttot
let per_unmap=$unmap*100/$Ttot
let per_ambiguous=$ambiguous*100/$Ttot
let per_2rad=$dbrad*100/$Ttot
if [[ $double_digest == 1 ]]
then
echo "" >> $STAT_DIR/summary.stat
echo "$run :" >> $STAT_DIR/summary.stat
echo " total reads : $Ttot" >> $STAT_DIR/summary.stat
echo " wrong barcode : $unmap ($per_unmap %)" >> $STAT_DIR/summary.stat
echo " ambiguous barcode : $ambiguous ($per_ambiguous %)" >> $STAT_DIR/summary.stat
echo " 2 rad tag : $dbrad ($per_2rad %)" >> $STAT_DIR/summary.stat
echo " barcoded : $Tdemult ($per_demult %)" >> $STAT_DIR/summary.stat
echo " low quality read1: $Tlowqual ($per_lowQual %)" >> $STAT_DIR/summary.stat
echo " bad RADTag: $TbadRAD ($per_badRAD %)" >> $STAT_DIR/summary.stat
echo " quality filtered and RAD checked : $Tretained ($per_qualFil %)" >> $STAT_DIR/summary.stat
else
echo "" >> $STAT_DIR/summary.stat
echo "$run :" >> $STAT_DIR/summary.stat
echo " total pairs : $Ttot" >> $STAT_DIR/summary.stat
echo " wrong barcode : $unmap ($per_unmap %)" >> $STAT_DIR/summary.stat
echo " ambiguous barcode : $ambiguous ($per_ambiguous %)" >> $STAT_DIR/summary.stat
echo " 2 rad tag : $dbrad ($per_2rad %)" >> $STAT_DIR/summary.stat
echo " barcoded : $Tdemult ($per_demult %)" >> $STAT_DIR/summary.stat
if [[ $dereplication == 1 ]]
then
echo " clone filtered paired: $Tdup ($per_cloneF %)" >> $STAT_DIR/summary.stat
fi
echo " low quality read1: $Tlowqual ($per_lowQual %)" >> $STAT_DIR/summary.stat
echo " bad RADTag: $TbadRAD ($per_badRAD %)" >> $STAT_DIR/summary.stat
if [[ $dereplication == 1 ]]
then
echo " dereplicated, quality filtered and RAD checked : $Tretained ($per_qualFil %)" >> $STAT_DIR/summary.stat
else
echo " quality filtered and RAD checked : $Tretained ($per_qualFil %)" >> $STAT_DIR/summary.stat
fi
fi
done
echo -e "\nEND OF PREPROCESSING STEP"
date