Package `Meiosis`

Package ‘Meiosis’
May 10, 2017
Type Package
Title Simulation of Meiosis in Plant Breeding Research
Version 1.0.2
Date 2017-05-10
Description Tools for simulation of meiosis in plant breeding research.
License GPL (>= 3)
Depends R (>= 3.3.2)
Imports methods, Rcpp (>= 0.12.9), utils
LinkingTo Rcpp, BH
SystemRequirements C++11
RoxygenNote 6.0.1
Suggests knitr, rmarkdown, testthat, covr, pedigree
VignetteBuilder knitr
LazyData true
URL https://github.com/DominikMueller64/Meiosis
BugReports https://github.com/DominikMueller64/Meiosis/issues
NeedsCompilation yes
Author Dominik Mueller [aut, cre],
Karl W. Broman [aut]
Maintainer Dominik Mueller <[email protected]>
Repository CRAN
Date/Publication 2017-05-10 08:06:36 UTC
R topics documented:
calc_Lstar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
check_geno_individual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
check_positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
2
3
3
2
calc_Lstar
check_xoparam . . . . .
check_xo_individual . .
Converter . . . . . . . .
Converter$convert . . . .
Converter$insert_founder
create_xoparam . . . . .
create_xo_founder . . .
crossover . . . . . . . .
cross_geno . . . . . . .
cross_xo . . . . . . . . .
dh_geno . . . . . . . . .
dh_xo . . . . . . . . . .
exdat . . . . . . . . . . .
Meiosis . . . . . . . . .
meiosis_geno . . . . . .
meiosis_xo . . . . . . .
realized_coancestry . . .
realized_heter . . . . . .
seed_rng . . . . . . . . .
self_geno . . . . . . . .
self_xo . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.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
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Index
calc_Lstar
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
4
5
5
5
6
7
8
9
10
10
11
12
12
13
13
14
15
16
16
17
18
Calculate adjusted chromosome length for an obligate chiasma.
Description
Calculate the reduced chromosome length that will give the target expected number of chiasmata
when conditioning on there being at least one chiasma on the four-strand bundle.
Usage
calc_Lstar(L, m, p, epsilon = NULL)
Arguments
L
Double. Length of the chromosome in cM. Must be > 50.
m
Integer. The interference parameter (m = 0 is no interference).
p
Double. Proportion of chiasmata from no-interference mechanism. (p = 0 gives
pure chi-square model)
epsilon
Double. The precision for finding the adjusted chromosome length. Defaults to
NULL, where a reasonably "high" precision is used.
check_geno_individual
3
Details
This function is an R-wrapper of an underlying C++ routine. It is not intended for direct usage, but
exposed for completeness.
Value
Double. Adjusted chromosome length.
Examples
Meiosis::calc_Lstar(100, 0, 0)
Meiosis::calc_Lstar(60, 10, 0.1)
check_geno_individual Check genotypic representation of an individual.
Description
Check if the genotypic representation is valid.
Usage
check_geno_individual(x)
Arguments
x
List. Individual.
Value
Null
check_positions
Check genetic positions
Description
Check if genetic positions are valid.
Usage
check_positions(x)
Arguments
x
List. Genetic positions.
4
check_xo_individual
Value
Null
check_xoparam
Check crossover parameters.
Description
Check if crossover parameters are valid.
Usage
check_xoparam(x)
Arguments
x
List. Crossover parameters.
Value
Null
check_xo_individual
Check segmental representation of an individual.
Description
Check if the segmental representation is valid.
Usage
check_xo_individual(x)
Arguments
x
Value
Null
List. Individual.
Converter
5
Converter
Converter reference class
Description
An object of type Converter is used to efficiently convert data from the segmental to the genotypic
representation. This class has two methods that should be employed by the user: insert_founder
and convert. Please look up their documentation with help(Converter$insert_founder) and
help(Converter$convert). Before starting conversion, all founder alleles and founder genotypes
have to be added via the method insert_founder. Conversion is then done by the method convert.
The constructor has two parameters, positions and use_names (optional, defaults to FALSE). Parameter positions must be a list of vectors with the genetic positions. If these vectors are named,
and if use_names is TRUE, the result of a conversion via convert will also be named.
Please see the vignette (vignette('Introduction', package = 'Meiosis')) for an example.
Converter$convert
convert
Description
Convert an individual from its segmental to its genotypic representation.
Arguments
individual
List. An individual to be converted.
Converter$insert_founder
insert_founder
Description
Insert founder genotypes.
Arguments
keys
Integer vector. The two (unique) founder alleles.
geno
List. The genotypic data.
6
create_xoparam
create_xoparam
Create a parameter list for simulating crossovers.
Description
Create a parameter list for simulating crossover locations on a single meiotic product using the Stahl
model.
Usage
create_xoparam(L, m = 0L, p = 1, obligate_chiasma = FALSE)
Arguments
L
Double vector. Chromosome lengths in CentiMorgan (cM).
m
Integer. The interference parameter (m = 0 is no interference).
p
Double. Proportion of chiasmata from no-interference mechanism. (p = 0 gives
pure chi-square model)
obligate_chiasma
Logical. If TRUE, require an obligate chiasma on the 4-strand bundle at meiosis.
Only possible if all chromosomes are longer than 50 cM.
Details
If obligate_chiasma = TRUE and all chromsome are longer than 50 cM, reduced chromosome
length with be internally calculated (calc_Lstar) that will give the target expected number of
chiasmata when conditioning on there being at least one chiasma on the four-strand bundle.
This description is adopted from the simcross package.
Value
A nested list as long as the number of chromosomes with parameters used for simulating crossover
events.
Model
Chiasma locations are a superposition of two processes: a proportion p exhibiting no interference,
and a proportion (1 - p) following the chi-square model with interference parameter m. Crossover
locations are derived by thinning the chiasma locations with probability 1/2.
Simulations are under the Stahl model with the interference parameter being an integer. This is an
extension of the chi-square model, but with chiasmata being the superposition of two processes, one
following the chi-square model and the other exhibiting no interference.
create_xo_founder
7
References
Copenhaver, G. P., Housworth, E. A. and Stahl, F. W. (2002) Crossover interference in arabidopsis.
Genetics 160, 1631–1639.
Foss, E., Lande, R., Stahl, F. W. and Steinberg, C. M. (1993) Chiasma interference as a function of
genetic distance. Genetics 133, 681–691.
Zhao, H., Speed, T. P. and McPeek, M. S. (1995) Statistical analysis of crossover interference using
the chi-square model. Genetics 139, 1045–1056.
Examples
create_xoparam(L = c(50.5, 100.1, 133.5))
create_xo_founder
Create founders with crossover-data.
Description
Create founders with crossover-data.
Usage
create_xo_founder(alleles, L)
Arguments
alleles
Integer vector of length 2, giving founder alleles.
L
Double vector. Chromosome lengths in cM.
Value
A nested list. The first level refers to gametes, the second to chromosomes.
See Also
cross_xo, meiosis_xo
Examples
create_xo_founder(alleles = c(-5L, 54L), L = c(32.2, 65.3, 88.2))
8
crossover
crossover
Simulate crossover locations.
Description
Simulate crossover locations on a single meiotic product using the Stahl model.
Usage
crossover(L, m, p, obligate_chiasma, Lstar)
Arguments
L
Double. Length of the chromosome in cM.
m
Integer. The interference parameter (m = 0 is no interference).
p
Double. Proportion of chiasmata from no-interference mechanism. (p = 0 gives
pure chi-square model)
obligate_chiasma
Logical. If TRUE, require an obligate chiasma on the 4-strand bundle at meiosis.
Only possible if all chromosomes are longer than 50 cM.
Lstar
Double. Reduced chromosome length as produced by calc_Lstar.
Details
This function is an R-wrapper of an underlying C++ routine. It is not intended for direct usage, but
exposed for completeness.
Value
Double Vector. Crossover locations.
Model
Chiasma locations are a superposition of two processes: a proportion p exhibiting no interference,
and a proportion (1 - p) following the chi-square model with interference parameter m. Crossover
locations are derived by thinning the chiasma locations with probability 1/2.
Simulations are under the Stahl model with the interference parameter being an integer. This is an
extension of the chi-square model, but with chiasmata being the superposition of two processes, one
following the chi-square model and the other exhibiting no interference.
cross_geno
9
References
Copenhaver, G. P., Housworth, E. A. and Stahl, F. W. (2002) Crossover interference in arabidopsis.
Genetics 160, 1631–1639.
Foss, E., Lande, R., Stahl, F. W. and Steinberg, C. M. (1993) Chiasma interference as a function of
genetic distance. Genetics 133, 681–691.
Zhao, H., Speed, T. P. and McPeek, M. S. (1995) Statistical analysis of crossover interference using
the chi-square model. Genetics 139, 1045–1056.
Examples
Meiosis::crossover(300, 10, 0.5, FALSE, 300)
cross_geno
Cross individuals (genotypic representation)
Description
Simulation of a cross.
Usage
cross_geno(father, mother, positions, xoparam, use_names = FALSE,
check = FALSE)
Arguments
father
List. Father.
mother
List. Mother.
positions
List. Genetic positions.
xoparam
List. Crossover parameters.
use_names
Logical. Should loci names be preserved if present? Names in father supersede
the ones in mother, followed by positions.
check
Logical. Should checks be performed?
Value
List. A new individual.
Examples
data(exdat, package = 'Meiosis')
Meiosis::cross_geno(exdat$ind, exdat$ind2, exdat$positions, exdat$xoparam)
10
dh_geno
cross_xo
Cross individuals (segmental representation)
Description
Simulation of a cross.
Usage
cross_xo(father, mother, xoparam, check = FALSE)
Arguments
father
mother
xoparam
check
List. Father.
List. Mother.
List. Crossover parameters.
Logical. Should checks be performed?
Value
List. A new individual.
Examples
data(exdat, package = 'Meiosis')
Meiosis::cross_xo(exdat$founder, exdat$founder2, exdat$xoparam)
dh_geno
Produce doubled haploid (genotypic representation)
Description
Simulation of a doubled haploid.
Usage
dh_geno(individual, positions, xoparam, use_names = FALSE, check = FALSE)
Arguments
individual
positions
xoparam
use_names
check
List. Individual.
List. Genetic positions.
List. Crossover parameters.
Logical. Should loci names be preserved if present? Names in individual
supersede the ones in positions.
Logical. Should checks be performed?
dh_xo
11
Value
List. A new individual.
Examples
data(exdat, package = 'Meiosis')
Meiosis::dh_geno(exdat$ind, exdat$positions, exdat$xoparam)
dh_xo
Produce doubled haploid (segmental representation)
Description
Simulation of a doubled haploid.
Usage
dh_xo(individual, xoparam, check = FALSE)
Arguments
individual
List. Individual.
xoparam
List. Crossover parameters.
check
Logical. Should checks be performed?
Value
List. A new individual.
Examples
data(exdat, package = 'Meiosis')
Meiosis::dh_xo(exdat$founder, exdat$xoparam)
12
Meiosis
exdat
Example data
Description
Example data for illustration.
Usage
exdat
Format
A list with 6 items
xoparam List with crossover parameters (see create_xoparam)
positions Genetic positions of loci
ind Genotypic data of an individual
ind2 Genotypic data of another individual
founder Segmental data of an individual
founder2 Segmental data of another individual
For details on the data structures, see vignette('Introduction', package = 'Meiosis').
Meiosis
Meiosis: Simulation of meiosis in plant breeding research
Description
This packages provides tools for the simulation of meiosis in plant breeding research.
meiosis_geno
13
meiosis_geno
Simulate meiosis (genotypic representation)
Description
Simulation of meiosis events.
Usage
meiosis_geno(individual, positions, xoparam, use_names = FALSE,
check = FALSE)
Arguments
individual
List. Individual.
positions
List. Genetic positions.
xoparam
List. Crossover parameters.
use_names
Logical. Should loci names be preserved if present? Names in individual
supersede the ones in positions.
check
Logical. Should checks be performed?
Value
List. A new gamete.
Examples
data(exdat, package = 'Meiosis')
Meiosis::meiosis_geno(exdat$ind, exdat$positions, exdat$xoparam, TRUE, TRUE)
meiosis_xo
Simulate meiosis (segmental representation)
Description
Simulation of meiosis events.
Usage
meiosis_xo(individual, xoparam, check = FALSE)
14
realized_coancestry
Arguments
individual
List. Individual.
xoparam
List. Crossover parameters.
check
Logical. Should checks be performed?
Value
List. A new gamete.
Examples
data(exdat, package = 'Meiosis')
Meiosis::meiosis_xo(exdat$founder, exdat$xoparam)
realized_coancestry
Compute co-ancestry
Description
Compute the realized coefficient of co-ancestry between two individuals.
Usage
realized_coancestry(individual_1, individual_2 = NULL, check = FALSE)
Arguments
individual_1
List. A first Individual in segmental representation.
individual_2
List. A second Individual in segmental representation. If NULL, self-co-ancestry
of individual_1 is computed.
check
Logical. Should checks be performed?
Details
The realized coefficient of co-ancestry is (herein) defined as the probability that two alleles randomly drawn from one of the homologous chromosomes, each from one of the individuals, are
identical-by-descent (as specified by origins of founder alleles).
Value
Double. Realized coefficient of co-ancestry.
realized_heter
15
Examples
## Not run:
data(exdat, package = 'Meiosis')
Meiosis::realized_coancestry(Meiosis::dh_xo(exdat$founder, exdat$xoparam),
Meiosis::dh_xo(exdat$founder, exdat$xoparam))
## End(Not run)
realized_heter
Compute realized heterozygosity.
Description
Compute the realized heterozygosity of an individual, i.e., the proportion of the genome where
founder alleles match.
Usage
realized_heter(individual, check = FALSE)
Arguments
individual
List. Individual in segmental representation.
check
Logical. Should checks be performed?
Value
double. Realized heterozygosity.
Examples
## Not run:
data(exdat, package = 'Meiosis')
Meiosis::realized_heter(Meiosis::cross_xo(exdat$founder, exdat$founder, exdat$xoparam))
## End(Not run)
16
self_geno
seed_rng
Seed the random number generator of the C++ routines.
Description
A Mersenne Twister pseudo-random generator of 32-bit numbers with a state size of 10037 bits is
used in the underlying C++ routines.
Usage
seed_rng(seed = NULL)
Arguments
seed
Integer. If NULL, a random seed is used.
Details
The state of the random number generator used by the C++ routines is not shared with the R session
from which these routines are interfaced.
Value
Integer. The seed used.
Examples
Meiosis::seed_rng(123L)
the_seed <- Meiosis::seed_rng()
self_geno
Produce selfing (genotypic representation)
Description
Simulation of a selfing.
Usage
self_geno(individual, positions, xoparam, use_names = FALSE, check = FALSE)
self_xo
17
Arguments
individual
List. Individual.
positions
List. Genetic positions.
xoparam
List. Crossover parameters.
use_names
Logical. Should loci names be preserved if present? Names in individual
supersede the ones in positions.
check
Logical. Should checks be performed?
Value
List. A new individual.
Examples
data(exdat, package = 'Meiosis')
Meiosis::self_geno(exdat$ind, exdat$positions, exdat$xoparam)
self_xo
Produce selfing (segmental representation)
Description
Simulation of a selfing.
Usage
self_xo(individual, xoparam, check = FALSE)
Arguments
individual
List. Individual.
xoparam
List. Crossover parameters.
check
Logical. Should checks be performed?
Value
List. A new individual.
Examples
data(exdat, package = 'Meiosis')
Meiosis::self_xo(exdat$founder, exdat$xoparam)
Index
∗Topic datasets
exdat, 12
calc_Lstar, 2, 8
check_geno_individual, 3
check_positions, 3
check_xo_individual, 4
check_xoparam, 4
Converter, 5
Converter$convert, 5
Converter$insert_founder, 5
create_xo_founder, 7
create_xoparam, 6, 12
cross_geno, 9
cross_xo, 7, 10
crossover, 8
dh_geno, 10
dh_xo, 11
exdat, 12
Meiosis, 12
Meiosis-package (Meiosis), 12
meiosis_geno, 13
meiosis_xo, 7, 13
realized_coancestry, 14
realized_heter, 15
seed_rng, 16
self_geno, 16
self_xo, 17
18