Assigned on April 4, 2011
Due by 4pm, April 13, 2011
Submit by email to murali AT cs DOT vt DOT edu
This homework will give you practice in automating class
creation using the Class::Struct package. We will do so in
the context of parsing an ``OBO'' file that specifies the terms
in the Gene Ontology and their relationships with each other.
Problem 1
(15 points) Add a
method called part_of to the GO::Term class to store
and retrieve all other GO terms that a given GO term is related to by
the "part_of" relationship. This information is provided in the file in
the lines starting with the string ``relationship''.
Problem 2
(30 points) Implement two
methods called get_num_parents and get_parents in
the GO::Term class. A parent of a term
t is another term u such that tis_au (i.e., the line "is_a: u" appears in the definition of
t) or t is part_ofu (i.e., the line
"relationship: part_of u" appears in the definition of t). Note the word
``or'' in the definition of ``parent.'' The method
get_num_parents returns the number of parents of a term. The
method get_parents returns a reference to a hash whose keys are
the identifiers of the parents of the term. For get_parents,
you can modify the existing method, if you prefer to.
Problem 3
(55 points) Implement a method
called get_siblings. The method should take a GO term's
identifier (a string) as argument and return a reference to a hash whose
keys are the siblings of the GO term. You have to decide in which class to
implement this method. A sibling of a term
t is another term u such that t and
u have a common parent. You may find it useful to write other
methods to "help" the get_siblings method. I will judge the
efficiency of your method when I grade it.
Write a test script called go.pl that uses these
methods and tests that they are working correctly.
Submitting your Homework
You should only use Class::Struct to implement classes.
You may modify the GO::Term and the GO::Ontology
classes we implemented during the lectures.
Label each part of the new code you write with a comment mentioning the
problem number for which you wrote the code.
I will check your code for proper use of the principles of object
oriented programming. You should make sure that you invoke each method
using the arrow operator. I will penalise your solution if it does
not use the principles we have discussed in class.
Make sure the script is executable by changing its executable bit
(chmod u+x go.pl).
Create a directory called <YourName>-Homework3 and put go.pl
and the module in that directory. Make sure that the module is placed
in the correct sub-directories.
Submit your homework by zipping (or tarring and
gzipping) the directory and emailing the zipped file to me.