Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_PDB.TransformTests Class Reference

List of all members.

Public Member Functions

def setUp
def get_total_pos
def get_pos
def test_transform

Public Attributes

 s
 m
 c
 r
 a

Detailed Description

Definition at line 823 of file test_PDB.py.


Member Function Documentation

def test_PDB.TransformTests.get_pos (   self,
  o 
)
Returns the average atom position in an entity.

Definition at line 848 of file test_PDB.py.

00848 
00849     def get_pos(self, o):
00850         """
00851         Returns the average atom position in an entity.
00852         """
00853         pos, count = self.get_total_pos(o)
00854         return 1.0*pos/count

Here is the call graph for this function:

Here is the caller graph for this function:

def test_PDB.TransformTests.get_total_pos (   self,
  o 
)
Returns the sum of the positions of atoms in an entity along
with the number of atoms.

Definition at line 833 of file test_PDB.py.

00833 
00834     def get_total_pos(self, o):
00835         """
00836         Returns the sum of the positions of atoms in an entity along
00837         with the number of atoms.
00838         """
00839         if hasattr(o, "get_coord"):
00840             return o.get_coord(), 1
00841         total_pos = numpy.array((0.0,0.0,0.0))
00842         total_count = 0
00843         for p in o.get_list():
00844             pos, count = self.get_total_pos(p)
00845             total_pos += pos
00846             total_count += count
00847         return total_pos, total_count

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 825 of file test_PDB.py.

00825 
00826     def setUp(self):
00827         self.s = PDBParser(PERMISSIVE=True).get_structure(
00828             'X', "PDB/a_structure.pdb")
00829         self.m = self.s.get_list()[0]
00830         self.c = self.m.get_list()[0]
00831         self.r = self.c.get_list()[0]
00832         self.a = self.r.get_list()[0]

Transform entities (rotation and translation).

Definition at line 855 of file test_PDB.py.

00855 
00856     def test_transform(self):
00857         """Transform entities (rotation and translation)."""
00858         for o in (self.s, self.m, self.c, self.r, self.a):
00859             rotation = rotmat(Vector(1,3,5), Vector(1,0,0))
00860             translation=numpy.array((2.4,0,1), 'f')
00861             oldpos = self.get_pos(o)
00862             o.transform(rotation, translation)
00863             newpos = self.get_pos(o)
00864             newpos_check = numpy.dot(oldpos, rotation) +  translation 
00865             for i in range(0, 3):
00866                 self.assertAlmostEqual(newpos[i], newpos_check[i])
00867 

Here is the call graph for this function:


Member Data Documentation

Definition at line 831 of file test_PDB.py.

Definition at line 829 of file test_PDB.py.

Definition at line 828 of file test_PDB.py.

Definition at line 830 of file test_PDB.py.

Definition at line 826 of file test_PDB.py.


The documentation for this class was generated from the following file: