Biol375 2019

From QiuLab
Jump to navigation Jump to search
Molecular Evolution (BIOL 375.00/790.64/793.03, Fall 2019)
Instructor: Dr Weigang Qiu, Professor, Department of Biological Sciences
Room: 926 HN (Seminar Room, North Building)
Hours: Mon. & Thur 4:10-5:25 pm
Office Hours: Belfer Research Building (Google Map) BB-402; Fridays 3-5pm or by appointment
Course Website:


Course Description

Molecular evolution is the study of the change of DNA and protein sequences through time. Theories and techniques of molecular evolution are widely used in species classification, biodiversity, comparative genomics, and molecular epidemiology. Contents of the course include:

  • Population genetics, which is a theoretical framework for understanding mechanisms of sequence evolution through mutation, recombination, gene duplication, genetic drift, and natural selection.
  • Molecular systematics, which introduces statistical models of sequence evolution and methods for reconstructing species phylogeny.
  • Bioinformatics, which provides hands-on training on data acquisition and the use of software tools for phylogenetic analyses.

This 3-credit course is designed for upper-level biology-major undergraduates. Hunter pre-requisites are BIOL203, and MATH150 or STAT113.


  • (Required) Graur, 2016, Molecular and Genome Evolution, First Edition, Sinauer Associates, Inc. ISBN: 978-1-60535-469-9. Publisher's Website (Student discount: a 15% discount and receive free UPS standard shipping)

  • (Recommended) Baum & Smith, 2013. Tree Thinking: an Introduction to Phylogenetic Biology, Roberts & Company Publishers, Inc.

Learning Goals

  • Be able to describe evolutionary relationships using phylogenetic trees
  • Be able to use web-based as well as stand-alone software to infer phylogenetic trees
  • Understand mechanisms of DNA sequence evolution
  • Understand algorithms for building phylogenetic trees

Links for phylogenetic tools

Exams & Grading

  • Bonus for full attendance & active participation in classroom discussions.
  • Assignments. All assignments should be handed in as hard copies only. Email submission will not be accepted. Late submissions will receive 10% deduction (of the total grade) per day.
  • Three Mid-term Exams (30 pts each)
  • Comprehensive Final Exam (50 pts)

Academic Honesty

While students may work in groups and help each other for assignments, duplicated answers in assignments will be flagged and investigated as possible acts of academic dishonesty. To avoid being investigated as such, do NOT copy anyone else's work, or let others copy your work. At the least, rephrase using your own words. Note that the same rule applies regarding the use of textbook and online resources: copied sentences are not acceptable and will be considered plagiarism.

Hunter College regards acts of academic dishonesty (e.g., plagiarism, cheating on examinations, obtaining unfair advantage, and falsification of records and official documents) as serious offenses against the values of intellectual honesty. The College is committed to enforcing the CUNY Policy on Academic Integrity and will pursue cases of academic dishonesty according to the Hunter College Academic Integrity Procedures.

Course Schedule

Part 1. Tree Thinking

  • 8/29 (TH). Overview & Introduction. Textbook Chapter: "Introduction" (pages 1-3)
Assignment 1 (10 pts; Due next class 9/5)
  • (10 pts) Pre-test: Full credits will be given as long as each question is answered with some reasoning. In other words, it will NOT be graded on being right or wrong. It's an assessment tool, to be compared with later test outcomes to show teaching/learning results.
  • 9/5 (TH). Introduction (Continued)
    • R terminologies
      • Object: variable that contains data (e.g., "iris")
      • Object class: type of data (e.g., "data.frame", which is a table)
      • Function: e.g., data(iris), which loads the data set called "iris"
      • Function arguments: input and options (e.g., "iris" above)
    • Tutorial: R & R-Studio (Bring your own computer)
    • Lecture slides:
Assignment 2 (5 pts; Due: next session)
R exercises
  1. Install R & R-studio (see "Links for phylogenetic tools" above)
  2. Open R-studio and install the "ape" package using the "Packages"->"Install" menu, located within the lower right window
  3. Type in the console window (lower left) the following commands (one at a time, wait for the prompt ">" to appear before proceed to the next command; quit & restart R-studio if stuck):
    1. library(ape)
    2. tr <- read.tree(text = "(monkey:0.09672,((tarsier:0.18996,lemur:0.14790)0.999:0.09005,(macaque:0.18524,(gibbon:0.10388,(orang-utan:0.09481,(human:0.03391,(gorilla:0.06135,chimpanzee:0.05141):0.01580)0.316:0.05381)1.000:0.03019)0.978:0.05616)0.997:0.05042)0.965:0.09672);")
    3. plot(tr)
  4. Export the tree graph using the "Export"->"Save as PDF" or "Save as Image" menu in the lower right window
  5. Exit R studio by typing the command "q()" and type "y" to answer the question for saving the R session
  6. Copy & paste the tree image into your document to be handed in
  • 9/9 (M). Intro to trees
    • Go over pre-test questions
    • In-class exercise 1 (5 pts)
    • Introduction to tree
  • 9/12 (TH). Intro to trees (continued)
    • In-class exercise 2. (5 pts)
    • Textbook Chapter 5: "Molecular Phylogenetics" (pages 170-175; 201-202)
  • 9/16 (M). Species Tree & Lineage Sorting.
    • Textbook Chapter 5: "Molecular Phylogenetics" (pages 177-180).
  • 9/19 (TH). Consensus Tree & Review.
  • 9/23 (M). 4:10 - 5:10pm Midterm Exam I Bring pencils, erasers, and a calculator

