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 09

Topic: Circular chronograms
Collaboration Policy: The lab should be completed working in pairs
Submission Deadline:    11:50am Friday, 8 March 2019

Contents:


Overview

As the grand finale of our tree visualizations, we explore the rendering of phylogenetic chronograms when using a circular layout as follows.

While this rendering might seem wildly different than our previous chronogram for this tree, it turns out that it is drawn with what is essentially the same recursive algorithm, with just a bit more care surrounding the geometry. In particular, if you recall our original discussion focused on the "T" shape that is used to extend from one branch to its two subtrees. That same structure is used in the circular rendering, as highlighted in a few parts of the following image:

Note that what in our previous drawing was the horizontal section of the "T" with a length proportional to the evolutionary time, remains a straight line segment but now eminating outward from the central origin of the diagram. What used to be the asymetric vertical line in our "T" shape, connecting to the two subsequent subtrees, is now an arc on a circle centered at the origin. Just as all the leaves in the traditional chronogram were aligned at the far right and with equal vertical separation, in our new diagram all leaves are evenly spaced along the outermost circle.


Turtle Graphics - part 2

In order to generate such figures with Python's turtle graphics module, we need two advanced features:

Your Tasks

We will start you with valid code for the prevoius lab, and thus the more traditional left-to-right chronograms. It turns out that the change is quite trivially, as soon as you can adjust to thinking about the geometry as polar coordiantes rather than the usual x/y coordinates. The only meaningful change that is needed is to replace the portion of the "T" with a circular arc rather than a straight line. Of course, more carefully bookkeeping will be necessary to produce such arcs.

While you could keep the old names, we recommend you rewrite the recursive signature of the draw function as follows.

    def draw(tree, radiusScale, angleScale, parentTime):

In additional to change the recursive parameterization, you are responsible for rewriting the lateral() function that draws the circular portion of a "T" shape. To do this you will need to use the turtle circle function appropriately. Since all of the circular arcs should be based on the origin of the screen, you may use the turtle.distance(0,0) function to determine the current distance of the turtle from the origin.


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 circular.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.


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