May 23, 2019
2019 R Exercise
Marguerite Butler
An informal session to provide more R practice for those who want to improve their R skills using phylogenetic trees in R as a subject. We will start by asking for topics people would like to discuss or work on. Come with your biggest R frustrations.
R workshop materials
No preparation is required, but you can consult background material:
Background on objects is in Rboot.pdf chapter 3
Background on phylogenetic trees is in Rcomparative.pdf chapter 9 (and more in chapter 10).
Free advice on R programming
Projection
Review of Tree objects and in-session demonstration
Projection by Brian Omeara
Exercise 1 (optional): Manipulating branches on a phylogenetic tree and simulating branch lengths. An exercise in manipulating objects, editing functions, and generating simulations.
R script
Nexus file
See also Rcomparative chapter 15.8 (but we will be using ape instead of phylobase).
Exercise 2 (optional): Gene Hunting (an exercise in string matching, abstracting, writing functions). Without using grep, write code to find all open reading frames in a randomly generated DNA sequence.
Exercise
Code starter
Code solution (donʻt peek until youʻve tried it!)
Sample dna sequence
Sample output
Exercise 3 (optional): Verification of PGLS “by hand”. Better understand what is going on in applying a Brownian motion model by “dividing out” the phylogeny on a small phylogeny.
Chapter 1 of R_BM_OUCH_minitutorial.pdf
Exercise 4 (optional): Coding your own BM and OU simulations. To better understand the meaning of the BM and OU parameters, and also to progressively build code of increasing complexity via functions.
Chapter 2 of R_BM_OUCH_minitutorial.pdf
Code:
bmousim.R
OU.sim.branch.R Try to get here yourself before looking
ou2drgl.R To do 3D simulations in RGL