gt_pcadapt | R Documentation |
gen_tibble
objectpcadapt is an algorithm that detects genetic markers under selection. It is
based on the principal component analysis (PCA) of the genotypes of the
individuals. The method is described in Luu et al. (2017). See the R package
pcadapt
, which provides extensive documentation and examples.
gt_pcadapt(x, pca, k, n_cores = 1)
x |
A |
pca |
a |
k |
Number of principal components to use in the analysis. |
n_cores |
Number of cores to use. |
Internally, this function uses the snp_pcadapt
function from the bigsnpr
package.
An object of subclass gt_pcadapt
, a subclass of mhtest
.
Luu, K., Bazin, E., Blum, M. G. B., & François, O. (2017). pcadapt: an R package for genome scans for selection based on principal component analysis. Molecular Ecology Resources, 17(1), 67–77.
# 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 object
pca <- gt_pca_partialSVD(lobsters)
# Create a gt_pcadapt object
gt_pcadapt(lobsters, pca, k = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.