From PyMOLWiki
Jump to navigation Jump to search
Type Python Script
Author(s) Pablo Guardado Calvo
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. It's very useful for drawing the axes of rotational symmetry in an oligomeric assembly.

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 ( or try to modify the code for yourself to correct it.

To load the script just type:

run path-to-the-script/

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 length, width and color of the axis.

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

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

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

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

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

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


# download the source and save as
fetch 2vak
# calculate rotation axis between chains A and B
draw_axis('chain A', 'chain B')
# Another example, calculate the rotation axis of an homodimer
fetch 3rfg
# calculate rotation axis between chains A and B
draw_axis('chain A', 'chain B')
# Clearly, each of the domains are made up with motifs with internal symmetry
draw_axis('resi 200-236 and chain A', 'resi 238-274 and chain A', 20, 0.6, 1, 0, 0, 1, 0, 0)
# Also, you can create first the selections and use them to calculate the axis
sele selection1, resi 200-236 and chain A
sele selection2, resi 238-274 and chain A
draw_axis('selection1', 'selection2', 20, 0.6, 1, 0, 0, 1, 0, 0)
# will produce the same result.