Run ADMIXTURE from R
gt_admixture.Rd
This function runs ADMIXTURE, taking either a gen_tibble
or a file as an input.
This is a wrapper that runs ADMIXTURE from the command line, and reads the output
into R. It can run multiple values of k
and multiple repeats for each k
.
Usage
gt_admixture(
x,
k,
n_runs = 1,
crossval = FALSE,
n_cores = 1,
seed = NULL,
conda_env = "none"
)
Arguments
- x
a
gen_tibble
or a character giving the path of the input PLINK bed file- k
an integer giving the number of clusters
- n_runs
the number of runs for each k value (defaults to 1)
- crossval
boolean, should cross validation be used to assess the fit (defaults ot FALSE)
- n_cores
number of cores (defaults to 1)
- seed
the seed for the random number generator (defaults to NULL)
- conda_env
the name of the conda environment to use. "none" forces the use of a local copy, whilst any other string will direct the function to use a custom conda environment.
Value
an object of class gt_admix
consisting of a list with the following elements:
k
the number of clustersQ
a matrix with the admixture proportionsP
a matrix with the allele frequencieslog
a log of the output generated by ADMIXTURE (usually printed on the screen when running from the command line)cv
the cross validation error (ifcrossval
is TRUE)loglik
the log likelihood of the modelid
the id column of the inputgen_tibble
(if applicable)group
the group column of the inputgen_tibble
(if applicable)