Course Home | Assignments | Data Sets/Tools | Python | Schedule | Git Submission | Tutoring

Saint Louis University

Computer Science 1020
Introduction to Computer Science: Bioinformatics

Michael Goldwasser

Spring 2019

Computer Science Department

Lab 08

Topic: Chronograms
Collaboration Policy: The lab should be completed working in pairs
Submission Deadline:    11:50am Wednesday, 6 March 2019

Contents:


Overview

The cladograms drawn in our previous lab illustrate the presume phylogenetic relationships between model species and their presumed ancestors, but the horizontal axis of those diagrams did carry any additional information. In particular, there was no presumption about how long ago in the past neighboring species may have diverged from their common ancestor.

In this lab, we refine our visualizations to produce what are known as chronograms, as we will use the horizontal axis to denote a sense of evoluationary time. If working with modern species, we will typically align all of the leaf nodes in the rightmost column, as those represent the present day. Presumed common ancestors from the past will be denoted to the left at a distance that depends on the presumed amount of time that has since passed. As an example, here is a figure taken from a 2011 article Megacycles of atmospheric carbon dioxide concentration correlate with fossil plant genome size.

While our illustration will not be quite as pretty (and uses a different convention for the y-coordinates of the internal edges), this example will be rendered as


Detailed Model

The key to developing chronograms is that we must be given information about the presumed evolutionary scale. In the previous lab, you may recall that some of the sample trees included numeric labels for the internal nodes. For example, there was a "tree frog" tree that appeared as follows.

For whatever timescale is being used, the 5 at the node connecting Hyla versicolor and Hyla avivoca is to suggest that they diverged 5 evolutionary time units ago, while the 20 at the node connecting Triprion petasalus and Anotheca spinosa suggest they were more distant relatives. The node with label 35 that connects those two clades suggests that the common ancestor of all four of those modern species existed 35 time units ago.

In our chronograms, we will draw the horizontal lines with lengths that are proportional to those evolutionary times, thus rendering the above tree as follows.

(Note that we no longer explicitly render the numeric labels now that the branch lengths portrays such information.)

As a much smaller example, here is a raw tree in our Python format:

(50,
    (30,
        ("A", (), ()),
        ("B", (), ())
    ),
    ("C", (), ())
)
We will render this as

The nodes A and B are connected to their nearest ancestor with a line proportional to length 30, while the node that is the ancestor of all three modern species is 50 units away from all three (and thus we note that the distance between the two implicit ancestors must be 20).


Your Tasks

As a starting point this lab, we will soon provide you with a working implementation for the previous lab. The vertical placement of all the leaves and intermediate lines will be the same for our new figures, so your focus should be on the nubmers provided at internal nodes and how to use those to alter the lengths of the horizontal segments. However, in order to do this properly, when drawing a segment from a parent to a child, you must be aware of the evolutionary age of the parent and the evolutionary age of the child (with leaves assumed to have age 0).

In order to convey this extra information, we would like for you to change the recursive signature of the draw function to the following.

def draw(tree, xScale, yScale, parentTime):
The xScale will now denote the number of horizontal pixels per eveolutionary time unit. The yScale remains the same as before, denoting the vertical separation of leaves. The new parmaeter parentTime is the key to knowing what was the presume age of the most recent ancestor of a (sub)tree that is being drawn. (For the original branch at the far left, we will just pick an arbitrary age that is known to be greater than the root node's age.)

With this new information, you should be able to determine the appropriate distance to advance (and later retreat) when tracing a horizontal edge. Of course, because we are relying on recursion, it is not just that you gain this additional information; you now have a responsibility to send the appropriate information when making recursive calls.

Finally, since the new figure style portrays the age information with edge lengths, you should modify the code so that the numeric labels are not explicitly rendered at internal nodes (though you must continue to render the labels for the leaf nodes).


Files You Need

We are providing you with two files:


Examples

The samples file includes four example trees.


Submitting Your Assignment

One member of your partnership should electronically submit your modified file chronograms.py. The comments at the beginning of the file should clearly identify the member(s) of the partnernship.


Grading Standards

The assignment is worth 25 points, which will be assessed as follows:


Michael Goldwasser
CSCI 1020, Spring 2019
Last modified: Wednesday, 13 March 2019
Course Home | Assignments | Data Sets/Tools | Python | Schedule | Git Submission | Tutoring