1
2
3
4 """ Various bits and pieces for calculating descriptors
5
6 """
7 from __future__ import print_function
8 from rdkit.six.moves import cPickle
9
10
12 """ abstract base class for descriptor calculators
13
14 """
15
17 """ Constructor
18
19 """
20 self.simpleList = None
21 self.descriptorNames = None
22 self.compoundList = None
23
24
25
26
27
29 """ prints out a list of the descriptors
30
31 """
32 if self.simpleList is None:
33 raise NotImplementedError('Need to have a simpleList defined')
34 print('#---------')
35 print('Simple:')
36 for desc in self.simpleList:
37 print(desc)
38 if self.compoundList:
39 print('#---------')
40 print('Compound:')
41 for desc in self.compoundList:
42 print(desc)
43
45 """ returns a list of the names of the descriptors this calculator generates
46
47 """
48 raise NotImplementedError('abstract base class')
49
51 """ Writes this calculator off to a file so that it can be easily loaded later
52
53 **Arguments**
54
55 - fileName: the name of the file to be written
56
57 """
58 try:
59 f = open(fileName, 'wb+')
60 except Exception:
61 print('cannot open output file %s for writing' % (fileName))
62 return
63 cPickle.dump(self, f)
64 f.close()
65
67 raise NotImplementedError('abstract base class')
68