-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathget_weight.qsub
executable file
·38 lines (34 loc) · 1.22 KB
/
get_weight.qsub
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
#$ -S /bin/bash
#$ -N FUSION
#$ -V
#$ -cwd
#$ -o weight.o
#$ -e weight.e
#$ -q all.q
#$ -t 1-60
export b=/genetics/bin
export f=$b/FUSION.compute_weights.R
export p=$b/plink-1.9
export d=/scratch/tempjhz22/FUSION/data
export o=/scratch/tempjhz22/FUSION
function get_weight_in_parallel ()
{
parallel -j1 --env b --env o --env d --env f --env p -C' ' '
echo {1} {2} {3}; \
cd $o/EWAS-fusion; \
if [ ! -d "{1}" ]; then mkdir {1}; fi; \
cd {1}; \
$p --make-bed --missing-phenotype -999 --pheno $d/FUSION.pheno --covar $d/FUSION.covar --allow-no-sex --bfile $o/1KG/{1}/{1} --maf 0.01 --pheno-name {1} --out t{1}; \
$f --bfile=t{1} --tmp=t{1}_t --covar=t{1}.cov --PATH_gcta=$b/gcta_nr_robust --PATH_plink=$b/plink-1.9 --PATH_gemma=$b/gemma_1_thread \
--crossval=5 --models=top1,blup,lasso,enet,bslmm --save_hsq --out={1};\
/bin/rm -f t{1}*'
}
export chr=$1
if [ ! -z "$chr" ]
then
export sl=$(($(awk '$2==chr' chr=$chr $d/CpG.txt | wc -l)/60+1))
awk '$2==chr' chr=$chr $d/CpG.txt | awk 'NR==(v-1)*sl+1, NR==v*sl' v=$SGE_TASK_ID sl=$sl | get_weight_in_parallel
else
export sl=$(($(wc -l $d/CpG.txt | cut -d' ' -f1)/60+1))
awk 'NR==(v-1)*sl+1, NR==v*sl' v=$SGE_TASK_ID sl=$sl $d/CpG.txt | get_weight_in_parallel
fi