null pointer exception when trying to convert mol to smiles

User fc702a6c20

25-04-2008 15:26:16

Hi,





I am trying to convert a mol file to a smiles string but keep getting a null pointer exception thrown I have tried it with the various options but to no avail. I came across someone else's post on this forum with a similar problem but they were running version 4.x, I am running Marvin version 5_0_02_1. Any ideas what the problem might be? Any Help would be greatly appreciated.





Code:





Molecule mol = MolImporter.importMol(molasString);


String smiles = mol.toFormat("smiles");





Exception Stack trace:


java.lang.NullPointerException


at chemaxon.struc.MoleculeGraph.getParity(Unknown Source)


at chemaxon.marvin.io.formats.smiles.SmilesExport.a(Unknown Source)


at chemaxon.marvin.io.formats.smiles.SmilesExport.a(Unknown Source)


at chemaxon.marvin.io.formats.smiles.SmilesExport.a(Unknown Source)


at chemaxon.marvin.io.formats.smiles.SmilesExport.toSMILES(Unknown Source)


at chemaxon.marvin.io.formats.smiles.SmilesExport.convert(Unknown Source)


at chemaxon.struc.Molecule.a(Unknown Source)


at chemaxon.struc.Molecule.exportToObject(Unknown Source)


at chemaxon.struc.Molecule.exportToFormat(Unknown Source)


at chemaxon.struc.Molecule.toFormat(Unknown Source)

ChemAxon 7c2d26e5cf

25-04-2008 20:31:04

Please show a mol file where this exception is dropped.


Probably, it is an invalid molecule.

User fc702a6c20

28-04-2008 09:49:36

ISISHOST03240423072D 1 1.00000 0.00000 2410


23 24 0 0 0 999 V2000


1.1759 1.4241 0.0000 C 0 0 0 0 0 0 0 0 0


1.8793 1.8379 0.0000 C 0 0 0 0 0 0 0 0 0


0.4690 1.8310 0.0000 C 0 0 0 0 0 0 0 0 0


1.1897 0.6172 0.0000 C 0 0 0 0 0 0 0 0 0


1.8759 2.6586 0.0000 C 0 0 0 0 0 0 0 0 0


0.4621 2.6517 0.0000 C 0 0 0 0 0 0 0 0 0


0.4862 0.2034 0.0000 C 0 0 0 0 0 0 0 0 0


1.1724 3.0655 0.0000 C 0 0 0 0 0 0 0 0 0


2.5862 3.0655 0.0000 O 0 0 0 0 0 0 0 0 0


0.4931 -0.6069 0.0000 C 0 0 0 0 0 0 0 0 0


1.1690 3.8793 0.0000 O 0 0 0 0 0 0 0 0 0


2.5897 3.8862 0.0000 C 0 0 0 0 0 0 0 0 0


-0.4862 -1.0828 0.0000 N 0 0 0 0 0 0 0 0 0


1.2000 -1.0035 0.0000 O 0 0 0 0 0 0 0 0 0


-1.1897 -0.6828 0.0000 C 0 0 0 0 0 0 0 0 0


-1.8862 -1.0862 0.0000 C 0 0 0 0 0 0 0 0 0


-1.8862 -1.9035 0.0000 C 0 0 0 0 0 0 0 0 0


-2.5897 -2.3034 0.0000 C 0 0 0 0 0 0 0 0 0


-1.1724 -2.3034 0.0000 C 0 0 0 0 0 0 0 0 0


-2.5897 -3.1241 0.0000 C 0 0 0 0 0 0 0 0 0


-1.1724 -3.1241 0.0000 C 0 0 0 0 0 0 0 0 0


-1.8862 -3.5448 0.0000 C 0 0 0 0 0 0 0 0 0


-1.8862 -4.3552 0.0000 O 0 0 0 0 0 0 0 0 0


1 2 2 0 0 0


1 3 1 0 0 0


