def setUp(self): self.nt1 = Component(atoms=[ Atom(x=0, y=0, z=1, name='C1'), Atom(x=0, y=0, z=0, name='C2'), Atom(x=1, y=0, z=1, name='N'), ], sequence='A', model=1, chain='A', number=1, polymeric=True) self.nt2 = Component(atoms=[ Atom(x=5, y=5, z=5, name='C1'), Atom(x=5, y=5, z=5, name='C2'), Atom(x=5, y=5, z=5, name='N'), ], sequence='U', model=1, chain='A', number=2, polymeric=True) self.nt3 = Component(atoms=[ Atom(x=-5, y=-5, z=-5, name='C1'), Atom(x=-5, y=-5, z=-5, name='C2'), Atom(x=-5, y=-5, z=-5, name='N'), ], sequence='C', model=1, chain='A', number=3, polymeric=True) self.nt4 = Component(atoms=[ Atom(x=0, y=0, z=3, name='C1'), Atom(x=0, y=0, z=3, name='C2'), Atom(x=0, y=0, z=3, name='N'), ], sequence='U', model=1, chain='A', number=4, polymeric=True) self.nt5 = Component(atoms=[ Atom(x=0, y=0, z=8, name='C1'), Atom(x=0, y=0, z=8, name='C2'), Atom(x=0, y=0, z=3, name='N'), ], sequence='G', model=1, chain='A', number=5, polymeric=True) structure = Structure([self.nt1, self.nt2, self.nt3, self.nt4, self.nt5], pdb='0000', model='1') self.pairs = Pairs(structure)
def pairs(self, first={}, second={}, distance={}): """Create an iterator for all pairs in the structure. The first and second arguments are selectors, that is a dictionary that can contain the same arguments given to the residues method. The third argument distance is a dictionary :first: A selector for the first item in the pair. :second: A selector for the second item in the pair. :distance: A :returns: A iterator that will go over all matching pairs in the structure. """ pairs = Pairs(self) pairs.first(**first) pairs.second(**second) pairs.distance(**distance) return pairs