Tutorial for Relaxation dispersion analysis cpmg fixed time recorded on varian as fid interleaved scripts

From relax wiki
Revision as of 13:20, 27 August 2013 by Tlinnet (talk | contribs) (Created page with "= CPMG_1_sort_pseudo3D_initialize_files.sh = <source lang="bash"> #!/bin/bash -e if [ -f fid ]; then echo "File exist: fid" IN=fid else echo "FID file not found i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CPMG_1_sort_pseudo3D_initialize_files.sh

#!/bin/bash -e

if [ -f fid ]; then
    echo "File exist: fid"
    IN=fid
else
    echo "FID file not found in current folder"
    exit $?
fi

if [ -f procpar ]; then
PLANE=`awk '/^ncyc /{f=1;next}f{print $1;exit}' procpar`
echo "Number of ncyc/planes in procpar: $PLANE"
MODEPAR=`awk '/^array /{f=1;next}f{print $2;exit}' procpar`
IFS=',' read -a MODEARR <<< "$MODEPAR"
echo "Modearray is: $MODEARR"
if [ ${MODEARR[0]} == '"phase' ]; then
MODE=1
fi
if [ ${MODEARR[0]} == '"ncyc' ]; then
MODE=0
fi
echo "Array is recorded: $MODEPAR, so mode should be: $MODE"
NI=`awk '/^ni /{f=1;next}f{print $2;exit}' procpar`
echo "Found in the file procpar that ni=$NI"
NP=`awk '/^np /{f=1;next}f{print $2;exit}' procpar`
echo "Found in the file procpar that np=$NP"
fi

echo 
echo "I suggest following sort_psedo3D command, which I will do for you"
echo "####################"
echo "sort_pseudo3D -in $IN -plane $PLANE -mode $MODE -ni $NI -np $NP"
echo "####################"
sort_pseudo3D -in $IN -plane $PLANE -mode $MODE -ni $NI -np $NP
echo 
echo "I moved your 'fid' to 'fid_original_interleaved"
echo "And made a link from 0.fid to fid, to use in varian"
echo 
echo "Now just click, 'read parameters', check 'Rance-Kay'"
echo "Remember to set Y-'Observe Freq MHz' to N15"
echo "Click 'Save script' to make 'fid.com' file, and 'Quit', and run the next CPMG script"

mv -n fid fid_original_interleaved
ln -s 0.fid fid
varian
rm fid
ln -s fid_original_interleaved fid

CPMG_2_convert_and_process.sh

#!/bin/bash

PLANE="ERR"
if [ -f procpar ]; then
PLANE=`awk '/^ncyc /{f=1;next}f{print $1;exit}' procpar`
PLANE=$(($PLANE -1))
#echo $PLANE
fi

if [ -f fid.com ]; then
  if grep -Fq "sleep" fid.com; then
  echo "sleep found in fid.com and is removed"
  sed -i '/^sleep/d' fid.com
  fi
  if grep -Fq "var2pipe -in ./0.fid" fid.com; then
  echo "0.fid found in fid.com and changed to 'fid'"
  sed -i "s/0.fid/fid/g" fid.com
  fi
fi

if [ ! -f convert_all.com ]; then
echo "'convert_all.com' does not exist, I will copy it over, alter it, and run it"
cp ./../scripts/convert_all.com $PWD
  if [ $PLANE != "ERR" ]; then
  sed -i "s/x <= 35/x <= $PLANE/g" convert_all.com
  fi
fi

echo 
echo "I suggest run convert_all.com, which I will do for you"
echo "####################"
echo "csh convert_all.com"
echo "####################"
tcsh convert_all.com
echo "Now we need to transform the spectra."
echo "Process one of the files normally and copy the processing script to the experiment folder."
echo "[m]->Right-Click Process 2D->Basic 2D"
echo "Save->Execute->Done; then; RClick File->Select File->test.ft2->Read/draw->Done"
echo "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"
echo "[m] '| nmrPipe -fn FT -neg \' to the script to the third lowest line."
echo "Save->Execute->Done. Then push [r] to refresh."
echo "Press [h], and find P0 and P1, and push [m], change parameters and update script"
echo "The changes to '| nmrPipe  -fn PS xxx \' should be the FIRST line (The proton dimension) with PS"
echo "save/execute, push [r] (read) and the [e] (erase settings) to see result in NMRdraw"
echo "And then run the next CPMG script"
cd 0.fid
nmrDraw
cp nmrproc.com ../fft.com
cd ..

CPMG_3_fft_all.sh

#!/bin/bash -e

PLANE="ERR"
if [ -f procpar ]; then
PLANE=`awk '/^ncyc /{f=1;next}f{print $1;exit}' procpar`
PLANE=$(($PLANE -1))
#echo $PLANE
fi

if [ -f fft.com ]; then
  echo "fft.com in your folder"
else
echo "no fft.com in your folder"
  if [ -f 0.fid/fft.com ]; then
  echo "fft.com in your 0 folder, and copy it to here"
  cp 0.fid/fft.com .
  elif [ -f 0.fid/nmrproc.com ]; then
  echo "nmrproc.com in your 0 folder, and copy it to here as fft.com"
  cp 0.fid/nmrproc.com ./fft.com
  else
  exit
  fi
fi

if [ ! -f fft_all.com ]; then
echo "'fft_all.com' does not exist, I will copy it over, alter it, and run it"
cp ./../scripts/fft_all.com $PWD
  if [ $PLANE != "ERR" ]; then
  sed -i "s/x <= 35/x <= $PLANE/g" fft_all.com
  sed -i '/^$/d' fft_all.com
  fi
fi

echo 
echo "I suggest run fft_all.com, which I will do for you"
echo "####################"
echo "csh fft_all.com"
echo "####################"
csh fft_all.com
echo
echo "Now get a peak list"
echo "In CCPNMR Analysis, you open one of you spectra from the relaxation series."
echo "Assign all the peaks you want to analyse. Usually, this is done by copying a peaklist from a HSQC experiment"
echo "and adjusting the crosses so they lie exactly on top of the peaks."
echo "It is important to remove all unassigned peaks from the peak list."
echo "If your spectrum is folded, pick the peaks at their position in the folded spectrum."
echo "Export this peak list in to you data folder as Sparky peak list using FormatConverter. (Other>FormatConverter and export>Sparky)"
echo "In analysis: Other->Format Converter->Export->Sparky->Peaks export menu->Select peak list->Select export file->"
echo "Save it for example as: 'peaks_20121005.sparky' in your experiment folder"

convert_all.com

#!/bin/csh -f

set x = 0

while ( $x <= 35 )
    mv $x.fid $x.fid.temp
 	mkdir $x.fid
	cd $x.fid
	mv ../$x.fid.temp ./fid
	cp ../fid.com .
	./fid.com
	cd ..
	@ x = $x + 1
end

fft_all.com

#! /bin/csh -f

set x = 0

while ( $x <= 35 )
	cd $x.fid
	cp ../fft.com .
	./fft.com
	cd ..
	@ x = $x + 1
end