Skip to contents

Iterative greedy algorithm that removes related individuals exceeding a kinship threshold. First reduces large connected components via graph-based pruning (removing highest-degree nodes), then applies plinkQC::relatednessFilter iteratively until no related pairs remain.

Usage

filterRelatedness(
  relatedness,
  relatednessThreshold = 0.0625,
  analysisType = c("maximize_unrelated", "maximize_cases"),
  relatednessIid1 = "IID1",
  relatednessIid2 = "IID2",
  relatednessFid1 = NULL,
  relatednessFid2 = NULL,
  relatednessValue = "PI_HAT",
  phenoData = NULL,
  phenoCol = "pheno",
  otherCriterion = NULL,
  otherCriterionThreshold = NULL,
  otherCriterionDirection = "ge",
  otherCriterionIid = "IID",
  otherCriterionMeasure = NULL,
  maxComponentSize = 20L,
  reduceFraction = 0.05,
  maxIterations = 20L,
  verbose = FALSE
)

Arguments

relatedness

A data.frame of pairwise relatedness estimates (e.g. KING .kin0 output). Must contain columns for IID1, IID2, and relatedness value.

relatednessThreshold

Kinship threshold above which individuals are considered related (default 0.0625, i.e. 2nd degree).

analysisType

One of "maximize_unrelated" (default) or "maximize_cases". The latter preserves cases in case-control studies.

relatednessIid1

Column name for first individual ID (default "IID1").

relatednessIid2

Column name for second individual ID (default "IID2").

relatednessFid1

Column name for first family ID (default NULL).

relatednessFid2

Column name for second family ID (default NULL).

relatednessValue

Column name for the relatedness measure (default "PI_HAT").

phenoData

A data.frame with columns IID and the column named by phenoCol. Required when analysisType = "maximize_cases".

phenoCol

Column name for the phenotype (default "pheno"). Expected to be binary (1 = case, 0 = control).

otherCriterion

Optional data.frame with additional filtering criteria (passed to plinkQC::relatednessFilter).

otherCriterionThreshold

Threshold for additional criterion.

otherCriterionDirection

Direction for threshold comparison (default "ge").

otherCriterionIid

Column name for individual ID in criterion data (default "IID").

otherCriterionMeasure

Column name for the criterion measure.

maxComponentSize

Maximum component size before graph-based pre-pruning (default 20).

reduceFraction

Fraction of highest-degree nodes to remove per iteration during pre-pruning (default 0.05).

maxIterations

Maximum plinkQC iterations for resolving remaining related pairs (default 20).

verbose

Logical, print progress messages (default FALSE).

Value

A character vector of individual IDs to exclude.