pairwise_king: Compute the KING-robust Matrix for a a 'gen_tibble' object

View source: R/pairwise_king.R

pairwise_kingR Documentation

Compute the KING-robust Matrix for a a gen_tibble object

Description

This function computes the KING-robust estimator of kinship.

Usage

pairwise_king(
  x,
  as_matrix = FALSE,
  block_size = bigstatsr::block_size(nrow(x))
)

Arguments

x

a gen_tibble object.

as_matrix

boolean, determining whether the results should be a square symmetrical matrix (TRUE), or a tidied tibble (FALSE, the default)

block_size

maximum number of loci read at once. More loci should improve speed, but will tax memory.

Details

Note that monomorphic sites are currently considered. Remove monomorphic sites before running pairwise_king if this is a concern.

Value

a square symmetrical matrix of relationship coefficients between individuals if as_matrix is TRUE, or a tidied tibble of coefficients if as_matrix is FALSE.

Examples

example_gt <- load_example_gt("gen_tbl")

# Compute the KING-robust matrix
pairwise_king(example_gt, as_matrix = TRUE)

# Or return a tidy tibble
pairwise_king(example_gt, as_matrix = FALSE)

# Adjust block_size
pairwise_king(example_gt, block_size = 2)


tidypopgen documentation built on Aug. 28, 2025, 1:08 a.m.