forked from jinghuazhao/SomaLogic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetal.sh
executable file
·62 lines (55 loc) · 1.68 KB
/
metal.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
59
60
61
62
# 25-3-2020 JHZ
export SomaLogic=/home/jhz22/SomaLogic
export sumstats=$SomaLogic/sumstats
export METAL=$SomaLogic/METAL
## generation of protein-specific METAL entries
if [ ! -d $METAL ]; then mkdir $METAL; fi
(
for study in FHS INTERVAL KORA Malmo QMDiab TwinsUK
do
ls $sumstats/$study | sed 's/'"$study".'//g' | awk -vstudy=$study '{
s=$1;gsub(/.gz|@/,"",s);
p=s;gsub(/\.txt/,"",p);
print p " " ENVIRON["sumstats"] "/" study "/" study "." s ".gz"
}'
done
) | \
awk '{print $0, NR}' > METAL/METAL.tmp
sort -k1,1 $METAL/METAL.tmp > $METAL/METAL.list
for p in $(cat doc/SomaLogic.list | tr '\n' ' ')
do
(
echo SEPARATOR TAB
echo COLUMNCOUNTING STRICT
echo CHROMOSOMELABEL CHR
echo POSITIONLABEL POS
echo CUSTOMVARIABLE N
echo LABEL N as N
echo TRACKPOSITIONS ON
echo AVERAGEFREQ ON
echo MINMAXFREQ ON
echo ADDFILTER CODE_ALL_FQ ">=" 0.001
echo ADDFILTER CODE_ALL_FQ "<=" 0.999
echo MARKERLABEL SNPID
echo ALLELELABELS EFFECT_ALLELE REFERENCE_ALLELE
echo EFFECTLABEL BETA
echo PVALUELABEL PVAL
echo WEIGHTLABEL N
echo FREQLABEL CODE_ALL_FQ
echo STDERRLABEL SE
echo SCHEME STDERR
echo GENOMICCONTROL OFF
echo LOGPVALUE ON
echo OUTFILE $HOME/SomaLogic/METAL/$p- .tbl
echo $p | \
join METAL/METAL.list - | \
sort -k3,3n | \
awk '{print "PROCESS", $2}'
echo ANALYZE HETEROGENEITY
echo CLEAR
) > METAL/$p.metal
done
## all in one directory to get ready for QCGWAS
if [ ! -d $sumstats/work ]; then mkdir $sumstats/work; fi
parallel --env sumstats -j10 -C' ' 'ln -vsf {} $sumstats/work/$(basename {})' ::: $(cut -d' ' -f2 $METAL/METAL.tmp)
sbatch metal.sb