Menu

ClusterInvasionInsertionTally

Robert Kofler
Attachments
invasion-tally.png (41251 bytes)

Distribution of insertions per diploid individual

Run simulations

java -jar invade.jar cluster --genome "mb:1,1,1,1" --rr "cm_mb:3,3,3,3" --cluster "kb:30,30,30,30" --u 0.1 --N 1000 --gen 100 --basepop "seg:30" --rep 1 --silent --steps 20 --tally-file tally.txt

generate histograms

library(ggplot2)
library(RColorBrewer)
library(plyr)
theme_set(theme_bw())

t<-read.table("/Users/robertkofler/dev/invade/out/artifacts/invade_jar/tally.txt")
names(t)<-c("replicate","generation","id","inscount","tally")

# filter the data of interst
filtereddf<-subset(t,id=="all")

# for histogram function we need to expand the counts
expandedcounts<-data.frame()
for(i in 1:nrow(filtereddf)) { 
  row <- filtereddf[i,]
  ta<-row$tally
  tmp<-data.frame(replicate=rep(row$replicate,ta), generation=rep(row$generation,ta),inscount=rep(row$inscount,ta))
  expandedcounts<-rbind(expandedcounts, setNames(tmp, names(tmp)))
  }

# factor
expandedcounts$generation<-as.factor(expandedcounts$generation)
g<-ggplot(expandedcounts,aes(x=inscount))+geom_histogram(binwidth = 5)+facet_grid(generation ~ .)+xlim(-5,60)+xlab("Insertions per diploid individual")

pdf(file="/Users/robertkofler/dev/invade/out/artifacts/invade_jar/invasion-tally.pdf",width=6,height=8)
plot(g)
dev.off()

results

Distribution of insertions per diploid individual with cluster insertions

Run simulations

java -jar invade.jar cluster --genome "mb:1,1,1,1" --rr "cm_mb:3,3,3,3" --cluster "kb:30,30,30,30" --u 0.1 --N 1000 --gen 1200 --basepop "seg:30" --rep 1 --silent --steps 200 --tally-file tally.txt

visualize with R

library(ggplot2)
library(RColorBrewer)
library(plyr)
theme_set(theme_bw())

t<-read.table("/Users/robertkofler/dev/invade/out/artifacts/invade_jar/tally.txt")
names(t)<-c("replicate","generation","id","inscount","tally")

# for histogram function we need to expand the counts
expandedcounts<-data.frame()
for(i in 1:nrow(t)) { 
  row <- t[i,]
  ta<-row$tally
  tmp<-data.frame(replicate=rep(row$replicate,ta), id=rep(row$id,ta),
                  generation=rep(row$generation,ta),inscount=rep(row$inscount,ta))
  expandedcounts<-rbind(expandedcounts, setNames(tmp, names(tmp)))
  }

# factor
expandedcounts$generation<-as.factor(expandedcounts$generation)
g<-ggplot(expandedcounts,aes(x=inscount))+geom_histogram(binwidth = 5)+facet_grid(generation ~ id,scales="free_x", space = "free_x")+
xlab("Insertions per diploid individual")

pdf(file="/Users/robertkofler/dev/invade/out/artifacts/invade_jar/invasion-tally-cluster.pdf",width=8,height=8)
plot(g)
dev.off()

results


Related

Wiki: Home