Re: [Rdkit-discuss] canonical fragment SMILES

2025-03-28 Thread Pavel Polishchuk
Thank you, Wim. It works. Even a simpler solution can be to remove all atoms except required ones. I had to guess :) However, this is a bug in the recent RDKit versions. The function MolFragmentToSmiles works correctly in version 2023, but not in 2024. On 28/03/2025 00:10, Wim Dehaen wrote: Pa

Re: [Rdkit-discuss] canonical fragment SMILES

2025-03-27 Thread Wim Dehaen
Pavel, this is a bit hacky, but you can try the below: ``` def get_frag_smi(mol,frag_atoms): if len(frag_atoms) > 1: b2b = [] # bonds to break fsmi = "" #fragment smiles # get bonds outside of fragment for b in mol.GetBonds(): b_idx = b.GetBeginAtomId