tidy_recomb_map_inds: Tidy recombination block data inherited in individuals from...

View source: R/tidy_recomb_map_inds.R

tidy_recomb_map_indsR Documentation

Tidy recombination block data inherited in individuals from founders

Description

This function takes a compact structure of nested lists and tables describing the founder blocks of identity by descent (IBD) inherited in a pedigree with recombination, and outputs the same data organized as a single table following tidy conventions, which is easy to manipulate externally although it is also larger and more redundant.

Usage

tidy_recomb_map_inds(inds)

Arguments

inds

The output value from recomb_map_inds. In particular, a list of named individuals, each of which is a list with two parents labeled "pat" and "mat", each of which is a list of chromosomes identified by index, each of which is a table with one row per IBD block, and at least two columns, labeled "anc" is the label of the founder individual from which this block was derived, and "pos" which is the end coordinate in basepairs of the block (the start of the block is given implicitly by the "pos" of the previous row plus 1, or 1 for the first block).

Value

A table with one row per IBD block, and the following columns: "ind" containing the label of the individual as given in the input object, "parent" equal to either "pat" or "mat", "chr" the chromosome, "start" and "end" the range of the block in basepairs, and "anc" the label of the founder individual.

See Also

recomb_map_inds()

Examples

# simulate the ancestors of one person to 3 generations
obj <- fam_ancestors( 3 )
fam <- obj$fam
ids <- obj$ids
# initialize founders
founders <- recomb_init_founders( ids[[ 1 ]], recomb_map_hg38 )
# draw recombination breaks along pedigree, with coordinates in genetic distance (centiMorgans),
# with information for last generation only
inds <- recomb_last_gen( founders, fam, ids )
# map recombination break coordinates to base pairs
inds <- recomb_map_inds( inds, recomb_map_hg38 )

# now that the input structure is ready, this function returns a tidy table version!
inds_tidy <- tidy_recomb_map_inds( inds )


OchoaLab/simfam documentation built on Jan. 11, 2025, 12:23 a.m.