augment_loci: Augment the loci table with information from a analysis...

View source: R/augment_loci.R

augment_lociR Documentation

Augment the loci table with information from a analysis object

Description

augment_loci add columns to the loci table of a gen_tibble related to information from a given analysis.

Usage

augment_loci(x, data, ...)

Arguments

x

An object returned by one of the gt_ functions (e.g. gt_pca()).

data

the gen_tibble used to run the PCA.

...

Additional parameters passed to the individual methods.

Value

A loci tibble with additional columns. If data is missing, a tibble of the information, with a column .rownames giving the loci names.

Examples

# Create a gen_tibble of lobster genotypes
bed_file <-
  system.file("extdata", "lobster", "lobster.bed", package = "tidypopgen")
lobsters <- gen_tibble(bed_file,
  backingfile = tempfile("lobsters"),
  quiet = TRUE
)

# Remove monomorphic loci and impute
lobsters <- lobsters %>% select_loci_if(loci_maf(genotypes) > 0)
lobsters <- gt_impute_simple(lobsters, method = "mode")

# Create PCA
pca <- gt_pca_partialSVD(lobsters)

# Augment the gen_tibble with the PCA scores
augment_loci(pca, data = lobsters)


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