My software notes

January 26, 2006


Filed under: NMRPipe and NMRview — kpwu @ 3:50 am

Read from NMRPipe mailing list at Yahoo groups. A guy said the varian version crinept type TROSY has to be process into two files after process, like IPAP type experiment. Although I had processed a CRINEPT type TROSY obtained from Bruker 800MHz, I never know to do such seperation. Moreover, there are some special tips to know for processing such FID, I paste the scripts provided by the poster who said Frank Degladio gave him the script.

———– script starts at next line————


var2pipe -in ./fid -noaswap  \
-xN              2050  -yN               128  \
-xT              1025  -yT                64  \
-xMODE        Complex  -yMODE      Rance-Kay  \
-xSW        13008.130  -ySW         3000.000  \
-xOBS         899.804  -yOBS          91.187  \
-xCAR           4.815  -yCAR         118.438  \
-xLAB              HN  -yLAB             N15  \
-ndim               2  -aq2D          States  \
-out ./test.fid -verb -ov

nmrPipe -in test.fid \
| nmrPipe -fn COADD -cList 1 0 -axis Y -time \
| nmrPipe  -fn SOL                                    \
| nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 2 -c 0.5    \
| nmrPipe  -fn ZF -auto                               \
| nmrPipe  -fn FT                                     \
| nmrPipe  -fn PS -p0 120  -p1 0.0 -di                \
| nmrPipe  -fn EXT -left -sw -verb                    \
| nmrPipe  -fn TP                                     \
| nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 1 -c 0.5    \
| nmrPipe  -fn ZF -auto                               \
| nmrPipe  -fn FT -neg                                     \
| nmrPipe  -fn PS -p0 90 -p1 0 -di                     \
-verb -ov -out A.ft2

nmrPipe -in test.fid \
| nmrPipe -fn COADD -cList 0 1 -axis Y -time \
| nmrPipe  -fn SOL                                    \
| nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 2 -c 0.5    \
| nmrPipe  -fn ZF -auto                               \
| nmrPipe  -fn FT                                     \
| nmrPipe  -fn PS -p0 120  -p1 0.0 -di                \
| nmrPipe  -fn EXT -left -sw -verb                    \
| nmrPipe  -fn TP                                     \
| nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 1 -c 0.5    \
| nmrPipe  -fn ZF -auto                               \
| nmrPipe  -fn FT -neg                                     \
| nmrPipe  -fn PS -p0 0 -p1 0 -di                     \
-verb -ov -out B.ft2

addNMR -in1 A.ft2 -in2 B.ft2 -out A+B.ft2 -add -c1 1.0 -c2 1.0
addNMR -in1 A.ft2 -in2 B.ft2 -out A-B.ft2 -sub -c1 1.0 -c2 1.0

——————– end ———————————————-


NMRView startup file

Filed under: NMRPipe and NMRview — kpwu @ 3:06 am

You could generate a startup file for NMRView,especially when you are going to analyze lots of dynamic data. The startup file can load many spectra in seconds, also including the sequence file, the peak list and PDB coordinate files.

Usage: save the following lines in a file and run “source your_file”

—————- file content ——————————–

##### read in spectra #############
nv_dataset dir /disk1/nv/mouse/gftnmr
nv_dataset open /disk1/nv/mouse/gftnmr/masyn-15c-hsqc-1216.nv
nv_dataset open /disk1/nv/mouse/gftnmr/hacacocanh-dp1.nv
nv_dataset open /disk1/nv/mouse/gftnmr/hacacocanh-dp2.nv
#nv_dataset open /disk1/nv/mouse/gftnmr/hacacocanh-dp3.nv
nv_dataset open /disk1/nv/mouse/gftnmr/hacacocanh-dp4.nv
##### read in molecule sequence file
nv_sread seq /disk1/nv/mouse/gftnmr/mouse.seq
##### read in assignment peaklist ##
readpks /disk1/nv/mouse/gftnmr/masyn-15c-1216-hsqc.xpk
##### read in ppm file
#readppm /disk1/nv/mouse/gftnmr/nv/ppm.out

convert all *.ps to PNG format by a script

Filed under: softwares and scripts — kpwu @ 2:59 am
  1. ONLY convert the files in the directory where this script is.
  2. “-density 150” is the resolution, in this case 150 dpi
  3. -geometry 100% is the scale you want to resize by %
  4. also, you can convert lots of JPEG to smaller resolution, just change .ps to .jpg, and change the output to another directory, either using .jpg or .png

———— following lines are the content of the script ———


## using “convert” from ImageMagick to do ps convert into PNG

echo PS convert to PNG, please wait the process
for INP in *.ps
newname=`basename $INP .ps`
convert -density 150 -geometry 100% $INP $newname%02d.png
echo ” convert $INP to $newname.png completely”
echo ” process ended, please check your graphical files”

