nterm = 149 cterm = 183 # Obtain coordinates... ## peptide = ["N", "CA", "C", "O"] peptide = ["N"] xyzs = pr.atom.extract_xyz(peptide, atom_dict, chain, nterm, cterm) # Find the good segment... helixlen = 18 bindex, result = helix.protein_fit_by_length(xyzs, helixlen) helix.report_params(result.params, title = f"Optimal params:" + \ f"cost = {result.cost}") print(f"Select residues: [{nterm + bindex}, {nterm + bindex + helixlen})") xyzs_sel = xyzs[bindex:bindex + helixlen] # Estimate the helix axis vector... nv0 = helix.estimate_axis(xyzs_sel) # Estimate the point that the axis of helix passes through... pv0 = np.nanmean(xyzs_sel, axis=0) # Fitting... ## result = helix.protein(xyzs) params = result.params # Check... ## helix.check_fit(params, xyzs[bindex:bindex+helixlen], pv0, nv0) parvals = helix.unpack_params(params) helix.check_select(parvals, xyzs, pv0, nv0, nterm, bindex, helixlen)
# Select helix 3... chain = "A" nterm = 150 cterm = 167 # Obtain coordinates... xyzs_dict = {} peptides = ["N", "CA", "C", "O"] for i in peptides: xyzs_dict[i] = pr.atom.extract_xyz([i], atom_dict, chain, nterm, cterm) # Estimate the mean helix axis... nv0_dict = {} for i in peptides: nv0_dict[i] = helix.estimate_axis(xyzs_dict[i]) nv0_array = np.array([v for v in nv0_dict.values()]) nv0 = np.nanmean(nv0_array, axis=0) # Estimate the mean position that the axis of helix passes through... pv0_dict = {} for i in peptides: pv0_dict[i] = np.nanmean(xyzs_dict[i], axis=0) pv0_array = np.array([v for v in pv0_dict.values()]) pv0 = np.nanmean(pv0_array, axis=0) # Fitting... result = helix.peptide(xyzs_dict) params = result.params ## params = helix.peptide(xyzs_dict)
except ValueError: pass print(f"Fitting {bindex + nterm}...{bindex + nterm + len_helix}") ## # Report ## helix.report_params_helix(result.params, title = f"Optimal params:" + \ ## f"cost = {result.cost}") # Save values... params_dict[bindex] = [result.params, result.cost] # [[[ Visualization purpose ]]] # Estimate the mean helix axis... nv0_dict = {} for i in peptides: nv0_dict[i] = helix.estimate_axis(xyzs_filtered_dict[i]) nv0_array = np.array([v for v in nv0_dict.values()]) nv0 = np.nanmean(nv0_array, axis=0) # Estimate the mean position that the axis of helix passes through... pv0_dict = {} for i in peptides: pv0_dict[i] = np.nanmean(xyzs_filtered_dict[i], axis=0) pv0_array = np.array([v for v in pv0_dict.values()]) pv0 = np.nanmean(pv0_array, axis=0) # Fitting... params = result.params # Check... # Unpack parameters
xyzs_dict = {} peptides = ["N", "CA", "C", "O"] for i in peptides: xyzs_dict[i] = pr.atom.extract_xyz([i], atom_dict, chain, nterm, cterm) # Find the good segment... helixlen = 18 bindex, result = helix.peptide_fit_by_length(xyzs_dict, helixlen) helix.report_params_peptide(result.params, title = f"Optimal params:" + \ f"cost = {result.cost}") print(f"Select residues: [{nterm + bindex}, {nterm + bindex + helixlen})") # Estimate the mean helix axis... nv0_dict = {} for i in peptides: nv0_dict[i] = helix.estimate_axis(xyzs_dict[i][bindex:bindex + helixlen]) nv0_array = np.array([v for v in nv0_dict.values()]) nv0 = np.nanmean(nv0_array, axis=0) # Estimate the mean position that the axis of helix passes through... pv0_dict = {} for i in peptides: pv0_dict[i] = np.nanmean(xyzs_dict[i][bindex:bindex + helixlen], axis=0) pv0_array = np.array([v for v in pv0_dict.values()]) pv0 = np.nanmean(pv0_array, axis=0) # Fitting... params = result.params # Check... # Unpack parameters