Homework 4: Phylogenetic Tree Building
Due: Friday, Oct. 16, 11:59pm on Moodle
The goal of this assignment is to implement an algorithm for creating phylogenetic trees (UPGMA in this case), and use it on a real-world example. In this assignment we will also be using/learning numpy. There are download instructions and tutorials on this site: numpy.
python hw4.pyNothing should happen if you have numpy installed correctly. In this file is a skeleton for UPGMA. The first step is to implement
def min_dist(distance):which should return a tuple (i,j) of the cell with the minimum distance (i.e. the clusters to merge first).
def merge_clusters(clusters, distance):There is a step-by-step outline in the code, but you can do this however you like. The output should be a set of clusters that is one less than the input clusters, and a square distance matrix that had one less row and column.
EXTRA CREDIT 2: Implement Neighbor-Joining in a similar framework (i.e. using numpy arrays for the distance matrices and Si,j tables). Apply NJ to the same three examples, draw out the trees, and compare the results.