Title: | Pedigree, Genetic Merit, Phenotype, and Genotype Simulation |
---|---|
Description: | Simulate pedigree, genetic merits and phenotypes with random/non-random matings followed by random/non-random selection with different intensities and patterns in males and females. Genotypes can be simulated for a given pedigree, or an appended pedigree to an existing pedigree with genotypes. Mrode, R. A. (2005) <ISBN:9780851989969, 0851989969>; Nilforooshan, M.A. (2022) <doi:10.37496/rbz5120210131>. |
Authors: | Mohammad Ali Nilforooshan [aut, cre]
|
Maintainer: | Mohammad Ali Nilforooshan <[email protected]> |
License: | GPL-3 |
Version: | 1.4.3 |
Built: | 2025-02-14 03:09:22 UTC |
Source: | https://github.com/nilforooshan/pedsimulate |
An R package for simulating a pedigree with genetic merits and phenotypes, starting from a base population (generation 0) or an existing pedigree. The pedigree depth and design can be chosen by the values provided to the arguments of the simulation function. Genotypes can be simulated for a given pedigree, or an appended pedigree to an existing pedigree with genotypes. Marker effects to be chosen by the researcher.
Starting from a base population with a user-defined size and equal number of males and females, next generations are simulated for the user-defined litter size and number of generations. No selection (natural or artificial) and non-random mating is applied to this population. Alternatively, the simulation can be started from an existing pedigree. Natural (mortality) and artificial selection are applied to the next generations. Different generation overlap, selection intensities and selection patterns can be applied to males and females. Selected males and females are ordered similarly/differently to simulate various random, assortative or disassortative mating scenarios. Performance and genetic merit of individuals are simulated using the basic rules of quantitative genetics. The performance (P) of an individual is influenced by genetic (A) and environmental (E) effects. Thus, P = A + E, and Var(P) = Var(A) + Var(E). The additive genetic merit (A) of an individual is the average of its parents' additive genetic merits (PA = (Asire + Adam)/2) plus the Mendelian Sampling term due to the sampling of alleles passed from the parent to the offspring. The Mendelian Sampling variance is half of Var(A) in the base population. Because there is no provided information for environmental effects, the environment effect is assigned to individuals from a normal distribution of random numbers (E ~ N(0, IVar(E))). The package also provides functions to identify halfsib, fullsib and parent-progeny matings in the pedigree. For a given pedigree, genotypes can be simulated. Marker effects can be chosen by the researcher and added to the simulated phenotypes. In that case, genetic effects and variance used to simulate phenotypes change to residual polygenic effects and variance (genetic effects and variance not explained by the markers).
Mohammad Ali Nilforooshan [email protected]
Mrode, R. A. 2005. Linear Models for the Prediction of Animal Breeding Values, 2nd ed. Cambridge, MA: CABI Publishing. <ISBN:9780851989969, 0851989969>
Nilforooshan, M. A. 2022. pedSimulate – An R package for simulating pedigree, genetic merit, phenotype, and genotype data. R. Bras. Zootec., 51:e20210131. <doi:10.37496/rbz5120210131>
Simulate genotypes for an appended pedigree to an existing pedigree with genotypes.
appendGen(ped, M, AF = c(), mut.rate = 0, seed = NA)
appendGen(ped, M, AF = c(), mut.rate = 0, seed = NA)
ped |
: Pedigree |
M |
: Genotype |
AF |
: Vector of allele frequencies at different loci for the genotypes to be simulated. If no value is provided, it will be estimated from |
mut.rate |
: Vector of mutation rates at different loci for the genotypes to be simulated, default = 0 for no mutation. |
seed |
: A numeric variable input to the random number generator for reproducible simulations, default = 'NA' for non-reproducible simulations. |
Only diploid and bi-allelic situations are covered. No linkage disequilibrium is simulated.
M2 : New simulated genotypes appended to M
.
nSNP = 100 AF = runif(nSNP, 0.01, 0.99) mut.rate = runif(nSNP, 0, 10^-5) ped = data.frame(ID=1:5, SIRE=c(0,0,1,0,3), DAM=c(0,0,2,2,4)) gen = simulateGen(ped, AF, mut.rate) ped = rbind(ped, data.frame(ID=6:8, SIRE=c(3,6,6), DAM=c(0,4,5))) gen = appendGen(ped, M=gen, AF, seed=34)
nSNP = 100 AF = runif(nSNP, 0.01, 0.99) mut.rate = runif(nSNP, 0, 10^-5) ped = data.frame(ID=1:5, SIRE=c(0,0,1,0,3), DAM=c(0,0,2,2,4)) gen = simulateGen(ped, AF, mut.rate) ped = rbind(ped, data.frame(ID=6:8, SIRE=c(3,6,6), DAM=c(0,4,5))) gen = appendGen(ped, M=gen, AF, seed=34)
Simulate pedigree, genetic merits and phenotypes with random/assortative/disassortative matings followed by random/non-random selection of males and females with similar/different selection patterns in males and females, starting from an existing pedigree.
appendPed( ped, Va0, Ve, littersize = 1, ngen, mort.rate = 0, overlap.s = 0, overlap.d = 0, f.rate = 1, m.rate = 1, fsel = "R", msel = "R", f.order = "fsel", m.order = "msel", seed = NA )
appendPed( ped, Va0, Ve, littersize = 1, ngen, mort.rate = 0, overlap.s = 0, overlap.d = 0, f.rate = 1, m.rate = 1, fsel = "R", msel = "R", f.order = "fsel", m.order = "msel", seed = NA )
ped |
: The input pedigree |
Va0 |
: Additive genetic variance in the base generation (i.e., F0). |
Ve |
: Residual variance, constant across generations. |
littersize |
: Litter size, default = 1. |
ngen |
: Number of generations to simulate after the founder generation. |
mort.rate |
: Mortality rate per generation, after the availability of phenotype (e.g., birth weight, weaning weight)
and before the age of maturity (i.e., before mating), default = 0. Maximum |
overlap.s |
: Number of overlapping generations for sires, default = 0 for no generation overlap. |
overlap.d |
: Number of overlapping generations for dams, default = 0 for no generation overlap. |
f.rate |
: Proportion of females selected as dams, default = 1. |
m.rate |
: Proportion of males ( |
fsel |
: If |
msel |
: If |
f.order |
: Ordering selected females for mating;
if |
m.order |
: Ordering selected males for mating;
if |
seed |
: A numeric variable input to the random number generator for reproducible simulations, default = 'NA' for non-reproducible simulations. |
ped2 : New generations appended to the input pedigree data.frame
.
ped = simulatePed( F0size = 100, Va0 = 9, Ve = 36, littersize = 2, ngen = 4, mort.rate = 0.05, overlap.s = 1, overlap.d = 0, f.rate = 0.8, m.rate = 0.5, fsel = "P", msel = "PA" ) ped2 = appendPed( ped = ped, Va0 = 9, Ve = 36, littersize = 2, ngen = 2, mort.rate = 0.05, overlap.s = 1, overlap.d = 0, f.rate = 0.8, m.rate = 0.5, fsel = "R", msel = "R", f.order = "P", m.order = "PA", seed = 76 )
ped = simulatePed( F0size = 100, Va0 = 9, Ve = 36, littersize = 2, ngen = 4, mort.rate = 0.05, overlap.s = 1, overlap.d = 0, f.rate = 0.8, m.rate = 0.5, fsel = "P", msel = "PA" ) ped2 = appendPed( ped = ped, Va0 = 9, Ve = 36, littersize = 2, ngen = 2, mort.rate = 0.05, overlap.s = 1, overlap.d = 0, f.rate = 0.8, m.rate = 0.5, fsel = "R", msel = "R", f.order = "P", m.order = "PA", seed = 76 )
Find fullsib matings in the pedigree
fs_mate_finder(ped)
fs_mate_finder(ped)
ped |
: A pedigree |
fs_mates : A data.frame
with two columns (SIRE, DAM) representing fullsib mates.
ped = data.frame(ID=1:7, SIRE=c(0,0,1,0,3,3,5), DAM=c(0,0,0,2,4,4,6)) fs_mate_finder(ped)
ped = data.frame(ID=1:7, SIRE=c(0,0,1,0,3,3,5), DAM=c(0,0,0,2,4,4,6)) fs_mate_finder(ped)
Find halfsib matings in the pedigree
hs_mate_finder(ped)
hs_mate_finder(ped)
ped |
: A pedigree |
hs_mates : A data.frame
with two columns (SIRE, DAM) representing halfsib mates.
ped = data.frame(ID=1:7, SIRE=c(0,0,1,1,0,3,5), DAM=c(0,0,2,2,2,4,4)) hs_mate_finder(ped)
ped = data.frame(ID=1:7, SIRE=c(0,0,1,1,0,3,5), DAM=c(0,0,2,2,2,4,4)) hs_mate_finder(ped)
Find parent-progeny matings in the pedigree
pp_mate_finder(ped)
pp_mate_finder(ped)
ped |
: A pedigree |
pp_mates : A data.frame
with two columns (SIRE, DAM) representing parent-progeny mates.
ped = data.frame(ID=1:4, SIRE=c(0,0,1,1), DAM=c(0,0,2,3)) pp_mate_finder(ped)
ped = data.frame(ID=1:4, SIRE=c(0,0,1,1), DAM=c(0,0,2,3)) pp_mate_finder(ped)
Simulate genotypes for a given pedigree, allele frequency and mutation rate at each marker locus.
simulateGen(ped, AF, mut.rate = 0, seed = NA)
simulateGen(ped, AF, mut.rate = 0, seed = NA)
ped |
: Pedigree |
AF |
: Vector of allele frequencies at different loci for the genotypes to be simulated. |
mut.rate |
: Vector of mutation rates at different loci for the genotypes to be simulated, default = 0 for no mutation. |
seed |
: A numeric variable input to the random number generator for reproducible simulations, default = 'NA' for non-reproducible simulations. |
Only diploid and bi-allelic situations are covered. No linkage disequilibrium is simulated.
M : The simulated genotype data.frame
with rows corresponding to animals (in the same order as in the pedigree) and columns corresponding to markers.
nSNP = 100 AF = runif(nSNP, 0.01, 0.99) mut.rate = runif(nSNP, 0, 10^-5) ped = data.frame(ID=1:5, SIRE=c(0,0,1,0,3), DAM=c(0,0,2,2,4)) gen = simulateGen(ped, AF, mut.rate, seed=684)
nSNP = 100 AF = runif(nSNP, 0.01, 0.99) mut.rate = runif(nSNP, 0, 10^-5) ped = data.frame(ID=1:5, SIRE=c(0,0,1,0,3), DAM=c(0,0,2,2,4)) gen = simulateGen(ped, AF, mut.rate, seed=684)
Simulate pedigree, genetic merits and phenotypes with random/assortative/disassortative matings followed by random/non-random selection of males and females with similar/different selection patterns in males and females.
simulatePed( F0size, Va0, Ve, littersize = 1, ngen, mort.rate = 0, overlap.s = 0, overlap.d = 0, f.rate = 1, m.rate = 1, fsel = "R", msel = "R", f.order = "fsel", m.order = "msel", seed = NA )
simulatePed( F0size, Va0, Ve, littersize = 1, ngen, mort.rate = 0, overlap.s = 0, overlap.d = 0, f.rate = 1, m.rate = 1, fsel = "R", msel = "R", f.order = "fsel", m.order = "msel", seed = NA )
F0size |
: Even number of founder animals. No mortality, selection and non-random mating in this generation. |
Va0 |
: Additive genetic variance in the base generation (i.e., F0). |
Ve |
: Residual variance, constant across generations. |
littersize |
: Litter size, default = 1. |
ngen |
: Number of generations to simulate after the founder generation. |
mort.rate |
: Mortality rate per generation, after the availability of phenotype (e.g., birth weight, weaning weight)
and before the age of maturity (i.e., before mating), default = 0. Maximum |
overlap.s |
: Number of overlapping generations for sires, default = 0 for no generation overlap. |
overlap.d |
: Number of overlapping generations for dams, default = 0 for no generation overlap. |
f.rate |
: Proportion of females selected as dams, default = 1. |
m.rate |
: Proportion of males ( |
fsel |
: If |
msel |
: If |
f.order |
: Ordering selected females for mating;
if |
m.order |
: Ordering selected males for mating;
if |
seed |
: A numeric variable input to the random number generator for reproducible simulations, default = 'NA' for non-reproducible simulations. |
The output pedigree data.frame
(ped
) has 9 columns: ID, SIRE, DAM, SEX,
GEN (generation number starting with 0 for the base generation), PA (parent average),
MS (Mendelian Sampling), E (environment and residuals), and P (phenotype).
Random, assortative, and disassortative matings can be simulated with different combinations of
fsel
, msel
, f.order
, and m.order
.
ped : The output pedigree data.frame
. Further information provided in Details.
ped = simulatePed( F0size = 100, Va0 = 9, Ve = 36, littersize = 2, ngen = 4, mort.rate = 0.05, overlap.s = 1, overlap.d = 0, f.rate = 0.8, m.rate = 0.5, fsel = "P", msel = "PA", f.order = "fsel", m.order = "msel", seed = 68 )
ped = simulatePed( F0size = 100, Va0 = 9, Ve = 36, littersize = 2, ngen = 4, mort.rate = 0.05, overlap.s = 1, overlap.d = 0, f.rate = 0.8, m.rate = 0.5, fsel = "P", msel = "PA", f.order = "fsel", m.order = "msel", seed = 68 )