Protool/hydrogens.py
def build_hydrogen(self,residue,buildH,coords):
        """Build a hydrogen in the structure when given coordinates, the Hname and the residue"""
        fit_coords=[]
        findatoms=sorted(coords.keys())
        findatoms.remove(buildH)
        ref_coords=[]
        for atom in findatoms:
            fit_coords.append(coords[atom])
            #
            # Now find the corresponding atom in the structure
            #
            struct_res=residue
            if atom[-2:]=='-1':
                try:
                    struct_res=self.PI.PreviousResidue(residue)
                    atom=atom[:-2]
                except ResidueNotFoundError:
                    print 'prev not found'
                    return None
            ref_coords.append(self.PI.GetPosition('%s:%s' %(struct_res,atom)))
        #
        # Get rotation and translation for bb -> bb
        #
        import quatfit
        refcenter,fitcenter,rotation=quatfit.qfit(len(ref_coords),ref_coords,fit_coords)
        #
        # Get the atoms that should be transformed
        #
        trans_coords=[coords[buildH],coords[buildH]]
        #
        # Apply rotation and translation to trans_coords
        #
        newcoords = quatfit.qtransform(len(trans_coords), trans_coords, refcenter, fitcenter, rotation)
        #
        # Add the atom
        #
        struct_atom=self.PI.atoms['%s:CA' %residue]
        resnumber=struct_atom['RESNUM']
        restype=struct_atom['RESNAME']
        chainid=struct_atom['CHAINID']
        atomnumber=struct_atom['NUMBER']
        uniqueid='%s:%s:%s' %(chainid,resnumber,buildH)
        count=0
        if not self.PI.atoms.has_key(uniqueid):
            self.PI.add_atom(uniqueid,atomnumber=atomnumber,
                             atomname=buildH,chainid=chainid,residuename=restype,
                             residuenumber=resnumber,
                             xcoord=newcoords[count][0],ycoord=newcoords[count][1],zcoord=newcoords[count][2],update=None)
        #
        # Fix atom numbers
        #
        self.PI.renumber_atoms()
        return
Build a hydrogen in the structure when given coordinates, the Hname and the residue
Build a hydrogen in the structure when given coordinates, the Hname and the residue
Build a hydrogen in the structure when given coordinates the Hname and the residue
def build_hydrogen(self,residue,buildH,coords):
        fit_coords=[]
        findatoms=sorted(coords.keys())
        findatoms.remove(buildH)
        ref_coords=[]
        for atom in findatoms:
            fit_coords.append(coords[atom])
             Now find the corresponding atom in the structure
            struct_res=residue
            if atom[-2:]=='-1':
                try:
                    struct_res=self.PI.PreviousResidue(residue)
                    atom=atom[:-2]
                except ResidueNotFoundError:
                    print 'prev not found'
                    return None
            ref_coords.append(self.PI.GetPosition('%s:%s' %(struct_res,atom)))
         Get rotation and translation for bb -> bb
        import quatfit
        refcenter,fitcenter,rotation=quatfit.qfit(len(ref_coords),ref_coords,fit_coords)
         Get the atoms that should be transformed
        trans_coords=[coords[buildH],coords[buildH]]
         Apply rotation and translation to trans_coords
        newcoords = quatfit.qtransform(len(trans_coords), trans_coords, refcenter, fitcenter, rotation)
         Add the atom
        struct_atom=self.PI.atoms['%s:CA' %residue]
        resnumber=struct_atom['RESNUM']
        restype=struct_atom['RESNAME']
        chainid=struct_atom['CHAINID']
        atomnumber=struct_atom['NUMBER']
        uniqueid='%s:%s:%s' %(chainid,resnumber,buildH)
        count=0
        if not self.PI.atoms.has_key(uniqueid):
            self.PI.add_atom(uniqueid,atomnumber=atomnumber,
                             atomname=buildH,chainid=chainid,residuename=restype,
                             residuenumber=resnumber,
                             xcoord=newcoords[count][0],ycoord=newcoords[count][1],zcoord=newcoords[count][2],update=None)
         Fix atom numbers
        self.PI.renumber_atoms()
        return
def build_hydrogen ( self , residue , buildH , coords ) : fit_coords = [ ] findatoms = sorted ( coords . keys ( ) ) findatoms . remove ( buildH ) ref_coords = [ ] for atom in findatoms : fit_coords . append ( coords [ atom ] ) struct_res = residue if atom [ - 2 : ] == '-1' : try : struct_res = self . PI . PreviousResidue ( residue ) atom = atom [ : - 2 ] except ResidueNotFoundError : print 'prev not found' return None ref_coords . append ( self . PI . GetPosition ( '%s:%s' % ( struct_res , atom ) ) ) import quatfit refcenter , fitcenter , rotation = quatfit . qfit ( len ( ref_coords ) , ref_coords , fit_coords ) trans_coords = [ coords [ buildH ] , coords [ buildH ] ] newcoords = quatfit . qtransform ( len ( trans_coords ) , trans_coords , refcenter , fitcenter , rotation ) struct_atom = self . PI . atoms [ '%s:CA' % residue ] resnumber = struct_atom [ 'RESNUM' ] restype = struct_atom [ 'RESNAME' ] chainid = struct_atom [ 'CHAINID' ] atomnumber = struct_atom [ 'NUMBER' ] uniqueid = '%s:%s:%s' % ( chainid , resnumber , buildH ) count = 0 if not self . PI . atoms . has_key ( uniqueid ) : self . PI . add_atom ( uniqueid , atomnumber = atomnumber , atomname = buildH , chainid = chainid , residuename = restype , residuenumber = resnumber , xcoord = newcoords [ count ] [ 0 ] , ycoord = newcoords [ count ] [ 1 ] , zcoord = newcoords [ count ] [ 2 ] , update = None ) self . PI . renumber_atoms ( ) return
Build a hydrogen in the structure when given coordinates, the Hname and the residue
Build a hydrogen in the structure when given coordinates the Hname and the residue
"""Build a hydrogen in the structure when given coordinates, the Hname and the residue""" # # Now find the corresponding atom in the structure # # # Get rotation and translation for bb -> bb # # # Get the atoms that should be transformed # # # Apply rotation and translation to trans_coords # # # Add the atom # # # Fix atom numbers #
self
residue
buildH
coords