Create IUPAC-Name by Oracle package?

User acb578c1ac

15-07-2008 13:28:26

Hi,





is it possible to include JChem or required java-files in Oracle to create a IUPAC-Name by a given structure at oracle side? And what are the first steps to do it?








thanks in advanced!

ChemAxon a3d59b832c

15-07-2008 16:14:54

Yes, it is possible in JChem Base, JChem Cartridge and in Instant JChem.





Required steps:





1. JChem Base


These steps can be done through JChem Manager, Instant JChem or API:


- Set up a JChem table with a calculated column "name()"


- Import structures into the JChem table, and the calculated columns will contain the corresponding IUPAC names.





See the JChem Administration Guide for using JChem Manager: http://www.chemaxon.com/jchem/doc/admin/


or the Developers Guide for the use of the API:


http://www.chemaxon.com/jchem/doc/guide/





2. Instant JChem GUI:


First connect to a remote Oracle database, then do the same as above.





Connect to remote(Oracle) databases:


http://www.chemaxon.com/instantjchem/ijc_latest/docs/user/help/htmlfiles/connections/adding_schema.html


Animation for creating Chemical Terms columns: http://www.chemaxon.com/anim/ijc/chemterms/chemterms.html





3. Oracle Cartridge:


3.1. You can do the same as above, and use jc_insert() cartridge function to insert into the JChem table.


http://www.chemaxon.com/jchem/doc/guide/cartridge/index.html#jctable





3.2. Non-JChem tables can be set up with similar pre-calculated columns, but in this case in JChem index ("autoCalcCt=..." parameter at index creation).


http://www.chemaxon.com/jchem/doc/guide/cartridge/index.html#index





3.3. Use the jc_molconvert operator or function with format name "name"


http://www.chemaxon.com/jchem/doc/guide/cartridge/cartapi.html#jc_molconvert





From your question, it seems that mostly one of the Cartridge options are relevant. Let us know if you need further information.





Best regards,


Szabolcs

User acb578c1ac

17-07-2008 09:02:15

Hi,





thanx for fast answering and step by step examples! But i assumed that is quite easier to implement without using GUI and Cartridges. Is it possible to only add an external java source an wrap these java functions in plsql-packages to get an iupac-name by given structure in sdf-format : for example? Because we have higher restricions on cusomers databases, so we prefer a simple solution for generating iupac-names. is there any way?





thanks in advanced!

ChemAxon aa7c50abf8

17-07-2008 10:12:59

Hi
Quote:
wrap these java functions in plsql-packages to get an iupac-name by given structure in sdf-format
Correct! You just need to load MarvinBeans.jar (or jchem.jar) into Oracle and write a PL/SQL wrapper around a thin Java wrapper around the MolConverter class (http://www.chemaxon.com/marvin/help/developer/beans/api/index.html). The Java wrapper would look something like this:





Code:
    protected String molconvert(String structure, String[] options)


            throws Exception {


        ByteArrayOutputStream baos = new ByteArrayOutputStream();


        ByteArrayInputStream bais =


                new ByteArrayInputStream(structure.getBytes());





        String[] args = options;





        MolConverter mc =


                MolConverter.createMolConverter(bais, baos, args, null, null);


        try {


            if (mc != null) {


                mc.convert();


            }


        } catch (java.lang.InternalError ie) {


            if (ie.getMessage().indexOf("X11") != -1) {


                throw new RuntimeException("To enable image generation, set the system property 'java.awt.headless' to 'true'");


            }


        }





        return new String(baos.toByteArray());


    }






The PL/SQL wrapper is a standard/trivial wrapper around the above Java wrapper: http://download.oracle.com/docs/cd/B19306_01/java.102/b14187/chthree.htm#CACJJHGI





Note that current Marvin versions require Java 1.4+, so you need at least Oracle 10g for this to work.

User acb578c1ac

17-07-2008 14:48:28

hi,





code-sample looks great, thanx!





I created this compilable java-source





Code:






create or replace and compile java source named MolConvert as


import java.io.ByteArrayOutputStream;


import java.io.ByteArrayInputStream;


import chemaxon.formats.MolConverter;





public class MolConvertClass


{


  public static String molconvert(String structure, String[] options)


            throws Exception {


        ByteArrayOutputStream baos = new ByteArrayOutputStream();


        ByteArrayInputStream bais = new ByteArrayInputStream(structure.getBytes());





        String[] args = options;





        MolConverter mc =


                MolConverter.createMolConverter(bais, baos, args, null, null);


        try {


            if (mc != null) {


                mc.convert();


            }


        } catch (java.lang.InternalError ie) {


            if (ie.getMessage().indexOf("X11") != -1) {


                throw new RuntimeException("To enable image generation, set the system property 'java.awt.headless' to 'true'");


            }


        }





        return new String(baos.toByteArray());


    }





}














a corresponding wrapper...





Code:






 function convert(pSDF     varchar2,


                   pOptions varchar2) return varchar2 as


    language java name 'MolConvertClass.molconvert(java.lang.String, java.lang.String[])return java.lang.String';











and a calling function...





Code:






  function GetIUPAC return varchar2 is


    vSDF   varchar2(32000);


    vIUPAC varchar2(500);


   begin


 


    select sdf


      into vSDF


      from molecule;


 


    vIUPAC := convert(vSDF,???);


 


    return(vIUPAC);


 


  end;











There are several bugs already in there.. I gues the interfaces does not mach correctly and i'am unsure about the second parameter (options (args))!!





I hope you can help to make this code runable..





thanks in advanced!

ChemAxon aa7c50abf8

17-07-2008 15:42:51

If you're just after IUPAC names, then you can simply remove the second argument from both wrappers and create the MolConverter instance in the Java wrapper like this:





Code:
MolConverter mc =


                MolConverter.createMolConverter(bais, baos, new String[] {"name"}, null, null);

User acb578c1ac

18-07-2008 07:38:03

good morning,





thanks for the last code file.. looks now very good. but now i get an exception that i need a licens file to test it. i send a request to your technical support forum. hope, they can help





the aim is near! well done pkovacs!!





____ ___ ___ ___ _____


|| T ||| H ||| A ||| N ||| X ||


||__|||__|||__|||__|||__||


|/__\|/__\|/__\|/__\|/__\|

ChemAxon 0815c054e1

18-07-2008 09:01:38

Dear Andre,





You can ask for a free 30 days evaluaiton license for any of ChemAxon products.





Please send an email about your request to sales _at_ chemaxon.com. and we will get back to you.





BR,


Norci