CSci 493 Syllabus        FAQ



Problem Set 1: Tree Warm-ups
CSci 493: Algorithms for Tree Distributions
Fall 2022


Learning Objective: to recap standard tree traversal techniques and gain fluency with the biopython phylo and nexus submodules.

General Notes

Program Descriptions

Program 1.1: Newick Format.Due 10am, Wednesday, 14 September.
Learning Objective: to use basic tree I/O methods from the biopython libraries.
Available Libraries: biopython and core Python 3.7+.

Description: read in tree in Newick format and print out the same tree.

To get started, install biopython in your IDE and read through the Phylo wiki on reading, writing, and drawing trees in Newick format. Note that the wiki uses a module that's deprecated from Python 2 for string wrapper. Instead use the io module:

from io import StringIO

Program 1.2: Tree Equality.Due 10am, Thursday, 15 September.
Learning Objective: to increase facility with Newick tree format and the biopython libraries.
Available Libraries: biopython and core Python 3.7+.

Description: Write a function that returns true if two biopython trees represent the same leaf labeled tree and false otherwise.

You may use either tree class in Biopython (i.e. the class from Phylo or Nexus).

Program 1.3: Tree Height.Due 10am, Friday, 14 September.
Learning Objective: to increase facility with Newick tree format and the biopython libraries.
Available Libraries: biopython and core Python 3.7+.

Description: Write a complete program that uses Biopython to read in a rooted tree in Newick format. Your program should print out the height of the tree.

Recall that the depth of a leaf in a rooted tree is the number of edges between the leaf and the root. The height of a tree is the maximum depth of a leaf in the tree.

Program 1.4: Tree Balance.Due 10am, Monday, 19 September.
Learning Objective: to increase facility with Newick tree format and the biopython libraries.
Available Libraries: biopython and core Python 3.7+.
Reference:
Colless Index (Tree Balance)

Description: Read in a rooted binary tree in Newick format and print out its Colless Index.

See the Tree Balance website for the formal definition of Colless Index.