legalG              package:MasterBayes              R Documentation

_L_e_g_a_l _G_e_n_o_t_y_p_e _C_o_n_f_i_g_u_r_a_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       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

_V_a_l_u_e:

       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

_A_u_t_h_o_r(_s):

     Jarrod Hadfield j.hadfield@sheffield.ac.uk

_S_e_e _A_l_s_o:

     'MCMCped'

_E_x_a_m_p_l_e_s:

     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

