Package cinfony :: Module pybel :: Class Molecule
[frames] | no frames]

Class Molecule

source code

object --+
         |
        Molecule

Represent a Pybel Molecule.

Required parameter:
   OBMol -- an Open Babel OBMol or any type of cinfony Molecule

Attributes:
   atoms, charge, conformers, data, dim, energy, exactmass, formula,
   molwt, spin, sssr, title, unitcell.
(refer to the Open Babel library documentation for more info).

Methods:
   addh(), calcfp(), calcdesc(), draw(), localopt(), make3D(), removeh(),
   write()

The underlying Open Babel molecule can be accessed using the attribute:
   OBMol

Instance Methods
 
__init__(self, OBMol)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__iter__(self)
Iterate over the Atoms of the Molecule.
source code
 
calcdesc(self, descnames=[])
Calculate descriptor values.
source code
 
calcfp(self, fptype='FP2')
Calculate a molecular fingerprint.
source code
 
write(self, format='smi', filename=None, overwrite=False, opt=None)
Write the molecule to a file or return a string.
source code
 
localopt(self, forcefield='mmff94', steps=500)
Locally optimize the coordinates.
source code
 
make3D(self, forcefield='mmff94', steps=50)
Generate 3D coordinates.
source code
 
addh(self)
Add hydrogens.
source code
 
removeh(self)
Remove hydrogens.
source code
 
__str__(self)
str(x)
source code
 
draw(self, show=True, filename=None, update=False, usecoords=False)
Create a 2D depiction of the molecule.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties
  atoms
  charge
  conformers
  data
  dim
  energy
  exactmass
  formula
  molwt
  spin
  sssr
  title
  unitcell

Inherited from object: __class__

Method Details

__init__(self, OBMol)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__iter__(self)

source code 
Iterate over the Atoms of the Molecule.

This allows constructions such as the following:
   for atom in mymol:
       print atom

calcdesc(self, descnames=[])

source code 
Calculate descriptor values.

Optional parameter:
   descnames -- a list of names of descriptors

If descnames is not specified, all available descriptors are
calculated. See the descs variable for a list of available
descriptors.

calcfp(self, fptype='FP2')

source code 
Calculate a molecular fingerprint.

Optional parameters:
   fptype -- the fingerprint type (default is "FP2"). See the
             fps variable for a list of of available fingerprint
             types.

write(self, format='smi', filename=None, overwrite=False, opt=None)

source code 
Write the molecule to a file or return a string.

Optional parameters:
   format -- see the informats variable for a list of available
             output formats (default is "smi")
   filename -- default is None
   overwite -- if the output file already exists, should it
               be overwritten? (default is False)
   opt -- a dictionary of format specific options
          For format options with no parameters, specify the
          value as None.

If a filename is specified, the result is written to a file.
Otherwise, a string is returned containing the result.

To write multiple molecules to the same file you should use
the Outputfile class.

localopt(self, forcefield='mmff94', steps=500)

source code 
Locally optimize the coordinates.

Optional parameters:
   forcefield -- default is "mmff94". See the forcefields variable
                 for a list of available forcefields.
   steps -- default is 500

If the molecule does not have any coordinates, make3D() is
called before the optimization. Note that the molecule needs
to have explicit hydrogens. If not, call addh().

make3D(self, forcefield='mmff94', steps=50)

source code 
Generate 3D coordinates.

Optional parameters:
   forcefield -- default is "mmff94". See the forcefields variable
                 for a list of available forcefields.
   steps -- default is 50

Once coordinates are generated, hydrogens are added and a quick
local optimization is carried out with 50 steps and the
MMFF94 forcefield. Call localopt() if you want
to improve the coordinates further.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

draw(self, show=True, filename=None, update=False, usecoords=False)

source code 
Create a 2D depiction of the molecule.

Optional parameters:
  show -- display on screen (default is True)
  filename -- write to file (default is None)
  update -- update the coordinates of the atoms to those
            determined by the structure diagram generator
            (default is False)
  usecoords -- don't calculate 2D coordinates, just use
               the current coordinates (default is False)

Tkinter and Python Imaging Library are required for image display.


Property Details

atoms

Get Method:
unreachable.atoms(self)

charge

Get Method:
unreachable.charge(self)

conformers

Get Method:
unreachable.conformers(self)

data

Get Method:
unreachable.data(self)

dim

Get Method:
unreachable.dim(self)

energy

Get Method:
unreachable.energy(self)

exactmass

Get Method:
unreachable.exactmass(self)

formula

Get Method:
unreachable.formula(self)

molwt

Get Method:
unreachable.molwt(self)

spin

Get Method:
unreachable.spin(self)

sssr

Get Method:
unreachable.sssr(self)

title

Get Method:
_gettitle(self)
Set Method:
_settitle(self, val)

unitcell

Get Method:
unreachable.unitcell(self)