Homework 2
CS 5046 (Spring 2011)

Assigned on February 23, 2011
Due by the beginning of class on March 2, 2011
Submit by email to murali AT cs DOT vt DOT edu

Please include "CS 5046 Homework 2" in the subject of the email message.

The aim of this homework is to help you get comfortable with object-oriented programming in Perl. In class, we developed the Network class (in the Network.pm module) that contained several methods to read in and process a network of molecular interactions. In this homework, you will add extra functionality to this module.
Problem 1
(20 points) The Network class we developed ignores the type of the experiment that detected the interaction. Modify the read method so that it also stores the experimental type with each interaction. Recall that the experimental type is stored in the column named "EXPERIMENTAL_SYSTEM". Keep in mind that each interaction may be reported by more than one type of experiment. Write detailed comments at the statements you add or modify explaining how you have changed the method and why.
Problem 2
(20 points) Modify the get_num_edges method so that it takes a scalar argument. If this argument is undefined or the empty string, the method works as before. Otherwise, the method returns the number of interactions whose experimental type equals the argument. Add a comment that discusses if there is any difference between the running time of the method in these two cases.
Problem 3
(60 points) Implement a method called compute_union that takes two instances of the Network class as arguments. You can assume that both instances were created using different invocations of the read subroutine. The compute_union subroutine returns a new network. Each gene (or interaction) in the new network is a gene (or interaction) in one of the arguments. In turn, every gene and interaction in either of the two arguments must be in the new network.
Submitting your Homework
  • You can submit one script named network.pl and the Network.pm module that solve all problems. The network.pl script should read in two networks and exercise all the subroutines you have implemented in this homework.
  • For every problem in this homework, add a comment in your code marking the first line where you solve that problem.
  • Create a directory called <YourName>-Homework1 and put network.pl in that directory. Place Network.pm in the CS5046 subdirectory.
  • Submit your homework by zipping (or tarring and gzipping) the directory and emailing the zipped file to me.
  • Last modified: Mon Mar 14 12:35:07 EDT 2011