Unusual result from jc_insert function

User 0908c5ccdd

19-03-2007 16:54:22

I have inserted a row into the database using the jc_insert operator. The code I used is as below:


Code:



aCDReturn := jchem_table_pkg.jc_insert(vSmiles, 'jchemistry', null, 'true', 'false', '');


iCDNum := aCDReturn(1);






The string for vSmiles is calculated from Accord for Excel and then sent to the PL/SQL procedure. This works fine. However I have come across a problem to do with aromaticity.





Structure 1 is attached and was registered into the database. The SMILES string calculated by Accord for Excel was c1ccc2c(c1)C(\C=C/O2)=O





However when this is written to the database in the PL/SQL procedure the CD_SMILES column in the JCHEMISTRY table shows O=c1ccoc2ccccc12 as the SMILES string. Notice the lower case atoms, that signify aromaticity. I may be wrong, but I did not think my original molecule was aromatic, yet the cartridge has attempted to draw it as aromatic.





When I produce an image of the inserted structure the cartridge "draws" the pyran ring as aromatic - see Structure 2.





Surely this is incorrect?

ChemAxon a3d59b832c

19-03-2007 17:23:41

ftm wrote:
Surely this is incorrect?
It is right, the structure is aromatic by the default "General" aromatization.


You may prefer the other aromaticity option: "Basic".





See the documentation about these aromatization options:


http://www.chemaxon.com/marvin/doc/user/aromatization-doc.html





You may also find the following discussion interesting:


http://www.chemaxon.com/forum/ftopic2530.html


(particularly posts after Wed Jan 31, 2007)





It is possible to use basic aromatization in JChem Base and Cartridge through custom standardization:


http://www.chemaxon.com/jchem/doc/user/Query.html#standardizationDB


http://www.chemaxon.com/jchem/doc/user/StandardizerConfiguration.html#aromatizesec





Let us know if you have more questions.





Szabolcs

ChemAxon a3d59b832c

20-03-2007 08:12:17

Just one more addition: JChem always uses the cd_smiles column for searching. However, you can use the cd_structure column for visualization. This always contains the original source of the molecule.

User 0908c5ccdd

20-03-2007 10:55:19

Hi Szabolcs





Thanks for the replies. Is there an easy way of setting the aromaticity flag to 'Basic' as an option when using the JC_MOLCONVERTB operator or is this something that has to be done with the Standardizer?





I was interested to read your reply about using the CD_STRUCTURE column for reporting structures. When I try to use this in my PL/SQL procedure it gives an error of





Error: PLS-00306: wrong number or types of arguments in call to 'JC_MOLCONVERTB'





I used the code as below. The original select clause using the CD_SMILES column is commented out. It works on CD_SMILES but errors with CD_STRUCTURE. I'm guessing that I will have to convert the BLOB returned into a format suitable for the JC_MOLCONVERTB operator prior to creating the image. Perhaps a MOL text? Is this correct?





Code:
create or replace procedure chemblob_to_file(myfilename in varchar2, chemistry in number) is





v_blob         blob;


blob_length    integer;


out_file       utl_file.file_type;


v_buffer       raw(32767);


chunk_size     binary_integer := 32767;


blob_position  integer := 1;





begin





-- Retrieve the BLOB


--select jc_molconvertb(cd_smiles, 'jpeg')


select jc_molconvertb(cd_structure, 'jpeg')


into v_blob


from jchemistry


where cd_id = chemistry;





-- Calculate size of BLOB


blob_length := dbms_lob.getlength(v_blob);





-- Open handle to write file location


-- wb parameter is "write in byte mode"


out_file := utl_file.fopen('NEW_DIR', myfilename, 'wb', chunk_size);





-- Write the BLOB to file in chunks


while blob_position <= blob_length loop


      if blob_position + chunk_size - 1 > blob_length then


         chunk_size := blob_length - blob_position + 1;


      end if;


      dbms_lob.read(v_blob, chunk_size, blob_position, v_buffer);


      utl_file.put_raw(out_file, v_buffer, true);


      blob_position := blob_position + chunk_size;


