· 8 years ago · Mar 04, 2018, 06:59 AM
11. Get a copy of PubChem
2
3$ mkdir pubchem
4$ cd pubchem
5$ wget -r ftp://ftp.ncbi.nlm.nih.gov/pubchem/Compound/CURRENT-Full/XML/ -c
6$ ln -s ftp.ncbi.nlm.nih.gov/pubchem/Compound/CURRENT-Full/XML XML
7
82. Set up MySQL
9
10CREATE TABLE IF NOT EXISTS `compounds` (
11 `InChI` varchar(4096) NOT NULL,
12 `CID` int(11) NOT NULL,
13 `OrganicSubset` tinyint(1) NOT NULL,
14 PRIMARY KEY (`CID`),
15 KEY `InChI` (`InChI`(1000))
16) ENGINE=MyISAM DEFAULT CHARSET=latin1;
17
183. Set up Groovy, CDK and MySQL
19
20$ sudo aptitude install groovy
21$ export CLASSPATH=cdk-1.2.1.jar:mysql.jar
22
23and populate the database with structures:
24
25$ groovy populate.groovy
26
27You may want to tune the file matching algorithm to populate with the first 1M or 10M, by tuning the regular expression do filter all files in the XML folder:
28
29dir = new File("XML")
30def p = ~/Compound_0.*gz/
31
32For the first 10M structures or ~/Compound_00.*gz/ for the first million, instead of ~/Compound.*gz/ for all SD files.
33
344. Atom Type perception
35
36Extra MySQL table:
37
38CREATE TABLE IF NOT EXISTS `atomtypeproblem` (
39 `atom` int(11) NOT NULL,
40 `element` varchar(2) NOT NULL,
41 `cid` int(11) NOT NULL,
42 KEY `cid` (`cid`)
43) ENGINE=MyISAM DEFAULT CHARSET=latin1;
44
45Run the analysis:
46
47$ groovy atomtyping.groovy
48
49Again, you may want to tune the file name pattern to match only the first 10M or so.