def run_analysis(self): """Execute the calculation.""" # Optimisation precision. Relax_disp.opt_func_tol = self.data.opt_func_tol Relax_disp.opt_max_iterations = self.data.opt_max_iterations # Execute. Relax_disp(pipe_name=self.data.pipe_name, pipe_bundle=self.data.pipe_bundle, results_dir=self.data.save_dir, models=self.data.models, grid_inc=self.data.inc, mc_sim_num=self.data.mc_sim_num, exp_mc_sim_num=self.data.exp_mc_sim_num, pre_run_dir=self.data.pre_run_dir, mc_sim_all_models=self.data.mc_sim_all_models, insignificance=self.data.insignificance, numeric_only=self.data.numeric_only, r1_fit=self.data.r1_fit) # Alias the relax data store data. data = ds.relax_gui.analyses[self.data_index]
# Create the data pipe. pipe_name = 'base pipe' pipe_bundle = 'relax_disp' pipe.create(pipe_name=pipe_name, bundle=pipe_bundle, pipe_type='relax_disp') # The path to the data files. data_path = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'dispersion' + sep + 'Hansen' # Load the saved base pipe containing R2eff data. results.read(data_path + sep + 'r2eff_pipe') deselect.spin(":4") # Set the nuclear isotope data. spin.isotope('15N') # Auto-analysis execution. ########################## # Run fast. Relax_disp.opt_func_tol = 1e-5 Relax_disp.opt_max_iterations = 10000 # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=ds.tmpdir, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, numeric_only=ds.numeric_only)
# Set the spin-lock offset. relax_disp.spin_lock_offset(spectrum_id=id, offset=offset) # Set the relaxation times (in s). relax_disp.relax_time(spectrum_id=id, time=relax_time) # Set the NMR field strength of the spectrum. spectrometer.frequency(id=id, frq=H_frq) # Load the R1 data. relax_data.read(ri_id='900MHz', ri_type='R1', frq=900.21422558574e6, file='R1_relax.out', dir=DATA_PATH, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, data_col=6, error_col=7) # Clustering (only to be activated after an initial analysis without clustering). #relax_disp.cluster(cluster_id='cluster', spin_id=':1-50') # Read the chemical shift data. chemical_shift.read(file='chemical_shifts.list', dir=DATA_PATH) # Deselect unresolved spins. deselect.read(file='unresolved', dir=DATA_PATH, res_num_col=1) # Auto-analysis execution. ########################## # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=RESULTS_DIR, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, modsel=MODSEL, insignificance=INSIGNIFICANCE, numeric_only=NUMERIC_ONLY) #Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=RESULTS_DIR, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, modsel=MODSEL, pre_run_dir=PRE_RUN_DIR, insignificance=INSIGNIFICANCE, numeric_only=NUMERIC_ONLY, mc_sim_all_models=MC_SIM_ALL_MODELS)
# To speed up the analysis, only select a few spins. deselect.all() # Load the experiments settings file. residues = open(ds.data_path + sep + 'global_fit_residues.txt', 'r') residueslines = residues.readlines() residues.close() # Split the line string into number and text. r = re.compile("([a-zA-Z]+)([0-9]+)([a-zA-Z]+)(-)([a-zA-Z]+)") for i, line in enumerate(residueslines): if line[0] == "#": continue else: re_split = r.match(line) #print re_split.groups() resn = re_split.group(1) resi = int(re_split.group(2)) isotope = re_split.group(3) select.spin(spin_id=':%i@%s' % (resi, isotope), change_all=False) # Run the analysis. Relax_disp(pipe_name=ds.pipe_name, pipe_bundle=ds.pipe_bundle, results_dir=ds.results_dir, models=ds.models, grid_inc=ds.grid_inc, exp_mc_sim_num=ds.exp_mc_sim_num)
# Load the initial state setup state.load(state='ini_setup.bz2') # Set settings for run. results_directory = 'temp' pipe_name = 'base pipe' pipe_bundle = 'relax_disp' MODELS = ['R2eff'] GRID_INC = 5 MC_NUM = 3 MODSEL = 'AIC' # Execute Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=results_directory, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, modsel=MODSEL) # Delete the "base pipe" pipe.delete(pipe_name='base pipe') # Save the program state. state.save('r2eff_pipe', force=True) # Delete data result directory shutil.rmtree(results_directory)
]) spectrum.error_analysis(subset=[ '800_reference.in', '800_66.667.in', '800_133.33.in', '800_133.33.in.bis', '800_200.in', '800_266.67.in', '800_333.33.in', '800_400.in', '800_466.67.in', '800_533.33.in', '800_533.33.in.bis', '800_600.in', '800_666.67.in', '800_733.33.in', '800_800.in', '800_866.67.in', '800_933.33.in', '800_933.33.in.bis', '800_1000.in' ]) # Deselect unresolved spins. deselect.read(file='unresolved', dir=data_path + sep + '500_MHz', res_num_col=1) deselect.read(file='unresolved', dir=data_path + sep + '800_MHz', res_num_col=1) # Spin subset. select.spin(':63-70', change_all=True) # Auto-analysis execution. ########################## # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=RESULTS_DIR, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM)
res_num_col=1) deselect.read(file='unresolved', dir=data_path + sep + '800_MHz', res_num_col=1) # Select just spins :70@N and :71@N. select.spin(":70-71", change_all=True) # Auto-analysis execution (manually replicated). ################################################ # Do not change! if False: Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM) # The 'R2eff' model. #~~~~~~~~~~~~~~~~~~~ # Pipe setup. model = MODELS[0] pipe.copy(pipe_from='base pipe', pipe_to=model, bundle_to='relax_disp') pipe.switch(pipe_name=model) relax_disp.select_model(model='R2eff') # Optimisation. calc(verbosity=1)
# Set the NMR field strength of the spectrum. spectrometer.frequency(id=id, frq=H_frq * 1e6) # Relaxation dispersion CPMG constant time delay T (in s). relax_disp.relax_time(spectrum_id=id, time=delay) # set each spectrum noise RMSD if ndat == 1: spectrum.baseplane_rmsd(error=24000, spectrum_id=id, spin_id=None) elif ndat == 6: spectrum.baseplane_rmsd(error=65000, spectrum_id=id, spin_id=None) # Peak intensity error analysis. spectrum.error_analysis_per_field() # Auto-analysis execution. ########################## # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=ds.tmpdir, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, modsel=MODSEL, pre_run_dir=PRE_RUN_DIR, insignificance=INSIGNIFICANCE, numeric_only=NUMERIC_ONLY, mc_sim_all_models=MC_SIM_ALL_MODELS)
for key in cdp.clustering: print(key, cdp.clustering[key]) # Print parameter kex before copying. for cur_spin, mol_name, resi, resn, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): print(cur_spin.kex) ## Make advanced parameter copy. # It is more advanced than the value.copy user function, in that clustering is taken into account. # When the destination data pipe has spin clusters defined, then the new parameter values, when required, will be taken as the median value. relax_disp.parameter_copy(pipe_from=ini_pipe_name, pipe_to=ds.pipe_name) # Print parameter kex after copying. for cur_spin, mol_name, resi, resn, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): print(cur_spin.kex) pipe.display() # Run the analysis. Relax_disp(pipe_name=ds.pipe_name, pipe_bundle=ds.pipe_bundle_cluster, results_dir=ds.results_dir, models=ds.models, grid_inc=ds.grid_inc, mc_sim_num=ds.mc_sim_num, modsel=ds.modsel)
# Specify the duplicated spectra. spectrum.replicated(spectrum_ids=['600_ncyc1', '600_ncyc1b']) spectrum.replicated(spectrum_ids=['600_ncyc2', '600_ncyc2b']) spectrum.replicated(spectrum_ids=['600_ncyc3', '600_ncyc3b']) spectrum.replicated(spectrum_ids=['800_ncyc1', '800_ncyc1b']) spectrum.replicated(spectrum_ids=['800_ncyc2', '800_ncyc2b']) spectrum.replicated(spectrum_ids=['800_ncyc3', '800_ncyc3b']) # Measured chemical shift differences. value.set(val=0.625, param='dw', spin_id=":135") value.set(val=0.033, param='dwH', spin_id=":135") value.set(val=0.981, param='dw', spin_id=":137") value.set(val=0.010, param='dwH', spin_id=":137") #value.set(val=0.5, param='pA') #value.set(val=67.5, param='kex') # Cluster all spins. relax_disp.cluster(cluster_id='all', spin_id=":135-137") # Auto-analysis execution. ########################## # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=RESULTS_DIR, pre_run_dir='mq_cr72_analysis', models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM)
relax_disp.relax_time(spectrum_id=id, time=0.1) # Errors. spectrum.baseplane_rmsd(error=1000000.0, spectrum_id=id) # Peak intensity error analysis. spectrum.error_analysis(subset=[ '500_reference', '500_66.6666', '500_133.3333', '500_200.0', '500_266.6666', '500_333.3333', '500_400.0', '500_466.6666', '500_533.3333', '500_600.0', '500_666.6666', '500_733.3333', '500_800.0', '500_866.6666', '500_933.3333', '500_1000.0' ]) spectrum.error_analysis(subset=[ '800_reference', '800_66.6666', '800_133.3333', '800_200.0', '800_266.6666', '800_333.3333', '800_400.0', '800_466.6666', '800_533.3333', '800_600.0', '800_666.6666', '800_733.3333', '800_800.0', '800_866.6666', '800_933.3333', '800_1000.0' ]) # Auto-analysis execution. ########################## # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=RESULTS_DIR, models=MODELS) # Save the program state. state.save('r2eff_values', force=True)
relax_disp.relax_time(spectrum_id=id, time=0.015) # Specify the duplicated spectra. spectrum.replicated(spectrum_ids=['600_ncyc1', '600_ncyc1b']) spectrum.replicated(spectrum_ids=['600_ncyc2', '600_ncyc2b']) spectrum.replicated(spectrum_ids=['600_ncyc3', '600_ncyc3b']) spectrum.replicated(spectrum_ids=['800_ncyc1', '800_ncyc1b']) spectrum.replicated(spectrum_ids=['800_ncyc2', '800_ncyc2b']) spectrum.replicated(spectrum_ids=['800_ncyc3', '800_ncyc3b']) # Measured chemical shift differences. value.set(val=0.625, param='dw', spin_id=":135") value.set(val=0.033, param='dwH', spin_id=":135") value.set(val=0.981, param='dw', spin_id=":137") value.set(val=0.010, param='dwH', spin_id=":137") # Optimised parameters from the paper. value.set(val=0.5, param='pA') value.set(val=67.5, param='kex') # Auto-analysis execution. ########################## # Run faster. Relax_disp.opt_func_tol = 1e-10 Relax_disp.opt_max_iterations = 10000 # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=ds.tmpdir, models=ds.models, grid_inc=GRID_INC, mc_sim_num=MC_NUM)
# Set the relaxation times. relax_disp.relax_time(spectrum_id=data[i][0], time=data[i][3]) # Set the spectrometer frequency. spectrometer.frequency(id=data[i][0], frq=800, units='MHz') # Clustering. relax_disp.cluster(cluster_id='cluster', spin_id='@N,NE1') # Set some parameters to speed up the optimisation. value.set(param='kex', val=1500.0) # Real value of 1000. # Auto-analysis execution. ########################## # Run faster. Relax_disp.opt_func_tol = 1e-10 Relax_disp.opt_max_iterations = 10000 # Do not change! Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=ds.tmpdir, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, exp_mc_sim_num=EXP_MC_NUM) # Save the program state. state.save('devnull', force=True)