-
Notifications
You must be signed in to change notification settings - Fork 24
/
GATK_05_FilterSNP.sh
executable file
·51 lines (41 loc) · 1.82 KB
/
GATK_05_FilterSNP.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
#!/bin/bash
#This script is expecting you to have all of your vcf files and vcf.idx files placed in a subfolder from where you ran GATK. This way the files that are generated are placed in your GATK folder.
#Also update the GATK location, Raw file and the reference for your run
module load GIF/perl/5.24.1
module load vcftools
module load GIF2/gatk
vcffile=(*.vcf)
#this is just naming the vcf file that will be generated belwo.
RAW="WhiteWildCultured.vcf"
REFERENCE="/work/GIF/remkv6/Purcell/Abalone/15_WhiteWildCultured/H.rufescens.fasta"
#MAXDEPTH=19950
GATK="/shared/software/GIF/programs/gatk/3.5"
vcf-concat ${vcffile[@]} >> ../${RAW}
MAXDEPTH=$(grep -oh ";DP=.*;" ${RAW} | cut -d ";" -f 2 | cut -d "=" -f 2 | st --sd |awk '{print $0*5}')
cat ../${RAW} | vcf-sort -t $TMPDIR -p 16 -c > ${RAW%.*}_sorted.vcf
java -Xmx120g -Djava.io.tmpdir=$TMPDIR -jar ${GATK}/GenomeAnalysisTK.jar \
-T SelectVariants \
-R ${REFERENCE} \
-V ${RAW%.*}_sorted.vcf \
-selectType SNP \
-o ${RAW%.*}_sorted_SNPs.vcf
java -Xmx120g -Djava.io.tmpdir=$TMPDIR -jar ${GATK}/GenomeAnalysisTK.jar \
-T VariantFiltration \
-R ${REFERENCE} \
-V ${RAW%.*}_sorted_SNPs.vcf \
--filterExpression "QD < 2.0 || FS > 60.0 || MQ < 40.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0 || DP > ${MAXDEPTH}" \
--filterName "FAIL" \
-o ${RAW%.*}_sorted_filtered_SNPs.vcf
java -Xmx120g -Djava.io.tmpdir=$TMPDIR -jar ${GATK}/GenomeAnalysisTK.jar \
-T SelectVariants \
-R ${REFERENCE} \
-V ${RAW%.*}_sorted.vcf \
-selectType INDEL \
-o ${RAW%.*}_sorted_indels.vcf
java -Xmx120g -Djava.io.tmpdir=$TMPDIR -jar ${GATK}/GenomeAnalysisTK.jar \
-T VariantFiltration \
-R ${REFERENCE} \
-V ${RAW%.*}_sorted_indels.vcf \
--filterExpression "QD < 2.0 || FS > 200.0 || ReadPosRankSum < -20.0" \
--filterName "FAIL" \
-o ${RAW%.*}_sorted_filtered_indels.vcf