Converts a SNPDataLong object to a data.frame, runs PCA, and performs anticlustering on the selected principal components.
runAnticlusteringPCA(object, K = 2, n_pcs = 20, center = TRUE, scale = TRUE)An object of class SNPDataLong.
Number of groups for anticlustering, or a vector of group sizes (as in anticlust).
Number of top principal components to use. If < 1,
it is interpreted as the proportion of variance to be explained (e.g.,
0.8 means PCs explaining at least 80% variance).
Logical or numeric. Passed to scale via
genoToDF. If TRUE, center columns; if numeric, a vector of
column means. Default: TRUE.
Logical or numeric. Passed to scale via
genoToDF. If TRUE, scale to unit variance; if numeric,
a vector of column sds. Default: TRUE.
A list with components:
Integer vector with anticlustering group assignments.
The PCA result object (from stats::prcomp).
Numeric matrix of the PCs used for anticlustering.
if (FALSE) { # requireNamespace("anticlust", quietly = TRUE) && exists("nelore_imputed")
res <- runAnticlusteringPCA(nelore_imputed, K = 2, n_pcs = 0.8)
table(res$groups)
}