end loop;





-- Close the file handle


utl_file.fclose(out_file);


 


end chemblob_to_file;


ChemAxon aa7c50abf8

20-03-2007 12:41:43

Quote:
Is there an easy way of setting the aromaticity flag to 'Basic' as an option when using the JC_MOLCONVERTB operator


Please use the smiles:a_bas option with jc_molconvert (http://www.chemaxon.com/marvin/doc/user/molconvert.html):


Code:
select jc_molconvert('O=C1C=COc2ccccc12', 'smiles:a_bas') from dual






You can also use jc_standardize:


Code:
select jc_standardize('O=C1C=COc2ccccc12', 'config:aromatize:b') from dual;






If you need this standardization for all your structures in the table, I suggest to consider setting a custom standardization for the table (in the case of JChem structure tables) or the jc_idxtype index (in the case of regular structure tables). The way to specify this with regular structure tables is through an index parameter:


Code:
CREATE INDEX jc_idx_2 ON jchemtest2(structure_col) INDEXTYPE IS jc_idxtype PARAMETERS('std_config=aromatize:b')
. With JChem structure tables you have to specify the custom standardization configuration while creating the table with JChem Manager (http://www.chemaxon.com/jchem/doc/admin/index.html#create). Note that JChem Manager accepts only Standardizer configuration files in XML format. The XML format of the basic aromatization configuration looks like this (http://www.chemaxon.com/jchem/doc/user/StandardizerConfiguration.html#config,


http://www.chemaxon.com/jchem/doc/user/StandardizerConfiguration.html#aromatizesec):


Code:
<?xml version="1.0" encoding="UTF-8"?>


<!-- Standardizer configuration file -->





<StandardizerConfiguration Version ="0.1">


    <Actions>   


   <Aromatize ID="chemaxonaromatize" Type="basic"/>


    </Actions>


</StandardizerConfiguration>








When your structure table (index) has a custom standardization configuration assigned to it, the standardization will be done automatically for you.
Quote:
wrong number or types of arguments in call to 'JC_MOLCONVERTB'
With cd_structure, please, use jc_molconvertbb, which accepts BLOB as its first parameter. (Note the double 'b'.)





Peter

User 0908c5ccdd

20-03-2007 13:39:13

Many thanks for the response. Apologies, but I still cannot get this to work for the jc_molconvertb function. I require a BLOB of the image to be created and I then save this to the local disk.





I have tried:





Code:
select jc_molconvertb(jc_standardize(cd_smiles, 'config:aromatize:b'), 'jpeg')


into v_blob


from jchemistry


where cd_id = chemistry;






and





Code:
-- Retrieve the BLOB


select jc_molconvertb(cd_smiles, 'jpeg:a_bas')


into v_blob


from jchemistry


where cd_id = chemistry;






Neither are returning an error but the image files (JPG) that are produced are still in the GENERAL aromatic form (see attached).





Also, when I try to use jc_molconvertbb on my CD_STRUCTURE column I get an error (also attached as error.jpg) Does this mean I can only index either the SMILES column or the STRUCTURE column? If so then I can't return an image from the contents of the STRUCTURE column.

ChemAxon aa7c50abf8

20-03-2007 14:32:47

Quote:
the image files (JPG) that are produced are still in the GENERAL aromatic form
Is it not that the cd_smiles column already contains the aromatized form? (I think the aromatize action will never ever dearomatize an already aromatized ring.)
Quote:
when I try to use jc_molconvertbb on my CD_STRUCTURE column I get an error (also attached as error.jpg). Does this mean I can only index either the SMILES column or the STRUCTURE column?
You should be able to create a jc_idxtype index on both columns. But for your immediate purpose, I'd suggest to use the jcf_molconvertbb function instead of the jc_molconvertbb operator (note the 'f' in jcf_). The function will not complain about indexes and will not be worse than the operator performance-wise either.





Peter