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;
    if (!OEConfigureMCSFragDatabaseOptions(itf))
      OEThrow.Fatal("Error configuring options");

    if (!OESetupMCSFragDatabaseOptions(fragopts, itf))
      OEThrow.Fatal("Error setting options");

    // use the custom options to fragment an arbitrary input molecule
    OEThrow.Info("MoleculeToCores using command-line options:");
    std::vector<std::string> cores;
    for (OEIter<const std::string> coreiter = OEMoleculeToCores(mol, fragopts); coreiter; ++coreiter)
      cores.push_back(coreiter);

    std::sort(cores.begin(), cores.end());
    unsigned int corenum = 0;
    for (std::vector<std::string>::const_iterator ci = cores.begin(); ci != cores.end(); ++ci,++corenum)
      OEThrow.Info("%d: %s", corenum, ci->c_str());