| Title: | Software for Testing QTL Analysis via Simulations |
|---|---|
| Description: | Software for testing QTL analysis via simulations. |
| Authors: | Karl W Broman [aut, cre]
|
| Maintainer: | Karl W Broman <[email protected]> |
| License: | GPL-3 |
| Version: | 0.73-6 |
| Built: | 2026-05-09 20:42:33 UTC |
| Source: | https://github.com/kbroman/qtlsim |
Analyze a backcross using ANOVA, CIM, and forward selection.
anal.all(dat, cim.steps=7, max.steps=20)anal.all(dat, cim.steps=7, max.steps=20)
dat |
The data: a list with components |
cim.steps |
Number of steps in forward selection prior to CIM analysis. |
max.steps |
Maximum number of steps in forward selection. |
A list with three components: LOD scores from ANOVA, LOD scores from CIM, and a matrix of marker indices and RSS from forward selection
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
simbc, anal.leaps,
anal.mcmc, perm
dat <- simbc() results <- anal.all(dat)dat <- simbc() results <- anal.all(dat)
Analyze a backcross using forward or backward selection or either of these followed by branch-and-bound.
anal.leaps(dat, method=c("forward","backward","forwback", "forwardleap","backwardleap"), bic.mult=2.5, max.steps=30)anal.leaps(dat, method=c("forward","backward","forwback", "forwardleap","backwardleap"), bic.mult=2.5, max.steps=30)
dat |
The data: a list with components |
method |
Model search approach to use: forward selection, backward elimination, forward selection followed by backward elimination, or forward or backward selection followed by branch-and-bound. |
bic.mult |
Multiplier for BIC, for choosing the size of the model. |
max.steps |
Maximum number of steps in forward selection. |
A list whose first component is a vector indicating the marker columns selected and second component is the corresponding BIC-delta value.
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
simbc, anal.all,
anal.mcmc, perm
dat <- simbc(n.ind=100,qtl.eff=c(1,1,1,-1,1,1,1)*0.75) results <- anal.leaps(dat,method="forwback",bic.mult=2.56)dat <- simbc(n.ind=100,qtl.eff=c(1,1,1,-1,1,1,1)*0.75) results <- anal.leaps(dat,method="forwback",bic.mult=2.56)
Analyze a backcross using an MCMC model selection method.
anal.mcmc(dat, bic.mult=2.5, n.steps=1000, start=NULL)anal.mcmc(dat, bic.mult=2.5, n.steps=1000, start=NULL)
dat |
The data: a list with components |
bic.mult |
Multiplier for BIC, for choosing the size of the model. |
n.steps |
Number of steps to take in the Markov chain. |
start |
Model at which to start the chain: a vector giving the columns of the genotype matrix to use as an initial state. |
A list giving the marker numbers chosen, the BIC criterion for the chosen model, the iteration of MCMC at which this model was first seen, and vectors giving the number of QTLs in the model and the BIC criterion, at each step of the chain
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
simbc, anal.all,
anal.leaps, perm
dat <- simbc() results <- anal.mcmc(dat)dat <- simbc() results <- anal.mcmc(dat)
Run multiple simulations of a backcross, analyzed using ANOVA, CIM and forward selection (with both BIC and permutation tests).
anal.multi(n.sim=1000, cim.steps=c(3,5,7,9,11), bic.mult=c(2,2.5,3), max.steps=13, n.perm=1000, alpha=0.05, thresh=NULL, drop=1.5, n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1)anal.multi(n.sim=1000, cim.steps=c(3,5,7,9,11), bic.mult=c(2,2.5,3), max.steps=13, n.perm=1000, alpha=0.05, thresh=NULL, drop=1.5, n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1)
n.sim |
Number of simulation replicates. |
cim.steps |
Number of steps in forward selection prior to CIM analysis. |
bic.mult |
Multipliers for BIC. |
max.steps |
Maximum number of steps in forward selection. |
n.perm |
Number of permutation replicates in permutation tests. |
alpha |
Significance level in permutation tests. |
thresh |
LOD thresholds for ANOVA and CIM. Should be length 1 or 1+length(cim.steps). If NULL and the chromosome structure and number of individuals match simulations that I've already done, we use my estimated LOD thresholds. |
drop |
Drop in LOD that is required between inferred QTLs. Should be length 1 or 1+length(cim.steps). |
n.ind |
Number of backcross individuals. |
n.mar |
Vector indicating the number of markers on each chromosome. |
mar.sp |
Vector of length sum(n.mar)-n.chr-1, giving the inter-marker spacings in cM. |
qtl.chr |
Chromosomes on which qtls are sitting. |
qtl.mar |
Markers to the left of each qtl, numbered 1, 2, ... |
qtl.dist |
Distance between qtl and marker to left, in cM. |
qtl.eff |
QTL effects. |
sigma |
Residual (environmental) standard deviation. |
A list of length 2+n.cim+n.bic, whose components correspond to the results of ANOVA, CIM, forward selection with BIC, and forward selection with permutation tests. Each component of this list is itself a list of length n.sim, with each component giving the chromosome numbers and marker numbers of the identified QTLs.
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
simbc, sim.null,
sim.mcmc, anal.multi2
## Not run: results <- anal.multi(n.sim=10)## Not run: results <- anal.multi(n.sim=10)
Run multiple simulations of a backcross, analyzed using ANOVA, CIM, forward selection (with both BIC and permutation tests) and MCMC.
anal.multi2(n.sim=1000, cim.steps=c(3,5,7,9,11), bic.mult=c(2,2.5,3), max.steps=13, n.perm=1000, alpha=0.05, thresh=NULL, drop=1.5, n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), n.mcmc=1000, mcmc.bic=2.56, qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1)anal.multi2(n.sim=1000, cim.steps=c(3,5,7,9,11), bic.mult=c(2,2.5,3), max.steps=13, n.perm=1000, alpha=0.05, thresh=NULL, drop=1.5, n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), n.mcmc=1000, mcmc.bic=2.56, qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1)
n.sim |
Number of simulation replicates. |
cim.steps |
Number of steps in forward selection prior to CIM analysis. |
bic.mult |
Multipliers for BIC. |
max.steps |
Maximum number of steps in forward selection. |
n.perm |
Number of permutation replicates in permutation tests. |
alpha |
Significance level in permutation tests. |
thresh |
LOD thresholds for ANOVA and CIM. Should be length 1 or 1+length(cim.steps). If NULL and the chromosome structure and number of individuals match simulations that I've already done, we use my estimated LOD thresholds. |
drop |
Drop in LOD that is required between inferred QTLs. Should be length 1 or 1+length(cim.steps). |
n.ind |
Number of backcross individuals. |
n.mar |
Vector indicating the number of markers on each chromosome. |
mar.sp |
Vector of length sum(n.mar)-n.chr-1, giving the inter-marker spacings in cM. |
n.mcmc |
Number of steps in MCMC |
mcmc.bic |
Delta value in BIC in the MCMC runs |
qtl.chr |
Chromosomes on which qtls are sitting. |
qtl.mar |
Markers to the left of each qtl, numbered 1, 2, ... |
qtl.dist |
Distance between qtl and marker to left, in cM. |
qtl.eff |
QTL effects. |
sigma |
Residual (environmental) standard deviation. |
A list of length 3+n.cim+n.bic, whose components correspond to the results of ANOVA, CIM, forward selection with BIC, forward selection with permutation tests, and MCMC with BIC. Each component of this list is itself a list of length n.sim, with each component giving the chromosome numbers and marker numbers of the identified QTLs.
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
simbc, sim.null,
sim.mcmc, anal.multi
## Not run: results <- anal.multi2(n.sim=10)## Not run: results <- anal.multi2(n.sim=10)
Combine output of multiple runs of
sim.mcmc.
combine.mcmc(...)combine.mcmc(...)
... |
Two or more objects, of the form output from
|
A single object, of the form output from
sim.mcmc.
Karl W Broman, [email protected]
## Not run: output1 <- sim.mcmc(n.sim=10) ## Not run: output2 <- sim.mcmc(n.sim=10) ## Not run: output <- combine.mcmc(output1, output2)## Not run: output1 <- sim.mcmc(n.sim=10) ## Not run: output2 <- sim.mcmc(n.sim=10) ## Not run: output <- combine.mcmc(output1, output2)
Combine output of multiple runs of
anal.multi.
combine.sims(...)combine.sims(...)
... |
Two or more objects, of the form output from
|
A single object, of the form output from
anal.multi.
Karl W Broman, [email protected]
## Not run: output1 <- anal.multi(n.sim=10) ## Not run: output2 <- anal.multi(n.sim=10) ## Not run: output <- combine.sims(output1, output2)## Not run: output1 <- anal.multi(n.sim=10) ## Not run: output2 <- anal.multi(n.sim=10) ## Not run: output <- combine.sims(output1, output2)
Convert the output of anal.leaps, anal.mcmc or perm for use with the function which.correct.
convertOutput(object, n.mar=rep(11,9))convertOutput(object, n.mar=rep(11,9))
object |
An object of the form output from
|
n.mar |
Vector indicating the number of markers on each chromosome. |
A matrix whose columns are identified QTLs, and rows are chromosome and marker numbers, respectively.
Karl W Broman, [email protected]
anal.leaps,
anal.mcmc, perm,
which.correct
dat <- simbc(n.ind=250) res1 <- anal.leaps(dat, "forward", 2.1, 27) res2 <- anal.leaps(dat, "backward", 2.1, 27) res <- lapply(list(res1,res2), convertOutput) out <- which.correct(res)dat <- simbc(n.ind=250) res1 <- anal.leaps(dat, "forward", 2.1, 27) res2 <- anal.leaps(dat, "backward", 2.1, 27) res <- lapply(list(res1,res2), convertOutput) out <- which.correct(res)
Convert data simulated with simbc() into the form used by R/qtl.
convertSim(object, n.chr=9, chr.len=100)convertSim(object, n.chr=9, chr.len=100)
object |
A list with two components: the genotype data as a matrix, and the phenotype data as a vector. |
n.chr |
Number of chromosomes in the data. |
chr.len |
Length of the chromosomes, in cM. |
An object of class cross. See read.cross for
details.
Karl W Broman, [email protected]
dat <- simbc() cross <- convertSim(dat, 9, chr.len=100)dat <- simbc() cross <- convertSim(dat, 9, chr.len=100)
Analyze a backcross using forward selection with permutation tests to choose the size of the model.
perm(dat, n.perm=1000, alpha=0.05)perm(dat, n.perm=1000, alpha=0.05)
dat |
The data: a list with components |
n.perm |
Number of permutation replicates to perform at each state. |
alpha |
Level of significance to use in each permutation test. |
A vector of marker indices.
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
anal.all, anal.leaps,
anal.mcmc, simbc
## Not run: dat <- simbc() ## Not run: results <- perm(dat)## Not run: dat <- simbc() ## Not run: results <- perm(dat)
Plot a summary of the results of
anal.multi or sim.mcmc.
plot_res(x, ..., ylim=NULL)plot_res(x, ..., ylim=NULL)
x |
Output of |
... |
Arguments to be passed to |
ylim |
Y-axis limits. If NULL, (0,1) is used. |
A plot of the proportion of times each QTL was identified by each method, and the proportion of linked and unlinked extraneous loci.
Karl W Broman, [email protected]
anal.multi, anal.mcmc,
which.correct
## Not run: output <- anal.multi() ## Not run: tab <- which.correct(output) ## Not run: plot_res(tab)## Not run: output <- anal.multi() ## Not run: tab <- which.correct(output) ## Not run: plot_res(tab)
Run multiple simulations of a backcross, analyzed using several model selection techniques, including MCMC.
sim.mcmc(n.sim=1000, max.steps=28, bic.mult=2.5, n.steps=1000, n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1, only.two=FALSE)sim.mcmc(n.sim=1000, max.steps=28, bic.mult=2.5, n.steps=1000, n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1, only.two=FALSE)
n.sim |
Number of simulation replicates. |
max.steps |
Maximum number of steps in forward/backward selection. |
bic.mult |
Multiplier for BIC. |
n.steps |
Number of steps in MCMC. |
n.ind |
Number of backcross individuals. |
n.mar |
Vector indicating the number of markers on each chromosome. |
mar.sp |
Vector of length sum(n.mar)-n.chr-1, giving the inter-marker spacings in cM. |
qtl.chr |
Chromosomes on which qtls are sitting. |
qtl.mar |
Markers to the left of each qtl, numbered 1, 2, ... |
qtl.dist |
Distance between qtl and marker to left, in cM. |
qtl.eff |
QTL effects. |
sigma |
Residual (environmental) standard deviation. |
only.two |
If TRUE, only do forward selection and MCMC |
A list of three components. The first is a list of length 5, whose components correspond to the results of forward and backward selection, the same followed by branch-and-bound, with BIC, and MCMC. (Each component of this list is itself a list of length n.sim, with each component giving the chromosome numbers and marker numbers of the identified QTLs.) The second component of the main list gives the BIC values corresponding to the identified models. The last component gives the step at which the final model from MCMC was first observed, plus the number of distinct models observed.
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
simbc, anal.mcmc,
anal.leaps,
anal.multi
## Not run: results <- sim.mcmc(n.sim=10)## Not run: results <- sim.mcmc(n.sim=10)
Simulates genotype and phenotype data for a backcross experiment with no QTLs, and applies ANOVA and CIM, in order to estimate LOD thresholds.
sim.null(n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), cim.steps=c(3,5,7,9,11), n.sim=10000)sim.null(n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), cim.steps=c(3,5,7,9,11), n.sim=10000)
n.ind |
Number of backcross individuals. |
n.mar |
Vector indicating the number of markers on each chromosome. |
mar.sp |
Vector of length sum(n.mar)-n.chr-1, giving the inter-marker spacings in cM. |
cim.steps |
Vector giving number of steps of forward selection to perform prior to CIM. |
n.sim |
Number of simulation replicates to perform. |
A matrix of size [n.sim x (1+length(cim.steps))] giving the maximum LOD score for ANOVA and CIM (with the different values of cim.steps) for each simulation replicate.
Karl W Broman, [email protected]
Broman, K. W. (1997) Identifying quantitative trait loci in experimental crosses. PhD dissertation, Department of Statistics, University of California, Berkeley.
## Not run: output <- sim.null()## Not run: output <- sim.null()
Simulates genotype and phenotype data for a backcross experiment with QTLs exactly at marker postions, and acting additively.
simbc(n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1)simbc(n.ind=100, n.mar=rep(11,9), mar.sp=rep(10,10*9), qtl.chr=c(1,1,2,2,3,4,5), qtl.mar=c(4,8,4,8,6,4,1), qtl.dist=rep(0,7), qtl.eff=c(1,1,1,-1,1,1,1)/2, sigma=1)
n.ind |
Number of backcross individuals. |
n.mar |
Vector indicating the number of markers on each chromosome. |
mar.sp |
Vector of length sum(n.mar)-n.chr-1, giving the inter-marker spacings in cM. |
qtl.chr |
Chromosomes on which qtls are sitting. |
qtl.mar |
Markers to the left of each qtl, numbered 1, 2, ... |
qtl.dist |
Distance between qtl and marker to left, in cM. |
qtl.eff |
QTL effects. |
sigma |
Residual (environmental) standard deviation. |
A list with two components: geno, a matrix containing the
genotype data, and pheno, a vector of phenotypes.
Karl W Broman, [email protected]
dat <- simbc()dat <- simbc()
Given the results of a model selection procedure and the true underlying locations of QTLs, determine which QTLs were correctly identified and how many were extraneous.
which.correct(results, truth=rbind(c(1,1,2,2,3,4,5),c(4,8,4,8,6,4,1)), within=1)which.correct(results, truth=rbind(c(1,1,2,2,3,4,5),c(4,8,4,8,6,4,1)), within=1)
results |
A list (or a list of lists), with each component in the
inner lists being either |
truth |
Matrix whose columns are the true QTLs, with rows giving the chromosome and marker numbers, respectively. |
within |
Distance (in number of markers) allowable between true and inferred QTLs for the inferred QTL to be considered correct. |
A list of matrices, with the matrices of size n.sim x (n.qtl+2). The first set of columns in each matrix indicate which QTLs were correctly identified. The last two columns give the number of extraneous loci on the same chromosome as a QTL and the number of unlinked extraneous loci.
Karl W Broman, [email protected]
## Not run: dat <- simbc() ## Not run: output1 <- anal.multi(dat) ## Not run: output2 <- which.correct(output1)## Not run: dat <- simbc() ## Not run: output1 <- anal.multi(dat) ## Not run: output2 <- which.correct(output1)