1
2
3
4
5
6 import sys,os.path
7 from rdkit import RDConfig
8 from rdkit.VLib.Supply import SupplyNode
9 from rdkit import Chem
10 from rdkit.Chem.Suppliers import DbMolSupplier
11
13 """ Supplies molecules from a db result set:
14
15 Sample Usage:
16 >>> from rdkit.Dbase.DbConnection import DbConnect
17 >>> dbName = os.path.join(RDConfig.RDCodeDir,'Chem','Fingerprints',\
18 'test_data','data.gdb')
19 >>> conn = DbConnect(dbName,'simple_mols')
20 >>> dataset = conn.GetData()
21 >>> suppl = DbMolSupplyNode(dataset)
22 >>> ms = [x for x in suppl]
23 >>> len(ms)
24 12
25 >>> ms[0].GetProp("ID")
26 'ether-1'
27 >>> ms[10].GetProp("ID")
28 'acid-4'
29 >>> suppl.reset()
30 >>> suppl.next().GetProp("ID")
31 'ether-1'
32 >>> suppl.next().GetProp("ID")
33 'acid-1'
34 >>> suppl.reset()
35
36 """
37 - def __init__(self,dbResults,
38 **kwargs):
43
44
49 """
50
51 """
52 return self._supplier.next()
53
58
59
60
61
62
64 import doctest,sys
65 return doctest.testmod(sys.modules["__main__"])
66
67
68 if __name__ == '__main__':
69 import sys
70 failed,tried = _test()
71 sys.exit(failed)
72