Loading Marvin Applet with 2d structure

User 2c6aa21beb

03-02-2010 10:15:33


Hi,


I'm using the Marvin applet and when I load the structure the 2d coordinates
are being lost. I'm using the smiles structure which doesn’t have the
coordinates. How do I load the chemical structure with the 2d coordinates?


Please see attached word document for a detailed description with pictures.


Kind Regards and thanks in advance;


Karl

ChemAxon 990acf0dec

03-02-2010 11:04:37

Hi Karl,


There is no way to export coordinates into the original SMILES format, but you can do that if you export the structure to ChemAxon Extended SMILES format, and use the "c" option for exporting the coordinates. You can read more details here:


http://www.chemaxon.com/marvin/help/formats/cxsmiles-doc.html


Best regards,


Akos

User 2c6aa21beb

03-02-2010 11:36:26

Hi Akos,

Thanks very much for the quick reply.

When I use

marvinApplet.getMol("cxsmiles:+c");

I do get the coordinates;

But when I use the web services to store the Chemical structure,

<addStructure xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID1536034240</connectionHandlerId><tableName>en_chemstruct</tableName><structure>C1CCCCC1 |(-6.16,1.98,;-7.49,1.21,;-7.49,-.33,;-6.16,-1.1,;-4.83,-.33,;-4.83,1.21,)|</structure><additionalColumns>dataid</additionalColumns><additionalColumns>version</additionalColumns><additionalValues>35657</additionalValues><additionalValues>1</additionalValues></addStructure>

the cd_smiles column is C1CCCCC1, why am I losing the coordinates? am I using the add web_service incorrectly? or is it updating the cd_structure column with the correct data?


If its storing the coordinates now with the cxsmiles:+c, how can I get this coordinates and the structure loaded back into the applet?


Many Thanks again,

Karl

User c1ce6b3d19

04-02-2010 11:14:36

Karl,


My suggestion would be to use the mrv format  to store into the database, because it contains the coordinates and other chemistry specific features as default. 


marvinApplet.getMol("mrv");



The structure (with coordinates) can be retrieved by using the modified runCompleteSearch call you included in a previous email. 


<runCompleteSearch xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID-1135095665</connectionHandlerId><tableName>en_chemstruct</tableName><queryMolecule>c1ccccc1</queryMolecule><queryOptions>sep=!
maxHitCount:100!maxTime:60000!returnNonHits:n!filterQuery:select
cd_structure
from en_chemstruct where dataid = 34337 and version =
1</queryOptions><beginIndex>0</beginIndex><count>1</count><outputFormat>mrv</outputFormat><dataFieldNames>cd_structure</dataFieldNames></runCompleteSearch>


The molecule structure is returned inside the <Molecule> tags of the WS response. 


Your molecule will look something like this:


<?xml version="1.0" ?>
<cml>
<MDocument>
  <MChemicalStruct>
    <molecule molID="m1">
      <atomArray
          atomID="a1 a2 a3 a4 a5 a6"
          elementType="C C C C C C"
          x2="-6.16 -7.49 -7.49 -6.16 -4.83 -4.83"
          y2="1.98 1.21 -0.33 -1.1 -0.33 1.21"
          />
      <bondArray>
        <bond atomRefs2="a1 a2" order="1" />
        <bond atomRefs2="a2 a3" order="1" />
        <bond atomRefs2="a3 a4" order="1" />
        <bond atomRefs2="a4 a5" order="1" />
        <bond atomRefs2="a5 a6" order="1" />
        <bond atomRefs2="a1 a6" order="1" />
      </bondArray>
    </molecule>
  </MChemicalStruct>
</MDocument>
</cml>

User 2c6aa21beb

04-02-2010 18:10:15

Hi Thanks for the suggestion;


I trying to do what you suggested but I'm having problems adding the mrv using the addstructure web service. So I didnt even get a chance to try the search for the mrv....


 


The error is saying format (?) Unrecognized file contents.


