MSketch getMol function

User e34a92cce5

05-10-2010 15:50:28

Hi,


I am using Marvin Sketch on my web application to allow my users to draw their structures and then have them run their searches (using JChem Web Services). This has been running well except in a few instances, when users try to draw certain structures for which Marvin Sketch is unable to generate the smiles query string. The function that I use to generate the query string isone that came with the documentation:


if(document.MSketch != null)
        {
        var s = document.MSketch.getMol('smiles');
        s = unix2local(s); // Convert "\n" to local line separator
        currentform.structure_query.value = s;
        if(!s)
            {
            alert("Please enter a valid structure");
            return false;
            }
        else
            {
            return true;
            }
        }


and the query structure is one that I have attached to this message. When I debugged, it looks like MSketch is unable to get a valid smiles string for the attached structure and hence user get the "Please enter a valid structure" alert. Is there a way to work around this, since I am able to run this query within Instant JChem.


Thanks

ChemAxon 990acf0dec

06-10-2010 16:39:49

Hi,


Your structure contains "Any" bonds, which cannot be represented in SMILES format. You should use a format that enables the usage of the Any bond, like SMARTS, Mrv or MOL.


 


Best regards,


Akos

User e34a92cce5

10-02-2016 19:00:06

I have been contemplating moving to the javascript version of Marvin Sketch, especially since Google Chrome has stopped supporting Java runtime. However, I am having trouble finding documentation that could switch my existing code to convert a drawn structure into a format that can be used for searching. I for sure do not want to go to the new JChem webservices, since my existing version (5.5) which does not support structure conversion from Marvin JS has been otherwise working well. So my question is how can the following be done in MarvinJS without updating JChem web services :


var s = document.MSketch.getMol('smiles');
currentform.structure_query.value = s; 

ChemAxon 7c2d26e5cf

11-02-2016 08:55:11

The pure Marvin JS supports only MRV and MDL molfile (v2000) formats. Marvin JS can collaborate with JChem WS (REST) . If JChem WS is available, Marvin JS can also handle other chemical formats (like SMILES).


Your JChem WS version is too old, it still not support the required REST protocol.


If you have the new JChem WS, getting SMILES from the editor is very easy. Use the exportStructure function of the editor. Please see the following example: Marvin JS Example - Get The Molecule.
In this example, MRV format is preferred. If you replace the parameter of the exportStructure function to "smiles", the result will be in SMILES format (instead of MRV).


Without upgrading of JChem WS, transform the drawn structure to SMILES format is more complicated.


In this case, get the drawn structure from the editor in "mrv" (or "mol") format and write some custom code that sends the molecule source to the old JChem WS to convert it to the proper format.


Since both ways require asynchronous communication with the server, you can not use synchronous JavaScript code like in your applet example.

User e34a92cce5

11-02-2016 18:11:56

Thanks for the response, Tamas. 


So, it looks like I have to stick to the Java based Marvin, since my JChem web services (5.5) does not support REST. Are there any internal tools that you have access to which can do the MRV to SMILES/SMARTS conversion for me. I have used molconvert in the past but it'd be nice to have javascript functions that could do it so that I can pass it along to the form variables for submission.  Also, do the newer versions of web services support SOAP. If they do, I could try upgrading the web services.

ChemAxon 13811e1703

12-02-2016 10:37:54

Hi,

You can deploy JChem REST Web Services together with the old SOAP version (into dedicated application server instances) Then MarvinJS can be configured to use the rest service for structure conversion, and you can continue using the soap version for other purposes.

Although it is highly recommended to switch to JChem REST Web Services completely, the soap version is not supported anymore. You can find interactive documentation here:
https://restdemo.chemaxon.com/apidocs/ />
We can help you in the migration process, all of the functionality in the soap version is available in the rest api.


Regards,
Peter 

User e34a92cce5

10-06-2016 19:30:47

Are there any earlier versions of JChem web services that support both SOAP and REST API?

ChemAxon 13811e1703

14-06-2016 06:43:58

Hi,

The current version has only REST  api. The old version with SOAP api is not supported enymore.

Regards,
Peter 

User 9f246fa673

19-10-2016 20:06:22










plajko wrote:

Hi,

You can deploy JChem REST Web Services together with the old SOAP version (into dedicated application server instances) Then MarvinJS can be configured to use the rest service for structure conversion, and you can continue using the soap version for other purposes.

Although it is highly recommended to switch to JChem REST Web Services completely, the soap version is not supported anymore. You can find interactive documentation here:
https://restdemo.chemaxon.com/apidocs/ />
We can help you in the migration process, all of the functionality in the soap version is available in the rest api.


Regards,
Peter 



 


Where can I find the help you mention here for migrating old soap to use new REST api?


We are currently on 5.11.2 in production but planning migration to JCHem 16.9.5.


 


Jim