genetic_relatedness: Estimates pair-wise relatedness

Description Usage Arguments Value Note Examples

View source: R/genetic_relatedness.R

Description

This function returns single relatedness estimates as a pairwise matrix.

Usage

1
2
3
4
5
6
genetic_relatedness(
  x,
  loci = NA,
  mode = c("Nason", "LynchRitland")[1],
  freqs = NA
)

Arguments

x

A data.frame that has locus columns.

loci

The loci to use (if missing all loci are used).

mode

The kind of relatedness to be estimated. Currently Fij (the default) and LynchRitland are available.

freqs

An optional data.frame (as returned by the function frequencies() with allele frequencies). If this is not provided, it will be estimated from all the data. This allows you to estimate relatedness among subsets of individuals using more global measures of relatedness.

Value

A matrix of pairwise relatedness estimates.

Note

This only works on diploid data and will return NA for any comparison of missing genotypes.

Examples

1
2
3
loci <- c( locus(1:2), locus(c(2,2)), locus(1:2) )
genetic_relatedness( loci )
genetic_relatedness( loci, freqs = data.frame( Allele=c("1","2"), Frequency=c(0.5,0.5)))

MarianaLag/Mlag documentation built on Feb. 13, 2020, 12:30 a.m.