[Rdkit-discuss] Delete several Atoms

2017-06-25 Thread Changge Ji
Dear all, Is there an easy way to delete several atoms in a molecule according to an index list ? RWMol RemoveAtom() can only delete one atom each time. And after that, the index changed. Many Thanks. Best, Changge Changge Ji

Re: [Rdkit-discuss] Delete several Atoms

2017-06-25 Thread Brian Kelley
Yes, go backwards through the index list. for index in sorted(indices, reverse=True): mol.RemoveAtom(index) Indices are only changed if they are higher than the removed index. Brian Kelley > On Jun 25, 2017, at 10:16 AM, Changge Ji wrote: > > Dear all, > > Is