Part 2. Analysis of Trait Evolution

  • 9/26 (TH). Traits & trait matrix
    • Textbook Chapter 5, pages 180-183
    • R demo I (by Chris)
# iris dataset exercise
# load libraries

# summary of data
iris %>% glimpse()

# previewing data

# subsetting data
slice(iris, 1:3)
iris %>% slice(1:3)

# grouping and subsetting data
iris %>%
  group_by(Species) %>%

iris %>%
  group_by(Species) %>%
  summarise(average = mean(Sepal.Length))

# filtering data
filter(iris, Species == 'versicolor')
iris %>%
  filter(Species == 'versicolor')

iris %>%
  filter(Sepal.Length >= 7)

# OR operation
iris %>%
  filter(Sepal.Length < 5 | Sepal.Length > 7)

# check distribution using histogram
ggplot(iris, aes(x = Sepal.Length)) +

# distribution by Species
ggplot(iris, aes(x = Sepal.Length, fill = Species)) +
  geom_histogram(alpha = 0.5)

# distribution by Species using facetwrap
ggplot(iris, aes(x = Sepal.Length, color = Species)) +
  geom_histogram() + facet_wrap(~Species)

# boxplot
ggplot(iris, aes(y = Sepal.Length, x = Species)) +

# boxplot with points
ggplot(iris, aes(y = Sepal.Length, x = Species)) +
  geom_boxplot() +
  geom_jitter(size = 2, width = 0.1, alpha = 0.5, color = 'blue')

# scatterplot
ggplot(iris, aes(y = Sepal.Length, x = Petal.Length, color = Species)) + geom_point()
Assignment #3 (5 pts; Due next session)
Watch Origin of Species: Lizards in an Evolutionary Tree. Provide short answer (1-3 sentences) to each of the following three questions.
  1. What are the two hypotheses explaining the origin of different ecomorphs of lizards on Caribbean Islands?
  2. What is the expected phylogeny under each hypothesis?
  3. Which hypothesis is supported by the phylogeny of actual DNA sequences?
  • 10/3 (TH). Homoplasy & consistency
    • Character & Character states
    • R Demo (part 2) (Crhis)
Bonus R Exercise (10 pts; Due 10/10, Thursday)
  1. In R studio, load the tidyverse library and read the human gene data table with hg <- read_tsv(file = "", col_name = T)
  2. Show commands and outputs for the following operations:
    1. Show first three genes for each chromosome
    2. Count the number of genes on each chromosome
    3. Add a column called "Gene.Length"
    4. Calculate the mean, max, and min gene length on each chromosome
    5. Show distribution of gene length by a histogram (with binwidth=1e4)
    6. Show above with log10 transformation
    7. Show distribution of gene length on each chromosome (with facet_wrap)
    8. Show distribution of gene length on each chromosome with a boxplot
  • 10/7 (M). Parsimony reconstruction (Chapter 5).
    • Textbook Chapter 5, pages 188-191
Assignment #4 (5 pts; Due next session)
  1. Download or Copy/Paste the lizard DNA sequences to your own computer and save the file as "lizard.txt"
  2. Align the DNA sequences using this website and save the aligned DNA file ("Output->Alignment in Fasta format") as "lizard-aligned.txt". Use "one-click" option in the Phylogeny Analysis tab to make a tree.
  3. Based on the lizard card, construct a character-state matrix for all lizard species. For each species, list its character state for each of the following two characters (as columns): (1) Geographic origin, and (2) Habitat.
  4. Construct a diagram by combining the tree and the character-state matrix, showing character states for each species on each row.
  5. Determine which hypothesis ("Multiple origin" or "Single origin" of ecomorphs) is more supported by the mtDNA tree. Explain.

