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.


This function does not perform any validation or filtering on the input molecule to be transformed. The caller is expected to perform validity and/or size checking to ensure sensible inputs are provided.

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;
        uint molidx = 0;
        OEGraphMol mol = new OEGraphMol();
        while (OEChem.OEReadMolecule(ifs, mol))
            // consider only the largest input fragment

            int smolcnt = 0;
            // only consider solubility transforms having at least 5 matched pairs
            foreach (OEMolBase solMol in OEMedChem.OEApplyChEMBL24SolubilityTransforms(mol, xformctxt, 5))
                // compute net change in solubility from MMP data
                if (OEChem.OEHasSDData(solMol, "OEMMP_normalized_value (uM)"))
                    List<Double> deltasol = new List<Double>();
                    String sddata = OEChem.OEGetSDData(solMol, "OEMMP_normalized_value (uM)");
                    String[] sdlines = sddata.Split('\n');
                    foreach (String sditem in sdlines)
                        String[] sdvalues = sditem.Split(',');
                        if (sdvalues.Length < 4)
                        if (sdvalues[2].Length == 0 || sdvalues[2].Length == 0)
                        deltasol.Add(Convert.ToDouble(sdvalues[3]) - Convert.ToDouble(sdvalues[2]));
                    if (deltasol.Count == 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
                                       "OEMMP_average_delta_normalized_value", String.Format("{0:F1},{1:F1},{2:D}", avgsol, sdev, deltasol.Count));

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

            OEChem.OEThrow.Info(String.Format("{0:D}: Exported molecule count, {1:D}", molidx, smolcnt));
            totalmols += smolcnt;