Changes

Jump to navigation Jump to search
f_exp.close()
</source>
 
 
== Run analysis in relax ==
* Start relax
* Then click: "New analysis (Cmd+n)
* Then click icon for "Relaxation dispersion" -> Next
* Just accept name for the pipe
 
* Open the interpreter: Cmd+p
* Paste in
<source lang="python">
import os; os.chdir(os.getenv('HOME') + os.sep + 'Desktop' + os.sep + 'temp'); pwd()
</source>
* Then do
<source lang="python">
script(file='2_load_data.py')
</source>
* You can scroll through earlier commands with: Cmd+ Arrow up
* When this is done, quit relax
* Then to convert all xmgrace files to png
<source lang="bash">
cd grace
python grace2images.py
</source>
 
* Afterwards you can
* start relax
* Open the interpreter: Cmd+p
* Paste in
<source lang="python">
import os; os.chdir(os.getenv('HOME') + os.sep + 'Desktop' + os.sep + 'temp'); pwd()
</source>
* Close the interpreter
* File -> Open relax state -> "temp_state.bz2"
 
 
File: '''2_load_data.py'''
<source lang="python">
# relax import
from pipe_control.mol_res_spin import spin_loop
 
# Test if running as script or through GUI.
is_script = False
if not hasattr(cdp, "pipe_type"):
is_script = True
# We need to create a data pipe, which will tell relax which type of data we are expecting
pipe_name = 'relax_disp'
pipe_bundle = 'relax_disp'
pipe.create(pipe_name, pipe_bundle)
 
# Minimum: Just read the sequence data, but this misses a lot of information.
sequence.read(file='residues.txt', res_num_col=1)
 
# Name the spins
for cur_spin, mol_name, resi, resn, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True):
spin.name(name="HN", spin_id=spin_id)
# Manually force the model to be R2eff, so plotting can be performed later
cur_spin.model = "R2eff"
 
# Name the isotope for field strength scaling.
spin.isotope(isotope='15N')
 
 
# Open the settings file
set_file = open("exp_settings.txt")
set_file_lines = set_file.readlines()
 
for line in set_file_lines:
if "#" in line[0]:
continue
 
# Get data
field, RF_field_strength_kHz, f_name = line.split()
 
# Assign data
spec_id = f_name
relax_disp.exp_type(spectrum_id=spec_id, exp_type='R1rho')
 
# Set the spectrometer frequency
spectrometer.frequency(id=spec_id, frq=float(field), units='MHz')
 
# Is in kHz, som convert to Hz
#http://wiki.nmr-relax.com/Relax_disp.spin_lock_offset%2Bfield
#http://www.nmr-relax.com/manual/relax_disp_spin_lock_field.html
disp_frq = float(RF_field_strength_kHz)*1000
 
# Set The spin-lock field strength, nu1, in Hz
relax_disp.spin_lock_field(spectrum_id=spec_id, field=disp_frq)
 
# Read the R2eff data
relax_disp.r2eff_read(id=spec_id, file=f_name, dir=None, disp_frq=disp_frq, res_num_col=1, data_col=2, error_col=3)
 
# Is this necessary? The time, in seconds, of the relaxation period.
#relax_disp.relax_time(spectrum_id=spec_id, time=time_sl)
 
 
# Plot data
relax_disp.plot_disp_curves(dir='grace', y_axis='r2_eff', x_axis='disp', num_points=1000, extend_hz=500.0, extend_ppm=500.0, interpolate='disp', force=True)
 
state.save("temp_state", force=True)
 
 
# Do it through script
#if False:
#if True:
if is_script:
# Deselect spin 51, due to weid data point
deselect.spin(spin_id=":51@HN", change_all=False)
 
import os
from auto_analyses import relax_disp as aa_relax_disp
from lib.dispersion.variables import EXP_TYPE_CPMG_DQ, EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_LIST, EXP_TYPE_R1RHO, MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LIST_ANALYTIC_CPMG, MODEL_LIST_FULL, MODEL_LIST_NUMERIC_CPMG, MODEL_LM63, MODEL_M61, MODEL_M61B, MODEL_MP05, MODEL_NOREX, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_R1RHO_2SITE, MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR, MODEL_PARAMS, MODEL_R2EFF, MODEL_TP02, MODEL_TAP03
# Number of grid search increments. If set to None, then the grid search will be turned off and the default parameter values will be used instead.
#GRID_INC = None
GRID_INC = 21
# The number of Monte Carlo simulations to be used for error analysis at the end of the analysis.
MC_NUM = 500
# Model selection technique.
MODSEL = 'AIC'
result_dir_name = os.getcwd()
# Which models to analyse ?
#MODELS = [MODEL_R2EFF, MODEL_NOREX, MODEL_DPL94, MODEL_TP02, MODEL_TAP03, MODEL_MP05, MODEL_NS_R1RHO_2SITE]
#MODELS = [MODEL_R2EFF, MODEL_NOREX]
# R2EFF shall be skipped here
#MODELS = [MODEL_NOREX]
# http://wiki.nmr-relax.com/M61
MODELS = [MODEL_NOREX, MODEL_M61]
 
# Fit, instead of read
r1_fit = True
# Go
aa_relax_disp.Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=result_dir_name, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM, modsel=MODSEL, r1_fit=r1_fit)
</source>

Navigation menu