-
Notifications
You must be signed in to change notification settings - Fork 1
/
normalize_vcf_consortium.sh
executable file
·58 lines (48 loc) · 1.52 KB
/
normalize_vcf_consortium.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
#!/bin/bash
DIR="../Data/Original/consortium/Main_GENIE_cBioPortal_Releases/16.2-consortium"
ENV="genie"
__conda_setup="$('$HOME/miniforge3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$HOME/miniforge3/etc/profile.d/conda.sh" ]; then
. "$HOME/miniforge3/etc/profile.d/conda.sh"
else
export PATH="$HOME/miniforge3/bin:$PATH"
fi
fi
unset __conda_setup
if [ -f "$HOME/miniforge3/etc/profile.d/mamba.sh" ]; then
. "$HOME/miniforge3/etc/profile.d/mamba.sh"
else
echo "Please install mamba first."
echo "See https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html"
exit 1
fi
if ! mamba env list | grep -qe "^$ENV "; then
echo "The environment '$ENV' does not exists"
echo "Please create this environment!"
exit 1
fi
mamba activate $ENV
if ! type bcftools >/dev/null 2>&1; then
echo "Please install bcftools in first."
echo "mamba activate nirvana"
echo "mamba install bcftools"
exit 1
fi
FA=$HOME/gencode/GRCh37.primary_assembly.genome.fa.bgz
if ! test -f $FA; then
echo "'$FA' is missing, please dowload and install!"
exit 1
fi
FAI=$HOME/gencode/GRCh37.primary_assembly.genome.fa.bgz.fai
if ! test -f $FAI; then
echo "'$FAI' is missing, please create the FASTA index!"
exit 1
fi
cd $DIR
zcat genie.vcf.gz | bgzip > tmp.vcf.bgz
bcftools reheader --fai $FAI tmp.vcf.bgz -o tmp2.vcf.bgz
bcftools norm -f $FA -c w -o genie_normalized.vcf.bgz -Oz tmp2.vcf.bgz
rm tmp.vcf.bgz tmp2.vcf.bgz