-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselectSNP_gatk.sh
48 lines (39 loc) · 1.28 KB
/
selectSNP_gatk.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
#!/bin/bash
#PBS -lselect=1:ncpus=8:mem=16gb
#PBS -lwalltime=12:00:00
# load modules
module load gatk/3.6
module load java/jdk-8u66
# index array
i=$PBS_ARRAY_INDEX
# path to reference genome
ref=${ref}
# Expand a space-sperated parameter of file names into addressable array
vcflist=(${args})
# sample name
sample=$( basename ${vcflist[$i]} )
# output location
vcfout=${vcfout}
# Select SNPS only
java -jar -Djava.io.tmpdir=$EPHEMERAL $GATK_HOME/GenomeAnalysisTK.jar \
-T SelectVariants \
-R "${ref}" \
-V "${vcflist[$i]}" \
-o "${vcfout}/${sample%%.*}.raw.snps.vcf" \
-selectType SNP
# Annotate SNPs to ID allele balance
java -jar -Djava.io.tmpdir=$EPHEMERAL $GATK_HOME/GenomeAnalysisTK.jar \
-R "${ref}" \
-T VariantAnnotator \
-V "${vcfout}/${sample%%.*}.raw.snps.vcf" \
-o "${vcfout}/${sample%%.*}.annotated.snps.vcf" \
--annotation AlleleBalance
# Filter high confidence SNPs
# Filter on mapping quality (MQ), depth of coverage (DP), Fisher strand bias (FS) and the balance of alleles (ABHom)
java -jar -Djava.io.tmpdir=$EPHEMERAL $GATK_HOME/GenomeAnalysisTK.jar \
-T VariantFiltration \
-R "${ref}" \
-V "${vcfout}/${sample%%.*}.annotated.snps.vcf" \
-o "${vcfout}/${sample%%.*}.filtered.snps.vcf" \
--filterExpression "DP < 4 || MQ < 40.0 || QD < 2.0 || QUAL < 50" \
--filterName LowConf