January 25, 2006

[MOLMOL]align your structures by a simple macro

Filed under: pymol/ molmol — kpwu @ 3:45 am

Save the following lines into a macro(xxx.mac), you can put the file in the MOLMOL_HOME/macros, then you will find the file in the standard macro directory while you browse the toolbar in MOLMOL

**** ONLY align the backbone, and you will see the RMSD value at the bottom of MOLMOL

——————-copy the following lines into a xxx.mac——————-

SelectAtom ”
SelectBond ”
SelectAngle ”
SelectDist ”
SelectPrim ”
StyleAtom invisible
StyleBond invisible
StyleRibbon invisible as_is as_is as_is
SelectAtom ‘bb’
SelectBond ‘bb’
StyleAtom invisible
StyleBond line
Fit to_first ‘selected’

convert protein sequence from 1 to 3 letter code for each residue

Filed under: NMRPipe and NMRview,xplor/xplor-nih/cns — kpwu @ 3:37 am

Copy the following lines in a shell script file, make sure the file is executable, so far only work one direction from single letter code to 3-letter code, plan to cover both directions and DNA/RNA in the future.

The script was designed for NMRView sequence format, and Xplor sequence format,too.

# convert protein sequence from one letter code to three letter code
# Just set up your sequence file name for “xseq= ??”
# Kuen-Phon Wu, 06/11/2004 version 0.2
# 06/17/2004 version 0.3
# This program will ignore any other characters which are not standard 20 Amino
# acids, like: B,O…. Either lowercases or uppercases can be process via this
# program, have fun!
# Just use as: ./ [FILENAME] > [OUT_FILE]

usage=”Usage: [inputfile] > [OUTPUT]”

