glSim
simulates simple SNP data with the
possibility of contrasted structures between two groups
as well as background ancestral population structure.
Returned objects are instances of the class glSim(n.ind, n.snp.nonstruc, n.snp.struc = 0, grp.size = c(0.5, 0.5), k = NULL,
pop.freq = NULL, ploidy = 1, alpha = 0, parallel = FALSE,
LD = TRUE, block.minsize = 10, block.maxsize = 1000, theta = NULL,
sort.pop = FALSE, ...)
k
specifying the proportions of the
k ancestral populations (must sum to 1). If, as by default, pop.freq
is null, and k
is non-null, pop.freq
will be the result of
random sampliLD=TRUE
. Increasing the minimum block size will increase
the RAM requirement but decrease the amount osort.pop=TRUE
) or phenotypic population
(sort.pop=FALSE
).n.snp.struc
is greater than 0, some SNPs are simulated in
order to differ between groups (noted 'A' and 'B'). Different patterns
between groups are achieved by using different
frequencies of the second allele for A and B, denoted $p_A$ and
$p_B$. For a given SNP, $p_A$ is drawn from a uniform
distribution between 0 and (0.5 - alpha). $p_B$ is then computed
as 1 - $p_A$. Therefore, differences between groups are mild for
alpha=0, and total for alpha = 0.5.
=== Linked or independent loci ===
Independent loci (LD=FALSE
) are simulated using the standard
binomial distribution, with randomly generated allele
frequencies. Linked loci (LD=FALSE
) are trickier towe need to
simulate discrete variables with pre-defined correlation structure.
Here, we first generate deviates from multivariate normal distributions with randomly generated correlation structures. These variables are then discretized using the quantiles of the distribution. Further improvement of the procedure will aim at i) specifying the strength of the correlations between blocks of alleles and ii) enforce contrasted structures between groups.
genlight
: class of object for storing massive binary
SNP data. - glPlot
: plotting
- glPca
: PCA for
## no structure
x <- glSim(100, 1e3, ploid=2)
plot(x)
## 1,000 non structured SNPs, 100 structured SNPs
x <- glSim(100, 1e3, n.snp.struc=100, ploid=2)
plot(x)
## 1,000 non structured SNPs, 100 structured SNPs, ploidy=4
x <- glSim(100, 1e3, n.snp.struc=100, ploid=4)
plot(x)
## same thing, stronger differences between groups
x <- glSim(100, 1e3, n.snp.struc=100, ploid=2, alpha=0.4)
plot(x)
## same thing, loci with LD structures
x <- glSim(100, 1e3, n.snp.struc=100, ploid=2, alpha=0.4, LD=TRUE, block.minsize=100)
plot(x)
Run the code above in your browser using DataLab