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"
}
}
}