gen.findMRCA: Finding most recent common ancestors, MRCAs

View source: R/fonctionsPAR.R

gen.findMRCAR Documentation

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)

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

Value

returns a matrix

Note

This function uses the parallel programming functions of foreach, snow and doSNOW for launching several processes.

See Also

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

Examples

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


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


GENLIB documentation built on Jan. 17, 2023, 5:16 p.m.

Related to gen.findMRCA in GENLIB...