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
            OEMCSFragDatabaseOptions fragopts = new OEMCSFragDatabaseOptions();
            if (!oemedchem.OEConfigureMCSFragDatabaseOptions(itf))
                oechem.OEThrow.Fatal("Error configuring options");
            if (!oemedchem.OESetupMCSFragDatabaseOptions(fragopts, itf))
                oechem.OEThrow.Fatal("Error setting options");

            // use the custom options to fragment an arbitrary input molecule
            System.out.println("MoleculeToCores using command-line options:");
            List<String> cores = new ArrayList<String>();
            for (String c : oemedchem.OEMoleculeToCores(mol, fragopts))
                cores.add(c);
            java.util.Collections.sort(cores);
            int corenum = 0;
            for (String core : cores)
            {
                System.out.println(corenum + ": " + core);
                ++corenum;
            }