setMol Deprecated

User 6e04fc94c3

13-01-2014 17:51:20

We're migrating our code base to use Marvin for Javascript but I've noticed the current setMol() functionality in the Applet version has been deprecated. I'm wondering if there a substitute method?


Currently, the Applet version will accept a molecule name (non-IUPAC), IUPAC, or SMILES via setMol(). It seems the new Javascript implementation relies on web services to evaluate an IUPAC and retrieve structure data in order to set the Marvin canvas.


Unfortunately, our test case, 'Benzene' doesn't work under this new model.


Old way:


document.MSketch.setMol(mol, opts);


Where mol = name, iupac, or smiles string.

User 6e04fc94c3

22-01-2014 22:02:45

Use case:

Our user would like to enter the name '2,4-diaminoanisole' and have the Marvin4JS canvas set to that molecule. In our GUI we also include the IUPAC, SMILES, Mol weight, and Formula for reference. As stated in my earlier post, the previous version of Marvin would accept any three molecule identifiers and also provide the other fields.


As a work around, I've found the appropriate REST call will convert from name, iupac, or smiles string into the MRV format required by Marvin4JS. Additionally, the 'chemicalTerms()' method built into the REST web services will calculate the other information for our GUI.


In this example, the user can put in for "structure" any of the following:
name: 2,4-diaminoanisole
iupac: 4-methoxybenzene-1,3-diamine
smiles: COC1=C(N)C=C(N)C=C1


REST url:
/webservices/rest-v0/util/detail

POST JSON:
{ "structures":
[{"structure": "2,4-diaminoanisole"}],
"display": {"include": ["structureData"],
"additionalFields": {"iupac": "chemicalTerms(name)",
"formula": "chemicalTerms(formula)",
"mass": "chemicalTerms(mass)",
"smiles" : "chemicalTerms(molString('smiles'))"},
"parameters": {"structureData": "mrv"}
}
}

Result:
{
"data": [
{
"structureData": {
"structure": ommited for clarity,
"format": "mrv",
"contentUrl": ommited for clarity,
"contentBaseUrl": omitted for clarity
},
"iupac": "4-methoxybenzene-1,3-diamine",
"formula": "C7H10N2O",
"mass": 138.1671,
"smiles": "COC1=C(N)C=C(N)C=C1"
}
],
"headers": {
"structureData": {
"name": "structureData",
"type": "STRUCTUREDATA",
"source": "GENERATED"
},
"iupac": {
"name": "iupac",
"type": "COMPLEX",
"source": "CALCULATOR"
},
"formula": {
"name": "formula",
"type": "COMPLEX",
"source": "CALCULATOR"
},
"mass": {
"name": "mass",
"type": "COMPLEX",
"source": "CALCULATOR"
},
"smiles": {
"name": "smiles",
"type": "COMPLEX",
"source": "CALCULATOR"
}
}
}

ChemAxon 00ec07c969

28-01-2014 11:07:47

Dear Kevin,


Unfortunately, you cannot display data  on the canvas of  Marvin for JavaScript editor. Marvin  for JS is written in javascript independently form  the JAVA-based Marvin applet, and is not a direct substitution of it.  Marvin for JS requires web service to import/export SMILES or IUPAC names


I send you a link to one of our demo examples, which is about importing/exporting SMILES to and from Marvin for JS.


https://marvin4js.chemaxon.com/marvin4js-latest/examples/example-molconvert.html


 


As for the other properties you also included in your GUI (IUPAC, SMILES, Mol weight, and Formula), you might consider writing them on your HTML page outside the Marvin for JS canvas.


Best reagrds,


Dóra