<addStructure xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID705397361</connectionHandlerId><tableName>en_chemstruct</tableName><structure><?xml version="1.0" ?>
<cml>
<MDocument>
  <MChemicalStruct>
    <molecule molID="m1">
      <atomArray
          atomID="a1 a2 a3 a4 a5 a6"
          elementType="C C C C C C"
          x2="-6.159999847412109 -7.493669188460368 -7.493669188460368 -6.159999847412109 -4.826330506363851 -4.826330506363851"
          y2="-1.209966118881919 -1.9799830594409595 -3.5200169405590405 -4.290033881118081 -3.5200169405590405 -1.9799830594409595"
          />
      <bondArray>
        <bond atomRefs2="a1 a2" order="1" />
        <bond atomRefs2="a1 a6" order="2" />
        <bond atomRefs2="a2 a3" order="2" />
        <bond atomRefs2="a3 a4" order="1" />
        <bond atomRefs2="a4 a5" order="2" />
        <bond atomRefs2="a5 a6" order="1" />
      </bondArray>
    </molecule>
  </MChemicalStruct>
</MDocument>
</cml>
</structure><additionalColumns>dataid</additionalColumns><additionalColumns>version</additionalColumns><additionalValues>37531</additionalValues><additionalValues>1</additionalValues></addStructure>


Here is the response I'm getting

<?xml version=\'1.0\' encoding=\'UTF-8\'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">Cannot recognize format (?)\nUnrecognized file contents:\n version="1.0" ?>\n</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>



I also tried to Web escape the mrv structure and I get the same error

<addStructure xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID-1025010257</connectionHandlerId><tableName>en_chemstruct</tableName><structure>%3C%3Fxml%20version%3D%221%2E0%22%20%3F%3E%0A%3Ccml%3E%0A%3CMDocument%3E%0A%20%20%3CMChemicalStruct%3E%0A%20%20%20%20%3Cmolecule%20molID%3D%22m1%22%3E%0A%20%20%20%20%20%20%3CatomArray%0A%20%20%20%20%20%20%20%20%20%20atomID%3D%22a1%20a2%20a3%20a4%20a5%20a6%22%0A%20%20%20%20%20%20%20%20%20%20elementType%3D%22C%20C%20C%20C%20C%20C%22%0A%20%20%20%20%20%20%20%20%20%20x2%3D%22%2D1%2E815000057220459%20%2D3%2E1486693982687175%20%2D3%2E1486693982687175%20%2D1%2E815000057220459%20%2D0%2E48133071617220047%20%2D0%2E48133071617220047%22%0A%20%20%20%20%20%20%20%20%20%20y2%3D%223%2E5200339001915673%202%2E750016959632527%201%2E2099830785144459%200%2E4399661379554054%201%2E2099830785144459%202%2E750016959632527%22%0A%20%20%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CbondArray%3E%0A%20%20%20%20%20%20%20%20%3Cbond%20atomRefs2%3D%22a1%20a2%22%20order%3D%221%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cbond%20atomRefs2%3D%22a1%20a6%22%20order%3D%221%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cbond%20atomRefs2%3D%22a2%20a3%22%20order%3D%221%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cbond%20atomRefs2%3D%22a3%20a4%22%20order%3D%221%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cbond%20atomRefs2%3D%22a4%20a5%22%20order%3D%221%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3Cbond%20atomRefs2%3D%22a5%20a6%22%20order%3D%221%22%20%2F%3E%0A%20%20%20%20%20%20%3C%2FbondArray%3E%0A%20%20%20%20%3C%2Fmolecule%3E%0A%20%20%3C%2FMChemicalStruct%3E%0A%3C%2FMDocument%3E%0A%3C%2Fcml%3E%0A</structure><additionalColumns>dataid</additionalColumns><additionalColumns>version</additionalColumns><additionalValues>37530</additionalValues><additionalValues>1</additionalValues>

<?xml version=\'1.0\' encoding=\'UTF-8\'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">Cannot recognize format (?)\nUnrecognized file contents:\n%3C%3Fxml%20version%3D%221%2E0%22%20%3F%3E%0A%3Ccml%3E%0A%3CMDocument%3E%0A%20%20%3CMChemicalStruct%3E%0A%20%20%20%20%3Cmolecule%20molID%3D%22m1%22%3E%0A%20%20%20%20%20%20%3CatomArray%0A%20%20%20%20%20%20%20%20%20%20atomID%3D%22a1%20a2%20a3%20a4%20a5%20...</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>



I even tried to adding the <format>mrv</format> to the addstructure webservice but this didnt help,


Am I doing something wrong here?? because in the example in


http://www.chemaxon.com/webservices/soap/DataManipulationWS.html


