-
Notifications
You must be signed in to change notification settings - Fork 5
/
prepare_database
executable file
·77 lines (51 loc) · 1.75 KB
/
prepare_database
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
#!/bin/bash
#database=$1
#organism=$2
for i in "$@"
do
case $i in
-t=*|--gtype=*)
GTYPE="${i#*=}"
;;
-db=*|--database=*)
database="${i#*=}"
;;
-org=*|--organism=*)
organism="${i#*=}"
;;
-h*|--help)
echo -e "\n\nprepare_database USAGE: \n\n./prepare_database -db=[GO_all|GO_BP|GO_MF|GO_CC|KEGG|REACTOME|NCG] -org=[see,org_codes_help]\n\n==========\nOptions: ALL PARAMETERS MUST BE SPECIFIED\n==========\n\n[-db= | --database=]\tOptions:[GO_all|GO_BP|GO_MF|GO_CC|KEGG|REACTOME] \n\n[-org= | --organism=]\tOptions:[see,org_codes_help]\n\n";
exit 1;
;;
*)
# unknown option
;;
esac
done
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
DT=`/bin/date`;
if [ $# -eq 0 ]; then
echo -e "\n\nPlease use:\n\n./prepare_database -h \n\n(or)\n\n./prepare_database --help \n\n for help\n";
exit 1;
fi
if [ -z $database ]; then
echo "Error:Please specify one of these databses GO_all,GO_BP,GO_MF,GO_CC,KEGG,NCG,REACTOME";
exit 1;
fi
if [ -z $organism ]; then
echo "Error:Please specify organism --organism. For KEGG and Geneontology use 'org_codes_help' folder comes with GeneSCF; For REACTOME and NCG use 'Hs'.";
exit 1;
fi
if [ $database == "GO_all" ] || [ $database == "GO_CC" ] || [ $database == "GO_MF" ] || [ $database == "GO_BP" ]; then
database="GO";
fi
if [ $database == "KEGG" ] || [ $database == "GO" ] || [ $database == "REACTOME" ]; then
sh ${DIR}/class/lib/db/update_${database}.sh ${organism} $DIR;
exit 1;
fi
if [ $database == "NCG" ]; then
echo -e "\nError: Database $database not supported. Please check the user manual for supported databases.\n";
else
echo -e "\nError: Database $database not supported. Please check the user manual for supported databases.\n";
exit 1;
fi