-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSNP_Pipeline.sh
More file actions
73 lines (59 loc) · 2.7 KB
/
Copy pathSNP_Pipeline.sh
File metadata and controls
73 lines (59 loc) · 2.7 KB
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
#!/bin/bash
if [[ $# -lt 7 ]]; then
echo "$0: <Config file> <Prepare Reference Switch> <Filter Reads Switch> <Alignment Switch> <Prep BAM Switch> <GATK2 Switch> <VEP Switch> <email address>"
echo "Switches are turned on by passing 1 and off by 0"
exit 1
fi
echo "Make sure that all Pre steps of Pipeline have been run. This script only launches RUN1-RUN6."
echo "Config file: $1. Prepare Reference: $2. Filter Reads: $3. Align to Genome: $4. Prep BAMS <PicardTools>: $5. GATK2: $6. Variant Effect Predictor: $7."
LOG_ERR="$1.SNP_Pipeline.error.log"
LOG_OUT="$1.SNP_Pipeline.output.log"
if [ -f $LOG_ERR ]; then
rm $LOG_ERR
fi
if [ -f $LOG_OUT ]; then
rm $LOG_OUT
fi
touch $LOG_ERR
touch $LOG_OUT
# Run prepare references step of pipeline
if [[ $2 -eq 1 ]]; then
echo "python -u RUN1_PrepareReferences.py $1"
# python RUN1_PrepareReferences.py $1
(time python -u RUN1_PrepareReferences.py $1 | tee -a $LOG_OUT) 3>&1 1>&2 2>&3 | tee -a $LOG_ERR
fi
# Run filter step of pipeline
if [[ $3 -eq 1 ]]; then
echo "python -u RUN2_Filter_Trimmomatic.py $1"
# python RUN2_Filter_Trimmomatic.py $1 > >(tee $LOG_OUT) 2> >(tee $LOG_ERR >&2)
(time python -u RUN2_Filter_Trimmomatic.py $1 | tee -a $LOG_OUT) 3>&1 1>&2 2>&3 | tee -a $LOG_ERR
fi
# Run Alignment to Genome step of pipeline.
if [[ $4 -eq 1 ]]; then
echo "python -u RUN3_AlignToReference.py $1"
# python RUN3_AlignToReference.py $1 > >(tee $LOG_OUT) 2> >(tee $LOG_ERR >&2)
(time python -u RUN3_AlignToReference.py $1 | tee -a $LOG_OUT) 3>&1 1>&2 2>&3 | tee -a $LOG_ERR
fi
# Run Preparing BAM files with PicardTools step of pipeline.
if [[ $5 -eq 1 ]]; then
echo "python -u RUN4_PrepBAM.py $1"
# python RUN4_PrepBAM.py $1 > >(tee $LOG_OUT) 2> >(tee $LOG_ERR >&2)
(time python -u RUN4_PrepBAM.py $1 | tee -a $LOG_OUT) 3>&1 1>&2 2>&3 | tee -a $LOG_ERR
fi
# Run GATK2 on prepared BAM files.
if [[ $6 -eq 1 ]]; then
echo "python -u RUN5_GATK2.py $1"
# python RUN5_GATK2.py $1 > >(tee $LOG_OUT) 2> >(tee $LOG_ERR >&2)
(time python -u RUN5_GATK2.py $1 | tee -a $LOG_OUT) 3>&1 1>&2 2>&3 | tee -a $LOG_ERR
fi
# RUN Variant Effect Predictor on GATK2 BAM files.
if [[ $7 -eq 1 ]]; then
echo "python -u RUN6_VEP.py $1"
# python RUN6_VEP.py $1 > >(tee $LOG_OUT) 2> >(tee $LOG_ERR >&2)
(time python -u RUN6_VEP.py $1 | tee -a $LOG_OUT) 3>&1 1>&2 2>&3 | tee -a $LOG_ERR
fi
if [[ -n $8 ]]; then
echo "SNP_Pipeline.sh done. Check the output and error logs for more information." | mailx -s "SNP Pipeline Done." $8
fi
echo "All steps finished running. Check $LOG_ERR and $LOG_OUT for errors and output log respectively."
echo "These many seconds since the entire script started: $SECONDS. Compare it to time if you launch time $0"