The following uses magicsim to simulate 1009 RILs from a cross between B73 and Mo17
| B73 x Mo17| | F1 | |5 generations of selfing|
A population of F1 lines are created, followed by 5 generations of selfing to make Recombinant Inbred Lines (RILs)
knitr::opts_chunk$set(echo = TRUE, warning=FALSE) ### Script to simulate 400 Double Haploid MAGIC lines #devtools::install_github('sarahodell/magicsim',force = T) library('magicsim') library("data.table") library("tidyverse") library("ggplot2") options(scipen=999)
set.seed(11) gmap=fread('ogutmap_v4_ordered.csv',data.table=F) # The 2 initial founder maize lines. This could be anything founders=c("Mo17","B73") ### Simulate chromosomes 1 throught 10 c=10 ### Initialize the founders B73=indv_init(chr=c,gmap,h1_donors=c("B73"),h2_donors=c("B73")) Mo17=indv_init(chr=c,gmap,h1_donors=c("Mo17"),h2_donors=c("Mo17"))
We can create F1s from the first round of crossing.
#Make F1s for each of the first crosses #f1=make_f1(B73,Mo17,gmap,chroms=c) n=100 ### Create F1s from the first round of crossing f1s=new("Pop",nIndv=n,indvlist=vector("list",length=n)) #Make F1s for each of the first crosses and add to the Pop object for(i in seq(1,n)){ f1s@indvlist[[i]]=make_f1(B73,Mo17,gmap,chroms=c) }
Self 100 F1s for 5 generations
gen=5 rils5=self_pop(f1s,c=c,ngen=gen,g_map=gmap)
We can visualize chromsome 10 for 10 individuals in the population
pop_breaktable=make_pop_breaktable(rils5,c=10,het=T) plot_Pop(pop_breaktable,n=10,c=10,het=T)
Can also do for all 10 chromosomes on one individual
indv_breaktable=make_indv_breaktable(rils5@indvlist[[1]]) plot_Indv(indv_breaktable)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.