Homework 3
CS5046 (Spring 2007)

Assigned on March 13, 2007
Due by 11AM, March 20, 2007
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 definition to the GO::Term class to store the definition of each GO term. This information is provided in the file in the lines starting with the string ``def''.
Problem 2
(40 points) Implement two new 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 t is_a u (i.e., the line "is_a: u" appears in the definition of t) or t is part_of u (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 an array containing the identifiers (and no other information) of the parents of the term.
Problem 3
(45 points) Implement a new class called GO::Ontology that stores all the instances of GO::Term created. (We have already created much of this class during the lectures.) This class should contain the following methods:

terms
Use this method to store a term created by the read method in a hash. The keys of the hash are GO identifiers (e.g., ``GO:0000001'') and the values are references to instances of the CS5046::GO::Term class.
read
This method takes a single parameter, which is a file specifying the structure of the Gene Ontology (e.g., gene_ontology.obo), and parses this file. The class should use the terms method to store terms.
get_grandparents
This method takes a single parameter, which is an identifier for a GO term. It returns a reference to an array containing the identifiers of the grandparents of the term. A grandparent of a term is any parent of a parent of a term. In a comment at the beginning of the method, tell me whether you added any fields to the definition of the GO::Term and the GO::Ontology classes to solve this problem.
Write a test script called go.pl that uses these methods and tests that they are working correctly.

Submitting your Homework

Last modified: Wed Apr 11 22:31:17 EDT 2007