Graham Kemp > Teaching > Programming Tools


Practical: Perl 2

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/lecture2/.

  2. Write a Perl program that reads a SWISS-PROT file and stores the sequence as a string in variable '$sequence'. The name of the SWISS-PROT file should be given as an argument on the command line.

    Test your program with SWISS-PROT files PAPA_CARPA (papaya proteinase I) and ACTN_ACTCH (kiwi fruit actinidin). These files are in directory /users/mdstud/kemp/ptools/perl/perl2/.

  3. Some Perl programs from Introduction to Bioinformatics by Arthur M. Lesk are in directory /users/mdstud/kemp/ptools/perl/lesk/.

    The program 'dotplot.pl' reads two sequences given at the end of the program file and writes out "raw" PostScript showing a dotplot comparing the sequences. Run this program, redirecting standard output to a file, and then view the resulting PostScript document.

  4. Write a Perl program that takes the names of two SWISS-PROT files on the command line and reads the sequences from these two files (you should be able to reuse some code from Question 2). Your program should then print pairs of numbers to standard output as follows: there should be two integers per line, separated by a space, indicating positions in the first and second sequences that have the same amino acid residue (e.g. positions where there is an "A" in both sequences). For example, if the first sequence is "MGLPKSFVSM" and the second is "MAMIPSISKL" then your program should produce the following output:

    0 0
    0 2
    2 9
    3 4
    4 8
    5 5
    5 7
    8 5
    8 7
    9 0
    9 2
    

    Test your program with SWISS-PROT files PAPA_CARPA (papaya proteinase I) and ACTN_ACTCH (kiwi fruit actinidin). These files are in directory /users/mdstud/kemp/ptools/perl/perl2/.

    If you write the output of your program to a file, you can then view a dotplot using the program /users/mdstud/kemp/ptools/perl/perl2/dotplot.tcl. This is a Tcl/Tk program; Tcl is another scripting language; Tk is a graphical toolkit that extends Tcl by adding commands for building user interfaces. To run this program, type its name and give the name of your file containing pairs of numbers as a command line argument.