-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprep_gbs_ref.sge
executable file
·57 lines (43 loc) · 1.3 KB
/
prep_gbs_ref.sge
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
#!/bin/bash
#prep_gbs_ref.sge
#sge submission script to prepare already qc'd reads for alignment to the reference
#removes reads with improper restriction site
#removes samples with no data
#M. Supple
#last modified 8 August 2016
#usage qsub stacks_final.sge <prep.input> <proper_read_start>
#<prep.input>: see prep.example.input or example at end of this script
#<proper_read_start> is expected start of each read (PstI=TGCAG)
#requires
#output
#interleaved fastq file for each sample
#$ -N prep_gbs_ref.sge
#$ -o prep_gbs_ref.output
#$ -l virtual_free=3g,h_vmem=3.1g
#$ -j y
#$ -cwd
#print some useful sge information
echo Job $JOB_NAME started `date` in queue $QUEUE with id=$JOB_ID on `hostname`
#read in input
source $1
reseq=$2
#get list of samples
samples=($(ls $gbs_path/$user/$lane_name/qc/qc_S*_il.fastq.gz))
#loop over each sample
for ((a=0; a<${#samples[@]}; a++))
do
echo -e "processing sample ${samples[a]}"
#remove bad reads
remove_bad_restriction_sites.pl ${samples[a]} $reseq
done
#remove samples with no data
for fullfile in $( ls clean_*gz ); do
filename=$(basename "$fullfile")
filesize=$( stat -c%s $fullfile )
if [ "$filesize" -lt "21" ]; then
rm $filename
echo "$filename failed"
fi
done
#print note that job completed
echo done `date`