-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparallel_prune.sh
executable file
·38 lines (33 loc) · 1.2 KB
/
parallel_prune.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
#!/bin/bash
# Split a PLINK file by chromosome chunks and send 23 jobs (23 chromosomes) and then recombine results
# Syntax: bash parallel_prune.sh <PLINK_filename> <output_filename>
# Example: bash parallel_prune.sh 06_duplicated_snps_rm 09_pruned 0.1
# suggested r^2 be 0.1
PLINK_filename=$1
output_filename=$2
r2=$3
export PATH=$PATH:/home/Bowei/ADHD_clinical #Need to change this to the local path the main QC script is running
# Split files into 23 chunks
for i in {1..23}
do
nohup plink --noweb --bfile ${PLINK_filename} --chr ${i} --make-bed --out ${PLINK_filename}_chr${i} &
done
for i in {1..23}
do
waiton $(findpid "${PLINK_filename} --chr ${i} --make-bed")
done
# Send the pruning jobs
let i=1 a=23
while [ $i -le $a ]
do
nohup plink --noweb --bfile ${PLINK_filename}_chr${i} --indep-pairwise 1500 100 ${r2} --out ${output_filename}_chr${i} &
let i=$i+1
done
for i in {1..23}
do
waiton $(findpid "${PLINK_filename}_chr${i} --indep-pairwise")
done
cat ${output_filename}_chr*prune.in > ${output_filename}.prune.in
plink --noweb --bfile ${PLINK_filename} --extract ${output_filename}.prune.in --make-bed --out ${output_filename}
rm ${PLINK_filename}_chr*
rm ${output_filename}_chr*