-
Notifications
You must be signed in to change notification settings - Fork 2
/
RAxML_plot-tree.Rmd
47 lines (37 loc) · 1.49 KB
/
RAxML_plot-tree.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: "Making a Tree Using RAxML"
author: "William Shoemaker and Jay T. Lennon"
date: "April 12, 2017"
header-includes:
- \usepackage{array}
output: pdf_document
geometry: margin=2.54cm
---
## 1) SETUP
### A. Retrieve and Set Your Working Directory
```{r, results = 'hide'}
rm(list = ls())
getwd()
setwd("~/GitHub/RAxML")
```
### B. Load Packages
The `require()` function in `R` returns `TRUE` if the package was successfully loaded or `FALSE` if the package failed to load.
This `for` loop loads each package and installs the package when `require()` returns `FALSE`.
```{r, results = 'hide', message = FALSE, warning = FALSE, tidy=TRUE, tidy.opts=list(width.cutoff=60)}
package.list <- c('ape', 'seqinr', 'phylobase', 'adephylo', 'geiger', 'picante', 'stats', 'RColorBrewer', 'caper', 'phylolm', 'pmc', 'ggplot2', 'tidyr', 'dplyr', 'phangorn', 'pander')
for (package in package.list) {
if (!require(package, character.only=TRUE, quietly=TRUE)) {
install.packages(package)
library(package, character.only=TRUE)
}
}
```
## 2) MAKE TREE
```{r, tidy=TRUE, tidy.opts=list(width.cutoff=60)}
ml.bootstrap <- read.tree("RAxML_bipartitionsBranchLabels.T15")
par(mar = c(1,1,2,1) + 0.1)
plot.phylo(ml.bootstrap, type = "phylogram", direction = "right", show.tip.label=TRUE,
use.edge.length = FALSE, cex = 0.6, label.offset = 1, main = "Maximum Likelihood with Support Values")
add.scale.bar(cex = 0.7)
nodelabels(ml.bootstrap$node.label, font = 2, bg = "white", frame = "r", cex = 0.5)
```