Skip to content

Commit

Permalink
Added support for multiple smile options
Browse files Browse the repository at this point in the history
  • Loading branch information
kmlefran committed Oct 16, 2023
1 parent 8a8392a commit d295fb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion group_decomposition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
A plugin for extracting data from .sum files and manipuating them
"""

__version__ = "0.5.1"
__version__ = "0.5.2"
7 changes: 4 additions & 3 deletions group_decomposition/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,12 @@ def _add_cml_single_atoms_bonds(el_list, bond_list):
return rwmol


def smiles_from_cml(cml_file):
"""Finds the Retreivium input SMILES in a cml file
def smiles_from_cml(cml_file, smile_tag="retrievium:inputSMILES"):
"""Finds the Retreivium SMILES in a cml file with a given label
Args:
cml_file: cml file name
smile_tag: the label fo the SMILEs in the cml file. Defaults to input SMILEs
Returns:
string of the input SMILES code tagged in the file as retrievium:inputSMILES
Expand All @@ -236,7 +237,7 @@ def smiles_from_cml(cml_file):
flag = 0
with open(cml_file, encoding="utf-8") as file:
for line in file:
if "retrievium:inputSMILES" in line:
if smile_tag in line:
flag = 1
elif flag == 1:
smile = line.split(">")[1].split("<")[0]
Expand Down

0 comments on commit d295fb9

Please sign in to comment.