Part 3. Tree Algorithms

  • 10/24 (TH). (No Class)
  • 10/28 (M).
    • BLAST & Alignments (Chapter 3. pages 93-100).In-class exercise: Run BLAST; show alignment & explain E-value
    • Genetic distances
  • 10/31 (TH).
  • 11/4 (M).
    • Distance methods (Chapter 5, pages 184-187). In class exercise: use APE package to calculate genetic distances
    • In class exercise: calculate Jukes-Cantor distance of this DNA sequence alignment. Note: Ignore gapped positions.
  • 11/7 (TH).
    • Maximum parsimony (Chapter 5, pages 191-194). In-class exercise: parsimony scores
    • Likelihood & Bayesian methods;
    • Bonus assignment II (5 pts, Due 11/18, Monday):
  • The two graphs show the log likelihoods (i.e., goodness of fit, or Prob(Data|Model)) of four nucleotide-substitution models for describing patterns of Human/Chimp DNA sequence divergence
  • Reproduce (with proper axis labels and custom size and shape for the points) one of the graphs using R/ggplot2. Read the data set using lk <- read_csv("")
  • Explain why HKY is the best model for the data
Hint: use geom_label()
Hint: use geom_point()
  • 11/11 (M).
    • Tree Testing (Chapter 5, pages 194-198).
  • 11/14 (TH).
    • Review exercises (Chapter 5, pages 207-209) .
  • 11/18 (M). 3rd Mid-term exam

Part 4. Mechanisms of molecular evolution

  • 11/21 (TH).
    • Mechanism of molecular evolution: Overview (pages 35-38) & Rates of nucleotide substitutions (pages 111-125).
  • 11/25 (M). In-class computer exercise:
    • Ka/Ks test of natural selection (pg 116-124). In-class exercise
Final project (20 pts). Due: 12/9, Monday)
  1. Calculate genetic distances
    1. Download or Copy/Paste the lizard DNA sequences to your own computer and save the file as "anoles.txt" in a directory (e.g., "Document")
    2. Align the DNA sequences using this website and save the aligned DNA file ("Output->Alignment in Fasta format") as "anoles-aligned.txt" (No need to print or submit the above two DNA sequence files; save them in a folder, e.g., "Document")
    3. Download & load library: library(ape)
    4. In RStudio, set working directory to the same one containing alignemnt ("Session" -> "Set Working Directory" -> "Choose Directory")
    5. Read alignment: mt <- read.FASTA("anoles-aligned.txt")
    6. Calculate raw distance: mt.raw <- dist.dna(mt, model = "raw")
    7. Apply Juke-Cantor (one-parameter model) correction: mt.jc <- dist.dna(mt, model = "JC")
    8. Apply Kimura(two-parameter model, for Ts and Tv) correction: mt.k80 <- dist.dna(mt, model = "K80") to
    9. Plot JC distance vs the raw distance: plot(mt.raw, mt.jc, xlab = "uncorrected distance (diff/site)", ylab = "corrected distance (sub/site)", xlim = c(0,0.4), ylim = c(0,0.5), las =1)
    10. Add a 1:1 line: abline(0,1, col = "red")
    11. Add K80 distances: points(mt.raw, mt.k80, pch = 3, col = "blue")
    12. Add a legend: legend(0.05, 0.45, legend = c("JC (1-parameter)", "K80 (2-parameter)"), pch = c(1,3), col = c("black","blue"), bty = "n")
    13. Export an PDF and print a copy
    14. Use the graph to explain
      1. (1) Why it is necessary to correct for raw distances when comparing sequences from distantly related species;
      2. (2) What is the key difference between the K80 and JC models
  2. Comparison of distance and parsimony trees (review previous assignments for detailed R-Studio instructions)
    1. In R studio, install & load the "ape" and "phangorn" libraries
      1. Obtain a neighbor-joining tree using K80 model: tree.nj <- NJ(mt.k80)
      2. Plot a midpoint rooted tree: plot(midpoint(tree.nj))
      3. Add a scale bar:
      4. Print tree and answer this question: what does the distance represent? What is the unit?
    2. Obtain a maximum parsimony tree
      1. Convert object to a different class: aln.phy <- as.phyDat(mt)
      2. Search maximum parsimony <- optim.parsimony(tree.nj, aln.phy)
      3. Get tree distance: <- acctran(, aln.phy)
      4. Plot tree: plot(midpoint(
      5. Add a scale bar:
      6. Print tree and answer the question: what does the distance represent? What is the unit?
    3. Compare the two trees and explain the differences in these two methods: Which one uses full sequence information and why?
  3. Bootstrap analysis
    1. aln.fas <- read.dna("anoles-aligned.txt", format ="fasta")
    2. Create a function for re-rooted distance tree: <- function(x) root(nj(dist.dna(x)), outgroup = c("Leiocephalus_barahonensis"), resolve.root = T)
    3. Calculate a tree: tr <-
    4. Perform bootstrap for 100 pseudo-replicates: boot.trees <- boot.phylo(tr, aln.fas,, B=100, rooted =T)
    5. Plot tree: plot(tr, no.margin = T)
    6. Add bootstrap values as node labels: nodelabels(boot.trees, bg= "white")
    7. Explain (1) Does bootstrap test for tree precision or tree accuracy? (2) What does a bootstrap value of 80% mean?