From 1581012194f99ff776a23d520a187164df3ee125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr> Date: Wed, 5 Sep 2018 10:03:33 +0200 Subject: [PATCH] compute 2D coordinates during SMILES to MOL conversion to enable loading SMILES in MarvinJS (related to #83) Former-commit-id: f3f0006b98d5bb0f5e303c14e1f7fc8c0bf03f9f --- ippisite/ippidb/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ippisite/ippidb/utils.py b/ippisite/ippidb/utils.py index 3927f824..ec26172d 100644 --- a/ippisite/ippidb/utils.py +++ b/ippisite/ippidb/utils.py @@ -9,6 +9,11 @@ def mol2smi(mol_string): def smi2mol(smi_string): m = pybel.readstring('smi', smi_string) + # generate 2D coordinates for MarvinJS layout + #NB: the line below should be replaced as soon as the new version of openbabel + # is out (>2.4.1), by a call to m.make2D() + # (see https://github.com/openbabel/openbabel/blob/06e233e2ca0c6d9f86f74bafe74ffcb75e9d76cd/scripts/python/pybel.py#L577) + pybel._operations['gen2D'].Do(m.OBMol) return m.write(format='mol') class FingerPrinter(object): -- GitLab