> Specifically I want to take as input a protein pdb file, and a small molecule 
> as sdf input, then output a pdb containing both structures.


That's pretty easy:

from openbabel import pybel

protein = next(pybel.readfile("pdb", "filename.pdb"))
print(len(protein.atoms))
small = pybel.readfile("mol", "filename.sdf")
print(len(small.atoms))

protein.OBMol += small.OBMol
print(len(protein.atoms)) # more atoms

protein.write('pdb', 'new_file.pdb', overwrite=False)


Hope that helps,
-Geoff

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

Reply via email to