doesnt mention anything about format.... and I also tried this sample xml and this doesnt save either????


Many Thanks


Karl

User c1ce6b3d19

04-02-2010 18:27:04

Karl,


 


Instead of the web escape characters, try the html entities:


< &lt;


> &gt;


& &amp;


" &quot;

User 2c6aa21beb

05-02-2010 10:53:45


Many Thanks

I needed to HTML escape the xml text and not xml escape as you suggested...


Now I'm getting an error when searching for the mrv using the web service;

<runCompleteSearch xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID37043903</connectionHandlerId><tableName>en_chemstruct</tableName><queryMolecule>C1CCCCC1</queryMolecule><queryOptions>sep=! maxHitCount:100!maxTime:60000!returnNonHits:n!filterQuery:select cd_structure from en_chemstruct where dataid = 37749 and version = 1</queryOptions><beginIndex>0</beginIndex><count>100</count><outputFormat>mrv</outputFormat><dataFieldNames>cd_structure</dataFieldNames><hitColorAndAlignmentOptions xsi:nil="true" /></runCompleteSearch>


<?xml version=\'1.0\' encoding=\'UTF-8\'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">The conversion from image to INTEGER is unsupported.</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>

I also tried to leave the queryMolecule element empty and I'm getting the same error

<runCompleteSearch xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID494374669</connectionHandlerId><tableName>en_chemstruct</tableName><queryMolecule></queryMolecule><queryOptions>sep=! maxHitCount:100!maxTime:60000!returnNonHits:n!filterQuery:select cd_structure from en_chemstruct where dataid = 37749 and version = 1</queryOptions><beginIndex>0</beginIndex><count>100</count><outputFormat>mrv</outputFormat><dataFieldNames>cd_structure</dataFieldNames></runCompleteSearch>


<?xml version=\'1.0\' encoding=\'UTF-8\'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">The conversion from image to INTEGER is unsupported.</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>


Am I doing something wrong here??? because I'm using the format mrv as you suggested in the earlier post,

Any help will be appreciated. I have also attached the exception from Tomcat.

Kind Regards
Karl


 


 


 

User 2c6aa21beb

05-02-2010 11:41:04

I have the search working now, I'm working on the display, I'll post more if I get it working,


 


Thanks


Karl

User c1ce6b3d19

05-02-2010 11:47:11

That's great.  what did you change to fix it?


 


Jon

User 2c6aa21beb

05-02-2010 12:06:37

Hi Jon, I needed to change


<runCompleteSearch xmlns="http://webservice.jchem.chemaxon"><connectionHandlerId>connectionHandlerID1637548116</connectionHandlerId><tableName>en_chemstruct</tableName><queryMolecule></queryMolecule><queryOptions>sep=! maxHitCount:100!maxTime:60000!returnNonHits:n!filterQuery:select cd_id from en_chemstruct where dataid = 38297 and version = 1</queryOptions><beginIndex>0</beginIndex><count>100</count><outputFormat>mrv</outputFormat><dataFieldNames>cd_id</dataFieldNames></runCompleteSearch>


to include the cd_id and not the cd_structure.


Now I cant even get the applet to load at all.


