Subsections

 
23.2 MDL File Format (SD and Mol)

OEChem provides low-level file readers and writers to assist reading and writing MDL mol and SD files.

23.2.1 OEReadMDLFile

def MyReadMDLMolecule(ifs, mol):
    mol.Clear()
    if OEReadMDLFile(ifs, mol):
        OEFindRingAtomsAndBonds(mol)
        OEAssignAromaticFlags(mol)
        return 1
    mol.Clear()
    return 0

23.2.2 OEWriteMDLFile

def MyWriteMDLMolecule(ofs, mol):
    OEClearAromaticFlags(mol)
    if not OEMDLHasParity(mol):
        OEMDLPerceiveParity(mol)
    OEWriteMDLFile(ofs, mol)
    ofs.write("$$$$\n")