Assignment 9
Due date: 4/5/10
Handling protein protein interaction data
In this assignment you will write several functions that load a dataset of protein-protein interactions, and enable a user to query the data. The functions you need to write are:
load_interactions(file_name). This function receives as a parameter a file name and returns a python dictionary that represents all the interactions in the file. The file will be comma-delimited, and each line in it will have the following format:protein_a,protein_b
This indicates thatprotein_ainteracts withprotein_b. As an example you can use the following interaction dataset: yeast interactions. This file contains 10,517 interactions in yeast extracted from the Bind database, and used in this paperinteract(id1, id2, interactions). This function receives the IDs of two proteins and returnsTrueif they appear in the given interaction dataset, andFalseotherwise.get_interactions(id, interactions). This function returns the IDs of all the proteins with which the protein with the given ID interacts with in the given interaction dataset. Extra credit will be given to an implementation in which this function in constant time regardless of the number of proteins in the dataset. For our purposes assume that accessing an element in a dictionary takes constant time regardless of the number of elements in the dictionary (this actually holds under certain conditions).average_interactions(interactions). Returns the average number of interactions over all proteins in the given set of interactions.
Submit a module named ppi.py that contains these functions.
