create.probability.matrix: Create probability matrix

Description Usage Arguments Value Examples

View source: R/create.probability.matrix.R

Description

Function giving the probability of each gamete type for each parental genotype.

Usage

1
create.probability.matrix(genotype.index, List_gene, r=0.5, List_mu)

Arguments

genotype.index

The output of the function genotype.index.multilocus, giving the index (order) of each genotype in the simulation.

List_gene

A vector of length g (number of loci), giving the number of alleles at each locus.

r

Parameter defining the recombination probability in simulations with two loci. r can take values between 0 and 0.5, with r=0.5 (default) for two unlinked loci and 0<r<0.5 for linked loci. With more than two loci, loci are considered unlinked.

List_mu

A vector giving the mutation probability of one allele into an other existing allele for each locus

Value

A square symmetric matrix whose [i,j] element gives the probability of having a gamete of type i knowing that the parent is of genotype j.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# With two loci with two alleles each; linked loci
# There are 4 possible gametes: A1B1, A2B1, A1B2, A2B2
# There are 10 possible genotypes:
# A1B1/A1B1, A1B1/A2B1, A1B1/A1B2, A1B1/A2B2,
#            A2B1/A2B1, A2B1/A1B2, A2B1/A2B2,
#                       A1B2/A1B2, A1B2/A2B2,
#                                  A2B2/A2B2
List_gene <- c(2,2)
genotype.index <- genotype.index.multilocus(List_gene)
List_mu <- c(1e-06,1e-06)
r <- 0.2 
create.probability.matrix(genotype.index, List_gene, r, List_mu)

# With 4 loci of respectively 2,3,2 and 5 alleles
List_gene <- c(2,3,2,5)
genotype.index <- genotype.index.multilocus(List_gene)
List_mu <- c(1e-06,1e-06)
create.probability.matrix(genotype.index, List_gene, List_mu=List_mu)

MarcoAndrello/MetaPopGen_0.0.8 documentation built on May 25, 2019, 12:23 p.m.