OEWriteMolToBytes

OEWriteMolToBytes(format, oemol) -> bytes
OEWriteMolToBytes(format, gzip, oemol) -> bytes
OEWriteMolToBytes(format, flavor, gzip, oemol) -> bytes

OEWriteMolToBytes(format, oemcmol) -> bytes
OEWriteMolToBytes(format, gzip, oemcmol) -> bytes
OEWriteMolToBytes(format, flavor, gzip, oemcmol) -> bytes

Encodes a molecule in terms of ‘format’. ‘format’ must be a file extension that is writeable by OpenEye, for example: “.oeb.gz”. The overloads which take a Boolean ‘gzip’ parameter or an unsigned ‘flavor’ and Boolean ‘gzip’ parameters expect the format or the format and flavor to be specified by one of the constants in OEFormat and OEOFlavor.

Returns bytes if encoding was successful, otherwise ‘’None’’.

mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "c1ccccc1")
molbytes = oechem.OEWriteMolToBytes(".smi", mol)
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "c1ccccc1")
molbytes = oechem.OEWriteMolToBytes(oechem.OEFormat_SMI, False, mol)
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "c1ccccc1")
molbytes = oechem.OEWriteMolToBytes(oechem.OEFormat_SMI,
                                    oechem.OEGetDefaultOFlavor(oechem.OEFormat_SMI),
                                    False, mol)