OEMoleculeToCores

OESystem::OEIterBase<const std::string>* OEMoleculeToCores(const OEChem::OEMolBase &mol,
                                                           const OEMCSFragDatabaseOptions &opts,
                                                           bool permuteFragments=true);

Given a molecule, return the fragmentation cores using the provided fragmentation options. If the permuteFragments argument is true, all combinations of the generated fragmentation cores are generated, otherwise a unique set of multi-fragment cores is returned representing all combinations of bond fragmentations between the min and max cut limits.

Shown below is a version that uses the free function and custom options setup from command line arguments:

    # set the MCS fragment database options from the command-line arguments
    fragopts = oemedchem.OEMCSFragDatabaseOptions()
    if not oemedchem.OEConfigureMCSFragDatabaseOptions(itf):
        oechem.OEThrow.Fatal("Error configuring options")
    if not oemedchem.OESetupMCSFragDatabaseOptions(fragopts, itf):
        oechem.OEThrow.Fatal("Error setting options")

    # use the custom options to fragment an arbitrary input molecule
    print('MoleculeToCores using command-line options:')
    sortedcores = sorted([c for c in oemedchem.OEMoleculeToCores(mol, fragopts)])
    for corenum, core in enumerate(sortedcores):
        print('{}: {}'.format(corenum, core))