Upgrading to JChem 6.1

User 7a902f260f

24-09-2013 14:38:45

Hi all,


I'm currently upgrading our code base to use JChem 6.1.  Some of the functions that we are relying on previously has been deprecated, and I'm trying to substitute them with the equivalent invocations with the latest API.  Most has been straight forward, but I have 2 that I need some help with:


1. MolImporter's importMol() is now a static method.  Previously, we were invoking the method as such:


MolImporter mi = new MolImporter();

mi.setQueryMode(true);

Molecule querymol = mi.importMol(args[1]);










With importMol() now being static, how do I now set the query mode?  I see that options can be passed in, but I'm unsure which one to use (with querymode set to true or false).





2.  getAromrings() and getNonAromrings() are now no longer available for the class Molecule.  I now need to use getAromaticAndAliphaticRings().  Am I correct in using these substitutions?




molecule.getAromrings() ==>  molecule.getAromaticAndAliphaticRings(MoleculeGraph.AROM_BASIC, true, true, 19, 0)[0];


molecule.getNonAromrings() ==> molecule.getAromaticAndAliphaticRings(MoleculeGraph.AROM_BASIC, true, true, 19, 0)[1];









Thanks!


ChemAxon 5433b8e56b

24-09-2013 15:29:41

Hi,


I have moved your question to the corresponding topic called "Structure representation: molecule handling and file formats". My colleagues will answer for you soon.


Regards,
Istvan 

ChemAxon 25dcd765a3

24-09-2013 22:12:39

Hi,


Here is the list for Marvin:


http://www.chemaxon.com/marvin/help/developer/deprecatedObjects.html


 


MoleculeGraph.getAromrings() -> getAromaticAndAliphaticRings(AROM_BASIC, true, false, 18, 1000)[0];

MoleculeGraph.getAromrings(int size) -> getAromaticAndAliphaticRings(AROM_BASIC, true, false, size, 1000)[0];



Regading "MolImporter's importMol() is now a static method".

MolImporter mi = MolImporter(java.io.InputStream is) //where 'is' is your molecule string

mi.setQueryMode(true);

Molecule querymol = mi.read();

mi.close();



User 7a902f260f

25-09-2013 17:47:08

Thanks for the response.  I'm still unclear what the difference is between importMol() and read() for some cases.  For example, are the Molecules generated in these two code snippets equivalent?


 


Code Snippet 1 (note that query mode is not explicitly set):


MolImporter mi = MolImporter(molStringAsInputStream); 

Molecule mol = mi.read();

mi.close();



Code Snippet 2:

Molecule mol = MolImporter.importMol(molString);





In addition, I have yet another deprecated method question:



final LibraryMCS mcs = new LibraryMCS();

mcs.setMCSMode(MCS.MODE_EXACT);

...

mcs.search()



So apparently, MODE_EXACT is not supported anymore.  Is there an equivalent method that I can use?  Is the search going to possibly return different results now?






ChemAxon 25dcd765a3

25-09-2013 22:03:34

 


For example, are the Molecules generated in these two code snippets equivalent?

Yes.


Why do we have two?


You can read more molecules with the first solution. (Code Snippet 1)


MolImporter mi = MolImporter(molStringAsInputStream); 

Molecule mol1 = mi.read();

Molecule mol2 = mi.read();

mi.close();


If you have just one on the stream, you can use the static method.

Regarding libMCS question my colleague will answer soon.

ChemAxon 4a2fc68cd1

26-09-2013 07:16:49

Hi,


In LibMCS, the underlying algorithm was replaced in 6.x releases with a more efficient implementation, which is superior to the previous one in terms of both running time and accuracy. The new code has slightly different options and yes, it will produce different results.


Instead of the former three search modes, there are only two now: NORMAL and FAST. However this new NORMAL mode (the default one) is generally not less accurate than the old EXACT mode. So I suggest you to simply skip this setting for the new version.


Best regards,
Peter