rdm_residual: Creates and plots IBD residuals for pairs of individuals in a...

View source: R/rdm_residual_v11_TF_TQ.R

rdm_residualR Documentation

Creates and plots IBD residuals for pairs of individuals in a population, represented as line segments over a defined landscape

Description

rdm_residual: Reads the IBD residuals for each pair of individuals in a population (as calculated by function rdm_IBD) together with their geographic coordinates, and then creates a 3-D graph showing the residuals for each pair of individuals, represented as a line segment over the landscape considered. The 3-D graph can be rotated to obtain a better view.

Usage

rdm_residual(IBD.res, Geo_raw, min.dist = 1, max.dist = Inf,
  n_resolution = 50, proj = sp::CRS("+init=epsg:4326"))

Arguments

IBD.res

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

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.

min.dist

IBD residuals are only calculated for pairs of individuals that are separated by a distance greater than min.dist. The default value is 1.

max.dist

IBD residuals are only calculated for pairs of individuals that are separated by a distance less than max.dist. The default value is Inf.

n_resolution

Specifies the number of cells that the landscape is divided into, for the purposes of creating the 3-D plot. The landscape is divided into n_resolution cells along both coordinate axes. Individuals that appear in the same cell are represented by a single point on the plot. The default value is 50.

proj

The coordinate system that is used for plotting. The default is EPSG 4326.

Value

An object of class SpatialLinesDataFrame, containing coordinates of the line segments joining each pair of individuals and the corresponding IBD residuals.

Examples

IBD_res <- rdm_IBD("files/genotypes.gen", "files/coordinates.txt")
rdm_residual(IBD_res, "files/coordinates.txt")

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