Created
April 10, 2019 17:56
-
-
Save rossibarra/dad62c3657038739356a6a19f4872073 to your computer and use it in GitHub Desktop.
bad R/ms simulation of bottlenecks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(cowplot) | |
Ne=25000 | |
mu=1E-8 | |
win_size=20000 | |
theta=win_size*4*mu*Ne | |
before<-as.numeric(sapply(1:20, function(i) | |
system(paste("~/src/msdir/ms 10 1000 -t", 4*theta, "-r", 4*theta, "1000 | ~/src/msdir/sample_stats | cut -f 2 | ~/src/msdir/stats | cut -f 1") | |
,intern=T))) | |
div<-as.numeric(sapply(1:100, function(i) | |
system(paste("~/src/msdir/ms 10 1000 -t", theta, "-r", theta, "1000 -eN", i/1000, "4 | ~/src/msdir/sample_stats | cut -f 2 | ~/src/msdir/stats | cut -f 1") | |
,intern=T))) | |
div=c(before,div) | |
bob=data.frame(c(-1*20:1*100,4*Ne*1:100/1000),div,rep(2,120)) | |
colnames(bob)=c("time","div","epochs") | |
ggplot(data=bob,aes(y=div,x=time))+ | |
geom_point(size=2)+ | |
ylab("nucleotide diversity")+ | |
xlab("gens since bottleneck") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment