Warning: Undefined array key "PATH_TRANSLATED" in /mnt/web/export/courses/cs5045/fall_2002/handouts/programs/program4.php on line 3
CS 5984: Programming Assignment 4
CS 5984: Computation for the Life Sciences

Fall Semester, 2002
Programming Assignment 4

The point value of each script is given in []. Within each script, include a header comment block that looks something like this:

#!/usr/bin/perl -w
#
# Perl script: name_of_script
#
# Perl guru: your_name
#
# Description_of_script
#
# Date: date_created
#

You should email your Perl scripts in separate emails to heath@vt.edu --- with the subject of each email being the name of the script --- by 5:00PM on October 7, 2002. No late submission will be accepted.


[50] Write and submit a Perl script named protein_mutate to generate pseudorandom mutations of an amino acid sequence. In particular, protein_mutate has the following behavior.

  1. Requires one command line argument interpreted as the total number of mutations to generate.

  2. Reads a single line from standard input, which is taken to be the initial amino acid sequence.

  3. Generates a sequence of mutations, with each subsequent mutation generated as follows.

    1. With probability 0.1, does a deletion; each position in the current amino acid sequence is equally likely to be deleted.

    2. With probability 0.1, does an insertion at a random location in the current amino acid sequence; for simplicity, each of the 20 standard amino acid is equally likely to be inserted.

    3. With probability 0.8, replaces the amino acid at a random location in the current amino acid sequence; for simplicity, each of the 20 standard amino acid is equally likely to be the replacement.

  4. Output the original amino acid sequence and all mutations, in a readable way, to standard output.

For example, if the amino acid sequence input is

    maatntilafsspsrllippssnpst
then the command
    protein_mutate 3
might have output
    Original sequence: maatntilafsspsrllippssnpst
    Delete position 6: maatnilafsspsrllippssnpst
    Replace p in position 18 with v: maatnilafsspsrllivpssnpst
    Insert q in position 0: qmaatnilafsspsrllivpssnpst
    3 pseudorandom mutations generated.


This page was last modified at 12:00 AM UTC, on January 1, 1970.

Current time at Virginia Tech is 7:40 PM UTC, on December 4, 2024.

Please report any problems found in these pages by email to: Lenwood S. Heath.