Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Geoffrey Hutchison
> I was wrong, the "F" option retains bonds' order and it even works for > aromatic atoms. > For future reference, to generate smiles of fragment by atom indices in > Python you can do: > idxs = [1,2,3,4] > mol.write('smi', opt={'F': ' '.join(map(str, idxs))}).strip() Yes, this method was from

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Maciek Wójcikowski
I was wrong, the "F" option retains bonds' order and it even works for aromatic atoms. For future reference, to generate smiles of fragment by atom indices in Python you can do: > idxs = [1,2,3,4] > mol.write('smi', opt={'F': ' '.join(map(str, idxs))}).strip() Pozdrawiam, | Best regards,

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Maciek Wójcikowski
No worries :) I planned to do Chem.FindAtomEnvironmentOfRadiusN() and Chem.PathToSubMol() in RDKit, but the function you've suggested is also feasible. @Geoff - the smiles fragment does not perserve any bond information from what I've tested so far. Pozdrawiam, | Best regards, Maciek

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Geoffrey Hutchison
> 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. It doesn't have to be a disconnected portion. That feature to the SMILES writer will take a bit mask for the fragment -- it can be any

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Andrew Dalke
On Jun 19, 2017, at 16:39, Maciek Wójcikowski wrote: > > 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): Perhaps you want

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Maciek Wójcikowski
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

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Maciek Wójcikowski
The last BeginModify should be EndModify. Pozdrawiam, | Best regards, Maciek Wójcikowski mac...@wojcikowski.pl 2017-06-19 16:39 GMT+02:00 Maciek Wójcikowski : > I'm trying to get back the ECFP environments, most preferably as smiles. > So it's literally a list of

Re: [Open Babel] Submolecule from OBMol

2017-06-19 Thread Noel O'Boyle
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 wrote: > Hi all, > > Quick