User eda6f877b4
11-09-2014 18:40:01
I am porting from MarvinView to Marvin JS. I need to load a structure from the database stored in standard structure table.
With the MarvinView reading the cd_structure from the db, this could be parsed directly. As I see Marvin JS only displays MOL or MRV format.
What is the recommended approach for this scenario..?
(using jchem for .net)
ChemAxon 7c2d26e5cf
12-09-2014 08:55:47
User eda6f877b4
12-09-2014 09:05:47
Hi Tamas,
Greatly appreciate your answers here!
I am familiar with the function importStructure("mol", s);
If I want to import the data stored in cd_structure into the sketcher, is it correct that this can only be done if the WS is installed..?
(I don't have the WS currently..)
So my alternative here would be to select the cd_structure from db convert to mol and the import this into the sketcher. (is that not correct?)
If yes, I was just wanting an example of performing the conversion from db stored data to the mol format.
ChemAxon 7c2d26e5cf
12-09-2014 10:31:04
I recommend to install JChem WS.
Do all compounds present in the same format in cd_structure?
If yes, you do not need extra step, just call importStructure function with the right format parameter.
E.g.: importStructure("smiles", s)
If no, I guess you can do this conversion on the fly with JChem WS when you retrieve records.
Please, consult with the manual of JChem WS or post to the JChem WS forum to get further info about JChem WS.
User eda6f877b4
12-09-2014 10:54:50
Hi Tamas:
I realize that the WS solution would be the best, but for now that is not an option :-(
I have pasted below here the generated JS code for the final page:
var marvinSketcherInstance;
var lastMol = "C1CCC(CC1)P(C1CCCCC1)C1CCCCC1.Cc1cc(C)c(N2CCN(C2=[Ru](Cl)(Cl)=Cc2ccccc2)c2c(C)cc(C)cc2C)c(C)c1";
var showSketcher = true;
$(document).ready(function () {
if (showSketcher) {
MarvinJSUtil.getEditor("#sketch").then(function (sketcherInstance) {
marvinSketcherInstance = sketcherInstance;
if (lastMol) {
//Import mol
marvinSketcherInstance.importStructure("smiles", lastMol).catch(function (error) {
alert(error);
});
}
initControl();
}, function (error) {
alert("Cannot retrieve sketcher instance:" + error);
});
}
});
Doing this the sketcher is loading without any problems but the canvas is blank and not displaying my structure..
ChemAxon 7c2d26e5cf
12-09-2014 11:11:13
If JChem WS is not installed, SMILES import will not work.
In this case, you can pass structures in mol (MDL molfile v2000) or in mrv format:
marvinSketcherInstance.importStructure("mol", lastMol)
marvinSketcherInstance.importStructure("mrv", lastMol)
User eda6f877b4
12-09-2014 11:30:57
OK.
Do you have an API example on stock for converting from cd_structure -> mol or mrv..?
Dann
ChemAxon d4fff15f08
15-09-2014 14:23:03
User eda6f877b4
16-09-2014 07:18:50
Hi Both,
Thanks for the help. I am all set with Marvin JS !
BR
Dann