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


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 (, download 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:

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.


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

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


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 )


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

   indicates which atoms were paired between the two structures


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


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 ( .

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 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 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 (

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).

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

# 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

# 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")

February 17, 2007

[PyMOL] Windows Vista Released: CAUTION

Filed under: pymol/ molmol — kpwu @ 8:39 am

A message from PyMOL developing company (DeLano Scientific LLC.)


This is a reminder that Microsoft’s new version of Windows, “Vista” has serious issues with OpenGL-based software and should be avoided for the time being.

Only in the last few weeks have all of the major graphics card companies finally begun to release Vista drivers with true OpenGL support. Thus, please allow a few months for the bugs to shake out before expecting PyMOL (and other OpenGL-depedent programs) to run well on Vista.

If you buy a new Windows PC or laptop soon, be sure to check what operating system comes installed — you may need to specifically ask for Windows XP.




DeLano Scientific LLC

February 15, 2007

making ramachandran plot by yourself

Filed under: pymol/ molmol,softwares and scripts — kpwu @ 9:34 pm

** NEW on April 19th, 2011****

New post regarding the Ramachandran plot with newer defined ranges is posted at here.


There are many programs (online or standalone) which can generate ramachandran plots for users when submitting a PDB file. Most people know that beta-strand and alpah-helix have allowed and most favored (most allowed) range, however, the values are not clearly provided by such programs. Here is a list of the 6 high populated regions (95% of the most current PDBs) determined by Ramachandran and his collegues in 70s. Some researchers made better definitions in the last 10 years. I try to obtain their list to make such kind of regions, but failed. Anyway, you can just take the listing 6 regions to make a Ramachadran plot by yourself easily using excel or other graphical program. I am showing an example generated by ProFit (using MacOS X).
ps. The axis labels are wrong, Y is psi, X is phi.

phi psi
-156.5 91.3
-70.4 91.3
-54.7 112.8
-54.7 173.2
-136.9 173.2
-136.9 155.8
-156.5 135.6
-156.5 91.3
-180.0 42.9
-140.8 16.1
-86.0 16.1
-74.3 45.6
-74.3 72.5
-44.3 102.0
-44.3 161.1
-46.9 179.9
-180.0 180.0
-180.0 -34.9
-164.3 -42.9
-133.0 -42.9
-109.4 -32.2
-106.9 -21.4
-44.3 -21.4
-44.3 -71.1
-180.0 -71.1
-156.5 -60.4
-54.7 -60.4
-54.7 -40.2
-100.4 -40.2
-123.9 -51.0
-156.5 -51.0
-156.5 -60.4
-180.0 -163.8
-75.6 -163.8
-46.9 -180.0
62.6 14.7
62.6 96.7
45.6 79.2
45.6 26.8
62.6 14.7

1.from pps:
2.I found the definations from xplor. X-PLOR provides an input file to calculate the phi/psi angles and output the values to a mathematica format to generate a Ramachandran plot,here is URL:

October 22, 2006

PyMOL Fancy DNA helix and filled Rings

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

<Update on July 27, 2011: New post of better DNA image can be read at here>

The PyMOL author provided a very good script to present DNA structure in fancy helix and filled rings without install the Nuccly plugin.

Here is an example (figure) and the script :
the three DNAs are ordered as A-form/B-form/1BNZ DNA with same sequence

set cartoon_ring_mode, 1 (or 2 or 3)
set cartoon_ring_finder, 1 (or 2 or 3 or 4)
set nucleic_acid_mode, 0 (or 1 or 2 or 3 or 4)

set cartoon_side_chain_helper

set cartoon_ring_transparency, 0.5

set cartoon_ladder_mode, 0 or 1

set cartoon_ladder_color, color-name
set cartoon_nucleic_acid_color, color-name

cartoon oval
set cartoon_oval_width, 0.8

cartoon rect

cartoon dumbbell
set cartoon_dumbbell_width, 0.4
set cartoon_dumbbell_radius, 0.4

Another case (1BNZ), facny DNA representation and transparent surface to see the the contact between two molecules

complex (dna-protein)

April 1, 2006

MOLMOL– get distance you want

Filed under: pymol/ molmol — kpwu @ 4:01 am

The following commands for MOLMOL are not perfect enough to do all work I'd like to do. My purpose is calculating the distance of some particular pairs, for example, NH(i), NH(i+1), HA(i), NH(i+1)…that's a way to evaluate the NOE constraints and the proteins structure you want to compare. I know you could say the software running structure calculation does this function well, but sometimes, I don't do calculation, I just want to get the distance list…

Here is the commands (using 2GB1, res 41-56 as examples)
SelectAtom '@H'
CalcDist 5 1 1 0 1 0 0 'selected' 'selected'

and you will get a window like this:
41 GLY H 42 GLU H 60 (2.68..3.80)
41 GLY H 55 THR H 3 (4.97..4.99)
42 GLU H 55 THR H 60 (3.32..3.58)
42 GLU H 56 GLU H 26 (4.80..4.99)

It doesn't fit my request, but at least generate enough data I want to see. I set 5A as the upper boundary, all H to H distances which are shorter than 5A will return in the window. For the above data, 3 of 60 structure of 2GB1 has 41G NH to 55T NH distance closer than others, and the distance range is 3.32 to 3.58 A.

March 19, 2006

draw better disulfide bond

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


show sticks, (cys/ca+cb+sg) and byres (cys/sg and bound_to cys/sg)

the above command provides better quality to draw a SS bond by pyMOL, in the past, pyMOL users can only use “dist” command to make dash lines first, and changed the intervals of dash lines as “zero” to make a fake stick lines.

NOW, pyMOL users can use the new command to generate a very nice SS bond in stick.
Enjoy pyMOL ^_^

February 15, 2006

load many PDBs in your pymol

Filed under: pymol/ molmol — kpwu @ 10:07 pm

There are 12 prion protein structures, 12 PDBs otained from RCSB-PDB, you can use the pdb loader which is a plugin of pymol, don’t need to fetch the file at RCSB website.

And change your mouse mode from “viewing” to “editing” by click the right bottom region of your pymol, then you could use the middle button of your mouse to move individual structure to specfic location, making arrays.

Finally,apply cartoon, fancy helices, highlight color and rainbow color to each structure, and type “ray” to generated shadows, png xxx.png to output your 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’

« Previous PageNext Page »

The Rubric Theme. Create a free website or blog at


Get every new post delivered to your Inbox.

Join 31 other followers