My software notes

May 2, 2013

[PyMOL] molmol-like colors on secondary structural elements

Filed under: pymol/ molmol — kpwu @ 9:18 pm
Tags: ,

I  recently saw some nice presentations of protein structures prepared by MOLMOL. Since MOLMOL is not actively maintained,  I wonder how to make similar colors on the secondary structural elements in PyMOL.

In this short blog,  an example is shown. The top and bottom figures  are made by PyMOL and MOLMOL, respectively.

How I did that? Basically, just make highlight color yellow, turn on discrete cartoon color, adjust the width and length of strands.

The PyMOL script is shown here, too:

cmd.show_as(“cartoon” ,”all”)
bg_color white
set cartoon_highlight_color, yellow
set cartoon_rect_width, 0.03
set cartoon_rect_length, 1.7
set cartoon_discrete_colors, on
util.cbss(“all”,”red”,”cyan”,”gray70″,_self=cmd)

2H28-molmol like

x

April 6, 2013

[PyMOL] compute molecular weight

Filed under: pymol/ molmol — kpwu @ 3:06 am
Tags:

From PyMOL 1.5, there is a quick way to compute the object molecular weight.

Simple click “A” right next to the (select) object, and go down to “compute”, then choose “molecular weight” to calculate MW of object either “explicit” or “with missing hydrogens” mode. The missing hydrogens mode means PyMOL automatically add missed protons of object and calculate the proton-added MW.

I found that object with water oxygens (commonly in crystal structures) will also be included while running this command. Users may need to be careful about it.

Note: The calculated MW is actually a bit different from values (same sequences, of course!) I used “protein calculator” or “ExPASy get pI/Mw“. The value from PyMOL are not average/monoisotopic MW as calculated from both two sites (both two sites gave me exact same numbers). I actually don’t know why..

Here is the snapshot. The computed MW can be seen in the pymol terminal (boxed). Top number includes missing hydrogens.

computeMW

Morphing movie using RigiMOL/PyMOL

Filed under: pymol/ molmol — kpwu @ 2:14 am
Tags: , ,

RigiMOL is a feature only available in incentive PyMOL, not in open source built PyMOL.

The following two short (very short) youtube videos are made by the example script provided at PyMOLWiki (script link at here).

The demo script is also pasted at here:

====================================

# get open and closed conformation of adenylate kinase

fetch 1ake 4ake, async=0

# make two state object

align 1ake and chain A, 4ake and chain A, cycles=0, object=aln

create rin, 1ake and aln, 1, 1

create rin, 4ake and aln, 1, 2

# morph from epymol

import rigimol rigimol.morph(“rin”, “rout”) 

======================================
Notes:

1. Steps, length of movie and resolution are tunable. I just show the movies using default (above) script.

2. Once the rout is made, movie can be save easily using “file -> save movie as”

3. I used MacPyMOL to made the two movies.

Cartoon mode

Ball and stick mode

September 18, 2012

[PyMOL] side-by-side comparison of 3 electrostatic surface potentials

Filed under: pymol/ molmol — kpwu @ 2:22 am
Tags: , , , ,

Here is an example using “grid mode” provided in PyMOL to show the charged states of a protein (PDB entry: 1Z66) at pH 4 (left), 7 (center) and 11 (right).  PyMOL script is attached after the figure.

First,  the potential maps at three pH states have to be generated. I used APBS web server combined with PROPKA to get  calculated pH-dependent potentials (.dx files).

Then I load 1z66.pdb and load all 3 .dx files. Draw first protein with one of the potentials. After that, turn on the grid mode and then duplicate pdb object twice.

Last, assign the potentials to duplicated objects. The electrostatic surface views at 3 pH states can be shown easily!

I really like the grid mode in PyMOL!  No need to use any image editor to assemble 3 potential views. No worry of sizes of molecules if generated separately.

Tips of “grid mode” can be found in my earlier post: [PyMOL] grid mode.

Steps to “Draw the electrostatic surface” can be checked at my earlier post, too.

=======pymol log.pml =================

