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