| profileSim | R Documentation |
Simulation of DNA profiles for specified pedigree members. Some pedigree
members may already be genotyped; in that case the simulation is conditional
on these. The main work of this function is done by markerSim().
profileSim(
x,
N = 1,
ids = NULL,
markers = NULL,
loopBreakers = NULL,
seed = NULL,
numCores = 1,
simplify1 = TRUE,
verbose = TRUE
)
x |
A |
N |
The number of complete simulations to be performed. |
ids |
A character (or coercible to character) of ID labels indicating
whose genotypes should be simulated. Alternatively, a function taking |
markers |
Either a vector indicating a subset of markers attached to
|
loopBreakers |
A vector containing IDs of individuals to be used as
loop breakers. Can usually be left as NULL, in which case automatic loop
breaking is applied. See |
seed |
An integer seed for the random number generator. Used only when
no mirai workers are set. For parallel simulations, set the seed in
|
numCores |
Deprecated. Use |
simplify1 |
A logical, by default TRUE, removing the outer list layer
when |
verbose |
A logical, by default TRUE. |
Simulations can be distributed across several R processes using the
mirai package. To use this, start mirai workers before calling
profileSim():
mirai::daemons(8, seed = 123) x = nuclearPed() db = NorwegianFrequencies res = profileSim(x, N = 100, markers = db) mirai::daemons(0)
The call to mirai::daemons(8, seed = 123) starts 8 persistent workers and
configures reproducible parallel RNG. These workers remain available for
later calls until stopped with mirai::daemons(0).
If no mirai daemons are set, profileSim() runs normally, and the seed
argument works as before. When mirai daemons are used, set the seed in
mirai::daemons(n, seed = ...) and omit the seed argument to profileSim().
A list of N objects similar to x, but with simulated genotypes.
Any previously attached markers are replaced by the simulated profiles. If
the indicated markers contained genotypes for some pedigree members, these
are still present in the simulated profiles.
If N = 1 and simplify1 = TRUE, the outer list layer is removed, i.e.,
profileSim(..., N = 1, simplify1 = T) is equivalent to profileSim(..., N = 1, simplify1 = F)[[1]]. This is usually the desired object in
interactive use, and works well with piping.
When using profileSim() in other functions, it is recommended to add
simplify1 = FALSE to safeguard against issues with N = 1.
# Example pedigree with two brothers
x = nuclearPed(children = c("B1", "B2"))
### Simulate profiles using built-in freq database
profileSim(x, markers = NorwegianFrequencies[1:3])
### Conditioning on known genotypes for one brother
# Attach two SNP markers with genotypes for B1
y = x |>
addMarker(B1 = "1/2", alleles = 1:2) |>
addMarker(B1 = "1", alleles = 1:2, chrom = "X")
# Simulate 2 profiles of B2 conditional on the above
profileSim(y, N = 2, ids = "B2", seed = 123)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.