Entering edit mode
11.4 years ago
quentin.delettre
▴
440
Dear biostar users,
In a python script i need to read an sdf file that contain multiple conformation of the same molecule and convert it to a multistate pdb.
The problem is that i can't see how to do it with openbabel in python and i would prefer not to call obabel as a subprocess.
from openbabel import *
...
#3D conformers to pdb
inputfile = args.input
try:
conv = OBConversion()
conv.SetInAndOutFormats("sdf","pdb")
mol= OBMol()
conv.ReadFile(mol,inputfile)
conv.WriteFile(mol,inputfile[:-4]+".pdb")
except:
raise
I think there would be some function that allow to read each conformer one by one and append each one in the pdb file as state.
Thanks
I think you read too fast. I don't want to call babel/obabel inside my script as an external program. I want to use the right functions with python that can do that (For example : http://openbabel.org/docs/2.3.1/UseTheLibrary/PythonDoc.html )
And even if i wanted to use obabel/babel, i don't want multiple file output. I want multiple states for one molecule in a pdb. No need for -m flag, it works fine without.