Performs LD pruning using one of two backends. The default "hclust"
backend groups the columns as single-linkage hierarchical clustering on the
distance (1 - |cor|), cut at 1 - corThres, would, and keeps the
first column of each group. Those groups are the connected components
of the graph joining columns with |cor| >= corThres, found from the
correlations a stripe of rows at a time, so the full correlation matrix is
never formed. The "snprelate" backend delegates
to SNPRelate::snpgdsLDpruning, which performs a sliding-window greedy
prune directly on a temporary GDS file.
Usage
ldPruneByCorrelation(
X,
corThres = 0.8,
backend = c("hclust", "snprelate"),
verbose = FALSE,
methodArgs = LdPruningOptions()
)Arguments
- X
Numeric matrix. Columns are the variables to prune (typically SNP genotype dosages); rows are observations.
- corThres
Numeric in (0, 1). Absolute correlation threshold. Columns whose pairwise |cor| exceeds this are grouped; one survivor is kept per group. Default 0.8.
- backend
Character, one of
"hclust"(default) or"snprelate". Controls the pruning algorithm:"hclust"Single-linkage groups, found as the connected components of the |cor| >=
corThresgraph."snprelate"Requires SNPRelate and gdsfmt. Creates a temporary GDS file and runs
SNPRelate::snpgdsLDpruning(method = "corr"). GDS stores genotypes as the integer codes 0, 1 and 2, so fractional dosages are refused rather than rounded.
- verbose
Logical. If TRUE, print progress messages. Default FALSE.
- methodArgs
Extra arguments for
SNPRelate::snpgdsLDpruning(), built withLdPruningOptions– the window controls in particular. Only the"snprelate"backend has an engine to configure, so supplying options alongsidebackend = "hclust"is an error rather than a silent no-op.