-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_filtermutectcalls.sh
60 lines (45 loc) · 1.71 KB
/
run_filtermutectcalls.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
#!/bin/bash
#SBATCH -c 4
#SBATCH -t 0-12:00
#SBATCH -p short
#SBATCH --mem 12000
#SBATCH -o run_filtermutectcalls.out
#SBATCH [email protected] # Email to which notifications will be sent
#SBATCH --mail-type=ALL
## load modules for bwa/gatk
module load gcc/6.2.0 gatk/4.1.9.0 bcftools/1.13
reference="/n/data1/hms/genetics/naxerova/lab/alex/reference_data/assemblies/Homo_sapiens_assembly19/Homo_sapiens_assembly19.fasta"
tmp_dir="/n/scratch/users/s/sed362"
## input files
unfiltered_vcf="mutect2/SD8_mutect2.vcf"
f1r2_file="mutect2/SD8_mutect2_f1r2.tar.gz"
## output files
artifact_prior_tables="mutect2/SD8_artifact-prior.tar.gz"
filtered_vcf="mutect2/SD8_filtered.vcf.gz"
passed_vcf="mutect2/SD8_filtered_passed.vcf.gz"
## learn read orientation bias
if test -f $artifact_prior_tables; then
echo "${artifact_prior_tables} already exists!"
else
echo "Running LearnReadOrientationModel."
gatk LearnReadOrientationModel --input $f1r2_file --output $artifact_prior_tables
fi
## filter mutect calls
if test -f $filtered_vcf; then
echo "${filtered_vcf} already exists!"
else
echo "Running FilterMutectCalls."
gatk FilterMutectCalls -R $reference -V $unfiltered_vcf --orientation-bias-artifact-priors $artifact_prior_tables -O $filtered_vcf
echo "Running IndexFeatureFile."
gatk IndexFeatureFile -I $filtered_vcf --tmp-dir $tmp_dir
fi
## subsetting passed mutect calls
if test -f $passed_vcf; then
echo "${passed_vcf} already exists!"
else
echo "Subsetting for PASS mutations."
bcftools view -i"FILTER='PASS'" $filtered_vcf | bcftools view -I -O z -o $passed_vcf -
echo "Running IndexFeatureFile."
gatk IndexFeatureFile -I $passed_vcf --tmp-dir $tmp_dir
fi
~