Custom Structure Checker and Fixer in JPC

Create custom structure checker

Based on the documentation available here, you can create a custom structure checker action in Java programming language. As a result of your development, you need to get a jar file which contains the necessary action. The created jar file must be referenced in externalcheckersfixers.xml configuration file which is stored where it is defined in the jchem-psql configuration file.

Artifacts

  • jar file containing your custom standardizer action

  • externalcheckersfixers.xml containing custom structure checker action factory configuration

Where to place the artifacts

  • Edit /etc/default/jchem-psql file

    Add the next line (example only) - defining the place of the externalcheckersfixers.xml - to the list of the JCHEM_PSQL_OPTS - in the jchem-psql file:
    -Dchemaxon.structurechecker.factory.ExternalCheckerFixerConfiguration=/<dir>/externalcheckersfixers.xml
    Take care, use the absolute path of the xml file in the <dir> field.

  • Move the externalcheckersfixers.xml file in the above defined place and make it readable.

    The absolute path of the above generated jar file is defined in the externalcheckersfixers.xml.

    Example:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <checker-list>
    <checker class="com.checkers.MyChecker" editor-class="" id="MyChecker" jar="file:///home/somebody/custom-checkers.jar"/>
    </checker-list>
    <fixer-list>
    <fixer class="com.checkers.MyFixer" id="MyFixer" jar="file:/home/somebody/custom-checkers.jar"/>
    </fixer-list>
    </configuration>

Move the jar file in the above defined place and make it readable.

Use the custom structure checker from cartridge

  • Stop Cartridge service.
    sudo service jchem-psql stop

  • Start Cartridge service
    sudo service jchem-psql start

The cartridge is ready for use the custom structure checker and fixer:

SELECT chemterm('check(''action_string’')','molecule');

The action string of the custom checker/fixer is defined at Java code level.

In place of the action string, the checker configuration xml (not the externalcheckersfixers.xml) can also be used. See examples in Chemical Terms/Structure checkers documentation page.

SELECT chemterm('check(''mycheckerAction'')','[Na+].CC([O-])=O');
 
SELECT chemterm('fix(''mycheckerAction->myfixerAction'')','[Na+].CC([O-])=O');