Skip to content

Commit

Permalink
assign stereochemistry in SmallMol from Molecule conformer. Default s…
Browse files Browse the repository at this point in the history
…anitize and kekulize to False since we want the original information of the molecule
  • Loading branch information
stefdoerr committed Jan 28, 2025
1 parent df9b190 commit 6f9dc83
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions moleculekit/smallmol/smallmol.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,15 @@ def _fromMolecule(self, mol, _logger, **kwargs):
_mol.AddConformer(conf, assignId=True)

# print(Chem.MolToSmiles(_mol))
if kwargs.get("sanitize", True):
Chem.SanitizeMol(_mol) # , Chem.SANITIZE_ALL ^ Chem.SANITIZE_ADJUSTHS)
if kwargs.get("kekulize", True):
if kwargs.get("sanitize", False):
Chem.SanitizeMol(_mol)
if kwargs.get("kekulize", False):
Chem.Kekulize(_mol)

Chem.AssignStereochemistryFrom3D(_mol)
if _logger:
logger.info(
f"Converted Molecule to SmallMol with SMILES: {Chem.MolToSmiles(_mol)}"
f"Converted Molecule to SmallMol with SMILES: {Chem.MolToSmiles(_mol, kekuleSmiles=True)}"
)

if mol.numAtoms != _mol.GetNumAtoms():
Expand Down

0 comments on commit 6f9dc83

Please sign in to comment.