/dd/ -> 0_0021_inc.php
1 <?php
2
3 // 0_0021_inc.php - defines antibody related tables
4 // 0_0021_inc.php - author: Nico Stuurman <nicost@sourceforge.net>
5
6 /***************************************************************************
7 * Copyright (c) 2001 by Nico Stuurman *
8 * ------------------------------------------------------------------------ *
9 * Creates tables antibodies,ab_type1-5, and inserts initial values *
10 * *
11 * *
12 * *
13 * This program is free software; you can redistribute it and/or modify it *
14 * under the terms of the GNU General Public License as published by the *
15 * Free Software Foundation; either version 2 of the License, or (at your *
16 * option) any later version. *
17 \**************************************************************************/
18
19
20 $query="CREATE TABLE antibodies (
21 id int PRIMARY KEY,
22 access char(9),
23 ownerid int,
24 magic int,
25 name text,
26 type1 int,
27 type2 int,
28 type3 int,
29 type4 int,
30 type5 int,
31 antigen text,
32 epitope text,
33 concentration float,
34 buffer text,
35 notes text,
36 location text,
37 source text,
38 date int)";
39 if (!$db->Execute($query)) $test=false;
40 $db->Execute("CREATE INDEX antibodies_id_index ON antibodies (id)");
41 $db->Execute("CREATE INDEX antibodies_ownerid_index ON antibodies (ownerid)");
42 $db->Execute("CREATE INDEX antibodies_date_index ON antibodies (date)");
43 $db->Execute("CREATE INDEX antibodies_magic_index ON antibodies (magic)");
44 $db->Execute("CREATE INDEX antibodies_name_index ON antibodies (name)");
45 $db->Execute("CREATE INDEX antibodies_name_index ON antibodies (name(10))");
46 $query="CREATE TABLE ab_type1
47 (id int PRIMARY KEY,
48 sortkey int,
49 type text,
50 typeshort text)";
51 if (!$db->Execute($query)) $test=false;
52 $query="INSERT INTO ab_type1 VALUES (1,10,'Primary','1')";
53 if (!$db->Execute($query)) $test=false;
54 $query="INSERT INTO ab_type1 VALUES (2,20,'Secondary','2')";
55 if (!$db->Execute($query)) $test=false;
56 $query="INSERT INTO ab_type1 VALUES (3,30,'other','-')";
57 if (!$db->Execute($query)) $test=false;
58 $query="CREATE TABLE ab_type2
59 (id int PRIMARY KEY,
60 sortkey int,
61 type text,
62 typeshort text)";
63 if (!$db->Execute($query)) $test=false;
64 $query="INSERT INTO ab_type2 VALUES (1,10,'monoclonal','mono')";
65 if (!$db->Execute($query)) $test=false;
66 $query="INSERT INTO ab_type2 VALUES (2,20,'polyclonal','poly')";
67 if (!$db->Execute($query)) $test=false;
68 $query="CREATE TABLE ab_type3
69 (id int PRIMARY KEY,
70 sortkey int,
71 type text,
72 typeshort text)";
73 if (!$db->Execute($query)) $test=false;
74 $db->Execute("CREATE INDEX ab_type3_id_index ON ab_type3 (id)");
75 $db->Execute("CREATE INDEX ab_type3_sortkey_index ON ab_type3 (sortkey)");
76 $query="INSERT INTO ab_type3 VALUES (1,1010,'unknown','?')";
77 if (!$db->Execute($query)) $test=false;
78 $query="INSERT INTO ab_type3 VALUES (2,50,'human','human')";
79 if (!$db->Execute($query)) $test=false;
80 $query="INSERT INTO ab_type3 VALUES (3,20,'mouse','mouse')";
81 if (!$db->Execute($query)) $test=false;
82 $query="INSERT INTO ab_type3 VALUES (4,10,'rabbit','rabbit')";
83 if (!$db->Execute($query)) $test=false;
84 $query="INSERT INTO ab_type3 VALUES (5,30,'rat','rat')";
85 if (!$db->Execute($query)) $test=false;
86 $query="INSERT INTO ab_type3 VALUES (6,40,'goat','goat')";
87 if (!$db->Execute($query)) $test=false;
88 $query="INSERT INTO ab_type3 VALUES (7,1000,'other','other')";
89 if (!$db->Execute($query)) $test=false;
90 $query="CREATE TABLE ab_type4
91 (id int PRIMARY KEY,
92 sortkey int,
93 type text,
94 typeshort text)";
95 if (!$db->Execute($query)) $test=false;
96 $db->Execute("CREATE INDEX ab_type4_id_index ON ab_type4 (id)");
97 $db->Execute("CREATE INDEX ab_type4_sortkey_index ON ab_type4 (sortkey)");
98 $query="INSERT INTO ab_type4 VALUES (1,100,'IgG','IgG')";
99 if (!$db->Execute($query)) $test=false;
100 $query="INSERT INTO ab_type4 VALUES (2,200,'IgM','IgM')";
101 if (!$db->Execute($query)) $test=false;
102 $query="INSERT INTO ab_type4 VALUES (3,300,'IgG1','IgG1')";
103 if (!$db->Execute($query)) $test=false;
104 $query="INSERT INTO ab_type4 VALUES (4,400,'IgG2a','IgG2a')";
105 if (!$db->Execute($query)) $test=false;
106 $query="INSERT INTO ab_type4 VALUES (5,500,'IgG2b','IgG2b')";
107 if (!$db->Execute($query)) $test=false;
108 $query="INSERT INTO ab_type4 VALUES (6,600,'IgE','IgE')";
109 if (!$db->Execute($query)) $test=false;
110 $query="INSERT INTO ab_type4 VALUES (7,20,'mix','mix')";
111 if (!$db->Execute($query)) $test=false;
112 $query="INSERT INTO ab_type4 VALUES (8,10,'unknown','?')";
113 if (!$db->Execute($query)) $test=false;
114 $query="CREATE TABLE ab_type5
115 (id int PRIMARY KEY,
116 sortkey int,
117 type text,
118 typeshort text)";
119 if (!$db->Execute($query)) $test=false;
120 $db->Execute("CREATE INDEX ab_type5_id_index ON ab_type5 (id)");
121 $db->Execute("CREATE INDEX ab_type5_sortkey_index ON ab_type5 (sortkey)");
122 $query="INSERT INTO ab_type5 VALUES (1,100,'Alkaline Phosph.','AP')";
123 if (!$db->Execute($query)) $test=false;
124 $query="INSERT INTO ab_type5 VALUES (2,200,'Horseradish Perox.','HP')";
125 if (!$db->Execute($query)) $test=false;
126 $query="INSERT INTO ab_type5 VALUES (3,300,'FITC','FITC')";
127 if (!$db->Execute($query)) $test=false;
128 $query="INSERT INTO ab_type5 VALUES (4,400,'Rhodamine','Rhod.')";
129 if (!$db->Execute($query)) $test=false;
130 $query="INSERT INTO ab_type5 VALUES (5,500,'Cy3','Cy3')";
131 if (!$db->Execute($query)) $test=false;
132 $query="INSERT INTO ab_type5 VALUES (6,600,'Cy5','Cy5')";
133 if (!$db->Execute($query)) $test=false;
134 $query="INSERT INTO ab_type5 VALUES (7,700,'Alexa-488','Alex488')";
135 if (!$db->Execute($query)) $test=false;
136 $query="INSERT INTO ab_type5 VALUES (8,2000,'Beads','Beads')";
137 if (!$db->Execute($query)) $test=false;
138 $query="INSERT INTO ab_type5 VALUES (9,0,'None','None')";
139 if (!$db->Execute($query)) $test=false;
140
141 $tablesid=$db->GenID("tableoftables_id_seq");
142 $query="INSERT INTO tableoftables VALUES ($tablesid,100,'antibodies','ab')";
143 if (!$db->Execute($query)) $test=false;
144
145 ?>