Learn R Programming

GENLIB (version 1.1.10)

gen.findMRCA: Finding most recent common ancestors, MRCAs

Description

Returns MRCAs of pairs of specified individuals and the distance (number of meioses) between individuals through the MRCAs.

Usage

gen.findMRCA(gen, individuals, NbProcess=parallel::detectCores()-1)

Value

returns a matrix

Arguments

gen

An object of class GLgen obtained with gen.genealogy, gen.lineages or gen.branching. Required.

individuals

Vector of individual id numbers for which to find the MRCAs. Required

NbProcess

Number of processes to use when running this function. Default=parallel::detectCores()-1

See Also

gen.genealogy gen.founder gen.findFounders gen.findDistance gen.find.Min.Distance.MRCA

Examples

Run this code
data(geneaJi)
genJi<-gen.genealogy(geneaJi)
gen.findMRCA(genJi, individuals=c(1,29), NbProcess = 1)

# \donttest{
 # For a more complex example:
 data(genea140) 
 gen140<-gen.genealogy(genea140) 
 all_commonFounders<-gen.findFounders(gen140, individuals=c(409033,408728), NbProcess = 1)
 # 127 founders common to #409033 and #408728
 length(all_commonFounders)
 # 22 most recent common ancestors for #409033 and #408728
 MRCA_2ind<-gen.findMRCA(gen140, individuals=c(409033,408728), NbProcess = 1)
# }

Run the code above in your browser using DataLab