Converting "Multiconformer" Sdf To Multistate Pdb With Openbabel
1
0
Entering edit mode
11.7 years ago

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

python pdb conversion • 5.6k views
ADD COMMENT
0
Entering edit mode
11.7 years ago
Aldo ▴ 60

You should try this:

babel *.sdf -opdb -m

Also, check "File Conversion" section on this link: http://openbabel.org/wiki/Tutorial:Basic_Usage

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1728 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6