Package CHEM :: Package Common :: Module Util
[hide private]
[frames] | no frames]

Module Util



Miscellaneous utility functions used across the application

Classes [hide private]
  virtual_oemolistream
Similar to using StringIO to simulate a virtual file object.
  virtual_oemolostream
Similar to using StringIO to simulate a virtual file object.
  ProgressDots
Clone of OEChem OEDots class, to add progress indicator to long processes, without actually requiring OEChem as a dependency.
  Codec
Throwaway class to "encrypt" and "decrypt" strings since the rotor module got deprecated after Python 2.3.
  BoltzmannProbabilityWeight
Functor which given an energy value, should provide a proportional probability weight based on Boltzmann probability distributions.
Functions [hide private]
 
isStdFile(filename)
Given a filename, determine if it is meant to represent sys.stdin / sys.stdout or just a regular file based on the convention of the filename "-"
 
stdOpen(filename, mode='r', stdFile=<CHEM.DB.rdb.search.NameRxnPatternMatchingModel.SearchSentence...)
Wrapper around basic file "open" method.
 
molBySmiles(smiles)
Convenience method for common construct of creating a new molecule by SMILES string.
 
molToSmiList(molList)
Convert a list of molecule objects into a list of respective SMILES strings.
 
splitCompositeMolToSmilesList(compositeMol, retainCounterIons=False)
Given a (composite) molecule, return a list of SMILES strings, with one element per component molecule of the composite.
 
splitCompositeSmilesToList(compositeSmi, retainCounterIons=False)
retainCounterIons option will try to not separate out components if they have opposing (and neutralizing) formal charges.
 
splitCompositeMol(compositeMol, retainCounterIons=False)
Given a (composite) molecule, return a list of molecule objects, with one element per component molecule of the composite.
 
isSmilesFormat(formatCode)
Check if the supplied formatCode is one of the OpenEye SMILES formats.
 
generatePlaceholders(count)
Returns a comma-separated string of query placeholders (e.g.
 
generateFingerprint(smiles, fpMax=8, fpMin=0, fpSize=1024)
Returns a standard fingerprint object for a given (SMILES) string.
 
standardizeSmiles(smi)
Given a SMILES string, generate a standardized isomeric SMILES version.
 
createStandardSmiString(mol)
Strange.
 
recordAtomCount(currentAtom, currentCount, atomCountDict)
Utility function used by standardMolecularFormula
 
standardizeMolecularFormula(molecularFormula)
Read in a string representing a molecular formula and extract out the atom contents.
 
main(argv)
Main method, callable from command line
Variables [hide private]
  OEFormat_SMI = -1
  log = logging.getLogger(Const.APPLICATION_NAME)
  handler = logging.StreamHandler(sys.stderr)
  formatter = logging.Formatter(Const.LOGGER_FORMAT)
  CHARGE_CHARS = ('-', '+')
Function Details [hide private]

stdOpen(filename, mode='r', stdFile=<CHEM.DB.rdb.search.NameRxnPatternMatchingModel.SearchSentence...)

 
Wrapper around basic file "open" method. If specified filename is the recognized as representing stdin or stdout (see "isStdFile") then return the designated stdFile object (presumably sys.stdin or sys.stdout).

splitCompositeMol(compositeMol, retainCounterIons=False)

 
Given a (composite) molecule, return a list of molecule objects, with one element per component molecule of the composite. Based on isomeric SMILES string delimiters, so no 3D or other annotation data is retained.

generatePlaceholders(count)

 
Returns a comma-separated string of query placeholders (e.g. %s), perfect for use in an "in" clause.

generateFingerprint(smiles, fpMax=8, fpMin=0, fpSize=1024)

 
Returns a standard fingerprint object for a given (SMILES) string. Just defer to basic FINGER.Finger(...) constructor, but check to see if want to use the web service instead. Useful for Windows clients that cannot import the FINGER module.

createStandardSmiString(mol)

 
Strange. Should be perfectly redundant with OECreateIsoSmiString, but in some cases, the direct call messes up, such as alkene stereochemistry giving C\C=C\C instead of C/C=C/C. Functionally the same, but distinct when doing unique SMILES checks.

standardizeMolecularFormula(molecularFormula)

 
Read in a string representing a molecular formula and extract out the atom contents. Feed these into a temporary molecule (no meaningful connectivity information required) and then generate the standard molecular formula representation.