Difference between revisions of "Tutorial for R1/R2 Relaxation curve-fitting analysis from NMRView files"

From relax wiki
Jump to navigation Jump to search
(Created page with "__TOC__ == Data background == Based on message found at: http://thread.gmane.org/gmane.science.nmr.relax.user/1874 Data stored in several NMRView .xpk files. relax can read...")
 
Line 66: Line 66:
 
Ind the end, there must be the (vol) peak volume integration intensity and the (int) the top peak point intensity.
 
Ind the end, there must be the (vol) peak volume integration intensity and the (int) the top peak point intensity.
  
The relax systemtests are found in:
+
The relax systemtests which test reading these files are found in:
 
<source lang="bash">
 
<source lang="bash">
 
test_suite/system_tests/chemical_shift.py
 
test_suite/system_tests/chemical_shift.py
 
test_suite/system_tests/peak_lists.py
 
test_suite/system_tests/peak_lists.py
 
</source>
 
</source>
 +
 +
== Run analysis in relax GUI ==
 +
=== The Script ===
 +
{{collapsible script
 +
| type  = relax script
 +
| title  = The <code>2_load_data.py</code> script.
 +
| lang  = python
 +
| script =
 +
# 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
 +
    # Taken from the relax disp manual, section 10.6.1 Dispersion script mode - the sample script
 +
    # Create the data pipe.
 +
    pipe_name = 'base pipe'
 +
    pipe_bundle = 'relax_fit'
 +
    pipe.create(pipe_name=pipe_name, bundle=pipe_bundle, pipe_type='relax_fit')
 +
 +
 +
# Set path
 +
import os
 +
os.chdir(os.getenv('HOME') + os.sep + 'Desktop' + os.sep + 'Karin')
 +
cwd = os.getcwd()
 +
outdir = cwd + os.sep
 +
 +
NMR_freq_label = 600
 +
 +
files =[
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_0ms', 0.00 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_10msa', 0.010 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_10msb', 0.010 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_30ms', 0.030 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_50ms', 0.050 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_70ms', 0.070 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_90msa', 0.090 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_90msb', 0.090 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_110ms', 0.110 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_130ms', 0.130 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_150ms', 0.150 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_170ms', 0.170 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_190ms', 0.190 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_210ms', 0.210 ],
 +
['R1-methyl_hRGS4_20C_pH7_Mar2016_250ms', 0.250 ]]
 +
 +
# Delete this, when all files are there
 +
files = files[:1]
 +
 +
# Create the spins from first file.
 +
# This is to create the data containers to store the data information.
 +
spectrum.read_spins(file="%s.xpk"%files[0][0], dir=cwd, dim=1)
 +
spectrum.read_spins(file="%s.xpk"%files[0][0], dir=cwd, dim=2)
 +
 +
all_spectrum_ids = []
 +
 +
# Read the spectrum intensities.
 +
for file_time in files:
 +
    file, time = file_time
 +
    spectrum_id = file
 +
    all_spectrum_ids.append(spectrum_id)
 +
 +
    spectrum.read_intensities(file="%s.xpk"%file, dir=cwd, spectrum_id=spectrum_id, int_method='height')
 +
    #spectrum.read_intensities(file="%s.xpk"%file, dir=cwd, spectrum_id=spectrum_id, int_method='point sum')
 +
 +
    # Set the relax time
 +
    relax_fit.relax_time(time=time, spectrum_id=spectrum_id)
 +
 +
# Do error analysis.
 +
# Replicated spectrums.
 +
spectrum.replicated(spectrum_ids=['R1-methyl_hRGS4_20C_pH7_Mar2016_10msa','R1-methyl_hRGS4_20C_pH7_Mar2016_10msb'])
 +
spectrum.replicated(spectrum_ids=['R1-methyl_hRGS4_20C_pH7_Mar2016_90msa','R1-methyl_hRGS4_20C_pH7_Mar2016_90msb'])
 +
 +
# Make error analysis
 +
spectrum.error_analysis(subset=all_spectrum_ids)
 +
#spectrum.error_analysis()
 +
 +
# Save the program state before run.
 +
state.save('ini_setup', force=True)
 +
 +
if is_script:
 +
#if false:
 +
    from auto_analyses.relax_fit import Relax_fit
 +
    GRID_INC = 21
 +
    MC_NUM = 500
 +
    results_directory = os.path.join(cwd, "Rx_fit")
 +
 +
    Relax_fit(pipe_name=pipe_name, pipe_bundle=pipe_bundle, file_root=str(NMR_freq_label), results_dir=results_directory, grid_inc=GRID_INC, mc_sim_num=MC_NUM, view_plots=False)
 +
}}
 +
 +
