hi all,
i'm trying to use a basic
`pybel.readfile()` --> modify molecule --> `newmol.write()` pattern,
but something is not going right.
the specific task is to add unique atom indices to a PDBQT file
without them, but that conversion seems to be working fine.
but the resulting output PDBQT contains only the REMARKS header
from the original file? i'm not able to debug very far because
of the Swig wrapper around the OBMol.
i'm attaching the routine, and a sample PDBQT file.
does anyone see the problem? thanks for any pointers,
Rik
def addAtomIdx(pdbqf):
'''write new version of pdbqf with indexed atom names, rename old file
..._NoAtomIdx.pdbqt
'''
atbl = defaultdict(int) #
allMol = pybel.readfile('pdbqt', pdbqf)
ligMol = allMol.next() # ASSUME only one mol PDBQT
obmol = ligMol.OBMol
for res in ob.OBResidueIter(obmol):
for obatom in ob.OBResidueAtomIter(res):
pbatom = pybel.Atom(obatom)
idx = pbatom.idx
atName = res.GetAtomID(obatom).strip()
atbl[atName] += 1
newAname = atName + '%d' % (atbl[atName])
res.SetAtomID(obatom,newAname)
# print res.GetName(),atName,newAname,res.GetAtomID(obatom)
pathName,basename = os.path.split(pdbqf)
ppos = basename.find('.')
bakFname = basename[:ppos]+'_NoAtomIdx.pdbqt'
bakPath = pathName + bakFname
os.rename(pdbqf, bakPath)
pybelmol = pybel.Molecule(obmol)
pybelmol.write('pdbqt',pdbqf,overwrite=True)
USER ADVS_Vina_result> 2013-6-9 10:4:35
USER ADVina_rec> s3NF8_A
USER ADVina_poses> 9
USER ADVina_input_file> AVX101125_0_VINoutput.pdbqt
USER ADVina_results> 1
USER ADVina_histogram>
-8.200:0.000:0.000,-8.100:12.834:15.353,-8.100:12.146:15.071,-7.800:12.176:14.757,-7.800:3.542:7.615,-7.400:1.442:2.286,-7.400:2.340:3.825,-7.400:3.207:7.712,-7.300:12.470:14.948
MODEL 1
USER # energy, leff
USER ADVina_pose1> -8.200, -0.273
USER ADVina_pose1_hba> N:UNK1:O~~A:THR174:OG1,N:UNK1:O~~A:GLU170:N
USER ADVina_pose1_hbd> N:UNK1:N~~B:GLN95:O
USER ADVina_pose1_vdw>
B:THR125:CG2,B:GLN95:CG,B:GLN95:CD,B:ALA98:CB,A:THR174:CG2,A:MET178:CE,B:ALA129:CB,B:ALA129:CA,B:THR125:O,B:ALA128:CB,B:ALA128:C,B:ALA129:N,B:THR125:C,B:GLN95:CA,B:GLN95:C,B:GLN95:CB,B:GLN95:O,B:TYR99:N,B:ALA98:C,B:TYR99:CA,B:TYR99:CB,A:THR174:HG1,A:THR174:OG1,B:TYR99:CD1,B:TYR99:CG,A:THR174:CB,B:GLN95:OE1,B:GLU96:OE2,B:GLU96:CD,A:LYS173:NZ,A:LYS173:HZ3,A:LYS173:CE,A:HIS171:CE1,A:HIS171:ND1,A:HIS171:CB,A:HIS171:CG,A:LYS173:CD,A:LYS173:CG,A:ALA169:CA,A:GLU170:N,A:GLU170:H,A:ALA169:C,A:GLU170:CB,A:GLU170:CA,A:GLN168:C,A:GLN168:O,A:ALA169:CB
USER ADVina_pose1_source> AVX101125_0_VINoutput.pdbqt:1
REMARK 6 active torsions:
REMARK status: ('A' for Active; 'I' for Inactive)
REMARK 1 A between atoms: C_12 and C_19
REMARK 2 A between atoms: C_13 and C_18
REMARK 3 A between atoms: C_14 and C_20
REMARK 4 A between atoms: C_15 and C_21
REMARK 5 A between atoms: C_19 and C_23
REMARK I between atoms: C_20 and N_25
REMARK 6 A between atoms: C_23 and N_25
ROOT
HETATM 1 C UNK N 1 11.206 -46.499 -1.411 0.00 0.00 0.022 C
HETATM 2 C UNK N 1 10.880 -45.241 -1.785 0.00 0.00 -0.029 C
ENDROOT
BRANCH 2 3
HETATM 3 C UNK N 1 9.913 -44.435 -1.019 0.00 0.00 -0.028 A
HETATM 4 C UNK N 1 10.334 -43.676 0.095 0.00 0.00 0.012 A
HETATM 5 C UNK N 1 9.409 -42.903 0.823 0.00 0.00 0.001 A
HETATM 6 C UNK N 1 8.053 -42.885 0.444 0.00 0.00 0.000 A
HETATM 7 C UNK N 1 7.625 -43.643 -0.663 0.00 0.00 0.001 A
HETATM 8 C UNK N 1 8.551 -44.415 -1.389 0.00 0.00 0.012 A
ENDBRANCH 2 3
BRANCH 2 9
HETATM 9 C UNK N 1 11.439 -44.572 -3.038 0.00 0.00 0.162 C
BRANCH 9 10
HETATM 10 N UNK N 1 12.854 -44.852 -3.248 0.00 0.00 -0.353 N
HETATM 11 C UNK N 1 13.859 -44.300 -2.553 0.00 0.00 0.252 C
HETATM 12 O UNK N 1 13.697 -43.427 -1.701 0.00 0.00 -0.268 OA
HETATM 13 H UNK N 1 13.077 -45.550 -3.943 0.00 0.00 0.163 HD
BRANCH 11 14
HETATM 14 C UNK N 1 15.235 -44.776 -2.921 0.00 0.00 0.034 A
HETATM 15 C UNK N 1 15.555 -45.046 -4.273 0.00 0.00 0.034 A
HETATM 16 C UNK N 1 16.857 -45.472 -4.606 0.00 0.00 0.088 A
HETATM 17 N UNK N 1 17.788 -45.610 -3.637 0.00 0.00 -0.375 N
HETATM 18 C UNK N 1 17.532 -45.354 -2.336 0.00 0.00 0.088 A
HETATM 19 H UNK N 1 18.725 -45.919 -3.899 0.00 0.00 0.164 HD
HETATM 20 C UNK N 1 16.249 -44.925 -1.943 0.00 0.00 0.034 A
ENDBRANCH 11 14
ENDBRANCH 9 10
ENDBRANCH 2 9
BRANCH 1 21
HETATM 21 C UNK N 1 10.746 -47.167 -0.183 0.00 0.00 -0.016 A
HETATM 22 C UNK N 1 9.477 -47.800 -0.243 0.00 0.00 0.015 A
HETATM 23 C UNK N 1 8.926 -48.449 0.880 0.00 0.00 0.040 A
HETATM 24 C UNK N 1 9.683 -48.462 2.058 0.00 0.00 0.106 A
HETATM 25 C UNK N 1 10.933 -47.875 2.127 0.00 0.00 0.122 A
HETATM 26 O UNK N 1 9.366 -49.023 3.252 0.00 0.00 -0.323 OA
HETATM 27 C UNK N 1 11.523 -47.225 1.020 0.00 0.00 0.087 A
HETATM 28 O UNK N 1 11.436 -48.070 3.377 0.00 0.00 -0.322 OA
HETATM 29 C UNK N 1 10.459 -48.777 4.093 0.00 0.00 0.352 A
BRANCH 27 30
HETATM 30 C UNK N 1 12.915 -46.645 1.137 0.00 0.00 0.213 C
HETATM 31 O UNK N 1 13.895 -47.422 1.121 0.00 0.00 -0.644 OA
HETATM 32 O UNK N 1 13.065 -45.405 1.232 0.00 0.00 -0.644 OA
ENDBRANCH 27 30
ENDBRANCH 1 21
TORSDOF 6
ENDMDL 1
------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss