forked from nteran/metabolomeDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
20150810_meeting.sql
62 lines (48 loc) · 1.06 KB
/
20150810_meeting.sql
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
CREATE TABLE metabolites
(
metabolite_id int NOT NULL,
InCHI_identifier text,
InCHI_key varchar(255),
SMILES text,
monoisotopic_mass double,
sum_formula varchar(255),
PRIMARY KEY (metabolite_id)
);
CREATE TABLE hmdb
(
metabolite_id int,
hmdb_id varchar(255),
kingdom varchar(255),
super_class varchar(255),
class varchar(255),
subclass varchar(255)
);
CREATE TABLE substituents
(
metabolite_id int,
name varchar(255),
db_origin varchar(255)
);
CREATE TABLE biological_origin
(
metabolite_id int,
origin_name varchar(255),
db_origin varchar(255)
);
INSERT INTO metabolites
(metabolite_id, SMILES, monoisotopic_mass)
VALUES
(1, 'CH', 500),
(2, 'CHN', 700),
(3, 'CHO', 800),
(4, 'CHON', 900);
INSERT INTO hmdb
(metabolite_id, hmdb_id, kingdom)
VALUES
(1, 'HMDB4', 'alcohol'),
(2, 'HMDB9', 'cyclic hydrocarbon');
for tag in xml_file:
hmdb_identfier = extract_tag("hmdb", tag)
prepare_sql = "INSERT INTO metabolites (xx, yy, zz) VALUES (%s, %s, %s)" % (hmdb_identifier, kingdom ... )
send_query( prepare_sql )
send_query( prepared_query, [hmdb_identifier, kingdom] )