Skip to content

Commit

Permalink
make deepsmiles optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Maik Jablonka committed Oct 2, 2023
1 parent 07dff2f commit fa46652
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/chemlift/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
from rdkit import Chem
import selfies as sf

import time

import deepsmiles

import requests


Expand Down Expand Up @@ -47,6 +47,7 @@ def smiles_to_selfies(smiles):
"""
Takes a SMILES and return the selfies encoding.
"""
import selfies as sf

return [sf.encoder(smiles)]

Expand All @@ -55,6 +56,8 @@ def smiles_to_deepsmiles(smiles):
"""
Takes a SMILES and return the DeepSMILES encoding.
"""
import deepsmiles

converter = deepsmiles.Converter(rings=True, branches=True)
return converter.encode(smiles)

Expand Down

0 comments on commit fa46652

Please sign in to comment.