-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_sim_zfqtl.sh
executable file
·51 lines (35 loc) · 987 Bytes
/
run_sim_zfqtl.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
#!/bin/bash -l
if [ $# -lt 4 ]; then
cat << EOF
plink=\$1 # e.g., plink=scratch/simulation/data/10287/1/0.15/3/20/1001-temp
yfile=\$2 # e.g., yfile=scratch/simulation/data/10287/1/0.15/3/20/1001-temp.y.txt.gz
output_snp=\$3
output_tis=\$4
tempdir=\$5 # e.g., tempdir=temp
EOF
exit 1
fi
plink=$1
yfile=$2
output_snp=$3
output_tis=$4
tempdir=$5
cat << EOF
plink=$1
yfile=$2
output_snp=$3
output_tis=$4
tempdir=$5
EOF
if [ -z $tempdir ]; then
outdir=$(dirname $output_tis)
[ -d $outdir ] || mkdir -p $outdir
tempdir=$(mktemp -d "$outdir/temp.XXXXXX")
fi
[ -d $tempdir ] || mkdir -p $tempdir
# 1. caculate summary statistics
Rscript --vanilla run.matrix.qtl.R $yfile $plink $tempdir/me.txt || exit 1
printf "[%s] Generated: $tempdir/me.txt\n\n\n" "$(date)"
# 2. run z-FQTL
Rscript --vanilla run.sim.zfqtl.R $plink $tempdir/me.txt $output_snp $output_tis || exit 1
printf "[%s] Finished: $0 --> %s and %s\n\n" "$(date)" $output_tis $output_snp