-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyze.sh
executable file
·93 lines (76 loc) · 2.23 KB
/
analyze.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# UK Biobank GWAS
#
# Class: script
#
# Run KnockoffGWAS on a toy dataset
#
# Authors: Matteo Sesia
# Date: 04/24/2019
#########
# Setup #
#########
# Print header
printf "KnockoffGWAS (27 July 2021) \n"
printf "https://bitbucket.org/msesia/knockoffgwas \n"
printf "(C) 2020,2021 Matteo Sesia GNU General Public License v3 \n\n"
# Setup spinner for long jobs
source "misc/spinner.sh"
# Log file
LOG_FILE="knockoffgwas.log"
rm -f $LOG_FILE
touch $LOG_FILE
echo "Log file: "$LOG_FILE
# Enter the directory where the scripts are stored
cd knockoffgwas
######################
# Check dependencies #
######################
printf "\nSetup\n"
# System dependencies
ERROR=0
check_dependency () {
CMD=$1
if [ ! -x "$(command -v $CMD)" ]; then
echo -e "Error: command $CMD not available"
ERROR=1
fi
}
DEPENDENCY_LIST=("plink" "R" "../snpknock2/bin/snpknock2")
start_spinner " - Checking system dependencies..."
for DEPENDENCY in "${DEPENDENCY_LIST[@]}"; do
check_dependency $DEPENDENCY &>> "../"$LOG_FILE
done
stop_spinner $ERROR
# R libraries
start_spinner " - Checking R library dependencies..."
Rscript --vanilla "utils/check_packages.R" &>> "../"$LOG_FILE
stop_spinner $?
####################
# Run KnockoffGWAS #
####################
printf "\nData analysis\n"
# Module 1: partition the genome into LD blocks
start_spinner ' - Running module 1 (partitioning the genome)...'
./module_1_partition.sh &>> "../"$LOG_FILE
stop_spinner $?
# Module 2: generate the knockoffs
start_spinner ' - Running module 2 (generating knockoffs)...'
./module_2_knockoffs.sh &>> "../"$LOG_FILE
stop_spinner $?
# Module 2b: evaluate the goodness of fit of the knockoffs
start_spinner ' - Running module 2b (evaluating knockoffs quality)...'
./module_2b_knockoffs_gof.sh &>> "../"$LOG_FILE
stop_spinner $?
# Module 3: compute the test statistics
start_spinner ' - Running module 3 (computing test statistics)...'
./module_3_statistics.sh &>> "../"$LOG_FILE
stop_spinner $?
# Module 4: report significant findings
start_spinner ' - Running module 4 (applying the knockoff filter)...'
./module_4_discover.sh &>> "../"$LOG_FILE
stop_spinner $?
#####################
# Summarize results #
#####################
printf "\nResults written in 'results/'\n"