This is a read-only mirror of pymolwiki.org

Difference between revisions of "Colorbydisplacement"

From PyMOL Wiki
Jump to navigation Jump to search
m (18 revisions)
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Acknowledgement ==
+
{{Infobox script-repo
This pymol script is made by Troels Emtekær Linnet.
+
|type      = script
 
+
|filename  = colorbydisplacement.py
This script is based on the scaffold from [[ColorByRMSD]]. Peace love and harmony goes to Shivender Shandilya and Jason Vertrees.
+
|author    = [[User:Tlinnet|Troels E. Linnet]]
 +
|license  = BSD
 +
}}
  
 
== Introduction ==
 
== Introduction ==
This script allows you to color two structures by distance displacement between an Open and Closed form of a protein, as calculated by PyMol's internal distance command. The pairwise distance is calculated between, C-alpha or all-atoms. The distance displacement values are stored as B-factors of these residues, which are colored by a ''rainbow'' color spectrum, with blue specifying minimum  and red indicating maximum.
+
This script allows you to color two structures by distance displacement between an Open and Closed form of a protein, as calculated by PyMol's internal distance command. The pairwise distance is calculated between all-atoms. The distance displacement values are stored as B-factors of these residues, which are colored by a ''rainbow'' color spectrum, with blue specifying minimum  and red indicating maximum.
  
== Code ==
 
 
Do keep in mind, all original B-factors values are overwritten!
 
Do keep in mind, all original B-factors values are overwritten!
  
There exist two versions. <br>
+
There exist one version. <br>
ColorByDisplacement'''CA''' is quick and is between CA atoms. Ideal for helices representation. <br>
 
 
ColorByDisplacement'''All''' is between All atoms in residues and is quite slow => 3-5 mins for a run. Ideal for sticks representation.
 
ColorByDisplacement'''All''' is between All atoms in residues and is quite slow => 3-5 mins for a run. Ideal for sticks representation.
  
Line 25: Line 25:
 
=== Examples ===
 
=== Examples ===
 
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
ColorByDisplacementCA O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t
 
 
ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t
 
ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t
  
ColorByDisplacementCA O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t, AlignedWhite='no'
 
 
ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t, AlignedWhite='no'
 
ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t, AlignedWhite='no'
 
ColorByDisplacementCA O5NT, C5NT, resi 26-355, resi 26-355
 
ColorByDisplacementAll O5NT, C5NT, resi 26-355, resi 26-355
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
<gallery heights="240px" widths="340px">
 
<gallery heights="240px" widths="340px">
Image:ColorByDisplacement-CA-1.png|ColorByDisplacementCA used on 1HP1 and 1HPU aligned and colored by distance displacement.
 
Image:ColorByDisplacement-CA-2.png|ColorByDisplacementCA used on 1HP1 and 1HPU aligned and colored by distance displacement.
 
 
Image:ColorByDisplacement-All-1.png|ColorByDisplacementAll used on 1HP1 and 1HPU aligned and colored by distance displacement.
 
Image:ColorByDisplacement-All-1.png|ColorByDisplacementAll used on 1HP1 and 1HPU aligned and colored by distance displacement.
 
Image:ColorByDisplacement-All-2.png|ColorByDisplacementAll used on 1HP1 and 1HPU aligned and colored by distance displacement.
 
Image:ColorByDisplacement-All-2.png|ColorByDisplacementAll used on 1HP1 and 1HPU aligned and colored by distance displacement.
Line 45: Line 38:
 
Residues not in both pdb files is colored black
 
Residues not in both pdb files is colored black
  
== Example Pymol Script ==
+
== Example 1 ==
<syntaxhighlight lang="python">
+
{{Template:PymolScriptRepoDownload|examples/colorbydisplacement_1.pml}}
cd C:\Users\tlinnet\Documents\My Dropbox\Speciale\5NT-project\Mutant-construct\Distance-Plot
+
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/colorbydisplacement_1.pml" highlight="python" />
#cd /homes/linnet/Documents/Speciale/5NT-project/Mutant-construct/Distance-Plot
 
### load pdb files and rename
 
load 1HP1.pdb, O5NT-1HP1
 
load 1HPU.pdb, C5NT-1HPU
 
 
 
hide everything
 
### Select asymmetric units from pdb file
 
create O5NT, /O5NT-1HP1//A
 
create C5NT, /C5NT-1HPU//C
 
delete O5NT-1HP1
 
delete C5NT-1HPU
 
 
 
cartoon auto
 
show cartoon, O5NT
 
show cartoon, C5NT
 
set cartoon_fancy_helices=1
 
set bg,[1,1,1]
 
 
 
set auto_zoom, off
 
 
 
### Make sharper
 
set fog=0
 
 
 
### Load my function, and run function with input
 
run ColorByDisplacement.py
 
ColorByDisplacementCA O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t
 
#ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t
 
 
 
set_view (\
 
    0.094686687,  -0.390707940,    0.915631354,\
 
    0.809000611,  -0.505792081,  -0.299485058,\
 
    0.580131471,    0.769104064,    0.268191338,\
 
    0.000000000,    0.000000000, -280.940521240,\
 
    26.240486145,  46.146961212,  21.702068329,\
 
  231.830673218,  330.050415039,  -20.000000000 )
 
</syntaxhighlight>
 
 
 
 
 
== Python Code ==
 
This code has been put under version control. In the project, [http://www.pymolwiki.org/index.php/Git_intro Pymol-script-repo].
 
 
 
You can see the code here:
 
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/master/colorbydisplacement.py
 
Or download here:
 
https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/colorbydisplacement.py
 
  
 
[[Category:Script_Library]]
 
[[Category:Script_Library]]
 
[[Category:Structural_Biology_Scripts]]
 
[[Category:Structural_Biology_Scripts]]
 +
[[Category:Pymol-script-repo]]

Latest revision as of 02:15, 28 March 2014

Type Python Script
Download colorbydisplacement.py
Author(s) Troels E. Linnet
License BSD
This code has been put under version control in the project Pymol-script-repo

Introduction

This script allows you to color two structures by distance displacement between an Open and Closed form of a protein, as calculated by PyMol's internal distance command. The pairwise distance is calculated between all-atoms. The distance displacement values are stored as B-factors of these residues, which are colored by a rainbow color spectrum, with blue specifying minimum and red indicating maximum.

Do keep in mind, all original B-factors values are overwritten!

There exist one version.
ColorByDisplacementAll is between All atoms in residues and is quite slow => 3-5 mins for a run. Ideal for sticks representation.

You have to specify which residues should be used in the alignment procedure, or it will take all residues as standard

V.2 is implemented the 2011.01.06 - Due to a bug in coloring.

Bug in code

A bug in the boolean operator of the spectrum command has been found. This versions work for version 1.3 Educational product.
For other versions of pymol, try to change (comment/uncomment) the cmd.spectrum line. The other spectrum line works for Open-Source PyMOL 1.2r3pre, Incentive product

Examples

ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t

ColorByDisplacementAll O5NT, C5NT, super1=resi 26-355, super2=resi 26-355, doColor=t, doAlign=t, AlignedWhite='no'

Dark blue is low displacement, higher displacements are in orange/yellow/red.
Residues used for alignment is colored white. Can be turned off in top of algorithm. Residues not in both pdb files is colored black

Example 1

Download: examples/colorbydisplacement_1.pml
This code has been put under version control in the project Pymol-script-repo

<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/colorbydisplacement_1.pml" highlight="python" />