msketch_name = "MSketch";
msketch_begin("http://127.0.0.1/i/enovatorchem/marvin", 800, 500);
msketch_param("background", "#b0b0b0");
msketch_param("molbg", "#F0F0F0");
msketch_param("molformat", "mrv");
msketch_param("cacheMols", "false");
msketch_param("mol", "&lt;?xml version=&apos;1.0&apos; encoding=&apos;UTF-8&apos;?&gt;&lt;soapenv:Envelope xmlns:soapenv=&quot;http://www.w3.org/2003/05/soap-envelope&quot;&gt;&lt;soapenv:Body&gt;&lt;ns:runCompleteSearchResponse xmlns:ns=&quot;http://webservice.jchem.chemaxon&quot;&gt;&lt;ns:return&gt;&amp;lt;Complete&gt;&amp;lt;SearchId&gt;searchID1844736295&amp;lt;/SearchId&gt;&amp;lt;ResultCount&gt;1&amp;lt;/ResultCount&gt;&amp;lt;Rows&gt; />&amp;lt;Row&gt;&amp;lt;Molecule&gt;&amp;lt;?xml version=&quot;1.0&quot; ?&gt;
&amp;lt;cml&gt;
&amp;lt;MDocument&gt;
&amp;lt;MChemicalStruct&gt;
&amp;lt;molecule molID=&quot;m1&quot;&gt;
&amp;lt;atomArray
atomID=&quot;a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20&quot;
elementType=&quot;N C C C C N C C C C N C C C C N C C C C&quot;
x2=&quot;-11.65999984741211 -12.993639847412108 -12.993639847412108 -10.32635984741211 -10.32635984741211 -4.730000019073486 -6.063640019073485 -6.063640019073485 -3.3963600190734873 -3.3963600190734873 1.815000057220459 0.48136005722045994 0.48136005722045994 3.148640057220458 3.148640057220458 8.579999923706055 7.246359923706056 7.246359923706056 9.913639923706054 9.913639923706054&quot;
y2=&quot;0.8030000858306892 1.5730000858306887 3.113000085830688 3.113000085830688 1.5730000858306887 0.6929999523162849 1.4629999523162844 3.0029999523162836 3.0029999523162836 1.4629999523162844 0.6929999523162849 1.4629999523162844 3.0029999523162836 3.0029999523162836 1.4629999523162844 0.6929999523162849 1.4629999523162844 3.0029999523162836 3.0029999523162836 1.4629999523162844&quot;
/&gt;
&amp;lt;bondArray&gt;
&amp;lt;bond atomRefs2=&quot;a1 a2&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a1 a5&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a2 a3&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a3 a4&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a4 a5&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a6 a7&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a6 a10&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a7 a8&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a8 a9&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a9 a10&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a11 a12&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a11 a15&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a12 a13&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a13 a14&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a14 a15&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a16 a17&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a16 a20&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a17 a18&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a18 a19&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a19 a20&quot; order=&quot;2&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a4 a8&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a9 a13&quot; order=&quot;1&quot; /&gt;
&amp;lt;bond atomRefs2=&quot;a14 a18&quot; order=&quot;1&quot; /&gt;
&amp;lt;/bondArray&gt;
&amp;lt;/molecule&gt;
&amp;lt;/MChemicalStruct&gt;
&amp;lt;/MDocument&gt;
&amp;lt;/cml&gt;
&amp;lt;/Molecule&gt;&amp;lt;cd_id&gt;183&amp;lt;/cd_id&gt;&amp;lt;/Row&gt;
&amp;lt;/Rows&gt;&amp;lt;/Complete&gt;&lt;/ns:return&gt;&lt;/ns:runCompleteSearchResponse&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
");
msketch_param("menuconfig", "http://127.0.0.1/i/enovatorchem/marvin/customization.xml" );
mview_param("importConv", "-a");
mview_param("colorScheme", "mono");
mview_param("navmode","zoom");
msketch_end();


Do I need to escape this mol applet parameter? because I have tried to xml escape, unescape, html escape without any luck.

Any help will be appreicated,

Karl


 


 


 


 

User c1ce6b3d19

05-02-2010 12:10:29

Karl,


Try translating the escaped characters back into regular characters before sending them to the applet.



&lt; <




&gt; >




&amp; &




&quot; "


User 2c6aa21beb

05-02-2010 12:12:39

I just checked the applet documentation


http://www.chemaxon.com/marvin/help/developer/sketchman.html


 


and mrv isnt listed?










molFormat Default file format:
mol, csmol,
smiles, cxsmiles,
cml, pdb, pov, sybyl,
or xyz.
mol

 


So am I using the correct parameter to load the mrv??


 


Cheers


Karl

User 2c6aa21beb

08-02-2010 11:55:14

I need assistance to save, retrieve and edit a chemical stucture using the MarvinSketch & the WebServices technologies using a suitable 2d format (not smiles)




 


 



 


 

ChemAxon 7c2d26e5cf

08-02-2010 16:09:36

We are checking the issue.

ChemAxon 7c2d26e5cf

09-02-2010 16:15:27

Marvin could not read the embedded molecule string since it is not encoded by the proper way.


Encode quotes and linebreaks.


" -> \"


linebreak -> \n


If you encode the string properly, you got a long string without linebreaks.


Please see the following examples. They demonstrates how to embed mol and mrv string into applet source:


MarvinSketch Example - Inline mol source


MarvinSketch Example - Inline mrv source