I'm trying to get back the ECFP environments, most preferably as smiles. So
it's literally a list of connected atoms.

The dumb solution goes as follows:

def submol(mol, idxs):
>     mol_clone = mol.clone
>     mol_clone.OBMol.BeginModify()
>     delete_atoms = []
>     for i in reversed(range(len(mol.atoms))):
>         if i in idxs:
>             continue
>         delete_atoms.append(mol_clone.OBMol.GetAtomById(i))
>     for atom in delete_atoms:
>         mol_clone.OBMol.DeleteAtom(atom)
>     mol_clone.OBMol.BeginModify()
>     return mol_clone


----
Pozdrawiam,  |  Best regards,
Maciek Wójcikowski
mac...@wojcikowski.pl

2017-06-19 15:53 GMT+02:00 Noel O'Boyle <baoille...@gmail.com>:

> This would be a useful API function.
>
> If it's a disconnected portion of the molecule, and you wanted to
> write a smiles, there is a fragment option for the smiles writer that
> you could use.
>
> - Noel
>
> On 17 June 2017 at 21:44, Maciek Wójcikowski <mac...@wojcikowski.pl>
> wrote:
> > Hi all,
> >
> > Quick question: I have OBMol and want to create a sub-molecule from a
> subset
> > of atoms given by atom/bond indices. Is there a clever way to do it in
> > OpenBabel? I'm aware that I can make a copy and prune the unwanted atoms
> ;)
> >
> > ----
> > Pozdrawiam,  |  Best regards,
> > Maciek Wójcikowski
> > mac...@wojcikowski.pl
> >
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > OpenBabel-discuss mailing list
> > OpenBabel-discuss@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> >
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to