My software notes

March 19, 2007

sausage view of a NMR ensemble structure

Filed under: pymol/ molmol — kpwu @ 1:50 pm

Usually, a NMR structure represents the dynamics of a protein in solution. The NMR structure deposited in Protein Data Bank always contains 10 to 20 structures (states). It’s nice to generate a “tube (sausage) ” like structure to show how flexible each residue is.

MOLMOL is the best molecular viewer having this kind of function. Just load a NMR structure and run the standard macro called sausage.mac to make a sausage-view. Here is an example of 1PIT.pdb

molmol-sausage

PyMOL, however, doesn’t have built-in script to generate a sausage-view-structure. Cameron Mura in UCSD provides a nice pymol script to make this purpose. Just go to his pymol homepage (http://mccammon.ucsd.edu/~cmura/PyMOL/), download average3d.py and follow the instruction to generate a sausage-view-structure. Here is the result I made (also, 1PIT.pdb)

pymol, sausage view

March 17, 2007

align structures by PyMOL

Filed under: pymol/ molmol — kpwu @ 11:30 am

PyMOL provides a command called align to align a specific region of structures. The protein structures do not need to have to identical sequence. It’s more flexible than MOLMOL 2k.2.
The command manual copied from PyMOL is pasted here:
————————————————————————————–
align

DESCRIPTION   "align" performs a sequence alignment followed by a structural

   alignment, and then carrys out zero or more cycles of refinement

   in order to reject structural outliers found during the fit.

USAGE

align (source), (target) [,cutoff [,cycles [,gap [,extend

         [,skip [,object [,matrix [, quiet ]]]]]]]]

PYMOL API

cmd.align( string source, string target, float cutoff=2.0,

              int cycles=2, float gap=-10.0, float extend=-0.5,

              float extend=-0.5,int skip=0, string object=None,

              string matrix="BLOSUM62",int quiet=1 )

NOTE

If object is not None, then align will create an object which

   indicates which atoms were paired between the two structures

EXAMPLES

align  prot1////CA, prot2, object=alignment

SEE ALSO

fit, rms, rms_cur, intra_rms, intra_rms_cur, pair_fit

————————————————————————————–
Another external fitting/alignment command is called cealign, you could find a complete description at here (http://www.pymolwiki.org/index.php/Cealign) .

Here are two snapshots before and after I align 1DYR to other 8 DHFR proteins. This time, all proteins have identical sequence; therefore, I use “align 1DYR, 1DAJ” to align 1DYR onto 1DAJ (all atoms to all atoms). The Tcl/Tk GUI window returned a RMS value and several detailed information.

before alignment

after alignment

March 15, 2007

Standard deviations and biggest errors

Filed under: softwares and scripts — kpwu @ 3:43 am

Here is a situation I met:
I have 3 files with same format (5 columns: res, T2,T2-Error, R2, R2-Error) and I want to get: 1. the average value of the R2, 2 the standard deviation of the three R2 values and 3 the biggest error range among the three errors and the standard deviation.

I decide to use awk and shell tools to help me finish this kind of work. Excel definitely helps out, however, I don’t want to spend 2 hours to do the routine work when I deal with the similar issue. Also, if the script is perfect, I don’t need to worry the human error when I manually compare the 4 errors by eyes.

Here is the example file and the solution:

res    T        T_SD      Rate     R_err
3    104.40     11.30      9.58      1.04
5    120.50      5.79      8.30      0.40
6     87.16      3.69     11.47      0.49
8    121.10      7.08      8.26      0.48
9    143.80      8.00      6.95      0.39
11    93.51      4.79     10.69      0.55

The output is:

res    R2-1    Err-1      R2-2       Err-2     R2-3      Err-3      Avg     Std    Big_sd
3     9.580     1.040     9.100     0.990     9.100     0.990     9.260     0.277     1.040
5     8.300     0.400     8.770     0.490     8.770     0.490     8.613     0.271     0.490
6    11.470     0.490    10.500     0.860    10.500     0.860    10.823     0.560     0.860
8     8.260     0.480     9.040     0.340     9.040     0.340     8.780     0.450     0.480
9     6.950     0.390     7.130     0.220     7.130     0.220     7.070     0.104     0.390

solutions:

  1. use paste to combine 3 files, the product is a file with 15 columns
  2. use grep -v res to filter out the first line (awk can’t do calculation with the first line)
  3. use awk to calculate the average, standard deviation and find out the biggest error values
  4. generate a final output

The content of script is:
————————————————————————–
#!/bin/sh

## Calculate the standard deviation of 3 R2 files from
## the fitting data which R2 was converted by get_rates.sh
## output: avg of 3 R2, std of 3 R2, the biggest errors
##
## avg = (R2-1 + R2-2 + R2-3)/3
## std= SQRT ( ( (r2-1 – avg)^2 + (r2-2 -avg)^2 + (r2-3 -avg)^2) /2)
##
## Date: March 14, 2007
## kpwu

## assign the location the 3 R2 file
file1=analyzed/r2-analyzed-1.txt
file2=analyzed/r2-analyzed-2.txt
file3=analyzed/r2-analyzed-2.txt

# make the first line, to indicate the info of each column
echo “res R2-1 Err-1 R2-2 Err-2 R2-3 Err-3 Avg Std Big_sd” > _temp
#step 1, 2, and 3
paste $file1 $file2 $file3 |grep -v res \
|awk ‘{avg=($4+$9+$14)/3; std=sqrt((($4-avg)^2 + ($9-avg)^2 + ($14-avg)^2 )/2);
i=0; if ($5 > $10) i=$5; else i=$10;
if ( i > $15) i = i; else i = $15;
printf “%1s%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n”,
$1,$4,$5,$9,$10,$14,$15,avg,std,i}’ >>_temp

mv _temp average_relaxation.txt

echo “DONE, saved as average_relaxation.txt”
———————————————————————–

March 14, 2007

color by b-factor values

Filed under: pymol/ molmol — kpwu @ 6:51 pm

Usually, people have to draw the protein structure according to folding, titration or relaxation experiments; especially for NMR people. PyMOL supports this function by using less “used” b-factor column of the PDB file. Robert Campbell has a color_b.py python script on his PyMOL homepage that you can use.

However, I am showing another way to color the structure without using any scripts. I found it from PyMOLWIKI (http://www.pymolwiki.org/index.php/Color#Reassigning_B-Factors_and_Coloring)

The steps are copied to this blog and the example I made is also showing here. I use 1XQ8.pdb to show it’s hydrophobicity (by Kyte-Doolittle’s method).
1xq8-b-factor.png

The updated B-factors can be saved by saving a new molecule. 
The hydrophobicities were saved for CA b-factors, here is the example:
cat 1XQ8.pdb |grep CA
ATOM      2  CA  MET A   1     250.631  34.877   0.809  1.00  0.67           C
ATOM     21  CA  ASP A   2     246.860  35.394   1.143  1.00  0.02           C
ATOM     33  CA  VAL A   3     246.085  36.822  -2.313  1.00  0.61           C
ATOM     49  CA  PHE A   4     243.374  38.718  -0.399  1.00 -0.29           C
ATOM     69  CA  MET A   5     245.745  40.728   1.827  1.00 -0.99           C
ATOM     86  CA  LYS A   6     247.572  41.993  -1.282  1.00 -1.24           C
ATOM    108  CA  GLY A   7     244.331  43.152  -2.944  1.00 -0.34           C
ATOM    115  CA  LEU A   8     243.551  44.864   0.384  1.00  0.17           C
ATOM    134  CA  SER A   9     246.922  46.620   0.797  1.00 -0.06           C
ATOM    145  CA  LYS A  10     246.614  47.601  -2.883  1.00  0.23           C
ATOM    167  CA  ALA A  11     243.302  49.441  -2.385  1.00  0.87           C
ATOM    177  CA  LYS A  12     244.578  51.340   0.678  1.00  0.28           C
----------------------------
# load the protein
cmd.load("protA.pdb")

# open the file of new values (just 1 column of numbers, one for each alpha carbon)
inFile = open("newBFactors", 'r')

# create the global, stored array
stored.newB = []

# read the new B factors from file
for line in inFile.readlines(): stored.newB.append( float(line) )

# close the input file
inFile.close()

# clear out the old B Factors
alter protA, b=0.0

# update the B Factors with new properties
alter protA and n. CA, b=stored.newB.pop(0)

# color the protein based on the new B Factors of the alpha carbons
cmd.spectrum("b", "protA and n. CA")

predict random coil relaxation (R2) values

Filed under: softwares and scripts — kpwu @ 6:24 pm

Recently, I’ve made a shell script that can generate a gaussian distribution-like random coil relaxation R2 values. The result is shown in the following figure. The script is kind of dirty hack, so I won’t paste the code at here. I’ll post it later when I have time to organize the code and make it more user-friendly.

Reference:

  1.  Protein Sci. 2006 Jun;15(6):1397-407.
  2. J Biomol NMR. 2006 Jul;35(3):175-86.
  3. Science. 2002 Mar 1;295(5560):1719-22.
  4. Biochemistry. 1997 Jul 22;36(29):8977-91. (Original paper)

rc-r21.png

NMRViewJ 7.0.10 is out!

Filed under: NMRPipe and NMRview — kpwu @ 6:15 pm

Copy news from NMRViewJ mailing list:
Enjoy using it ^_^
——-
As previously mentioned, I’ve been working almost entirely on moving
NvJ to support BMRB STAR version 3 so as to have better support in
NvJ for features like RunAbout.  I’m nearly, but not quite, done with
the transition.  While working on this I have fixed a few bugs so I
thought I would provide a release now.

I think I’ve got everything in this version to start moving ahead
with RunAbout with the STAR3 code, but I’ve got some testing to do
before I’d say it’s really ready.  I expect to do some testing over
the next few days and have another version available by Monday.  I’ve
got a personal deadline to have a new version of the video on using
RunAbout to assign Ubiquitin ready by then so I’ll be working hard on
it.

There is one more pernicious bug that occasionally manifests itself
with the error that some command, which you know exists, doesn’t
exist.  I think I know the cause of this and hope to stomp it before
Monday as well.

I’ve also done some updating of the One Moon Web site.  The NvJ
section of the home page now lists the latest version of NvJ so you
can tell at a glance if you’re running the latest.  More improvements
are on their way.

Listed below are the changes in this version.

Bruce

* Many changes to allow compatability with the new BMRB STAR format
(version 3.x)
NvJ will still read and write STAR 2 files.  New STAR3 code has
not been made
available in menu form yet as it is still a work in progress.

* When vectors are extracted and displayed any existing phase in the
Vector display window is
applied to them (thanks to Mike Summers).

* A residue library with residues using the IUPAC naming convention
is now in reslib_iu.
This is not yet used automatically, but you could copy it over to
reslib to use it.

* Peaks are now folded to display properly if their chemical shift is
outside the range of the
displayed spectrum.  (This doesn’t permanently change their
chemical shifts, just displays
them properly.

* A new “nv_win wait” command has been added.  Sometimes you want to
ensure that a window has
been completely drawn before doing something else in the script.
“nv_win wait” will not return
until drawing is complete.

* Bug in crosshair display is fixed.  Sometimes the black crosshair
would be displayed but was
not selectable.

* nvj batchfile now will take a command line arguments to specify
files  to be loaded during startup.
Files will be loaded in a manner consistent with their extension
(.nv, .str, .tcl).
Filenames should appear after –files on the command line:
./nvj –files mystarfile.str hsqc.nv hnco.nv startup.tcl

* Sequence display code changes so that if a residue is not standard
then draw an X for the single letter code

March 1, 2007

Run NMRPipe/NMRDraw on a Windows XP PC?

Filed under: NMRPipe and NMRview — kpwu @ 5:34 pm

Yes, there is an exciting news from NMRPipe Yahoo discussion forum.
NMRPipe author, Dr. Frank Delaglio announced an e-mail about the information. The email content is pasted in this blog article. See blow:

——————————————————————————————

Dear Colleagues,

Exciting news, we have an experimental version of NMRPipe
for Windows XP Professional Edition (HUZZAH!!!) This new
version is posted with the others at the NMRPipe download site.

This implementation of NMRPipe requires that users first install
Microsoft Services for UNIX 3.5, and an X11 graphics server.

Some more details follow, taken from the install README file …

Cheerful Regards,

big FD

————

———————————————-

NMRPipe for Windows XP Pro (Interix/SFU 3.5)

NOTE WELL: this is an EXPERIMENTAL release of NMRPipe for Windows XP
Pro which makes use of Microsoft Windows “Services for UNIX” (SFU
3.5). According to Microsoft, there are aspects of the installation and
use of SFU 3.5 that can effect system usability and security. So,
for the time being, we recommend that only users who are familiar
with both UNIX and PC system management try this release.

BACKGROUND: Microsoft currently provides a Windows-based UNIX
environment (Interix), called “Services for UNIX” (SFU). At the
time of this writing, SFU 3.5 can be downloaded at no charge from
the Microsoft web site. This download provides a comprehensive UNIX
environment that can be installed under Windows XP Professional Edition.

Information on Windows Services for UNIX Version 3.5:

http://www.microsoft.com/technet/interopmigration/unix/sfu/default.mspx

SFU 3.5 Download:

http://www.microsoft.com/downloads/details.aspx?familyid=896C9688-601B-44F1-81A4-02878FF11778&displaylang=en

There is now an experimental version of NMRPipe for Windows XP which
REQUIRES that users FIRST install Microsoft Services for UNIX 3.5,
and a suitable X11 graphics server with the needed fonts. The steps
involved follow, with more details below:

1. Download and install Microsoft SFU 3.5 from the Microsoft web site.

2. Install and run a PC X11 graphics server.

3. From the SFU “C-shell” window, start an “xterm” terminal
window. In order to use the “xterm” command, you will
might first have to set the DISPLAY environment variable
manually; later on, this can be established automatically
via “.cshrc”. To set the DISPLAY manually, type:

setenv DISPLAY 127.0.0.1:0

4. In the “xterm” terminal window, follow the usual “install.com”
procedure for installing NMRPipe. If desired, you can include
the special option “+sfu” to customize the SFU UNIX environment
and create a default home directory and “.cshrc” automatically:

./install.com /dev/fs/C/nmr +sfu /dev/fs/C/frank

5. Once NMRPipe is installed, commands and programs should
generally be executed from an “xterm” terminal window,
although most will work equally well from the SFU “C-shell”
window.

WHICH VERSIONS OF WINDOWS ARE SUPPORTED?

This version of NMRPipe can only be used on systems where SFU 3.5
can be installed. According to information from Microsoft, SFU 3.5
requires Windows XP Professional Edition, and can also be used
with certain other versions of Windows, such as Windows 2000 Service
Pack 4. You can also search the web for specific information and
tips on installing SFU 3.5 on various systems.

X11 GRAPHICS SERVER FOR WINDOWS

In order to use the graphical components of NMRPipe, an X11
graphics server must be running, and it must provide the lucida
and open look fonts as used by “nmrDraw”. There are several
commercial X11 graphics servers which run on Windows-based PCs:
including those from “www.starnet.com” and “www.hummingbird.com”.

For building and testing this version of NMRPipe, we used the
Xming X11 graphics server and Xming-fonts package. If you use
this, be sure to download and install BOTH the server and the fonts
package … it’s also a nice idea to MAKE a little DONATION to the
author of this useful software:

http://www.straightrunning.com/XmingNotes/

Blog at WordPress.com.