Graham Kemp > Teaching > Programming Tools


Practical: Perl 3

Aims

Objectives

After this practical you will:

Exercises

  1. Try out some of the scripts from the lecture. Some of these are in directory /users/mdstud/kemp/ptools/perl/lecture3/.

  2. It is possible to draw simple molecular graphics pictures using gnuplot. For example, if the x- and y-coordinates of the alpha-carbon atoms are in a file and we use gnuplot to plot this file "with lines" then gnuplot will draw an alpha-carbon trace.

    A lecture handout from the UNIX part of this course showed a C shell script called "draw_molecule" that reads the Protein Data Bank file for human interleukin-1 beta (chain A) complexed with the type-I receptor (chain B) (file /users/mdstud/kemp/ptools/beta_trefoil/1itb.pdb) and writes out files that can be read into gnuplot.

    Program /users/mdstud/kemp/ptools/perl/perl3/drawmol.csh is a UNIX script that calls the gnuplot program and writes encapsulated PostScript to standard output. Run this program, redirecting the output to a file, then view the resulting encapsulated PostScript file using the UNIX command 'gv'.

  3. Rewrite the program drawmol.csh in Perl.

  4. Generalise your solution to Question 3 so that it takes the name of a Protein Data Bank file on the command line. Your program should be able to deal with protein structures with an arbitrary number of chains. Test your program with some of the other Protein Data Bank files in directory /users/mdstud/kemp/ptools/beta_trefoil/, including "21bi.pdb", "2afg.pdb" and "1ilr.pdb".

  5. Study the program /users/mdstud/kemp/ptools/perl/lesk/translate.pl

    Generalise this program so that it prints the translations of a DNA sequence in all six possible reading frames (sequence as read in, in three phases; reverse complement, in three phases).

  6. Study the program /users/mdstud/kemp/ptools/perl/lesk/assemble.pl
    Try running this program with different input strings.

    Try this program with the following input fragments:

    rs International Mas
    onal Mas
    ernational Masters Prog
    me in Bio
    Bioinformatics
    Chalmers Interna
    rs Programme in Bio
    

    Now try the program with the same fragments in a different order:

    Chalmers Interna
    rs International Mas
    onal Mas
    ernational Masters Prog
    rs Programme in Bio
    me in Bio
    Bioinformatics
    

    Can you explain the difference in the program's output? Try to modify the program so that it assembles fragments correctly regardless of the order in which they appear in the input stream.