R/PE.R

PE = function(pedigrees, datamatrix, loci, claim=1, true=2, 
              available = NULL, file= NULL, ignore = FALSE){
  if(ignore){
    for (i in 1:length(loci)){
      alleles = names(loci[[i]]$alleles)
      n=length(alleles)
      M = diag(length(loci[[1]]$alleles))
      loci[[i]]$maleMutationMatrix = M
      loci[[i]]$femaleMutationMatrix = M
  }
}
  x = Familias2linkdat(pedigrees, datamatrix, loci) 
  target.num = if(is.character(available)) label2num(available,pedigrees) else available
  PEall = sapply(1:length(loci), function(i) exclusionPower(ped_claim=x[[claim]],
                  ped_true=x[[true]], ids=target.num, markerindex=i, plot=FALSE)) 
  
  PEcombined = 1- prod(1-PEall)
  PES = c(PEall, PEcombined )
  nn = unlist(c(lapply(loci, function(x) x$locusname), "Combined"))
  PES = data.frame(marker=nn, PE=PES) 
  if(!is.null(file)) {
    write.table(PES, file=file, quote=FALSE, row.names=FALSE)
  }
  PES
}

Try the fam2r package in your browser

Any scripts or data that you put into this service are public.

fam2r documentation built on May 2, 2019, 1:09 p.m.