ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/tags/aglappe-0.9.3/createGraphDb.sh
Revision: 555
Committed: Thu Feb 28 14:29:15 2008 UTC (11 years, 6 months ago) by duarte
File size: 3310 byte(s)
Log Message:
Tagging 0.9.3 for CMView release 0.9.3
Line File contents
1 #!/bin/sh
2 function usage {
3 echo
4 echo "Script to create/link/index a graph database. "
5 echo
6 echo "Usage: $1 -d <db_name> -m <mode>"
7 echo
8 echo "-d <db_name> the graph database name "
9 echo "-m <mode> create/index/unindex tables "
10 echo
11 }
12
13 #
14 #Set default value for variables
15 #
16 graphDb=""
17 mode=""
18 h="white"
19
20 while getopts d:m: opt
21 do
22 case "$opt" in
23 d) graphDb="$OPTARG";;
24 m) mode="$OPTARG";;
25 esac
26 done
27
28 if [ -z "$graphDb" ] || [ -z "$mode" ]
29 then
30 echo "Missing or more arguments"
31 usage $0
32 exit 1
33 fi
34
35 arch=`uname -m`
36 case "$arch" in
37 i686)
38 mysqldir=/project/tla/dist/mysql-i686
39 ;;
40 x86_64)
41 mysqldir=/project/tla/dist/mysql
42 ;;
43 *)
44 mysqldir=/project/tla/dist/mysql-i686
45 ;;
46 esac
47
48 mysqlbin=$mysqldir/bin/mysql
49 master=white
50 db=test
51
52 if [ "$mode" == "CREATE" ]
53 then
54 $mysqlbin -pnieve -h $h -B -N $db <<ENDSQL
55 SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
56 CREATE DATABASE IF NOT EXISTS ${graphDb}
57 DEFAULT CHARACTER SET latin1 DEFAULT COLLATE latin1_general_cs;
58 ENDSQL
59 $mysqlbin -pnieve -h $h -B -N $graphDb <<ENDSQL1
60 SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
61 CREATE TABLE chain_graph LIKE abstract.chain_graph;
62 CREATE TABLE scop_graph LIKE abstract.scop_graph;
63 CREATE TABLE single_model_graph LIKE abstract.single_model_graph;
64 CREATE TABLE single_model_node LIKE abstract.single_model_node;
65 CREATE TABLE single_model_edge LIKE abstract.single_model_edge;
66 CREATE TABLE pdb_residue_info LIKE abstract.pdb_residue_info;
67
68 ALTER TABLE chain_graph
69 MODIFY graph_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
70 MODIFY pchain_code VARCHAR(2) NOT NULL,
71 MODIFY scops INT,
72 MODIFY caths INT,
73 MODIFY entry_id INT,
74 MODIFY assembly_id INT,
75 MODIFY chain_id INT,
76 MODIFY model_id INT;
77
78 ALTER TABLE scop_graph
79 MODIFY graph_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
80 MODIFY pchain_code VARCHAR(2) NOT NULL,
81 MODIFY sunid INT UNSIGNED,
82 MODIFY sccs VARCHAR(10),
83 MODIFY domain_type ENUM('UNKNOWN', 'WHOLECHAIN', 'SINGLEFRAGMENT', 'MULTIFRAGMENT', 'MULTICHAIN'),
84 MODIFY num_chain INT,
85 MODIFY num_fragment INT,
86 MODIFY caths INT,
87 MODIFY num_chain_res INT,
88 MODIFY chain_scops INT,
89 MODIFY entry_id INT,
90 MODIFY assembly_id INT,
91 MODIFY chain_id VARCHAR(35),
92 MODIFY model_id INT;
93
94 ALTER TABLE single_model_graph
95 MODIFY graph_id INT UNSIGNED NOT NULL AUTO_INCREMENT;
96
97 ALTER TABLE single_model_node
98 MODIFY num INT NOT NULL,
99 MODIFY ssid VARCHAR(5),
100 MODIFY sheet_serial CHAR(1);
101
102 ALTER TABLE single_model_edge
103 MODIFY i_num INT NOT NULL,
104 MODIFY i_ssid VARCHAR(5),
105 MODIFY i_sheet_serial CHAR(1),
106 MODIFY j_num INT NOT NULL,
107 MODIFY j_ssid VARCHAR(5),
108 MODIFY j_sheet_serial CHAR(1);
109 ENDSQL1
110 fi
111
112 if [ "$mode" == "INDEX" ]
113 then
114 $mysqlbin -pnieve -h $h -B -N $graphDb <<ENDSQL
115 SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
116 CREATE INDEX NODE_GRAPH_IDX ON single_model_node (graph_id);
117 CREATE INDEX EDGE_GRAPH_IDX ON single_model_edge (graph_id);
118 CREATE INDEX CHAIN_IDX ON pdb_residue_info (pdb_code, chain_code, pdb_chain_code);
119 ENDSQL
120 fi
121
122 if [ "$mode" == "UNINDEX" ]
123 then
124 $mysqlbin -pnieve -h $h -B -N $graphDb <<ENDSQL
125 SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
126 DROP INDEX NODE_GRAPH_IDX ON single_model_node;
127 DROP INDEX EDGE_GRAPH_IDX ON single_model_edge;
128 ENDSQL
129 fi

Properties

Name Value
svn:executable *