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 in, for instance, molfile format.

If found that I can iterate through the residues and filter them with
something like this:

for obres in openbabel.OBResidueIter(obmol_from_cif_file):
    if obres.GetName() == 'LIG':
        print('ligand res')
    else:
        print('other res')

But it's not clear to me how to create a new mol or to delete the residues
I don't want. If I just use obmol_from_cif_file.DeleteResidue(obres) I end
up getting a Segmentation fault.

Thanks
Tim
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to