ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/tags/aglappe-0.9.6/doClassifySingleModels.sh
Revision: 576
Committed: Tue Apr 1 15:56:06 2008 UTC (11 years, 8 months ago) by filippis
Original Path: trunk/doClassifySingleModels.sh
File size: 2554 byte(s)
Log Message:
RIGraph:Now you can store unweighted graphs in db and also select the db that contains the ids for the single models.
-paramater weighted added to write_graph_to_db and write_graph_to_db_fast methods. If true, it works as before (atomWeight is written to db field weight) else the db field weight gets always value 1. Methods without this parameter still exist and work as before.
-protected field singleModelsDb and corresponding methods getSingleModelsDb and setSingleModelsDb have been added. All constructors set the singleModelsDb field to DEFAULT_SINGLEMODELS_DB which equals to "ioannis". Changes have been also made to write_graph_to_db and write_graph_to_db_fast methods to deal with the singleModelsDb field.

DbRIGraph, testDbRIGraph:Changes have been also made to address the reading of (un)weighted graphs from db.

doClassifySingleModels.sh has been added. You can create your own table with ids for the single models wherever you want.

createGraphDs.sh: mode to drop tables has been added.

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     ((i_cid!=j_cid)OR(abs(i_num-j_num)>=10)) "
73    
74     echo "Outputing the models..."
75     echo -n "" > $file
76     first=`seq 2 0.5 4`
77     fours=`seq 4.1 0.1 4.9`
78     last=`seq 5 0.5 20`
79     contactDistance=`echo "$first $fours $last"`
80    
81     for dist in $contactDistance
82     do
83     for ct in $contactType
84     do
85     for cr in $contactRange
86     do
87     for expBB in -1 0
88     do
89     #unweighted, undirected
90     echo -e "${dist}\t${expBB}\t1\t${ct}\t${cr}\t0" >> $file
91     #unweighted, directed
92     echo -e "${dist}\t${expBB}\t1\t${ct}\t${cr}\t1" >> $file
93     #weighted, undirected
94     echo -e "${dist}\t${expBB}\t${ct}\t${ct}\t${cr}\t0" >> $file
95     #weighted, directed
96     echo -e "${dist}\t${expBB}\t${ct}\t${ct}\t${cr}\t1" >> $file
97     done
98     done
99     done
100     done
101    
102     $mysqlbin -pnieve -h $h -B -N $db <<ENDSQL
103     SELECT 'Loading the data...';
104     SET sql_mode = "NO_UNSIGNED_SUBTRACTION,TRADITIONAL";
105     LOAD DATA LOCAL INFILE "$file" IGNORE INTO TABLE $table (dist, expBB, CW, CT, CR, d);
106     ENDSQL
107    
108     rm -f $file

Properties

Name Value
svn:executable *