ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/tags/aglappe-0.9.6/doClassifySingleModels.sh
Revision: 693
Committed: Mon Jun 23 09:55:22 2008 UTC (11 years, 4 months ago) by stehr
Original Path: branches/aglappe-cmview-1.0.x/doClassifySingleModels.sh
File size: 2599 byte(s)
Log Message:
branching for CMView release 1.0 based on aglappe-0.9.5
Line User Rev File contents
1 filippis 576 #!/bin/sh
2     function usage {
3     echo
4     echo "Script to assign id to each possible single model type. "
5     echo
6     echo "Usage: $1 -d <db> "
7     echo "<db> the database where single model types will be stored"
8     echo
9     }
10    
11     #
12     #Set default value for variables
13     #
14     db=""
15     table="single_model"
16     file="single_model.txt"
17    
18     while getopts d: opt
19     do
20     case "$opt" in
21     d) db="$OPTARG";;
22     esac
23     done
24    
25     if [ -z "$db" ]
26     then
27     echo "Missing arguments"
28     usage $0
29     exit 1
30     fi
31    
32     arch=`uname -m`
33     case "$arch" in
34     i686)
35     mysqldir=/project/tla/dist/mysql-i686
36     ;;
37     x86_64)
38     mysqldir=/project/tla/dist/mysql
39     ;;
40     *)
41     mysqldir=/project/tla/dist/mysql-i686
42     ;;
43     esac
44    
45     mysqlbin=$mysqldir/bin/mysql
46     h=white
47    
48     $mysqlbin -pnieve -h $h -B -N $db <<ENDSQL
49     SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
50     SELECT 'Creating the single model table if not exists ...';
51     CREATE TABLE IF NOT EXISTS $table (
52     single_model_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
53     dist DECIMAL(4,2) NOT NULL,
54     expBB TINYINT NOT NULL,
55     CW VARCHAR(16) NOT NULL,
56     CT VARCHAR(16) NOT NULL,
57     CR VARCHAR(80) NOT NULL,
58     d TINYINT(1) NOT NULL,
59     UNIQUE INDEX DESCRIPTION_IDX (dist, expBB, CW, CT, CR, d)
60     ) ENGINE=MyISAM;
61     ENDSQL
62    
63     contactType="Ca Cb Ca/Cb Ca+Cb+Ca/Cb BB SC BB/SC BB+SC+BB/SC Ca+SC"
64    
65     #(true) : no filtering
66     #((i_cid!=j_cid)OR(abs(i_num-j_num)>=2)) : remove backbone connectivity
67     #((i_cid!=j_cid)OR(abs(i_num-j_num)>=4)) : remove short range edges
68     #((i_cid!=j_cid)OR(abs(i_num-j_num)>=10)) : remove short and medium range edges
69     contactRange="(true) \
70     ((i_cid!=j_cid)OR(abs(i_num-j_num)>=2)) \
71     ((i_cid!=j_cid)OR(abs(i_num-j_num)>=4)) \
72 filippis 580 ((i_cid!=j_cid)OR(abs(i_num-j_num)>=10)) \
73     ((i_sstype!=j_sstype)OR(i_ssid!=j_ssid))"
74 filippis 576
75     echo "Outputing the models..."
76     echo -n "" > $file
77     first=`seq 2 0.5 4`
78     fours=`seq 4.1 0.1 4.9`
79     last=`seq 5 0.5 20`
80     contactDistance=`echo "$first $fours $last"`
81    
82     for dist in $contactDistance
83     do
84     for ct in $contactType
85     do
86     for cr in $contactRange
87     do
88     for expBB in -1 0
89     do
90     #unweighted, undirected
91     echo -e "${dist}\t${expBB}\t1\t${ct}\t${cr}\t0" >> $file
92     #unweighted, directed
93     echo -e "${dist}\t${expBB}\t1\t${ct}\t${cr}\t1" >> $file
94     #weighted, undirected
95     echo -e "${dist}\t${expBB}\t${ct}\t${ct}\t${cr}\t0" >> $file
96     #weighted, directed
97     echo -e "${dist}\t${expBB}\t${ct}\t${ct}\t${cr}\t1" >> $file
98     done
99     done
100     done
101     done
102    
103     $mysqlbin -pnieve -h $h -B -N $db <<ENDSQL
104     SELECT 'Loading the data...';
105     SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
106     LOAD DATA LOCAL INFILE "$file" IGNORE INTO TABLE $table (dist, expBB, CW, CT, CR, d);
107     ENDSQL
108    
109     rm -f $file

Properties

Name Value
svn:executable *