load 1z66.pdb
load 1z66-pH4.dx, emap_pH4
load 1z66-pH7.dx, emap_pH7
load 1z66-pH11.dx, emap_pH11
set grid_mode, on
cmd.show_as(“surface” ,”1z66″)
ramp_new elvl1, emap_pH4, [-5,0,5]
set surface_color, elvl1, 1z66,
cmd.disable(‘elvl1’)
cmd.create(None,”1z66″)
ramp_new elvl2, emap_pH7, [-5,0,5]
set surface_color, elvl2, obj01,
cmd.create(None,”1z66″)
ramp_new elvl3, emap_pH11, [-5,0,5]
set surface_color, elvl3, obj02,
cmd.disable(‘elvl3’)
cmd.disable(‘elvl2’)
bg_color white
ray 600
png 1z66.png

September 11, 2012

[PyMOL] customize spectrum colors

Filed under: pymol/ molmol — kpwu @ 12:29 am
Tags: ,

Saw a post at recent Pymol mailing list and found the nice example of “spectrumany” at PymolWiki.

Here is the example I created using “spectrumany” to show customized spectral colors of the example protein TBEV envelope protein “PDBV entry: 1SVB”.

By using the built-in command “spectrum”, one can color the envelope protein in 2 or 3 gradient colors or use the “rainbow” to colorful gradient.

The figure below was drew using command “spectrum count, red_white_blue, all“. (more pymol built-in color schemes are listed at my older post: [pymol] example– coloring surface by b-factor).

After downloding “spectrumany.py” and run “spectrumany.py”, one can customize gradient colors on his/her target. The example shown at here using command: “spectrumany count, red green blue yellow white, resi 1-395“.

In this pymol script, colors are separated by “space”. For example: red blue cyan white yellow

Note: In a lot of crystal protein structure PDB files, there are a lot of water molecules as well as some heavy metal ions. I found that using “spectrumany count, red green blue yellow white, all” will result in the image below.

All water molecules are colored in white not not shown in the image. The reasons are 1) water are numbered after 400 (421-800) and 2). water H2O is not shown in cartoon mode. When water molecules are presented in “sphere” mode, you can see the water molecules are colored from yellow to white.  In order to make right color gradient schemes (in cartoon mode) either using pymol-provided “spectrum” or the “spectrumany.py” script, it better to define the residue ranges (resi xxx-yyy) not use “all”.

August 26, 2012

[PyMOL] grid mode

Filed under: pymol/ molmol — kpwu @ 2:43 pm
Tags: ,

It is often that we compare different proteins and want to show all aligned proteins in one time.

One popular way shown in scientific papers is to superimpose all structures, however it shows an overlapped “tangle”.  Sometimes such way doesn’t provide a good view for reader.

I am going to show you the “grid_mode” provided in PyMOL. It’s quite useful for PyMOL users to generate high quality “well-aligned” proteins in grid mode.

First,  I load all proteins I want to compare. At here I use the envelope protein domain III from yellow fever virus (Dengue virus,  West Nile virus, Japanese Encephalitis virus and tick-borne Langat virus).

Then I use “alignto” command to align all structures to “1PJW” and remove all other un-used chains.

Then, I turn on the grid mode by typing in “set grid_mode, 1“. The PyMOL viewer instantly aligns the 4 proteins in 2×2 grid.

Since the 4 proteins are first aligned by “alignto” command and then are separated to grids, I can move and rotate them at one time.

In addition to the 2×2 grid,  I also find that 4 proteins can be separated in 4×1 (one raw) way when I expand the window width of “Pymol viewer”.

I frequently see some 2×2 “detailed views” of proteins in papers. I always thought that the author must generate individual figures and then assemble those figures by photoshop or other image editors. I found that PyMOL grid_mode can generate such 2×2 detail view quickly. I like this function A LOT! Here is the example. What I made is to zoom in the 4 proteins and rotate them to proper view for comparison. The output image is ready for publication! (easy, isnt it?)

August 20, 2012

PyMOL on the iPad

Filed under: pymol/ molmol — kpwu @ 9:26 pm
Tags: ,

PyMOL mobile app for iPad released today as posted by PyMOL maintainer at PyMOL mailing list.

