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,
                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 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
Example #4
0
 def are_linked(
     self,
     return_value=False,
     use_distance_always=False,
     bond_cut_off=3.5,  # Same as link_distance_cutoff of pdb_interpretation
     verbose=True,
 ):
     bond_cut_off *= bond_cut_off
     for i, residue in enumerate(self):
         if i == 0: continue
         op1, outl1 = self.get_o3prime_p(residue, return_subset=True)
         # if self[i-1] is None: # place holder for omega CDL
         #   return False
         op2, outl2 = self.get_o3prime_p(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
         p = op1[1]
         o3prime = op2[0]
         if p is None or o3prime is None: return False
         if self.bond_params_table is None:
             d2 = distance2(p, o3prime)
             if d2 < bond_cut_off: bond = True
             else: bond = False
         else:
             bond = self.bond_params_table.lookup(p.i_seq, o3prime.i_seq)
             if not bond and use_distance_always:
                 # needed for situations where atoms are added and the i_seq is updated
                 if distance2(p, o3prime) < bond_cut_off: bond = True
         if not bond:
             break
     else:
         return True
     if return_value: return d2
     return False
Example #5
0
 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