Difference between revisions of "Tutorial for Relaxation dispersion analysis cpmg fixed time recorded on varian as fid interleaved"

From relax wiki
Jump to navigation Jump to search
Line 353: Line 353:
 
</source>
 
</source>
  
== Analyse in GUI ==
+
== Analyse ==
 +
=== Analyse in GUI ===
 
Start relax in GUI mode
 
Start relax in GUI mode
 
<source lang="bash">
 
<source lang="bash">
Line 377: Line 378:
 
# Select file_name: '''relax_3_spectra_settings.py''' -> OK
 
# Select file_name: '''relax_3_spectra_settings.py''' -> OK
 
# Push "Execute"
 
# Push "Execute"
 +
 +
=== Analyse via script ===
  
 
= See also =
 
= See also =
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Revision as of 09:09, 27 August 2013

Intro

This tutorial is based on the analysis of NMR data from the paper:

The inverted chevron plot measured by NMR relaxation reveals a native-like unfolding intermediate in acyl-CoA binding protein.
Kaare Teilum, Flemming M Poulsen, Mikael Akke.
Proceedings of the National Academy of Sciences of the United States of America (2006).
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1458987

The data is recorded as FID interleaved

Preparation

You want to make a working dir, with different folders

peak_lists
spectrometer_data
scripts

You can create the folders by

mkdir peak_lists spectrometer_data scripts

In the folder spectrometer_data should be the files: fid and procpar as the output from recording fid interleaved on Varian.
In the folder peak_lists should contain SPARKY list in SPARKY list format.
In the folder scripts we put scripts which help us processing the files.

Get the process helper scripts

cd scripts
# Change shell
tcsh
# Set array of scripts to download
set SCRIPTS="CPMG_1_sort_pseudo3D_initialize_files.sh CPMG_2_convert_and_process.sh CPMG_3_fft_all.sh convert_all.com fft_all.com sparky_add.sh stPeakList.pl NMRPipe_to_Sparky.sh"

# Download scripts
foreach SCRIPT ( ${SCRIPTS} )
curl https://raw.github.com/nmr-relax/relax_scripts/master/shell_scripts/$SCRIPT -o $SCRIPT
end

# Make them executable
chmod +x *.sh *.com *.pl

# Go back to previous directory
cd ..

Extract interleaved spectra, process to NMRPipe and do spectral processing

Extract interleaved and change format to NMRPipe

sort out the interleaved fid with the script CPMG_1_sort_pseudo3D_initialize_files.sh.

# Copy data
cp -r spectrometer_data spectrometer_data_processed

# sort_pseudo3D and initialize files
cd spectrometer_data_processed
CPMG_1_sort_pseudo3D_initialize_files.sh

Now we make a file to convert from binary format of Varian to NMRPipe.

  1. Now click, 'read parameters', check 'Rance-Kay'
  2. Remember to set Y-'Observe Freq MHz' to N15
  3. Click 'Save script' to make 'fid.com' file, and 'Quit', and run the next CPMG script

Now it is time to convert all the fid from varian format to NMRPipe with the script CPMG_2_convert_and_process.sh.

CPMG_2_convert_and_process.sh

Spectral processing

  1. Now we need to spectral process the spectra.
  2. Process one of the files normally and the next script will copy the processing script to the other folder.
  3. [m]->Right-Click Process 2D->Basic 2D
  4. Save->Execute->Done; then; RClick File->Select File->test.ft2->Read/draw->Done
  5. If your spectra look reversed (i.e. if your peaks do not seem to match your reference spectrum) it might be solved by changing to
  6. [m] '| nmrPipe -fn FT -neg \' to the script to the third lowest line.
  7. Save->Execute->Done. Then push [r] to refresh.
  8. Press [h], and find P0 and P1, and push [m], change parameters and update script
  9. The changes to '| nmrPipe -fn PS xxx \' should be the FIRST line (The proton dimension) with PS
  10. save/execute, push [r] (read) and the [e] (erase settings) to see result in NMRdraw
  11. And then run the next CPMG script

As suggested in the relax manaul, section 5.2.2 Spectral processing, the spectral processing script could look like: File: nmrproc.com

#!/bin/csh

nmrPipe -in test.fid \
| nmrPipe  -fn SOL                                    \
| nmrPipe  -fn GM  -g1 5 -g2 10 -c 0.5                \
| nmrPipe  -fn ZF -auto -size 8000                    \
| nmrPipe  -fn FT -auto                               \
| nmrPipe  -fn PS -p0 214.00 -p1 -21.00 -di -verb     \
| nmrPipe  -fn TP                                     \
| nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 2 -c 0.5    \
| nmrPipe  -fn ZF -auto -size 8000                    \
| nmrPipe  -fn FT -neg                                \
| nmrPipe  -fn PS -p0 0.00 -p1 0.00 -di -verb         \
| nmrPipe  -fn TP                                     \
| nmrPipe  -fn POLY -auto                             \
| nmrPipe  -fn EXT -left -sw                          \
   -ov -out test.ft2

