Package cinfony :: Module cdk
[frames] | no frames]

Module cdk

source code


cdk - A Cinfony module for accessing the CDK from CPython and Jython

Global variables:
  cdk - the underlying CDK Java library (org.openscience.cdk)
  informats - a dictionary of supported input formats
  outformats - a dictionary of supported output formats
  descs - a list of supported descriptors
  fps - a list of supported fingerprint types
  forcefields - a list of supported forcefields

Classes
  Outputfile
Represent a file to which *output* is to be sent.
  Molecule
Represent a cdkjpype Molecule.
  Fingerprint
A Molecular Fingerprint.
  Atom
Represent a cdkjpype Atom.
  Smarts
A Smarts Pattern Matcher
  MoleculeData
Store molecule data in a dictionary-type object
Functions
 
readfile(format, filename)
Iterate over the molecules in a file.
source code
 
readstring(format, string)
Read in a molecule from a string.
source code
Variables
  cdk = JPackage("org").openscience.cdk
  descs = ['hBondacceptors', 'weight', 'ip', 'CPSA', 'autoCorrel...
A list of supported descriptors
  fps = ['pubchem', 'daylight', 'extended', 'estate', 'maccs', '...
A list of supported fingerprint types
  informats = {'inchi': 'InChI', 'mol': 'MDL MOL', 'sdf': 'MDL S...
A dictionary of supported input formats
  outformats = {'inchi': 'InChI', 'inchikey': 'InChIKey', 'mol':...
A dictionary of supported output formats
  forcefields = [u'mm2', u'mmff94']
A list of supported forcefields
  __package__ = 'cinfony'
Function Details

readfile(format, filename)

source code 
Iterate over the molecules in a file.

Required parameters:
   format - see the informats variable for a list of available
            input formats
   filename

You can access the first molecule in a file using the next() method
of the iterator:
    mol = readfile("smi", "myfile.smi").next()

You can make a list of the molecules in a file using:
    mols = list(readfile("smi", "myfile.smi"))

You can iterate over the molecules in a file as shown in the
following code snippet:
>>> atomtotal = 0
>>> for mol in readfile("sdf", "head.sdf"):
...     atomtotal += len(mol.atoms)
...
>>> print atomtotal
43

readstring(format, string)

source code 
Read in a molecule from a string.

Required parameters:
   format - see the informats variable for a list of available
            input formats
   string

Example:
>>> input = "C1=CC=CS1"
>>> mymol = readstring("smi", input)
>>> len(mymol.atoms)
5


Variables Details

descs

A list of supported descriptors

Value:
['hBondacceptors',
 'weight',
 'ip',
 'CPSA',
 'autoCorrelationPolarizability',
 'kierHallSmarts',
 'zagrebIndex',
 'wienerNumbers',
...

fps

A list of supported fingerprint types

Value:
['pubchem',
 'daylight',
 'extended',
 'estate',
 'maccs',
 'klekota-roth',
 'graph',
 'substructure',
...

informats

A dictionary of supported input formats

Value:
{'inchi': 'InChI',
 'mol': 'MDL MOL',
 'sdf': 'MDL SDF',
 'smi': 'SMILES'}

outformats

A dictionary of supported output formats

Value:
{'inchi': 'InChI',
 'inchikey': 'InChIKey',
 'mol': 'MDL MOL',
 'mol2': 'MOL2',
 'sdf': 'MDL SDF',
 'smi': 'SMILES'}