View source: R/sim_phenotypes.R
sim_trial | R Documentation |
Simulates a trial in which phenotypic data on a quantitative trait is gathered.
sim_trial(pop, h2, n.env = 1, n.rep = 1, check.pop, check.rep, ...)
pop |
An object of class |
h2 |
The heritability of the trait or traits. May be a |
n.env |
The number of environments in which to phenotype. |
n.rep |
The number of replicates of each experimental (i.e. non-check) individual in each environment. |
check.pop |
A |
check.rep |
A scalar specifying the number of times each check is replicated in each environment. |
... |
Other arguments. See |
Other arguments that can be specified are :
V_E
The variance of environmental effects. May be a double
(V_E is the same for all traits) or a numeric vector with length equal
to the number of traits.
V_R
The variance of the residual effects. May be a double
(V_R is the same for all traits) or a numeric vector with length equal
to the number of traits.
An object of class pop
with all information in the input pop
object,
plus simulated phenotypes.
## Not run:
# Load some historic data
data("s2_cap_genos")
data("s2_snp_info")
map <- s2_snp_info %>%
select(-alleles) %>%
data.frame(row.names = .$rs, stringsAsFactors = FALSE) %>%
select(-rs) %>%
table_to_map()
# Create a genome with genetic architecture
genome <- sim_genome(map = map)
# Simulate a a trait with 15 QTL
qtl.model <- matrix(nrow = 15, ncol = 4)
genome <- sim_gen_model(genome, qtl.model, add.dist = "geometric", max.qtl = 15)
pop <- create_pop(genome = genome, geno = s2_cap_genos)
# Sample the population for checks
set.seed(1035)
check_pop <- pop %>%
subset_pop(individual = sample(indnames(.), 5))
# Remove the checks from the original pop
exp_pop <- pop %>%
subset_pop(setdiff(indnames(.), indnames(check_pop)))
# Simulate a trial
pop_pheno <- sim_trial(pop = exp_pop, h2 = 0.5, n.env = 3, n.rep = 1,
check.pop = check_pop, check.rep = 3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.