From 4674dd9a2b8f4d8207dea15899e8a4de226921e0 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Thu, 9 Nov 2023 12:04:39 -0500 Subject: [PATCH] Only use names if the user specifies names. --- HISTORY.rst | 5 +++++ from_smiles_step/from_smiles.py | 21 +-------------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8c1dbde..a70f35c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,11 @@ History ======= +2023.11.9.1 -- Removed using structure names when perceiving type + * Using structure names is too dangerous to use by perceiving if text is a name of + SMILES and there is no easy test for valid SMILES. So change to only using names + if the user specifies names. + 2023.11.9 -- Improved structure handling, added from names * Switched to standard structure handling, which adds more options * Added getting structures from Pubchem using the chemical name. diff --git a/from_smiles_step/from_smiles.py b/from_smiles_step/from_smiles.py index c910f1a..76f3ceb 100644 --- a/from_smiles_step/from_smiles.py +++ b/from_smiles_step/from_smiles.py @@ -121,28 +121,9 @@ def run(self): notation = "InChI" else: notation = "SMILES" - # Some characters are not valid in SMILES - # fmt: off - for c in ( - "d", "f", "g", "h", "i", "j", "k", "l", "m", - "q", "r", "t", "u", "v", "w", "x", "y", "z" - ): - # fmt: on - if c in text: - notation = "name" - break if notation == "SMILES": - if P["notation"] == "perceive": - try: - # See if it is a name... - configuration.PC_from_identifier(text, namespace="name") - except Exception as e: - print(f"PubCHem exception {e}") - # SMILES? - configuration.from_smiles(text, rdkit=True) - else: - configuration.from_smiles(text) + configuration.from_smiles(text) elif notation == "InChI": configuration.from_inchi(text) elif notation == "InChIKey":