compute$kinship

Compute Sample Kinship Matrix

Description

Estimates the genetic relatedness (kinship) between all pairs of samples in a PolyGeniusData object. It extracts allele dosages for a defined set of variants and calls PLINK’s kinship routine to produce a sample-by-sample kinship coefficient matrix.

Usage

`compute$kinship`(data, variants = NULL)

Arguments

data

A PolyGeniusData object.

variants

(Optional) Specification of which genetic markers to use when constructing the sample × variant dosage matrix for kinship estimation. You may supply:

  • A path to a BED1‐style text file (tab-delimited rows of chr, start, end).

  • An in-memory data.frame (or tibble) with columns chr, start, and end.

If NULL (the default), the common20k variant space is resolved via workspace$catalogs$variantSpaces.

Value

Invisibly returns the original data object, with the computed kinship matrix saved to data$obsp[[key]].