RotationAxis

From PyMOLWiki
Revision as of 10:51, 15 December 2014 by PabloGuardado (talk | contribs)
Jump to navigation Jump to search
Type Python Script
Download Draw_rotation_axis.py
Author(s) Pablo Guardado Calvo
License
This code has been put under version control in the project Pymol-script-repo

This script will draw a CGO cylinder representing a rotation axis for a given transformation.

The idea is to align two molecules/domains/chains/selections (using cmd.super) and extract the trasformation (TTT) matrix (T). The direction of the rotation axis, and a point are obtained from T and are used to create a cgo object representing the axis. The script generates two measures: one in the graphical screen (the rotation axis value, and the norm of the translation vector along the rotation axis) and some basic information in the command-line (the transformation matrix, the rotation angle, distance between centroids, and some pml lines that you can use to reproduce the axis...)

As always with these type of things, you have to use it at your own risk. I did not try all possible combinations, but if you find a bug, do not hesitate to contact me (pablo.guardado@gmail.com) or try to modify the code for yourself to correct it.

To load the script just type:

run path-to-the-script/draw_rotation_axis.py

or if you want something more permanent add the previous line to your .pymolrc file

The script works just typing:

draw_axis('selection1', 'selection2')

Please, pay attention to the apostrophes around the selections, you MUST use them. Also works with chains:

draw_axis('chain A', 'chain B')

or objects:

draw_axis('obj01', 'obj02)

Also, you can play a bit with the lenght, width and colour of the axis.

draw_axis('selection1', 'selection2', scale_factor, width, r1, g1, b1, r2, g2, b2)

scale_factor = to control the lenght of the axis, the default is 20

width = to control the width of the axis. Default is 0.6

r1, g1, b1 = first RGB colour code. Default is 1, 1, 1

r2, g2, b2 = second RGB colour code to create the gradient. Default is 1, 0, 0.

To create a single colour axis, just made r1,g1,b1=r2,g2,b2

Examples

# download the source and save as Draw_rotation_axis.py
run draw_rotation_axis.py
fetch 2vak
# calculate rotation axis between chains A and B
draw_axis('chain A', 'chain B')