def get_phi_psi_correction(result, residue, phi_psi, display_phi_psi_correction=False, verbose=False): rc = None key = (round_to_ten(phi_psi[0]), round_to_ten(phi_psi[1])) if residue.resname=='PRO': correction = PRO_phi_psi.get(key, None) elif residue.resname in ['VAL', 'THR', 'ILE']: correction = VAL_THR_ILE_phi_psi.get(key, None) else: correction = others_phi_psi.get(key, None) if correction: correction = radial_deviation(*tuple(correction), input_in_radians=True) current = radial_deviation(result.deviation, result.dihedral) rc = current-correction start = (current.r>=0.25) finish = (rc.r>=0.25) if verbose: print('current %s is corrected with %s' % (current, correction)), print(' to give %s\n' % rc) if display_phi_psi_correction and (start or finish): show_phi_psi_correction(residue, phi_psi, current, correction, rc) return rc.r, rc.t/pi*180, start, finish else: return None
def show_phi_psi_correction(residue, phi_psi, current, correction, rc, units=100): import matplotlib.pyplot as plt xs = [current.t, correction.t, rc.t] ys = [current.r, correction.r, rc.r] labels = ['default', 'correction', 'result'] for i, (x, y) in enumerate(zip(xs, ys)): y*=units plt.polar(x, y, 'ro') plt.text(x, y, '%s' % (labels[i]), ) key = (round_to_ten(phi_psi[0]), round_to_ten(phi_psi[1])) plt.title('%s (%5.1f, %5.1f) (%4.0f, %4.0f)\n%s minus %s equals %s' %( residue.id_str(), phi_psi[0], phi_psi[1], key[0], key[1], current, correction, rc, ) ) plt.show()
def get_cdl_key(self, exact=False, only_psi_phi_pairs=True, force_plus_one=False, omega_cdl=False, verbose=False): dihedrals=self.get_phi_psi_angles(only_psi_phi_pairs=only_psi_phi_pairs, omega_cdl=omega_cdl, verbose=verbose, ) if dihedrals is None: return None key = [] for phi_or_psi in dihedrals: if exact: key.append(phi_or_psi) else: key.append(round_to_ten(phi_or_psi)) return tuple(key)
def get_cdl_key(self, exact=False, only_psi_phi_pairs=True, force_plus_one=False, omega_cdl=False, verbose=False): dihedrals=self.get_phi_psi_angles(only_psi_phi_pairs=only_psi_phi_pairs, omega_cdl=omega_cdl, verbose=verbose, ) key = [] for phi_or_psi in dihedrals: if exact: key.append(phi_or_psi) else: key.append(round_to_ten(phi_or_psi)) #print self, self.get_ramalyze_key(verbose=1) return tuple(key)