Hi Greg,

Did you get a chance to add any more tests or docs here?
I'm happy to help to improve the docs (see my recent message about RDKit from Java), but not sure where to start.

More specifically I'm wanting to run the equivalent to this Python code from Java. Any hints would be appreciated.

uncharger = rdMolStandardize.Uncharger()

def remove_isotopes(mol):
    for atom in mol.GetAtoms():
        atom.SetIsotope(0)

def standardize(mol):
    mol = rdMolStandardize.Cleanup(mol)
    mol = uncharger.uncharge(mol)
    remove_isotopes(mol)
    return mol

Thanks
Tim


On 27/12/2019 14:20, Greg Landrum wrote:
Hi Tim,

Unfortunately I don't have decent example code for using the standardizer from Java. Normally I reference the tests, but in this case they are extremely minimal: https://github.com/rdkit/rdkit/blob/master/Code/JavaWrappers/gmwrapper/src-test/org/RDKit/MolStandardizeTest.java

I will try to make some time to improve the situation here with the goal of
a) have better tests
b) making it more obvious how to use the code from Java

-greg


On Thu, Dec 26, 2019 at 4:55 PM Tim Dudgeon <tdudgeon...@gmail.com <mailto:tdudgeon...@gmail.com>> wrote:

    I'm trying to get my head round using the new standardizer code
    from Java.
    Looks like this should be accessible from the RDKFuncs class, but
    I'm failing at stage 1.

    Simple example is:

    package org.exmple;

    import org.RDKit.RDKFuncs;
    import org.RDKit.RWMol;

    public class Simple {

         static {
             System.loadLibrary("GraphMolWrap");
         }

         public static void main(String[] args) {
             RWMol mol1 = RWMol.MolFromSmiles("CC");
             try {
                 RWMol mol2 = RDKFuncs.cleanup(mol1);
                 System.out.println(mol2.MolToSmiles());
             }catch (Exception ex) {
                 System.out.println("Exception! " + ex.getMessage());
                 ex.printStackTrace();
             }
         }
    }

    Result is:

    Exception! null
    org.RDKit.GenericRDKitException
        at org.RDKit.RDKFuncsJNI.cleanup__SWIG_1(Native Method)
        at org.RDKit.RDKFuncs.cleanup(RDKFuncs.java:5173)
        at org.squonk.fragnet.Simple.main(Simple.java:15)

    Exception doesn't give much to go on!

    This is running against code on RDKit Release_2019_09 branch and using Java 
11.

    Has anyone got this working?

    Tim

    _______________________________________________
    Rdkit-discuss mailing list
    Rdkit-discuss@lists.sourceforge.net
    <mailto:Rdkit-discuss@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to