View source: R/haploSimulate.R
haploSimulate | R Documentation |
Given a matrix of haplotype structure simulates time series for haplotype frequencies under neutrality (drift only) or with selection. Returns haplotype frequency time series data, haplotype structure matrix, and the matrix of allele frequency time series data computed from the haplotypes. Sequencing noise can be added to the allele frequency. In this case also a coverage matrix is returned.
haploSimulate(
hp_str,
Ne,
tp,
meancov = NULL,
hp0 = NULL,
benef_all = NULL,
s = 0,
haploid = FALSE
)
hp_str |
Haplotype structure matrix.
|
Ne |
One integer value corresponding to the effective population size. |
tp |
A vecotr of integer values corresponding to the generations of interest |
meancov |
One integer value specifying the mean coverage to simulate sequencing noise. If NULL the true allele frequencies are returned. |
hp0 |
Haplotype frequency matrix at generation 0.
|
benef_all |
A vector of integer numbers corresponding to the rows of hp_str with beneficial allele(s). If NULL neutral simulations are performed. |
s |
A vector of length |
haploid |
Logical. TRUE for haploid simulations and FALSE for diploids. |
List with allele frequency matrix, haplotype frequency matrix
and haplotype structure matrix. If meancov!=NULL
the allele
frequency matrix contains noisy allele frequencies and an additional
element corresponding to the coverage matrix is returned.
hp_str <- matrix(sample(c(rep(0,20), rep(1,30)), 50), nrow = 10, ncol = 5)
Ne <- 300
tp <- seq(0,60,10)
meancov = 80
hp0 = c(0.1,0.3,0.2, 0.05, 0.35)
benef_all = c(1,3)
s = c(0.05,0,0.2,rep(0,7))
haploSimulate(hp_str, Ne, tp, meancov) #to simulate under neutrality. All haplotypes starting with equal frequency
haploSimulate(hp_str, Ne, tp, meancov, hp0) #to simulate under neutrality. Custom starting haplotype frequency.
haploSimulate(hp_str, Ne, tp, meancov, benef_all, s) #to simulate with selection
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.