Fourier transform all spectra

Now it is time to Fourier Transform all spectra with the script CPMG_3_fft_all.sh.

CPMG_3_fft_all.sh

Convert all *.ft2 files to ucsf format, so they can be opened in SPARKY

Done by the script NMRPipe_to_Sparky.sh

NMRPipe_to_Sparky.sh

Check the peak list matches

sparky 0.fid/test.ucsf

SPARKY GUI

The keyboard shortcuts are listed in the manual [1]

First make window bigger.
zo for zoom out. zi Zoom in.

ct for setting countour level.
Set level 6 for positive and negative.
Add 1 to the +e0x level. Ex: xxxe+03 -> xxxe+04 ind positive and negative.
Ok

rp for read peaks. Find your peak file.

../peak_lists/peaks.list

Click Create peaks, Close.

Shift all peaks

Select on peak, and center it.
lt (LT) to show a list of peaks for a spectrum.
Double click on peak "A3N" in the list. Zoom in "zi".

Now you want to align you peaks, since they can be off-shifted.
First note down the current value of PPM in w1 and w2.

A3N-HN	121.828	8.513

Push F1 for select mode, drag it with the mouse or "pc" for auto "peak center".
Then click "Update" in the peak list, and note down the new values.

A3N-HN	121.681	8.514
We need to shift the nitrogen peaks 
(121.681 - 121.828)=-0.147 ppm, 
and proton peaks 
(8.514 - 8.513)=0.001 ppm.

Exit SPARKY

Go to the peak_list folder.

cd ../peak_lists/

Correct Nitrogen

sparky_add.sh peaks.list '$2' -0.147 peaks_corr_N15.list

Correct Proton

sparky_add.sh peaks_corr_N15.list '$3' 0.001 peaks_corr_N15_1H.list

Check and auto center peaks

Now go into Sparky again, and read peak list.

cd ..
cd spectrometer_data_processed
sparky 0.fid/test.ucsf

rp Choose ../peak_lists/peaks_corr_N15_1H.list
Create peaks, close.
zo zoom out. ct set contour.
lt and go through peaks, and auto center with pc.

Problematic peaks:

H30N-HN, not possible to auto center in the middle. Next to L47 and E4.
A57N-HN / D68N-HN  In original peak list: A57N-HN 121.526 7.944 / D68N-HN 121.511 7.922, both centered to: 121.409 7.933.

Manually alter peaks

Save file to: ../peak_lists/peaks_corr_peak_center.list and then alter values manual.

cp ../peak_lists/peaks_corr_peak_center.list ../peak_lists/peaks_corr_final.list 
gedit ../peak_lists/peaks_corr_final.list &

Then alter to:

H30N-HN 117.794 8.045
A57N-HN	121.417 7.944
D68N-HN	121.402 7.922

Then check again in sparky.

Check for peak movement

As stated in the relax manual section 5.2.1 Temperature control and calibration, the pulse sequence can put a lot of power into the sample.

It is therefore good practice to inspect for peak movements, by overlaying all spectra:

Open all the files, and overlay them with SPARKY command ol.

sparky 0.fid/test.ucsf 1.fid/test.ucsf 2.fid/test.ucsf 3.fid/test.ucsf 4.fid/test.ucsf

Changes colours for different spectra in contour ct.
Then overlay with "ol". Make sure no peaks move around.

Measuring peak heights

We will use the program NMRPipe seriesTab to measure the intensities.

seriesTab needs a input file, where the ppm values from a SPARKY list has been converted to spectral points.
The spectral points value depends on the spectral processing parameters.

Generate spectral point file

Create a file with spectral point information with script stPeakList.pl.

stPeakList.pl 0.fid/test.ft2 ../peak_lists/peaks_corr_final.list > peaks_list.tab
cat peaks_list.tab

Make file with paths to .ft2 files

Then we make a file list of filepaths to .ft2 files.

