-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_loftk.sh
executable file
·143 lines (125 loc) · 6.24 KB
/
run_loftk.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#! /bin/bash
set -e
### Creating display functions
### Setting colouring
NONE='\033[00m'
OPAQUE='\033[2m'
FLASHING='\033[5m'
BOLD='\033[1m'
ITALIC='\033[3m'
UNDERLINE='\033[4m'
STRIKETHROUGH='\033[9m'
RED='\033[01;31m'
GREEN='\033[01;32m'
YELLOW='\033[01;33m'
PURPLE='\033[01;35m'
CYAN='\033[01;36m'
WHITE='\033[01;37m'
function echobold { #'echobold' is the function name
echo -e "${BOLD}${1}${NONE}" # this is whatever the function needs to execute, note ${1} is the text for echo
}
function echoitalic {
echo -e "${ITALIC}${1}${NONE}"
}
function echonooption {
echo -e "${OPAQUE}${RED}${1}${NONE}"
}
function echoerrorflash {
echo -e "${RED}${BOLD}${FLASHING}${1}${NONE}"
}
function echoerror {
echo -e "${RED}${1}${NONE}"
}
# errors no option
function echoerrornooption {
echo -e "${YELLOW}${1}${NONE}"
}
function echoerrorflashnooption {
echo -e "${YELLOW}${BOLD}${FLASHING}${1}${NONE}"
}
function importantnote {
echo -e "${CYAN}${1}${NONE}"
}
script_copyright_message() {
echo ""
THISYEAR=$(date +'%Y')
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ CC-BY-SA-4.0 License +"
echo "+ Copyright (c) 2021-${THISYEAR} Abdulrahman Alasiri +"
echo "+ +"
echo "+ Copyright (c) 2020 University Medical Center Utrecht +"
echo "+ +"
echo "+ Creative Commons Attribution Share Alike 4.0 International +"
echo "+ +"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
}
script_arguments_error() {
echoerror "$1" # Additional message
echoerror "- Argument #1 is path_to/filename of the configuration file."
echoerror ""
echoerror "An example command would be: run_loftk.sh [arg1]"
echoerror "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
script_copyright_message
exit 1
}
echobold "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echobold "+ LOFTK (Loss-of-Function ToolKit) +"
echobold "+ +"
echobold "+ +"
echobold "+ * Written by : Abdulrahman Alasiri +"
echobold "+ * E-mail : [email protected] +"
echobold "+ * Last update : 2022-01-31 +"
echobold "+ * Version : 1.0.3 +"
echobold "+ +"
echobold "+ * Description : This script will set some directories, and execute LoF analysis +"
echobold "+ according to your specifications and using your genotypes or sequencing data. +"
echobold "+ +"
echobold "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "Today's date and time: "$(date)
TODAY=$(date +"%Y%m%d")
echo ""
### START of if-else statement for the number of command-line arguments passed ###
if [[ $# -lt 1 ]]; then
echoerrorflash " *** Oh no! Computer says no! ***"
echo ""
script_arguments_error "You must supply at least [1] argument when running a LoF analysis!"
else
### LOADING CONFIGURATION FILE
# Loading the configuration file (please refer to the LoFToolKit-Manual for specifications of this file).
source "$1" # Depends on arg1.
### REQUIRED | GENERALS
CONFIGURATIONFILE="$1" # Depends on arg1 -- but also on where it resides!!!
### MAIL SETTINGS
#EMAIL=${YOUREMAIL}
#MAILTYPE=${MAILSETTINGS}
### PROJECT SPECIFIC
ANALYSISTYPE=${ANALYSIS}
ROOTDIR=${ROOTDIR} # the root directory, e.g. /hpc/dhl_ec/aalasiri/lof/Imputation/ukb_5K/Imputation
PROJECTNAME=${PROJECTNAME} # e.g. "ukb_5K"
LOFTK=${LOFTOOLKIT}
### Insert VEP and LOFTEE to LoF_annotation.sh
cp ${LOFTK}/src/LoF_annotation_raw.sh ${LOFTK}/LoF_annotation.sh
if [ ${ASSEMBLY} == "GRCh37" ]; then
sed -i -e "/#@#@VEPLOFTEEPONTER37/r ${LOFTK}/bin/VEP_LOFTEE_GRCh37.config" ${LOFTK}/LoF_annotation.sh
elif [ ${ASSEMBLY} == "GRCh38" ]; then
sed -i -e "/#@#@VEPLOFTEEPONTER38/r ${LOFTK}/bin/VEP_LOFTEE_GRCh38.config" ${LOFTK}/LoF_annotation.sh
fi
### START running LoFTK
if [[ ${DATA_TYPE} == "genotype" ]] && [[ ${FILE_FORMAT} == "IMPUTE2" ]]; then
echo "LoFTK will analyze the ${DATA_TYPE} data that exist in ${FILE_FORMAT} files."
${LOFTK}/allele_to_vcf.sh ${CONFIGURATIONFILE}
${LOFTK}/LoF_annotation.sh ${CONFIGURATIONFILE}
elif [[ ${DATA_TYPE} == "genotype" ]] && [[ ${FILE_FORMAT} == "VCF" ]]; then
echo "LoFTK will analyze the ${DATA_TYPE} data that exist in ${FILE_FORMAT} files."
${LOFTK}/LoF_annotation.sh ${CONFIGURATIONFILE}
elif [[ ${DATA_TYPE} == "exome" || ${DATA_TYPE} == "genome" ]] && [[ ${FILE_FORMAT} == "VCF" ]]; then
echo "LoFTK will analyze the ${DATA_TYPE} data that exist in ${FILE_FORMAT} files."
${LOFTK}/LoF_annotation.sh ${CONFIGURATIONFILE}
else
echo "We only perfomr analysis of genotyped data in IMPUTE2 and VCF input files, or sequencing [exome/genome] data in VCF only"
echo ""
echo "Please check DATA_TYPE and FILE_FORMAT in LoF.config file."
fi
fi
script_copyright_message