Please go to “http://pymol.org/mobile” to see details.

Or directly go iTunes store to download this App.

 

 

June 28, 2012

[PyMOL] Draw Goodsell-like view using GLSL

Filed under: pymol/ molmol — kpwu @ 12:10 am
Tags: , ,

There is a new post in Pymol user mailing list showing an approach to draw the “Goodsell-like” molecule. The most famous Goodsell molecular images are the “Molecule of the month” at PDB-101. Dr. Goodsell also provides online version of images used in his book: “The Machinery of Life“.

That detail of Goodsell-like presentation in pymol is available at PyMOLWiki. It mainly uses GLSL rendering technique. I practiced several times and found out that my MacPyMOL version (2 years old) is not able to run such rendering (OpenGL only..). Therefore I used macports to install PyMOL 1.5 (run under X11).

There may be a wrong description at PyMOLWiki — I rename the “sphere.fs” to “sphere.fs.bak” and copy and save the author’s code (at PyMOLWiki) as “sphere.fs” (not shaders.fs).

Here is another 2 tries I have done using PDB files 2Y1M and 2WCC for top 2 figures and the bottom DNA figure, respectively.

June 26, 2012

[PyMOL] contact map (CMView)

Filed under: pymol/ molmol,softwares and scripts — kpwu @ 1:59 am
Tags: , ,

In PyMOL Wiki, there is a “contact map visualizer” plugin providing users to inspect the protein intramolecular contacts. However, this plugin requires “PyGame”, “Tkinter”, “PIL (python image library)” and most importantly, Gromacs!

I used Fink (Mac OSX 10.6.8) to successfully install Gromacs 4.1 but Fink reported problems while installing pygame. So I can generate xpm file of target protein structure by Gromacs but not inspect the contact map in PyMOL.

In contrast, I found another contact map visualizer called “CMView – Protein contact map visualization and analysis“. This program is written in Java and uses PyMOL as the molecular viewer.

Installation note (work platform: Mac OSX 10.6.8 with X11)

1. Download the CMView file, unzip it and move the folder to proper path)

2.Edit the “cmview.cfg” file and correct the path of pymol execute. Optional programs such as DSSP and DALI can be used if installed.

3. In terminal, call “cmview.sh” and load the PDB file from “CMView” and enjoy visualizing the molecules.

While the PDB is loaded, the CMView (run in Java) will show you the contact map.  You can use mouse to crop the region of interest and instantly see the contacts in the PDB file.

May 24, 2012

[PyMOL] different colors of nucleic acid rings

Filed under: pymol/ molmol — kpwu @ 12:55 am
Tags: , ,

The image below can be drew followed by steps in my earlier post, which shows single color of the nucleotide rings and bonds.

I saw a discussion list at PyMol forum today that an user requested a way to display different colors of the nucleotide rings. Below is the example image I tested (using PDB: 2WCC).

One thing to note: if you use “set cartoon_ring_color, xxx” in the beginning, you may not see your ring/bond in same color. Then you have to do one more step to color the bond color by using “color red, resn A (or DA, or other nucleic acids)”.

Pymol commands:

fetch 2WCC
as cartoon
bg_color white
select DNA, ///1 + ///2
cartoon oval, DNA
set cartoon_ring_mode, 3
set cartoon_nucleic_acid_color, blue
select dna_A, resn DA (here the Adenosine is named as DA)
select dna_C, resn DC
select dna_G, resn DG
select dna_T, resn DT
color yellow, dna_A
color red, dna_C
color gray40, dna_G
color palecyan, dna_T

* The 4 select can be skipped and use “color yellow, resn DA” in the coloring steps.

**IF you use “set cartoon_ring_color, orange” for all nucleotides in the beginning and wanna change colors for specific types of nucleotide rings, you may meet problems that command “set cartoon_ring_color, red, resn DA” (for the rings) and “color red, resn DA” (for the bonds in sidechain) don’t work sometimes. I somehow can change the bond color but not always (don’t know why– it works on my macbook but no on my iMac, both are MacPyMOL).

Next Page »

Create a free website or blog at WordPress.com.