-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSkylinePlottingExample.Rmd
61 lines (44 loc) · 1.37 KB
/
SkylinePlottingExample.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: "multiNe"
output: html_document
---
Methods to estimate effective population size
```{r, echo=F}
library(ape)
library(multiNe)
library(INLA)
library(adegenet)
```
Start by simulating a multiPhylo object from the "ape" package.
```{r}
trs<-rmtree(N=20,n=100)
```
Now if you call the main function this will provide a skyline plot and a table with the median and 2.5 and 97.5 %iles at each time point.
```{r}
conf.int<-Phylos2Skylines_anchor(trees=trs,output_type="conf.int.plot")
```
The conf.int table can also be plotted directly using conf.int.skyline, with the epsilon value indicating the amount of smoothing (i.e. it specifies the )
```{r}
conf.int.skyline(conf.int,epsilon=0.01)
```
There is a function for simulating trees under various functions of population size and other factors.
```{r}
growing_trees<-simulate.tree(n=100,N=20,sampling="hetero")$out
plot(growing_trees[[1]])
conf.int<-Phylos2Skylines_anchor(trees=growing_trees,output_type="conf.int.plot",epsilon=0)
```
This can also be used to graph piecewise linear functions such as the output of INLA.
```{r,eval=T,echo=T}
tree<-rmtree(N=2,n=50)[[1]]
result<-calculate.moller(tree,lengthout=100,L=1)
conf.int.skyline(result,epsilon=0.01,plot_type="linear")
```
```{r,eval=F,echo=F}
library(phyclust)
sim_ms<-ms(nsam=5,nreps=10,"-T")
sim_genind<-ms2ms(sim_ms)
```
```{r}
data(nancycats)
HENe(nancycats)
```