Learn R Programming

MasterBayes (version 2.58)

legalG: Legal Genotype Configurations

Description

A function for checking whether a set of genotypes have a positive probability given the pedigree. If not, a legal configuration is found using heuristic methods. Missing genotypes are also replaced with compatible genotypes.

Usage

legalG(G, A, ped, time_born=NULL, marker.type="MSW")

Arguments

G

list of genotype objects

A

list of allele frequencies

ped

pedigree with id in the first column, dam in the second, and sire in the third. The genotypes must be in the same order as the id column

time_born

an optional vector for ordering a pedigree more efficiently (see orderPed)

marker.type

"MSW" or "MSC" for co-dominant markers with Wang's (2004) model of genotyping error or CERVUS's model of genotyping error (Kalinowski, 2006; Marshall, 1998) or "AFLP" for dominant markers (Hadfield, 2009).

Value

G

a list of genotype objects with positive likelihood given the pedigree

legal

logical; TRUE if the the genotype configuration passed to legalG had a positive likelihood

References

Marshall, T. C. et al (1998) Molecular Ecology 7 5 639-655 Kalinowski S.T. et al (2007) Molecular Ecology 16 5 1099-1106 Hadfield J. D. et al (2009) in prep

See Also

MCMCped

Examples

Run this code
# NOT RUN {
data(WarblerG)
A<-extractA(WarblerG[,16:17])

pedigree<-matrix(NA, 8,3)
pedigree[,1]<-1:8
pedigree[,2][5:8]<-c(1,1,2,2)
pedigree[,3][5:8]<-c(3,3,4,4)

G<-simgenotypes(A, E1=0, E2=0.3, ped=pedigree, no_dup=1)

newG<-legalG(G=G$Gobs,A=A,ped=pedigree)
newG$valid

# The input genotypes had a zero probability given the pedigree 
# (because of genotype error) but the output genotypes have 
# positive probability

legalG(newG$G,A,pedigree)$valid
# }

Run the code above in your browser using DataLab