forked from joyceyiyiwang/Portability_Questions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
09g_calc_heterozygosity.sh
43 lines (35 loc) · 1.09 KB
/
09g_calc_heterozygosity.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
#!/bin/bash
#SBATCH -J calc_heterozygosity
#SBATCH -o calc_heterozygosity.o%j
#SBATCH -e calc_heterozygosity.o%j
#SBATCH -p normal
#SBATCH -N 1
#SBATCH -n 4
#SBATCH -t 24:00:00
#SBATCH -A OTH21148
#SBATCH [email protected]
#SBATCH --mail-type=begin
#SBATCH --mail-type=end
set -e
source /work2/06568/joyce_w/stampede2/software/anaconda3/etc/profile.d/conda.sh
conda init bash
conda activate pgs
plink='/work2/06568/joyce_w/stampede2/software/plink/plink/plink'
plink2='/work2/06568/joyce_w/stampede2/software/plink/plink2/plink2'
# Directory
scratch='/scratch/06568/joyce_w/pgs_portability_questions/data'
# Prepare IDs in each bin
Rscript 09h_prepare_heterozygosity.R
# Calculate heterozygosity in each bin
for i in $(seq 1 500);
do
$plink \
--bfile ${scratch}/ukb_merged/ukb_merged \
--keep data/ukb_populations/bins/bin_${i}_id.txt \
--extract data/pgs/all_pgs_snps.txt \
--freqx \
--out data/heterozygosity/heterozygosity_bin_${i}
done
# Stratify the SNPs by effect sizes and calculate the mean heterozygosity
Rscript 09i_post_heterozygosity_calc.R
conda deactivate