Draw a helical wheel plot from a pdb file

Many programs are available that draw helical wheels from a given peptide primary structure (sequence), assuming a perfect alpha helix. Sometimes it may be interesting to see what the helical-wheel plot of a non-ideal helix looks like. Because I could not find such a program, I created one myself.

This script needs the PDL and SVG modules, and makes some assumptions as to how your pdb file looks. Please read below.

It is a Perl script that uses the PDL (perl data language) module for the calculations and the SVG module to generate the image. You should have Perl and these two modules installed to use it. The modules can be downloaded from http://www.cpan.org. You also need the Getopt::Long and Pod::Usage modules, but you probably already have those. I only tested it on Linux, but it should work on windows XP (and other versions) as well.

I have made the script available under the creative commons by-nc-sa licence, which means you may use and distribute it as long as you say you got it from me. And not for commercial purposes. If you publish any results, I would appreciate it if you mention my name in your article. At the moment there is no scientific publication related to this software.

click here to download (wheel.tar.bz2)
(but please continue reading for more information)

To learn how to use the program, you can take a look at the man-page with

./wheel.pl -m

The program goes through the following steps to draw the helical wheel:

  • Read the coordinates of the CA atoms from the pdb file
  • Find the principal axis of those atoms (the longest axis)
  • Move the centre of mass to the origin
  • Calculate the mass distribution tensor of the CA atoms
  • Calculate the eigenvectors and eigenvalues of this matrix (the matrix of eigenvectors is the rotation matrix)
  • Rotate the principal axis to coincide with the z-axis
  • Draw the xy-plane, which is the helical wheel plot

The numerical data for all steps is written to a log-file, in case you want to know what happened.

The output image will look similar to this (it is resized and converted to a png file here for web publishing):
helical wheel plot example
Because the program creates an SVG image, it may be edited and resized without losing quality. I recommend inkscape for this purpose.

It is important to realize that this program does not show the idealized helical wheel representation, but a projection of the CA atoms on the xy plane of the actual pdb coordinates. This is useful, but of course leads to images that "look less nice" than the idealized helical wheels. If a helix is curved, has a kink, or flexible termini, the output may not be what you expect. If this is the case, the principal helix axis that is calculated by the software does not lead to the "nice" representation you want to see, even though it is technically correct.

There are three ways I can think of to solve this problem:

  1. remove some amino acid residues (by using the -startres and -endres options of the program, or by removing them from the pdb file). But this may not be what you want.
  2. align (a part of) the helix to the z-axis manually (for example using molmol), and then use the -norotate option of the program. Although the helix will not be aligned to the principal axis, it may better represent the relative position of the amino acids as you want to show it (and still be correct).
  3. a combination of (1) and (2)

Please also note that the script makes several assumptions regarding the way your pdb file looks. If your pdb-file looks like the example below, it should work:

ATOM      1  N   LYS+    1       2.006  -6.797 -16.583  1.00  0.00
ATOM      2  H   LYS+    1       2.409  -5.881 -16.443  1.00  0.00
ATOM      3  CA  LYS+    1       1.934  -7.721 -15.428  1.00  0.00
ATOM      4  HA  LYS+    1       0.893  -7.948 -15.252  1.00  0.00
ATOM      5  CB  LYS+    1       2.689  -9.032 -15.717  1.00  0.00

At the moment, pdb-files that contain a chain identifier field cannot be read without making a small change to the source code of the script. The easiest way around this is probably to temporarily remove the chain identifier from your pdb file with your favorite editor (try a regexp in vi).

Feel free to contact me if you have any ideas, questions, problems or comments.

download (wheel.tar.bz2)

This entry was posted in science. Bookmark the permalink.

6 Responses to Draw a helical wheel plot from a pdb file

  1. Anton says:

    Hello Louic!
    I have very strange issue with your good program.
    (I adapted it to put also a moments of variability on the picture, but this surely is not the source of the error).
    I wanted to build a scheme of 3-D model of GPCR with variability vectors and other data. I liked very much results for TM helices 1-3, but for TM4 not :(
    The problem is that program distorts molecule while 'normalizing' coordinates and after that it builds incorrect wheel, viewed from the 'side' rather than from the 'top'. This is not due to rotations -- I checked with -norotate option as well as reconstructed PDB file from the CA-coordinates from the log-file after internal rotation.
    I would be thankful if you tell me what's the mess. Where I can send you my file and a picture with erroneous result?

    Thanks in advance.

  2. Anton says:

    Most probably the error is in
    $x .= $x/abs($x)->max;
    $y .= $y/abs($y)->max;
    $z .= $z/abs($z)->max;
    I don't understand them completely since I'm new to Perl.

  3. louic says:

    Hi Anton!

    Thank you for the useful comments. It appears you have found a serious error in the script, both in the part you mention, and in another place as well. I have corrected these two errors, so it should work now.

    Thanks again for your useful comments!

  4. Pingback: Create A Helical Wheel Plot | All Wheels Blog

  5. Sagar says:

    Hello Louic,

    I am getting following errors while trying to run this program:

    Use of uninitialized value $checkres in string eq at /home/path/wheel.pl line 29.
    Use of uninitialized value $checkres in string eq at /home/path/wheel.pl line 30.
    Use of uninitialized value $checkres in string eq at /home/path/wheel.pl line 31.

    A part of the perl script is given below and I have marked the line 29-31:

    # the definition of the background color for
    # apolar, polar, positively and negatively charged residues
    sub rescol {
    my $checkres = shift;
    my @apo = ('A','C','F','I','L','M','P','U','V','W','Y');
    my @pos = ('H','K','R');
    my @neg = ('D','E');
    foreach (@apo) { if ($_ eq $checkres) { return 'grey'; } } # Line 29
    foreach (@pos) { if ($_ eq $checkres) { return 'blue'; } } # Line 30
    foreach (@neg) { if ($_ eq $checkres) { return 'red'; } } # Line 31
    return 'white';

    I will appreciate your help and Please let me know if you need more information.


  6. louic says:

    Hi Sagar,

    This program is about 7 years old and I think the problem is that you are using a more modern version of Perl. Unfortunately I cannot help you to make the necessary changes to the program, it would cost me too much time (I don't use Perl anymore, so have not been maintaining this). So apart from suggesting to install an older version of Perl I'm afraid I cannot be of much help here.

Leave a Reply

Your email address will not be published. Required fields are marked *