| Title: | Calculations for Recombinant Inbred Lines |
|---|---|
| Description: | Calculate two- and three-locus probabilities in multiple-strain recombinant inbred lines, and simulate such lines. Broman (2005) <doi:10.1534/genetics.104.035212>. |
| Authors: | Karl W Broman [aut, cre]
|
| Maintainer: | Karl W Broman <[email protected]> |
| License: | GPL-3 |
| Version: | 0.56-2 |
| Built: | 2026-05-09 20:42:37 UTC |
| Source: | https://github.com/kbroman/ricalc |
A brief introduction to the contents of the R/ricalc package.
coinc.gam: Calculate the three-point
coincidence function for the gamma model.
mf.gam: Map function for the gamma model.
imf.gam: Inverse of map function for the gamma model.
mouseL: Estimated genetic lengths of mouse chromosomes.
threept.AI: Three-point haplotype probabilities
for 8-way RIL, autosome, under interference.
threept.ANI: Three-point haplotype probabilities
for 8-way RIL, autosome, with no interference.
threept.XI: Three-point haplotype probabilities
for 8-way RIL, X chromosome, under interference.
threept.XNI: Three-point haplotype probabilities
for 8-way RIL, X chromosome, with no interference.
fulltm: Generation-to-generation transition
matrices for 2- and 4-way RIL by selfing and by sibling mating (in
symbolic notation...lists of lists of character strings).
mtm: Transition matrices for meiosis, again in
symbols...lists of lists of character strings).
lookup: Lookup tables for parental types in the
generation of multiple-strain RIL, representing the
get.start: Symbolic notation for the starting
state in the generation of multiple-strain RIL.
count.absorb: Count the absorbing states in
multiple-strain RIL.
sim.ri: Simulate multiple-strain RIL.
get.ril.coinc: Numerical calculation of the
3-point coincidence-type quantity for 2- and 4-way RIL.
get.ril.prob: Numerical calculation of
haplotype probabilities on 2- or 4-way RIL chromosomes.
get.full.tm: Calculate the
generation-to-generation transition matrix for the formation of
RIL.
get.full.tm.symbolic: Calculate the
generation-to-generation transition matrix for the formation of
RIL, in symbolic form.
convert.full.tm: Convert a sparse version of a
transition matrix into a full matrix.
Karl W Broman, [email protected]
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
Teuscher, F. and Broman, K. W. (2007) Haplotype probabilities for multiple-strain recombinant inbred lines. Genetics 175, 1267–1274.
Calculates the three-point coincidence under the gamma renewal model, under the assumption that the two defined intervals have the same recombination fraction.
coinc.gam(r, nu=1, tol=1e-12)coinc.gam(r, nu=1, tol=1e-12)
r |
Recombination fraction for each interval (can be a vector). |
nu |
Interference parameter ( |
tol |
Tolerance for doing numerical integration. |
Uses the functions mf.gam and
imf.gam.
Vector of three-point coincidences, of same length as the input
r.
Karl W Broman, [email protected]
Zhao, H. and Speed, T. P. (1996) On genetic map functions. Genetics 142, 1369–1377.
Broman, K. W., Rowe, L. B., Churchill, G. A. and Paigen, K. (2002) Crossover interference in the mouse. Genetics 160, 1123–1131.
coinc.gam(seq(0.01,0.49,by=0.01), 11.3)coinc.gam(seq(0.01,0.49,by=0.01), 11.3)
Convert a sparse version of a transition matrix (with only the non-zero elements) into a full matrix.
convert.full.tm(full.tm)convert.full.tm(full.tm)
full.tm |
A list whose elements are the rows of the matrix, each being a vector with just the non-zero elements of the matrix. |
A full matrix version of the input.
Karl W Broman, [email protected]
get.full.tm,
get.full.tm.symbolic
Convert data generated by sim.ped to a matrix of
genotypes.
convert2gen(xodat, map)convert2gen(xodat, map)
xodat |
Allele information with continuous crossover locations, as
generated by |
map |
A vector of marker locations, in cM. |
The marker locations (map) must be sorted and should span a
length that is less then what was used to generated xodat.
If there are just two possible alleles (1 and 2) in xodat, the
genotypes are coded as 1, 2, and 3, for genotypes
11, 12 and 22. Otherwise, they are converted to binary codes. For
example, with possible alleles 1, 2, and 3, an individual with
genotype a,b will be given the value .
The output is a matrix with length(xodat) rows and
length(map) columns. Genotype codes are described in Details.
Karl W Broman, [email protected]
ailped <- genAILped(ngen=2, npairs=2, sibship.size=2) aildat <- sim.ped(ailped, 100) map <- seq(0, 100, by=10) names(map) <- paste("M", 1:length(map), sep="") ailgen <- convert2gen(aildat, map)ailped <- genAILped(ngen=2, npairs=2, sibship.size=2) aildat <- sim.ped(ailped, 100) map <- seq(0, 100, by=10) names(map) <- paste("M", 1:length(map), sep="") ailgen <- convert2gen(aildat, map)
Determine the absorbing states of the Markov chain for the generation of recombinant inbred lines.
count.absorb(n.strains=c("2","4"),type=c("selfing","sibmating"), chrtype=c("A","X"),n.loci=c("2","3"))count.absorb(n.strains=c("2","4"),type=c("selfing","sibmating"), chrtype=c("A","X"),n.loci=c("2","3"))
n.strains |
Number of parental strains. |
type |
Method for mating. |
chrtype |
Indicates autosome or X chromosome (when
|
n.loci |
Number of loci. |
A vector whose names indicate the minimal set of absorbing states, and whose elements are the number of the full states corresponding to each.
Karl W Broman, [email protected]
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
count.absorb()count.absorb()
Symbolic generation-to-generation transition matrices for the process of creating multiple strain recombinant inbred lines.
data(fulltm)data(fulltm)
A list of lists; each list contains the non-zero elements in the rows of the transition matrices.
These were formed using the internal function
get.full.tm.symbolic, with help from mathematica to simplify
the expressions.
get.full.tm,
get.full.tm.symbolic,
convert.full.tm
data(fulltm) fulltm[["2sibX2"]]["AA|BB x AA"]data(fulltm) fulltm[["2sibX2"]]["AA|BB x AA"]
Generate a pedigree matrix, for use with the simulation function
sim.ped, for advanced intercross lines.
genAILped(ngen=8, npairs=20, sibship.size=10)genAILped(ngen=8, npairs=20, sibship.size=10)
ngen |
Number of generations of crosses. |
npairs |
Number of mating pairs per generation. |
sibship.size |
Size of sibships in the final generation. |
We generate equal numbers of males and females at each generation. Matings are with random male/female pairs, with no attempt to avoid matings between siblings.
The output is a matrix with five columns: "id", "sex"
(coded as 0=female, 1=male), "mom", "dad",
and "generation".
Karl W Broman, [email protected]
ailped <- genAILped(ngen=5, npairs=5, sibship.size=2)ailped <- genAILped(ngen=5, npairs=5, sibship.size=2)
Calculate the full generation-to-generation transition matrix for the formation of RILs.
get.full.tm(r, coinc=1, n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), n.loci=c("2","3"))get.full.tm(r, coinc=1, n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), n.loci=c("2","3"))
r |
Recombination fraction between markers. |
coinc |
The 3-point coincidence (used only when
|
n.strains |
Number of parental strains. |
type |
Method for mating. |
chrtype |
Indicates autosome or X chromosome (when
|
n.loci |
Number of loci. |
The transition matrix as a list whose components are the rows of the matrix. Only the non-zero elements of each row are returned.
Karl W Broman, [email protected]
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
get.full.tm.symbolic,
fulltm, convert.full.tm
fulltm2self2 <- get.full.tm(0.1)fulltm2self2 <- get.full.tm(0.1)
Calculate the full generation-to-generation transition matrix for the formation of RILs, in symbolic form.
get.full.tm.symbolic(n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), n.loci=c("2","3"))get.full.tm.symbolic(n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), n.loci=c("2","3"))
n.strains |
Number of parental strains. |
type |
Method for mating. |
chrtype |
Indicates autosome or X chromosome (when
|
n.loci |
Number of loci. |
The transition matrix as a list whose components are the rows of the matrix. Only the non-zero elements of each row are returned, and they are returned as character strings.
Karl W Broman, [email protected]
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W., Rowe, L. B., Churchill, G. A. and Paigen, K. (2002) Crossover interference in the mouse. Genetics 160, 1123–1131.
fulltm2self2 <- get.full.tm.symbolic()fulltm2self2 <- get.full.tm.symbolic()
Calculate (numerically) the quantity analogous to a three-point coincidence on a 2- or 4-way RIL chromosome.
get.ril.coinc(r, coinc=1, n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), verbose=TRUE)get.ril.coinc(r, coinc=1, n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), verbose=TRUE)
r |
Recombination fraction between markers. |
coinc |
The 3-point coincidence (used only when
|
n.strains |
Number of parental strains. |
type |
Method for mating. |
chrtype |
Indicates autosome or X chromosome (when
|
verbose |
If TRUE, print stuff as things progress. |
A single number.
Karl W Broman, [email protected]
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
get.ril.coinc(0.01)get.ril.coinc(0.01)
Calculate (numerically) the haplotype probabilities on a 2- or 4-way RIL chromosome.
get.ril.prob(r, coinc=1, n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), n.loci=c("2","3"), verbose=TRUE)get.ril.prob(r, coinc=1, n.strains=c("2","4"), type=c("selfing","sibmating"), chrtype=c("A","X"), n.loci=c("2","3"), verbose=TRUE)
r |
Recombination fraction between markers. |
coinc |
The 3-point coincidence (used only when
|
n.strains |
Number of parental strains. |
type |
Method for mating. |
chrtype |
Indicates autosome or X chromosome (when
|
n.loci |
Number of loci. |
verbose |
If TRUE, print stuff as things progress. |
A vector of probabilities, with absorbing states in their reduced form.
Karl W Broman, [email protected]
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
Determine the initial state in the Markov chain to generate 2- or 4-way recombination inbred lines.
get.start(n.strains=c("2","4"),type=c("selfing","sibmating"), chrtype=c("A","X"),n.loci=c("2","3"))get.start(n.strains=c("2","4"),type=c("selfing","sibmating"), chrtype=c("A","X"),n.loci=c("2","3"))
n.strains |
Number of parental strains. |
type |
Method for mating. |
chrtype |
Indicates autosome or X chromosome (when
|
n.loci |
Number of loci. |
A character string.
Karl W Broman, [email protected]
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
get.start()get.start()
Calculates the genetic length (in cM) corresponding to a particular recombination fraction for the gamma renewal model for recombination at meiosis.
imf.gam(r, nu=1, tol=1e-12)imf.gam(r, nu=1, tol=1e-12)
r |
Recombination fraction, potentially a vector. |
nu |
Interference parameter ( |
tol |
Tolerance for doing numerical integration and finding root. |
Uses uniroot to solve the r = mf.gam(d,
nu).
Vector of interval lengths (in cM), of same length as the input r.
Karl W Broman, [email protected]
Zhao, H. and Speed, T. P. (1996) On genetic map functions. Genetics 142, 1369–1377.
Broman, K. W., Rowe, L. B., Churchill, G. A. and Paigen, K. (2002) Crossover interference in the mouse. Genetics 160, 1123–1131.
imf.gam(seq(0,0.49,by=0.01), 11.3)imf.gam(seq(0,0.49,by=0.01), 11.3)
Look-up tables for multi-locus parental types in the generation of 2-way or 4-way recombinant inbred lines by selfing, sibling mating with the X chromosome, or sibling mating with an autosome, and for cases of two or three loci. The tables connect all possible parental types to the prototypical versions after collapsing according to various symmetries.
data(lookup)data(lookup)
A list of vectors, each corresponding to a different set of conditions (for example, 2-way selfing at 3 points). Each vector has names corresponding to all possible parental types and with entries being the corresponding prototypes after collapsing according to various symmetries.
These were formed using the internal function gtypes.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
data(lookup) length(lookup[["2self3"]]) length(unique(lookup[["2self3"]]))data(lookup) length(lookup[["2self3"]]) length(unique(lookup[["2self3"]]))
Calculates the recombination fraction corresponding to a particular cM interval length for the gamma renewal model for recombination at meiosis.
mf.gam(d, nu=1, tol=1e-12)mf.gam(d, nu=1, tol=1e-12)
d |
Interval length (in cM), potentially a vector. |
nu |
Interference parameter ( |
tol |
Tolerance for doing numerical integration. |
Uses the function integrate to do numerical
integration.
Vector of recombination fractions, of same length as the input d.
Karl W Broman, [email protected]
Zhao, H. and Speed, T. P. (1996) On genetic map functions. Genetics 142, 1369–1377.
Broman, K. W., Rowe, L. B., Churchill, G. A. and Paigen, K. (2002) Crossover interference in the mouse. Genetics 160, 1123–1131.
mf.gam(0:25, 11.3)mf.gam(0:25, 11.3)
Estimated genetic lengths (in cM) of mouse chromosomes.
data(mouseL)data(mouseL)
An vector of length 20, each element being the length (in cM) of the corresponding chromosome.
Mouse Genome Informatics, http://www.informatics.jax.org/mgihome/other/mouse_facts1.shtml
data(mouseL) ri <- sim.ri(mouseL, type="selfing", n.str="8")data(mouseL) ri <- sim.ri(mouseL, type="selfing", n.str="8")
Transition matrices for meiosis: the probabilities of the possible haplotypes for a meiotic product from a given parental type. These are symbolic versions.
data(mtm)data(mtm)
A list of lists. Each list corresponds to a different condition (for example, 2 alleles for the X chromosome at 3 points). Each list contains a set of vectors, one for each possible parental type, containing a vector of character strings specifying the probabilities of each possible meiotic haplotype.
These were formed using the internal functions
write.meiosis.tm.symbolic and read.meiosis.tm.symbolic,
using mathematica to simplify the expressions.
data(mtm) sapply(mtm[["2A3"]],length)data(mtm) sapply(mtm[["2A3"]],length)
Print the version number of the currently installed version of R/ricalc.
ricalcversion()ricalcversion()
A character string with the version number of the currently installed version of R/ricalc.
Karl W Broman, [email protected]
ricalcversion()ricalcversion()
Simulates alleles for a general pedigree, using the chi-square model for interference at meiosis.
sim.ped(pedigree, L, sexsp=1, xchr=FALSE, m=10, obligate.chiasma=FALSE)sim.ped(pedigree, L, sexsp=1, xchr=FALSE, m=10, obligate.chiasma=FALSE)
pedigree |
A matrix with rows corresponding to individuals and
columns being individual identifiers ( |
L |
Length of chromosome in cM. |
sexsp |
Female:male recombination rate (must be > 0) |
xchr |
If TRUE, simulate the X chromosome. |
m |
The interference parameter (a non-negative integer).
|
obligate.chiasma |
Indicates whether there is an obligate chiasma on the four-strand bundle. |
Meiosis is simulated by the chi-square model (see Zhao et al. 1995), with the possibility of requiring an obligate chiasma on the four-strand bundle at meiosis.
The pedigree matrix must have columns named "id",
"sex", "mom"/"dam" and
"dad"/"sire". Other columns are ignored.
Founders should have 0 in the mom and dad columns; others should have
the identifiers for the mom and dad. Each individual must have either
both parents in the matrix or neither.
The output is a list with length equal to the number of rows in
pedigree. Each component is itself a list with two components,
the maternal and paternal chromosomes. These are matrices with two
rows: The first row consists of the locations of exchanges
(0 and L are included); the second row
contains the allele (coded 1, 2, ..., no. founders) in the interval to the
left.
Karl W Broman, [email protected]
Zhao, H., Speed, T. P. and McPeek, M. S. (1995) Statistical analysis of crossover interference using the chi-square model. Genetics 139, 1045–1056.
sim.ri, genAILped, convert2gen
ailped <- genAILped(ngen=5, npairs=5, sibship.size=2) aildat <- sim.ped(ailped, 100)ailped <- genAILped(ngen=5, npairs=5, sibship.size=2) aildat <- sim.ped(ailped, 100)
Simulates alleles for a multiple-strain RI line, using the chi-square model for interference at meiosis, performing inbreeding by selfing or sibling mating, until complete fixation has occurred.
sim.ri(L, sexsp=1, type=c("selfing","sibmating"), n.strains=c("2","4","8"), xchr=FALSE, m=10, obligate.chiasma=FALSE)sim.ri(L, sexsp=1, type=c("selfing","sibmating"), n.strains=c("2","4","8"), xchr=FALSE, m=10, obligate.chiasma=FALSE)
L |
Length of chromosome(s) in cM; either a vector or a single number. |
sexsp |
Female:male recombination rate (must be > 0) |
type |
Indicates whether the inbreeding is by selfing or by sibling mating. |
n.strains |
Number of initial parental strains. |
xchr |
If |
m |
The interference parameter (a non-negative integer).
|
obligate.chiasma |
Indicates whether there is an obligate chiasma on the four-strand bundle. |
Meiosis is simulated by the chi-square model (see Zhao et al. 1995), with the possibility of requiring an obligate chiasma on the four-strand bundle at meiosis.
Inbreeding is performed until complete fixation. Of course, we assume no mutation and no selection.
If length(L)==1, the output is a two-row matrix whose first
row consists of the locations of exchanges along the recombinant
inbred chromosome (0 and L are included). The second row
contains the allele (coded 1, 2, ..., 8) in the interval to the
left. Attributes "prop.het" and "num.het" are included
which contain the proportion of the genome that is not yet fixed and
the number of segments of such heterozygosity, respectively, after
each generation of inbreeding. The attribute "nubreak" gives
the number of unique breakpoints at each generation.
If length(L)>1, the output is a list of length
length(L), with each component being a two-row matrix, as
above. The overall list also has attributes "prop.het" and
"num.het", specifying the proportion of the entire genome that
has not yet been fixed and the number of segments of such
heterozygosity, respectively, after each generation of inbreeding.
Karl W Broman, [email protected]
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
Broman, K. W., Rowe, L. B., Churchill, G. A. and Paigen, K. (2002) Crossover interference in the mouse. Genetics 160, 1123–1131.
Zhao, H., Speed, T. P. and McPeek, M. S. (1995) Statistical analysis of crossover interference using the chi-square model. Genetics 139, 1045–1056.
data(mouseL) ri <- sim.ri(mouseL, type="selfing", n.str="8")data(mouseL) ri <- sim.ri(mouseL, type="selfing", n.str="8")
Three-point haplotype probabilities for four-way recombinant inbred
lines formed by sibling mating. A and X indicate autosome and the X
chromosome. I and NI indicate strong crossover interference (gamma
model with ) and no interference.
data(threept.AI) data(threept.ANI) data(threept.XI) data(threept.XNI)data(threept.AI) data(threept.ANI) data(threept.XI) data(threept.XNI)
Each is matrix; the first two columns indicate the recombination fraction between markers (at meiosis) and the three-point coincidence (at meiosis). The remaining columns are the haplotype probabilities for the fixed RIL chromosome. These are for the reduced set of states, taking account of many symmetries.
Use count.absorb to get the numbers of full
states in each reduced state.
These were calculated using perl programs included with this package.
Haldane, J. B. S. and Waddington, C. H. (1931) Inbreeding and linkage. Genetics 16, 357–374.
Broman, K. W. (2005) The genomes of recombinant inbred lines. Genetics 169, 1133–1146.
data(threept.AI) plot(threept.AI[,c(1,3)])data(threept.AI) plot(threept.AI[,c(1,3)])