Comparative Methods
2022-02-28
Chapter 1 Introduction
This book was created as part of my PhyloMeth class, which focuses on sensibly using and developing comparative methods. It will be actively developed over the course of Spring 2017, so if you don’t like this version (see date above), check back soon! The book is available here but you can fork it, add issues, and look at raw source code at https://github.com/bomeara/ComparativeMethodsInR. [Note I’ll be changing the name of the repo eventually; the course is largely in R (not entirely) but of course many key methods appear in other languages.]
1.1 Learning objectives
Readers of this book will be able to:
- Approach a study of a group of organisms by developing meaningful questions
- Identify the appropriate methods to answer these questions
- Where methods do not yet exist, be able to work on potential new methods
- Understand limtations of methods and how to evaluate these limits
- Draw sensible biological conclusions
1.2 Prerequisites
These are mostly prereqs for doing exercises associated with the class, but will help readers of the book, too.
1.2.1 R
Many methods are now implemented in R (R Core Team 2021): the phylogenetics task view has a brief overview. You can also install the relevant packages that are on CRAN and R-Forge using the task view itself:
install.packages("ctv")
library(ctv)
install.views("Phylogenetics")
Note that this will not install packages that are on GitHub or authors’ individual websites. The devtools
package can be useful for installing packages directly from GitHub.
1.2.2 Docker
Another option for installing things is to use the phydocker instance for Docker. Docker is (oversimplifying) like a very lightweight virtual machine. Note that it runs on Macs, Linux, Windows (Pro, Enterprise, and Education versions; for other versions, use Docker Toolbox), and various cloud service providers (i.e., you could throw money at Amazon to run this on one of their servers). This instance runs a copy of RStudio Server that has most of the relevant phylogenetic packages already installed. Once you have Docker installed, you can do
docker run -it -p 8787:8787 bomeara/phydocker
to run it as an RStudio Server.
If you want to use a local folder, you can use
docker run -it -v /Path/To/My/Folder:/data -p 8787:8787 bomeara/phydocker
Change /Path/To/My/Folder
to the absolute path to the folder you want access to (any subfolders will also be accessible). You can read and write to this in RStudio as the /data
directory. In your web browser, go to localhost:8787
, enter username and password (both are rstudio
), to launch a version of RStudio that will run in your browser and have everything you might need. You might want to do setwd("/data")
to make sure you’re in the right directory. You can save any results or figures to this directory and it will still exist when you quit this instance.