Skip to content

Commit

Permalink
Fix molecule deletion issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eachanjohnson committed Sep 22, 2024
1 parent 11f8c69 commit 7eb67f7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/metabolism/connect-metabolites.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ def _clean_smiles_list(smiles: str) -> str:
smiles = smiles.replace(".[H+].", "").replace(".[H+]", "").replace("[H+].", "")
mol = MolFromSmiles(smiles)
for remover in removers:
mol = remover(mol)
return MolToSmiles(mol)
if mol is not None:
mol = remover(mol)
if mol is not None:
return MolToSmiles(mol)
else:
return ''


def clean_metabolites(table: pd.DataFrame,
Expand Down

0 comments on commit 7eb67f7

Please sign in to comment.