1 4 1 0 0 0


2 5 1 0 0 0


3 6 2 0 0 0


4 7 2 0 0 0


5 8 2 0 0 0


5 9 1 0 0 0


7 10 1 0 0 0


8 11 1 0 0 0


9 12 1 0 0 0


10 13 1 0 0 0


10 14 2 0 0 0


13 15 1 0 0 0


15 16 1 0 0 0


16 17 1 0 0 0


17 18 2 0 0 0


17 19 1 0 0 0


18 20 1 0 0 0


19 21 2 0 0 0


20 22 2 0 0 0


22 23 1 0 0 0


6 8 1 0 0 0


21 22 1 0 0 0


M END





This mol file does display in marvin applets - although I have to add a "\" to the end of every line to display it

User fc702a6c20

28-04-2008 11:32:33

This mol also fails





23 24 0 0 1 0 0 0 0 0999 V2000


19.5277 -15.7894 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0


19.1269 -17.0538 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0


18.4238 -14.9876 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


21.0080 -14.8520 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


20.6810 -16.4555 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0


17.7885 -17.0538 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0


19.9225 -18.1332 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


17.3567 -15.7710 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0


23.3147 -14.8520 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0


21.8406 -15.7894 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


17.0053 -18.1456 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


16.0739 -15.3639 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0


24.5914 -15.2591 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0


15.0872 -16.2706 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


25.0230 -16.5358 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0


25.6646 -14.4757 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


26.3677 -16.5358 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0


24.2398 -17.6274 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


26.7623 -15.2775 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0


27.1570 -17.6151 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


28.0513 -15.6168 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0


27.7616 -14.2908 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


29.2048 -14.9384 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0


1 2 1 0 0 0


1 3 1 0 0 0


1 4 1 1 0 0


1 5 1 6 0 0


2 6 1 0 0 0


2 7 1 1 0 0


3 8 1 0 0 0


4 9 1 0 0 0


5 10 1 0 0 0


6 11 1 6 0 0


8 12 1 1 0 0


13 9 1 1 0 0


12 14 1 0 0 0


13 15 1 0 0 0


13 16 1 0 0 0


15 17 1 0 0 0


15 18 1 6 0 0


16 19 1 0 0 0


17 20 1 1 0 0


19 21 1 6 0 0


19 22 1 1 0 0


21 23 1 0 0 0


6 8 1 0 0 0


17 19 1 0 0 0


M END





regards,


smb

User fc702a6c20

28-04-2008 14:33:50

Hi,





Thank you very much for your time and help with this issue, but I have now managed to resolve it





Thanks again


smb

User 143c71d535

19-06-2008 12:45:22

How did you resolve the problem?

User fc702a6c20

19-06-2008 15:35:46

Hi,





sorry I probably should have posted my solution before, the problem I was having was mainly because the documentation is really sparse and instructions on which marvin application to use were not very clear. So my mistake was that I had been trying to get the smiles string from a mol file using the Jmarvin applet jars instead of the marvinBeans.jar. So in my project libraries I had included the jmarvin.jar and various others but had left out one that was necessary. Although you can successfully use the applet jars to get the smiles and Inchi, you have to do a lot of work to trawl through and find all the dependencies. My solution was to add the missing jar. It was only after I had further problems with generating the formula and exact mass that I realised that the correct jar to use was in fact the marvinBeans.jar because it contains everything that is needed.

ChemAxon 7c2d26e5cf

23-06-2008 23:56:52

Dear Suzana,


Can you describe which document was not clear for you?


The difference between applet and beans are described here:


http://www.chemaxon.com/product/marvin_land.html





If you would like to insert MarvinSketch or View into a web page, you need Marvin Applets package. In any other cases, you need the Marvin Beans package.





See the linking topic which files are required for the applet: required files to run Marvin applets





We are working on to improve the documentation. If you have any suggestion which part require more explanation, do not hesitate to share with us.