ls -v -d -1 */*.ft2 > ft2_files.ls
cat ft2_files.ls

Measure the height or sum in a spectral point box

seriesTab -in peaks_list.tab -out peaks_list_max_standard.ser -list ft2_files.ls -max
seriesTab -in peaks_list.tab -out peaks_list_max_dx1_dy1.ser -list ft2_files.ls -max -dx 1 -dy 1

OR make the sum in a box:

seriesTab -in peaks_list.tab -out peaks_list_sum_dx1_dy1.ser -list ft2_files.ls -sum -dx 1 -dy 1

Extract the spectra settings from Varian procpar file

Now we want to make a settings file we can read in relax.

set NCYCLIST=`awk '/^ncyc /{f=1;next}f{print $0;exit}' procpar`; echo $NCYCLIST
set TIMET2=`awk '/^time_T2 /{f=1;next}f{print $2;exit}' procpar`; echo $TIMET2
set SFRQ=`awk '/^sfrq /{f=1;next}f{print $2;exit}' procpar`; echo $SFRQ

foreach I (`seq 2 ${#NCYCLIST}`)
set NCYC=${NCYCLIST[$I]}; set FRQ=`echo ${NCYC}/${TIMET2} | bc -l`; echo $NCYC $TIMET2 $FRQ $SFRQ >> ncyc.txt
end
cat ncyc.txt

Analyse in relax

making a spin file from SPARKY list

relax does not yet has the possibility to read spins from a sparky file. See support request.

So we create one.

set ATOMS=`tail -n+4 peaks_list.tab | awk '{print $7}'`
set SCRIPT=relax_spins.py

foreach I (`seq 1 ${#ATOMS}`)
set ATOM=${ATOMS[$I]}; set SPIN=`echo $ATOM | sed -e "s/N-HN//g"`; set RESN=`echo $SPIN | sed -e "s/[0-9]*//g"`; set RESI=`echo $SPIN | sed -e "s/[A-Za-z]//g"`
echo $ATOM $SPIN $RESN $RESI
echo "spin.create(spin_name='N', spin_num=$I, res_name='$RESN', res_num=$RESI, mol_name=None)" >> $SCRIPT
end

Prepare directory for relax run

Then we make a directory ready for relax

mkdir ../relax
cp ncyc.txt ../relax
cp peaks_list* ../relax
cp relax_spins.py ../relax

relax script for setting experiment settings to spectra

Add the following python relax script file to the relax directory

relax_3_spectra_settings.py

# Loop over the spectra settings.
ncycfile=open('ncyc.txt','r')

# Make empty ncyclist
ncyclist = []

i = 0
for line in ncycfile:
    ncyc = line.split()[0]
    time_T2 = float(line.split()[1])
    vcpmg = line.split()[2]
    set_sfrq = float(line.split()[3]) * 1e6
    rmsd_err = float(line.split()[4])

    print ncyc, time_T2, vcpmg

    # Test if spectrum is a reference
    if float(vcpmg) == 0.0:
        vcpmg = None
    else:
        vcpmg = round(float(vcpmg),3)

    # Add ncyc to list
    ncyclist.append(int(ncyc))

    # Set the current spectrum id
    current_id = "Z_A%s"%(i)

    # Set the peak intensity errors, as defined as the baseplane RMSD.
    spectrum.baseplane_rmsd(error=rmsd_err, spectrum_id=current_id)

    # Set the NMR field strength of the spectrum.
    spectrometer.frequency(id=current_id, frq=set_sfrq)

    # Relaxation dispersion CPMG constant time delay T (in s).
    relax_disp.relax_time(spectrum_id=current_id, time=time_T2)

    # Set the relaxation dispersion CPMG frequencies.
    relax_disp.cpmg_frq(spectrum_id=current_id, cpmg_frq=vcpmg)

    i += 1

# Specify the duplicated spectra.
#spectrum.replicated(spectrum_ids=['Z_A1', 'Z_A15'])

# The automatic way
dublicates = map(lambda val: (val, [i for i in xrange(len(ncyclist)) if ncyclist[i] == val]), ncyclist)
for dub in dublicates:
    ncyc, list_index_occur = dub
    if len(list_index_occur) > 1:
        id_list = []
        for list_index in list_index_occur:
            id_list.append('Z_A%s'%list_index)
        # We don't setup replications, since we have RMSD values from background noise
        print id_list
        #spectrum.replicated(spectrum_ids=id_list)

# Delete replicate spectrum
spectrum.delete('Z_A15')

Analyse

Analyse in GUI

Start relax in GUI mode

relax_disp -g
  1. Ctrl+n for new analysis
  2. Select Relaxation dispersion analysis button -> Next
  3. CPMG, fixed time -> Next
  4. Starting pipe: base pipe
  5. Pipe bundle: relax_disp -> Start
  6. We want to load the spins manually, so in next window, then go to "User functions (n-z) -> script"
  7. Select file_name: relax_2_spins.py -> OK
  8. Then click Spin Isotopes button:
  9. The nuclear isotope name: 15N
  10. The spin ID string: @N* -> OK
  11. The load spectra: Select button "Add" under spectra list:
  12. The file name: peaks_list_max_standard.ser
  13. The spectrum ID string: auto
  14. Push "Apply" and then "Cancel"
  15. We want to change the spectra properties by a script.
  16. Go to "User functions (n-z) -> script"
  17. Select file_name: relax_3_spectra_settings.py -> OK
  18. Push "Execute"

Analyse via script

See also