ML.Descriptors.Descriptors

Package ML :: Package Descriptors :: Module Descriptors |
[hide private]
[frames] | no frames]

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