Skip to content
Snippets Groups Projects
Commit 88fd1fd1 authored by Bienchen's avatar Bienchen
Browse files

Fixing PDBize

parent 103cf37e
Branches
Tags
No related merge requests found
......@@ -357,14 +357,25 @@ def _PDBize(biounit, asu, seqres=None, min_polymer_size=10,
return atom_pos_wrong
chain_names='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'
cur_chain_name = 0
water_chain = mol.ChainHandle()
ligand_chain = mol.ChainHandle()
a_pos_wrong = False
pdb_bu = mol.CreateEntity()
edi = pdb_bu.EditXCS(mol.BUFFERED_EDIT)
chains = biounit.GetChainList()
c_intvls = biounit.GetChainIntervalList()
o_intvls = biounit.GetOperationsIntervalList()
# create list of operations
# for cartesian products, operations are stored in a list, multiplied with
# the next list of operations and re-stored... until all lists of operations
# are multiplied in an all-against-all manner.
operations = biounit.GetOperations()
for i in range(0,len(c_intvls)):
trans_matrices = list()
if len(operations) > 0:
for op in operations[0]:
l_operations = operations[o_intvls[i][0]:o_intvls[i][1]]
if len(l_operations) > 0:
for op in l_operations[0]:
rot = geom.Mat4()
rot.PasteRotation(op.rotation)
trans = geom.Mat4()
......@@ -372,9 +383,9 @@ def _PDBize(biounit, asu, seqres=None, min_polymer_size=10,
tr = geom.Mat4()
tr = trans * rot
trans_matrices.append(tr)
for op_n in range(1, len(operations)):
for op_n in range(1, len(l_operations)):
tmp_ops = list()
for o in operations[op_n]:
for o in l_operations[op_n]:
rot = geom.Mat4()
rot.PasteRotation(o.rotation)
trans = geom.Mat4()
......@@ -386,15 +397,9 @@ def _PDBize(biounit, asu, seqres=None, min_polymer_size=10,
tmp_ops.append(tp)
trans_matrices = tmp_ops
# select chains into a view as basis for each transformation
assu = asu.Select('cname=' + ','.join(biounit.GetChainList()))
assu = asu.Select('cname='+','.join(chains[c_intvls[i][0]:c_intvls[i][1]]))
# use each transformation on the view, store as entity and transform, PDBize
# the result while adding everything to one large entity
pdb_bu = mol.CreateEntity()
edi = pdb_bu.EditXCS(mol.BUFFERED_EDIT)
cur_chain_name = 0
water_chain = mol.ChainHandle()
ligand_chain = mol.ChainHandle()
a_pos_wrong = False
for tr in trans_matrices:
# do a PDBize, add each new entity to the end product
for chain in assu.chains:
......
......
......@@ -201,7 +201,7 @@ class TestMMCifInfo(unittest.TestCase):
pdb_ent, t = info.GetBioUnits()[0].PDBize(ent, transformation=True)
self.assertAlmostEquals(pdb_ent.GetCenterOfAtoms()[0], -915.8, 1)
self.assertAlmostEquals(pdb_ent.GetCenterOfAtoms()[1], -952.345, 2)
self.assertAlmostEquals(pdb_ent.GetCenterOfAtoms()[2], 3221.74, 2)
self.assertAlmostEquals(pdb_ent.GetCenterOfAtoms()[2], 3221.75, 2)
self.assertEquals(geom.Equal(t,
geom.Mat4(1,0,0,-920.462,
0,1,0,-966.654,
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment