Learning Objective: to recap standard tree traversal techniques and gain fluency with the biopython phylo and nexus submodules.
Program 3.1: Subtree Replacement. Due 10am, Wednesday, 26 September.
Description: Write a program that takes a tree (as a Newick string) and a pair of leaves, and returns a new tree with the subtree containing those leaves replaced by a placeholder.
For example, if the user enters:
If instead, the leaves entered were
Learning Objective: to use built-in functions to manipulate tree objects.
Available Libraries: Biopython and core Python 3.7+.
as the tree, and ((1,2),((3,4),5))
3 5
, your program should find the least common ancestor of the leaves (in this case, the parent of (3,4) and 5), and replace it by a placeholder:
((1,2),A)
3 4
, the output would be:
((1,2),(A,5))