legalG {MasterBayes} | R Documentation

## 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="MS", ...)

### 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 `order.ped`)
`marker.type` | "MS" or "AFLP" for codominant or dominant markers respectively
`...` | further arguments to be passed

### 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

### Author(s)

Jarrod Hadfield j.hadfield@sheffield.ac.uk

### See Also

`MCMCped`

### Examples

    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, pedigree=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 outout genotypes have
    # positive probability

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

[Package MasterBayes version 2.0 Index]