Collections:
indigo.convert() - Convert Structure Formats
How to convert file formats of a given structure with the indigo.convert() method?
✍: FYIcenter.com
If you want to convert a chemical structure from one file format to another,
you can use the indigo.convert() method on the Ketcher Indigo interface.
The indigo.convert(input, opts) method takes two arguments:
Here is an HTML document that shows you how to convert the chemical structure from SMILES format to other formats.
<html>
<!-- indigo-convert-structure-format.html Copyright (c) FYIcenter.com. -->
<head>
<title>Convert Structure File Formats</title>
</head>
<body>
<p>Create a chemical structure, then click convert button below the editor:</p>
<iframe id=frmKetcher src="/ketcher/index.html"
style="width: 680px; height: 400px;"></iframe>
<p><button onclick="convert();">Convert Structure Format</button></p>
<pre id=output style="background-color: #ddd;"></pre>
<script>
var ketcher = null;
function convert() {
frm = document.getElementById("frmKetcher");
ketcher = frm.contentWindow.ketcher;
indigo = ketcher.indigo;
promiseSmiles = ketcher.getSmiles();
promiseSmiles.then(consumeSmiles, consumeError);
}
function consumeSmiles(result) {
document.getElementById("output").innerHTML = "";
document.getElementById("output").innerHTML += "SMILES:\n";
document.getElementById("output").innerHTML += result+"\n\n";
indigo.convert(result, {outputFormat: "chemical/x-inchi"})
.then(function(value) {
document.getElementById("output").innerHTML += "InChI:\n";
document.getElementById("output").innerHTML += value.struct+"\n\n";
return indigo.convert(result, {outputFormat: "chemical/x-indigo-ket"});
},
consumeError)
.then(function(value) {
document.getElementById("output").innerHTML += "Ketcher:\n";
document.getElementById("output").innerHTML += value.struct+"\n\n";
return indigo.convert(result, {outputFormat: "chemical/x-mdl-molfile"});
},
consumeError)
.then(function(value) {
document.getElementById("output").innerHTML += "MDL Molfile:\n";
document.getElementById("output").innerHTML += value.struct+"\n\n";
},
consumeError);
}
function consumeError(error) {
document.getElementById("output").innerHTML = "";
document.getElementById("output").innerHTML += "Error:\n";
document.getElementById("output").innerHTML += error+"\n\n";
}
</script>
</body>
</html>
Open the above HTML document on your local Web server. Draw a molecule in the editor.
Click "Convert Structure Format" button, you will see that the SMILES representation of the molecule and other structure file formats:
For other chemical structure MIME types, see Chemical file format at wikipedia.org.
⇒ Ketcher File Format for Chemical Structures
2023-10-12, 1478🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1005668 Names: InChIKey: BECWEDJJQMUFRO-UHFFFAOYS A-NSMILES: BrCc1cccc(OBr...
Molecule Summary: ID: FYI-1000353 SMILES: Cc1cn(c(=O)[nH]c1=O)[C@H ]2C[C@H]([C@@H](O2)CO)OReceived a...
Molecule Summary: ID: FYI-1000357 SMILES: C1=CC=C(C2=CC=CC=C12)[C@ H](N1CC[C@H](CC1)C(=O)NC CC1=CC=C(C...
Molecule Summary: ID: FYI-1005055 Names: InChIKey: VWWQXMAJTJZDQX-UYBVJOGSS A-NSMILES: Cc6cc5nc1c(=O...
Molecule Summary: ID: FYI-1002237 Names: InChIKey: PPCMXWAVIIIOQZ-CAOOACKPS A-NSMILES: Cc1ccccc1/N=C...