Structure Checker

User 6d24b35814

26-04-2012 10:38:23

 


Hi


I'm using the java api in a script to flag up any potential issues in a set of smiles, specifically I'm using the valence checker.


StructureChecker checker = new ValenceErrorChecker();


My script runs fine on the commandline when executed in a terminal window, but I need to set this to run on a cronjob (obviously no terminal window). When I try this I get:-


Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY v
ariable.
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:89)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at java.awt.Toolkit$2.run(Toolkit.java:836)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:828)
        at javax.swing.ImageIcon.<init>(ImageIcon.java:119)
        at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
        at chemaxon.checkers.StructureCheckerDescriptor.createIconFromPath(StructureCheckerDescriptor.java:647)
        at chemaxon.checkers.StructureCheckerDescriptor.getIcon(StructureCheckerDescriptor.java:632)
        at chemaxon.checkers.AbstractStructureChecker.getIcon(AbstractStructureChecker.java:172)
        at chemaxon.checkers.AtomChecker.createResult(AtomChecker.java:62)
        at chemaxon.checkers.ComponentChecker.check1(ComponentChecker.java:71)
        at chemaxon.checkers.AbstractStructureChecker.check(AbstractStructureChecker.java:194)
        at prefilter_db.main(prefilter_db.java:125)


 


Is there a way of changing the behaviour of the code (options) so that it doesn't need a display? or is there an alternative non-graphical way of checking valency?


Many thanks


Ceara

ChemAxon e08c317633

26-04-2012 12:15:31

Apart from the API, you might want to see the command line tool: http://www.chemaxon.com/jchem/doc/user/structurecheck_cline.html />It will run on a cronjob too.

Zsolt

User 6d24b35814

26-04-2012 12:35:40

 


I'd actually just like to be able to run the script as it does other things as well, presumably if the structurechecker does run on a cronjob there must be a code work-around?


In any case I'll try structurechecker commandline tool. Is it part of the normal JChem distribution ? I have the correct environment set up but when I try to run structurecheck I get:-


structurecheck: Command not found.


Is it something that needs to be installed seperately?


Many thanks


Ceara

User 6d24b35814

26-04-2012 12:40:10

 


Sorry I realise my typo - structurechecker (not structurecheck).


I've found the app now.

User 6d24b35814

26-04-2012 13:27:34

Hi


I've looked at using structurechecker & I'm confused at it's usage.


I want it to flag up compounds that contain an atom with unusual/invalid valency.


So I try on a valid smiles:-


structurechecker -c "valence" -m check "CCC"


#SMILES false
CCC


if I enter a smiles that I'd like it to reject, it just puts '[]' around the problem atom


structurechecker -c "valence" -m check "CC(C)(C)(C)(C)(C)C"
#SMILES false
C[C](C)(C)(C)(C)(C)C


How do I make it reject such compounds?


Many thanks


Ceara

ChemAxon 2db1f4037e

26-04-2012 15:10:20

Hi Ceara,


Please try to run it in headless mode: java -Djava.awt.headless=true


Since you have a DISPLAY=:0.0 set, java thinks you have graphics environment.


Let me know it that solves your problem.


Cheers,


Istvan

User 6d24b35814

30-04-2012 09:21:24

Hi


Yes running java in headless mode fixed my problem.


Many thanks


Ceara