Re: [Open Babel] extracting ligands from macromolecular structures

2023-03-05 Thread Tim Dudgeon
Thanks. I'd already tried Richard's suggestion, and it works, but just for completeness, it seems that you need to collect the residues and the atoms and then delete both (in that order) for it to work correctly. Then I tried Noel's suggestion and that also seems to work, and is quite a bit simpler

Re: [Open Babel] extracting ligands from macromolecular structures

2023-03-04 Thread Noel O'Boyle
Also OBMol::CopySubstructure as described at https://baoilleach.blogspot.com/2018/05/when-all-you-want-is-ring.html and https://openbabel.github.io/api/3.0/classOpenBabel_1_1OBMol.shtml#a3271860ee44de0d38a27102c79913b1b . Should be quite a bit faster I would think. On Fri, 3 Mar 2023, 14:19 Richar

Re: [Open Babel] extracting ligands from macromolecular structures

2023-03-03 Thread Richard Overstreet
Hi Tim, Deleting residues can be tricky. I've found the following to work well. from openbabel import openbabel obconversion = openbabel.OBConversion() obconversion.SetInAndOutFormats("pdb", "pdb") mol = openbabel.OBMol() path = obconversion.ReadFile(mol, 'demo.pdb') non_lig_atoms=[] for i in

[Open Babel] extracting ligands from macromolecular structures

2023-03-03 Thread Tim Dudgeon
I'm trying to work out how to use openbabel from Python to perform operations such as extracting out ligands from macromolecules in PDB or CIF format. For instance, if I have a ligand that has the residue name of LIG, how do I create a new molecule with just that ligand so that I can write it out i