rdm_IBD: Calculates Isolation by Distance (IBD) residuals for each...

View source: R/rdm_IBD_v8_TF.R

rdm_IBDR Documentation

Calculates Isolation by Distance (IBD) residuals for each pair of individuals in a population

Description

rdm_IBD: Reads genotype data for individuals in a population together with the geographic coordinates of the individuals, models overall IBD trend for the population, and then calculates IBD residuals for each pair of individuals.

Usage

rdm_IBD(Gen_raw, Geo_raw, Dist_method = 1, IBD_method = 1)

Arguments

Gen_raw

A string specifying the path to a file of genotype data in GENEPOP format, with alleles specified using three digits. The GENEPOP file must have the extension .gen.

Geo_raw

A string specifying the path to a text file showing the name (1st column) and geographical x and y coordinates (2nd and 3rd columns) of each individual (each row). The first row needs to specify the column headings, and all entries need to be tab-delimited.

Dist_method

An integer from 1 to 6 specifying the method used to calculate genetic distance among individuals. Integers 1 to 6 correspond to the methods incorporated into the following six functions from the poppr R package, respectively: diss.dist, nei.dist, rogers.dist, reynolds.dist, edwards.dist, and provesti.dist. The default value is 1.

IBD_method

An integer specifying the method used to calculate the IBD residual for each pair of individuals. A value of 1 means that the residuals are calculated by fitting a straight line to all pairs of genetic and geographic distances, and measuring the vertical distance from each pair to the fitted line. The fitted straight line represents the combinations of genetic and geographic distances that are expected from IBD. A value of 2 means that a non-linear curve of the form y = a + b*(1-exp(-exp(c)*x)) is fitted instead of a straight line, where a, b and c are the fitted parameters. The default value is 1. The function rdm_IBD automatically plots the data points together with the fitted line or curve.

Value

An object of class dist, containing a matrix showing the IBD residuals for pairs of individuals.

Examples

rdm_IBD("files/genotypes.gen", "files/coordinates.txt")

takfung/ResDisMapper documentation built on Jan. 27, 2024, 8:36 a.m.