forked from MRCIEU/godmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
04b-methylation_adjustment1.sh
executable file
·50 lines (42 loc) · 1.12 KB
/
04b-methylation_adjustment1.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
#!/bin/bash
set -e
source ./config
batch_number=${1}
exec &> >(tee ${section_04b_logfile}${batch_number})
print_version
if [ -n "${1}" ]
then
re='^[0-9]+$'
if ! [[ $batch_number =~ $re ]] ; then
echo "error: Batch variable is not a number"
exit 1
fi
i=${1}
echo "Running batch ${i} of ${meth_chunks}"
else
i="NA"
echo "Running entire set on a single node using ${nthreads} threads."
fi
if [ "${related}" = "no" ]
then
echo "You have specified that the data is not family data. Adjusting only for covariates..."
Rscript resources/methylation/adjust_covs.R \
${betas} \
${covariates_combined}.txt \
${methylation_adjusted} \
${nthreads} \
${meth_chunks} \
${i}
elif [ "${related}" = "yes" ]
then
# For family data adjust methylation data for relatedness (take residuals after fitting pedigree matrix, i.e. GRAMMAR method)
echo "You have specified that the data is family data. Adjusting for pedigree and covariates..."
Rscript resources/methylation/adjust_pedigree.R \
${betas} \
${grmfile_relateds} \
${covariates_combined}.txt \
${methylation_adjusted} \
${nthreads} \
${meth_chunks} \
${i}
fi