if [ $# -lt 1 ] ; then
echo “$usage”
exit 1

tr ‘A-Z’ ‘a-z’ ==== $1 | tr ‘[:punct:]’ ‘b’ | tr ‘0-9’ ‘b’ |tr ‘\n’ ‘b’| \
sed -e ‘s/[o|x|z|u|j|b| ]//g’ \
-e ‘s/a/ALA\n/g’ -e ‘s/c/CYS\n/g’ -e ‘s/d/ASP\n/g’ \
-e ‘s/e/GLU\n/g’ -e ‘s/f/PHE\n/g’ -e ‘s/g/GLY\n/g’ \
-e ‘s/h/HIS\n/g’ -e ‘s/i/ILE\n/g’ -e ‘s/k/LYS\n/g’ \
-e ‘s/l/LEU\n/g’ -e ‘s/m/MET\n/g’ -e ‘s/p/PRO\n/g’ \
-e ‘s/r/ARG\n/g’ -e ‘s/q/GLN\n/g’ -e ‘s/n/ASN\n/g’ \
-e ‘s/s/SER\n/g’ -e ‘s/t/THR\n/g’ -e ‘s/w/TRP\n/g’ \
-e ‘s/y/TYR\n/g’ -e ‘s/v/VAL\n/g’

re-order the PDB file

Filed under: xplor/xplor-nih/cns — kpwu @ 12:06 am

Please save the followng lines in a shell script file, the script could be worked well in most cases, that is very convinient for change the PDB residue number from 1 to designated number, for example change from 1 to 331, when your protein is a part of C-terminal domain.

Enjoy it


## Author: Kuen-Phon Wu, 06/10/2004, v 0.5
#############  set up pdb file name ##############

#### just adjust the $5-33, which -33 is the number you want to minus
####  if you want to plus, just do an addition like +33

awk ‘ $1 ~ \
 /ATOM/{printf (“%s%7s%5s%4s%6s%12.3f%8.3f%8.3f%6.2f%6.2f\n”,\
  $1,$2,$3,$4,$5-33,$6,$7,$8,$9,$10) }
 ‘ $PDB  > _temp

### do sed for LYS+, HIS+,and  ARG+
sed -e ‘s/LYS+ / LYS+/g’ -e ‘s/ARG+ / ARG+/g’ -e ‘s/HIS+ / HIS+/g’ \
 _temp >$output
rm -f _temp

January 22, 2006

Vi, the powerful text editor

Filed under: softwares and scripts — kpwu @ 4:35 am

A good instruction of Vi is posted by vbird’s website (, check it!

some useful, daily use tips (copy from above URL):

+ 游標移動到非空白字元的下一列
n 那個 n 表示『數字』,例如 20 。按下數字後再按空白鍵,游標會向右移動這一行的 n 個字元。例如 20 則游標會向後面移動 20 個字元距離。
0 這是數字『 0 』:移動到這一行的最前面字元處 (常用)
$ 移動到這一行的最後面字元處(常用)
H 游標移動到這個螢幕的最上方那一行
M 游標移動到這個螢幕的中央那一行
L 游標移動到這個螢幕的最下方那一行
G 移動到這個檔案的最後一行(常用)
nG n 為數字。移動到這個檔案的第 n 行。例如 20G 則會移動到這個檔案的第 20 行(可配合 :set nu)
gg 移動到這個檔案的第一行,相當於 1G 啊! (常用)
n n 為數字。游標向下移動 n 行(常用)
x, X 在一行字當中,x 為向後刪除一個字元 (相當於 [del] 按鍵), X 為向前刪除一個字元(相當於 [backspace] 亦即是倒退鍵) (常用)
nx n 為數字,連續向後刪除 n 個字元。舉例來說,我要連續刪除 10 個字元, 『10x』。
dd 刪除游標所在的那一整列(常用)
ndd n 為數字。刪除游標所在的向下 n 列,例如 20dd 則是刪除 20 列 (常用)
d1G 刪除游標所在到第一行的所有資料
dG 刪除游標所在到最後一行的所有資料
d$ 刪除游標所在處,到該行的最後一個字元
d0 那個是數字的 0 ,刪除游標所在處,到該行的最前面一個字元
yy 複製游標所在的那一行(常用)
nyy n 為數字。複製游標所在的向下 n 列,例如 20yy 則是複製 20 列(常用)
y1G 複製游標所在列到第一列的所有資料
yG 複製游標所在列到最後一列的所有資料
y0 複製游標所在的那個字元到該行行首的所有資料
y$ 複製游標所在的那個字元到該行行尾的所有資料
p, P p 為將已複製的資料在游標下一行貼上,P 則為貼在游標上一行! 舉例來說,我目前游標在第 20 行,且已經複製了 10 行資料。則按下 p 後, 那 10 行資料會貼在原本的 20 行之後,亦即由 21 行開始貼。但如果是按下 P 呢? 那麼原本的第 20 行會被推到變成 30 行。 (常用)
J 將游標所在列與下一列的資料結合成同一列
c 重複刪除多個資料,例如向下刪除 10 行,[ 10cj ]
u 復原前一個動作。(常用)
[Ctrl]+r 重做上一個動作。(常用)
這個 u 與 [Ctrl]+r 是很常用的指令!一個是復原,另一個則是重做一次~ 利用這兩個功能按鍵,您的編輯,嘿嘿!很快樂的啦!
. 不要懷疑!這就是小數點!意思是重複前一個動作的意思。 如果您想要重複刪除、重複貼上等等動作,按下小數點『.』就好了! (常用)

automatically process you NMR FIDs

Filed under: NMRPipe and NMRview — kpwu @ 3:20 am

Once  you have lots of dynamics experiments, such as T1, T2 , or  diffusion data, you  won’t want to process all FIDs one by one and convert to nmrivew format one by one again.

If you acquire all FIDs in same parameters (ex:TD1,TD2 for Bruker, np, ni for Varian) , then just set the file location “base” and the file name you want those files to be (“name”), and the destination you want to move (“location”).

Make sure your, is executable, and has done phase corrections. 



#process FIDs in a script, quickly and easily
base=”/disk1/data/kpwu/nmr/T1″   # file location
name=”t1″                                    # file name
location=”/disk1/data/kpwu/nv/T1″  # where you want to collect

i=21                                            # initial number of the FID
while [ “$i” -lt 37 ]                         # last FID number +1 ( ex: 36+1)
cp *.com $base/$i
cd $base/$i
pipe2xyz -in test.ft2 -nv -out $name-$i.nv
mv $name-$i.nv $location
i=`expr $i + 1`

make your helices in cylinder view

Filed under: pymol/ molmol — kpwu @ 3:00 am


sample: 1DJM.pdb

load 1DJM.pb
show cartoon, 1DJM
set cartoon_cylindrical_helices,1
ray 350,300
png 1djm.png

January 21, 2006

pymol’s sequence mode

Filed under: pymol/ molmol — kpwu @ 5:05 am


Beginning from pymol 0.98, there is a new function called “sequence mode”

You can just click the pymol Tcl/Tk GUI toolbar [DISPLAY] -> [SEQUENCE] to enable the sequence mode, then you will see a sequence of you PDB file in the PyMOL viewer window. Seqeunce mode is a very powerful advantage, because you can use mose left button to select residues you have interests, then pymol automatically generetes a selection object for you, like what I show in this figure, I load 1PJW.pdb, enable the NMR ensemble structure view (set all_states, on), then enable the sequence mode, and select residues 21~ 37 quickly. The viewer window shows many purple dots which are the residues I selected.

See how amazning convenience the function is!

Enjoy PyMOL.

Last update: 2006/Jan/21

Next Page »

Blog at