=== Procedure in GUI ===

Revision as of 23:25, 31 March 2016

Data background

Based on message found at: http://thread.gmane.org/gmane.science.nmr.relax.user/1874

Data stored in several NMRView .xpk files.

relax can read the NMRView format.

The whole list of files is:

R1-methyl_hRGS4_20C_pH7_Mar2016_0ms
R1-methyl_hRGS4_20C_pH7_Mar2016_10msa
R1-methyl_hRGS4_20C_pH7_Mar2016_10msb
R1-methyl_hRGS4_20C_pH7_Mar2016_30ms
R1-methyl_hRGS4_20C_pH7_Mar2016_50ms
R1-methyl_hRGS4_20C_pH7_Mar2016_70ms
R1-methyl_hRGS4_20C_pH7_Mar2016_90msa
R1-methyl_hRGS4_20C_pH7_Mar2016_90msb
R1-methyl_hRGS4_20C_pH7_Mar2016_110ms
R1-methyl_hRGS4_20C_pH7_Mar2016_130ms
R1-methyl_hRGS4_20C_pH7_Mar2016_150ms
R1-methyl_hRGS4_20C_pH7_Mar2016_170ms
R1-methyl_hRGS4_20C_pH7_Mar2016_190ms
R1-methyl_hRGS4_20C_pH7_Mar2016_210ms
R1-methyl_hRGS4_20C_pH7_Mar2016_250ms

For determination of the errors of the intensity, there is 2x duplicated spectra (10ms, and 90ms.)

See:

NMRView format

Each file has a structure like this:

label dataset sw sf
H1 C13
R1-methyl_hRGS4_20C_pH7_Mar2016_0ms.nv
1500.2322998 3328.125
599.802978516 150.824996948
H1.L H1.P H1.W H1.B H1.E H1.J H1.U C13.L C13.P C13.W C13.B C13.E C13.J C13.U vol int stat comment flag0
0 {75.HG11} 1.03960 0.03402 0.08416 ++ {0.0} {} {75.CG1} 21.00886 0.34258 0.60154 ++ {0.0} {} 2.09171414375 0.0213 0 {} 0
1 {75.HG21} 1.04055 0.03307 0.07450 ++ {0.0} {} {75.CG2} 20.65424 0.20240 0.50941 ++ {0.0} {} 1.69693529606 0.0198 0 {} 0
....

This is 19 Columns of data.

The first line describes what datatypes is to be found in the following lines. Here:

  • Line 1 is the label of nucleus
  • Line 2 is the dataset from where the file is created from
  • Line 3 is the Sweep (Spectral) Width [sw] in Hz
  • Line 4 is the Nuclear magnetic resonance frequency at the given spectrometer field. In MHz.

Then follow a line of header description.

  • H1.L must be the label for the H1. Residue 75, atomname HG11
  • Then follows .P, .W and .B
  • Then follow .E, .J and .U.

Then comes for carbon C13.

Ind the end, there must be the (vol) peak volume integration intensity and the (int) the top peak point intensity.

The relax systemtests which test reading these files are found in:

test_suite/system_tests/chemical_shift.py
test_suite/system_tests/peak_lists.py

Run analysis in relax GUI

The Script

Procedure in GUI