Skip to content

Commit

Permalink
Only use names if the user specifies names.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsaxe committed Nov 9, 2023
1 parent b51dab6 commit 4674dd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 1 addition & 20 deletions from_smiles_step/from_smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 4674dd9

Please sign in to comment.