def __init__(self, model, radius=12.0, offset=0): """ A residue's exposure is defined as the number of CA atoms around that residues CA atom. A dictionary is returned that uses a L{Residue} object as key, and the residue exposure as corresponding value. @param model: the model that contains the residues @type model: L{Model} @param radius: radius of the sphere (centred at the CA atom) @type radius: float @param offset: number of flanking residues that are ignored in the calculation of the number of neighbors @type offset: int """ assert(offset>=0) ppb=CaPPBuilder() ppl=ppb.build_peptides(model) fs_map={} fs_list=[] fs_keys=[] for pp1 in ppl: for i in range(0, len(pp1)): fs=0 r1=pp1[i] if not is_aa(r1) or not r1.has_id('CA'): continue ca1=r1['CA'] for pp2 in ppl: for j in range(0, len(pp2)): if pp1 is pp2 and abs(i-j)<=offset: continue r2=pp2[j] if not is_aa(r2) or not r2.has_id('CA'): continue ca2=r2['CA'] d=(ca2-ca1) if d<radius: fs+=1 res_id=r1.get_id() chain_id=r1.get_parent().get_id() # Fill the 3 data structures fs_map[(chain_id, res_id)]=fs fs_list.append((r1, fs)) fs_keys.append((chain_id, res_id)) # Add to xtra r1.xtra['EXP_CN']=fs AbstractPropertyMap.__init__(self, fs_map, fs_keys, fs_list)
def __init__(self, model, pdb_file): depth_dict={} depth_list=[] depth_keys=[] # get_residue residue_list=Selection.unfold_entities(model, 'R') # make surface from PDB file surface=get_surface(pdb_file) # calculate rdepth for each residue for residue in residue_list: if not is_aa(residue): continue rd=residue_depth(residue, surface) ca_rd=ca_depth(residue, surface) # Get the key res_id=residue.get_id() chain_id=residue.get_parent().get_id() depth_dict[(chain_id, res_id)]=(rd, ca_rd) depth_list.append((residue, (rd, ca_rd))) depth_keys.append((chain_id, res_id)) # Update xtra information residue.xtra['EXP_RD']=rd residue.xtra['EXP_RD_CA']=ca_rd AbstractPropertyMap.__init__(self, depth_dict, depth_keys, depth_list)
def __init__(self, model, pdb_file): depth_dict = {} depth_list = [] depth_keys = [] # get_residue residue_list = Selection.unfold_entities(model, 'R') # make surface from PDB file surface = get_surface(pdb_file) # calculate rdepth for each residue for residue in residue_list: if not is_aa(residue): continue rd = residue_depth(residue, surface) ca_rd = ca_depth(residue, surface) # Get the key res_id = residue.get_id() chain_id = residue.get_parent().get_id() depth_dict[(chain_id, res_id)] = (rd, ca_rd) depth_list.append((residue, (rd, ca_rd))) depth_keys.append((chain_id, res_id)) # Update xtra information residue.xtra['EXP_RD'] = rd residue.xtra['EXP_RD_CA'] = ca_rd AbstractPropertyMap.__init__(self, depth_dict, depth_keys, depth_list)
def __init__(self, model, radius, offset, hse_up_key, hse_down_key, angle_key=None): """ @param model: model @type model: L{Model} @param radius: HSE radius @type radius: float @param offset: number of flanking residues that are ignored in the calculation of the number of neighbors @type offset: int @param hse_up_key: key used to store HSEup in the entity.xtra attribute @type hse_up_key: string @param hse_down_key: key used to store HSEdown in the entity.xtra attribute @type hse_down_key: string @param angle_key: key used to store the angle between CA-CB and CA-pCB in the entity.xtra attribute @type angle_key: string """ assert(offset>=0) # For PyMOL visualization self.ca_cb_list=[] ppb=CaPPBuilder() ppl=ppb.build_peptides(model) hse_map={} hse_list=[] hse_keys=[] for pp1 in ppl: for i in range(0, len(pp1)): if i==0: r1=None else: r1=pp1[i-1] r2=pp1[i] if i==len(pp1)-1: r3=None else: r3=pp1[i+1] # This method is provided by the subclasses to calculate HSE result=self._get_cb(r1, r2, r3) if result is None: # Missing atoms, or i==0, or i==len(pp1)-1 continue pcb, angle=result hse_u=0 hse_d=0 ca2=r2['CA'].get_vector() for pp2 in ppl: for j in range(0, len(pp2)): if pp1 is pp2 and abs(i-j)<=offset: # neighboring residues in the chain are ignored continue ro=pp2[j] if not is_aa(ro) or not ro.has_id('CA'): continue cao=ro['CA'].get_vector() d=(cao-ca2) if d.norm()<radius: if d.angle(pcb)<(pi/2): hse_u+=1 else: hse_d+=1 res_id=r2.get_id() chain_id=r2.get_parent().get_id() # Fill the 3 data structures hse_map[(chain_id, res_id)]=(hse_u, hse_d, angle) hse_list.append((r2, (hse_u, hse_d, angle))) hse_keys.append((chain_id, res_id)) # Add to xtra r2.xtra[hse_up_key]=hse_u r2.xtra[hse_down_key]=hse_d if angle_key: r2.xtra[angle_key]=angle AbstractPropertyMap.__init__(self, hse_map, hse_keys, hse_list)