Beispiel #1
0
 def calc_RMSD(self, list1, list2, keys):
     ''' Calculates RMSD between two atoms lists. The two lists have to have the same length. 
     '''
     superpose = sp.RotamerSuperpose(list1, list2)
     list2 = superpose.run()
     array1, array2 = np.array([0, 0, 0]), np.array([0, 0, 0])
     for a1, a2, k in zip(list1, list2, keys):
         array1 = np.vstack((array1, list(a1.get_coord())))
         array2 = np.vstack((array2, list(a2.get_coord())))
     rmsd = np.sqrt(
         sum(sum((array1[1:] - array2[1:])**2)) / array1[1:].shape[0])
     return rmsd
Beispiel #2
0
 def non_conserved_switcher(self, cgn, AA, ref_atoms, template):
     try:
         rot = Rotamer.objects.get(
             structure=template, residue__display_generic_number__label=cgn)
         if rot.residue.amino_acid != AA or rot.missing_atoms:
             return False
         parse = GPCRDBParsingPDB()
         parsed_atoms = parse.parse_rotamer_pdb(rot)
         superpose = sp.RotamerSuperpose(ref_atoms, parsed_atoms)
         new_atoms = superpose.run()
         if self.debug:
             print(template, cgn, superpose.backbone_rmsd)
         if superpose.backbone_rmsd > 0.45:
             return False
         return new_atoms
     except Exception as msg:
         return False
Beispiel #3
0
 def non_conserved_switcher(self, cgn, AA, ref_atoms, template):
     try:
         print(cgn, template, AA, ref_atoms[0].get_parent().get_resname())
         rot = Rotamer.objects.get(structure=template, residue__display_generic_number__label=cgn)
         print(rot.residue.amino_acid)
         if rot.residue.amino_acid!=AA or rot.missing_atoms:
             return False
         parse = GPCRDBParsingPDB()
         parsed_atoms = parse.parse_rotamer_pdb(rot)
         superpose = sp.RotamerSuperpose(ref_atoms, parsed_atoms)
         new_atoms = superpose.run()
         if self.debug:
             print(template, cgn, superpose.backbone_rmsd)
         if superpose.backbone_rmsd>0.45:
             return False
         return new_atoms
     except Exception as msg:
         if self.debug:
             print("WARNING: Rotamer swap-in {} at {} failed with {}".format(template, cgn, msg))
         return False
Beispiel #4
0
 def superpose(self, list1, list2, TM_keys=None):
     """Superposition, supply TM_keys (list of sequence residue numbers) when superimposing on only those atoms."""
     superpose = sp.RotamerSuperpose(list1, list2, TM_keys)
     return superpose.run(), superpose.num_atoms_used_for_superposition