OESystem::OEIterBase<OEChem::OEMolBase> *
   OEApplyChEMBL24SolubilityTransforms(OEChem::OEMolBase &input, int context, unsigned int minMMPThreshold=5)

Given an input molecule, apply transformations derived from solubility data obtained from the [ChEMBL24-2018] database. The context argument controls the amount of chemistry information that should be included for the transformation reaction, see OEMatchedPairContext. This function supports only the OEMatchedPairContext.Bond0 or OEMatchedPairContext.Bond2 context values. The minMMPThreshold argument will only apply transformations that meet or exceed the specified number of matched pairs. Use a minMMPThreshold value of 0 to apply all transformations regardless of the number of matched pairs associated with them.

In the examples below, the input structures are transformed by the ChEMBL solubility transforms and exported to a file format that supports SD data. Each transformed structure will contain information about the solubility transform (as SMIRKS) that generated it, and the matched pair information associated with each transform (ChEMBL identifiers and solubility data). The added annotation data will contain the data fields, OEMMP_normalized_value (uM), OEMMP_published_value, OEMMP_examples (SMILES), and OEMMP_transform (SMILES) for subsequent analysis.

        // number of bonds of chemistry context at site of change
        //  for the applied transforms
        int totalmols = 0;
        int xformctxt = OEMatchedPairContext.Bond2;
        int molidx = 0;
        OEGraphMol mol = new OEGraphMol();
        while (oechem.OEReadMolecule(ifs, mol)) {

            // consider only the largest input fragment
            oechem.OEDeleteEverythingExceptTheFirstLargestComponent (mol);

            int smolcnt = 0;
            // only consider solubility transforms having at least 5 matched pairs
            for (OEMolBase solMol : oemedchem.OEApplyChEMBL24SolubilityTransforms(mol, xformctxt, 5)) {
                // compute net change in solubility from MMP data
                if (oechem.OEHasSDData(solMol, "OEMMP_normalized_value (uM)")) {
                    ArrayList<Double> deltasol = new ArrayList<Double>();
                    String sddata = oechem.OEGetSDData(solMol, "OEMMP_normalized_value (uM)");
                    String[] sdlines = sddata.split("\n", -1);

                    for (String sditem : sdlines) {
                        // fromIndex,toIndex,fromValue,toValue
                        String[] sdvalues = sditem.split(",");
                        if (sdvalues.length < 4)
                        if (sdvalues[2].length() == 0 || sdvalues[3].length() == 0)
                        deltasol.add(Double.parseDouble(sdvalues[3]) - Double.parseDouble(sdvalues[2]));
                    if (deltasol.size() == 0)

                    double avgsol = average(deltasol);

                    // reject examples with net decrease in solubility
                    if (avgsol < 0.0)

                    double sdev = stddev(deltasol);

                    // annotate with average,stddev,num
                            String.format("%.2f",avgsol) + "," + String.format("%.2f",sdev) + "," + deltasol.size());

                // export solubility transformed molecule with SDData annotations
                if (oechem.OEWriteMolecule(ofs, solMol) == OEWriteMolReturnCode.Success)
                    smolcnt += 1;

            oechem.OEThrow.Info(molidx + ": Exported molecule count, " + smolcnt);
            totalmols += smolcnt;