def are_linked(self, return_value=False, verbose=True): d2 = None for i, residue in enumerate(self): if i==0: continue ccn1, outl1 = get_c_ca_n(residue, return_subset=True) if self[i-1] is None: # place holder for omega CDL return False ccn2, outl2 = get_c_ca_n(self[i-1], return_subset=True) if ccn1 is None: for line in outl1: if line not in self.errors: self.errors.append(line) break if ccn2 is None: for line in outl2: if line not in self.errors: self.errors.append(line) break n = ccn1[2] c = ccn2[0] if n is None or c is None: return False if self.bond_params_table is None: d2 = distance2(n,c) if d2<4: bond=True else: bond=False else: bond=self.bond_params_table.lookup(c.i_seq, n.i_seq) if not bond: break else: return True if return_value: return d2 return False
def get_omega_value( self, omega_cdl=False, ): # # this is very poor! there needs to be a better way to check for cis- # for i, residue in enumerate(self): if i == 0: continue if omega_cdl: if len(self) == 3: if i == 1: continue else: if i == 2: continue ccn1, outl1 = get_c_ca_n(residue, return_subset=True) ccn2, outl2 = get_c_ca_n(self[i - 1], return_subset=True) ca1 = ccn1[1] n = ccn1[2] c = ccn2[0] ca2 = ccn2[1] omega_atoms = [ca1, n, c, ca2] if None in omega_atoms: return None omega = dihedral_angle(sites=[atom.xyz for atom in omega_atoms], deg=True) return omega
def _get_atoms(atom_group, atom_names): atoms, outl = get_c_ca_n(atom_group, atom_names) if atoms is None: for i in range(len(atom_names)): atom_names[i] = atom_names[i].replace("'", '*') atoms, outl = get_c_ca_n(atom_group, atom_names) return atoms
def are_linked(self, return_value=False, verbose=True): d2 = None for i, residue in enumerate(self): if i==0: continue ccn1, outl1 = get_c_ca_n(residue) if self[i-1] is None: # place holder for omega CDL return False ccn2, outl2 = get_c_ca_n(self[i-1]) if ccn1 is None: for line in outl1: if line not in self.errors: self.errors.append(line) break if ccn2 is None: for line in outl2: if line not in self.errors: self.errors.append(line) break n = ccn1[2] c = ccn2[0] if self.bond_params_table is None: d2 = distance2(n,c) if d2<4: bond=True else: bond=False else: bond=self.bond_params_table.lookup(c.i_seq, n.i_seq) if not bond: #assert c.i_seq #assert n.i_seq break else: return True #assert d2 if return_value: return d2 return False
def get_phi_psi_atoms( self, only_psi_phi_pairs=True, force_plus_one=False, verbose=False, ): if len(self) != self.length: return None, None if force_plus_one: only_psi_phi_pairs = False if self[0] is None: backbone_i_minus_1 = None else: backbone_i_minus_1, junk = get_c_ca_n(self[0], return_subset=True) assert len(backbone_i_minus_1) == self.length backbone_i, junk = get_c_ca_n(self[1], return_subset=True) if verbose: print backbone_i if None in backbone_i: return None backbone_i_plus_1, junk = get_c_ca_n(self[2], return_subset=True) if verbose: print backbone_i_plus_1, junk if None in backbone_i_plus_1: return None assert len(backbone_i) == self.length assert len(backbone_i_plus_1) == self.length phi_atoms = [ backbone_i_minus_1[0], backbone_i[2], backbone_i[1], backbone_i[0], ] psi_atoms = [ backbone_i[2], backbone_i[1], backbone_i[0], backbone_i_plus_1[2], ] atoms = [phi_atoms, psi_atoms] if verbose: print atoms if not only_psi_phi_pairs: if self.start: psi_atoms = [ backbone_i_minus_1[2], backbone_i_minus_1[1], backbone_i_minus_1[0], backbone_i[2], ] atoms.insert(0, psi_atoms) if self.end or force_plus_one: phi_atoms = [ backbone_i[0], backbone_i_plus_1[2], backbone_i_plus_1[1], backbone_i_plus_1[0], ] atoms.append(phi_atoms) if verbose: for dihedral in atoms: print '-' * 80 for atom in dihedral: print atom.quote() return atoms
def get_o3prime_p(residue, return_subset=False): rc = get_c_ca_n(residue, atom_name_list=[" O3'", ' P '], return_subset=return_subset) if rc[0] is None: rc = get_c_ca_n(residue, atom_name_list=[" O3'", ' P '], return_subset=return_subset) return rc
def get_omega_atoms(three): ccn1, outl1 = get_c_ca_n(three[0]) ccn2, outl2 = get_c_ca_n(three[1]) if ccn1: ca1, c = ccn1[1], ccn1[0] else: ca1, c = None, None if ccn2: n, ca2 = ccn2[2], ccn2[1] else: n, ca2 = None, None #ca1, c, n, ca2 = ccn1[1], ccn1[0], ccn2[2], ccn2[1] omega_atoms = [ca1, c, n, ca2] return omega_atoms
def are_linked( self, return_value=False, use_distance_always=False, bond_cut_off=3., # Same as link_distance_cutoff of pdb_interpretation allow_poly_ca=False, poly_ca_cut_off=4., verbose=True): ''' Need to add poly-Calpha chains CA-CA 4.5 is use in CaBLAM, maybe shorter ''' if allow_poly_ca: assert 0 d2 = None bond_cut_off *= bond_cut_off for i, residue in enumerate(self): if i == 0: continue ccn1, outl1 = get_c_ca_n(residue, return_subset=True) if self[i - 1] is None: # place holder for omega CDL return False ccn2, outl2 = get_c_ca_n(self[i - 1], return_subset=True) if ccn1 is None: for line in outl1: if line not in self.errors: self.errors.append(line) break if ccn2 is None: for line in outl2: if line not in self.errors: self.errors.append(line) break n = ccn1[2] c = ccn2[0] if n is None or c is None: return False if self.bond_params_table is None: d2 = distance2(n, c) if d2 < bond_cut_off: bond = True else: bond = False else: bond = self.bond_params_table.lookup(c.i_seq, n.i_seq) if not bond and use_distance_always: # needed for situations where atoms are added and the i_seq is updated if distance2(n, c) < bond_cut_off: bond = True if not bond: break else: return True if return_value: return d2 return False
def are_linked(self, return_value=False, use_distance_always=False, bond_cut_off=2., verbose=True): d2 = None bond_cut_off *= bond_cut_off for i, residue in enumerate(self): if i == 0: continue ccn1, outl1 = get_c_ca_n(residue, return_subset=True) if self[i - 1] is None: # place holder for omega CDL return False ccn2, outl2 = get_c_ca_n(self[i - 1], return_subset=True) if ccn1 is None: for line in outl1: if line not in self.errors: self.errors.append(line) break if ccn2 is None: for line in outl2: if line not in self.errors: self.errors.append(line) break n = ccn1[2] c = ccn2[0] if n is None or c is None: return False if self.bond_params_table is None: d2 = distance2(n, c) if d2 < bond_cut_off: bond = True else: bond = False else: bond = self.bond_params_table.lookup(c.i_seq, n.i_seq) if not bond and use_distance_always: # needed for situations where atoms are added and the i_seq is updated if distance2(n, c) < bond_cut_off: bond = True if not bond: break else: return True if return_value: return d2 return False
def cis_group(self, limit=45., verbose=False): cis_peptide_bond = False for i, residue in enumerate(self): if i==0: continue if i==2: continue # only check the middle omega angle ccn1, outl1 = get_c_ca_n(residue) ccn2, outl2 = get_c_ca_n(self[i-1]) ca1 = ccn1[1] n = ccn1[2] c = ccn2[0] ca2 = ccn2[1] omega_atoms = [ca1, n, c, ca2] omega = dihedral_angle(sites=[atom.xyz for atom in omega_atoms], deg=True) if (180.-abs(omega))>limit: cis_peptide_bond = True break if verbose: if cis_peptide_bond: print 'cis peptide bond', cis_peptide_bond, omega print self return cis_peptide_bond
def get_omega_value(self, omega_cdl=False, ): # # this is very poor! there needs to be a better way to check for cis- # for i, residue in enumerate(self): if i==0: continue if omega_cdl: if len(self)==3: if i==1: continue else: if i==2: continue ccn1, outl1 = get_c_ca_n(residue, return_subset=True) ccn2, outl2 = get_c_ca_n(self[i-1], return_subset=True) ca1 = ccn1[1] n = ccn1[2] c = ccn2[0] ca2 = ccn2[1] omega_atoms = [ca1, n, c, ca2] if None in omega_atoms: return None omega = dihedral_angle(sites=[atom.xyz for atom in omega_atoms], deg=True) return omega
def get_phi_psi_atoms(self, only_psi_phi_pairs=True, force_plus_one=False, omega_cdl=False, ): if omega_cdl: if len(self) not in [self.length, self.length-1]: return None, None if len(self)==2: self.insert(0, None) else: if len(self)!=self.length: return None, None if force_plus_one: only_psi_phi_pairs=False if self[0] is None: backbone_i_minus_1 = None else: backbone_i_minus_1, junk = get_c_ca_n(self[0], return_subset=True) assert len(backbone_i_minus_1)==3 backbone_i, junk = get_c_ca_n(self[1], return_subset=True) if None in backbone_i: return None backbone_i_plus_1, junk = get_c_ca_n(self[2], return_subset=True) if None in backbone_i_plus_1: return None assert len(backbone_i)==3 assert len(backbone_i_plus_1)==3 if omega_cdl: # phi(+1) phi_atoms = [ backbone_i[0], backbone_i_plus_1[2], backbone_i_plus_1[1], backbone_i_plus_1[0], ] else: phi_atoms = [ backbone_i_minus_1[0], backbone_i[2], backbone_i[1], backbone_i[0], ] psi_atoms = [ backbone_i[2], backbone_i[1], backbone_i[0], backbone_i_plus_1[2], ] atoms = [phi_atoms, psi_atoms] if not only_psi_phi_pairs: if self.start: psi_atoms = [ backbone_i_minus_1[2], backbone_i_minus_1[1], backbone_i_minus_1[0], backbone_i[2], ] atoms.insert(0, psi_atoms) if self.end or force_plus_one: phi_atoms = [ backbone_i[0], backbone_i_plus_1[2], backbone_i_plus_1[1], backbone_i_plus_1[0], ] atoms.append(phi_atoms) if 0: for dihedral in atoms: print '-'*80 for atom in dihedral: print atom.quote() return atoms
def get_omega_atoms(three): ccn1, outl1 = get_c_ca_n(three[1]) ccn2, outl2 = get_c_ca_n(three[2]) ca1, c, n, ca2 = ccn1[1], ccn1[0], ccn2[2], ccn2[1] omega_atoms = [ca1, c, n, ca2] return omega_atoms