Package rdkit :: Package ML :: Package Descriptors :: Module Descriptors

[hide private]
[frames] | no frames]

# Source Code for Module rdkit.ML.Descriptors.Descriptors

     1  #
     2  #  Copyright (C) 2001,2002  greg Landrum and Rational Discovery LLC
     3  #
     4  """ Various bits and pieces for calculating descriptors
     5
     6  """
     7  from __future__ import print_function
     8  from rdkit import RDConfig
     9
    10 -class DescriptorCalculator:
    11    """ abstract base class for descriptor calculators
    12
    13    """
    14
    15    #------------
    16    #  methods used to calculate descriptors
    17    #------------
    18
    19 -  def ShowDescriptors(self):
    20      """ prints out a list of the descriptors
    21
    22      """
    23      print('#---------')
    24      print('Simple:')
    25      for desc in self.simpleList:
    26        print(desc)
    27      if self.compoundList:
    28        print('#---------')
    29        print('Compound:')
    30        for desc in self.compoundList:
    31          print(desc)
    32
    33 -  def GetDescriptorNames(self):
    34      """ returns a list of the names of the descriptors this calculator generates
    35
    36      """
    37      pass
    38
    39 -  def SaveState(self,fileName):
    40      """ Writes this calculator off to a file so that it can be easily loaded later
    41
    42       **Arguments**
    43
    44         - fileName: the name of the file to be written
    45
    46      """
    47      from rdkit.six.moves import cPickle
    48      try:
    49        f = open(fileName,'wb+')
    50      except:
    51        print('cannot open output file %s for writing'%(fileName))
    52        return
    53      cPickle.dump(self,f)
    54      f.close()
    55
    56 -  def CalcDescriptors(self,what,*args,**kwargs):
    57      pass
    58
    59 -  def __init__(self,*args,**kwargs):
    60      """ Constructor
    61
    62      """
    63      self.simpleList = None
    64      self.descriptorNames = None
    65      self.compoundList = None
    66