gl.run.snmf: Creates an input file for the function snmf (package LEA) and...

View source: R/gl.run.snmf.r

gl.run.snmfR Documentation

Creates an input file for the function snmf (package LEA) and runs it if package LEA is installed.

Description

Refer to the documentation of function snmf (package LEA) for further information of the function and its parameters.

Usage

gl.run.snmf(
  x,
  filename = "output",
  minK = 1,
  maxK = 2,
  rep = 1,
  regularization = 10,
  ploidy_lv = 2,
  ncores = 1,
  cleanup = TRUE,
  plot.out = TRUE,
  plot.dir = NULL,
  plot.file = NULL,
  verbose = NULL,
  ...
)

Arguments

x

Name of the genlight object containing the SNP data [required].

filename

File name of output data [default "output"].

minK

Minimum K [default 1].

maxK

Maximum K [default 2].

rep

Number of replicates runs per K [default 1].

regularization

Alpha value for regularization when analyzing small dataset [default 10].

ploidy_lv

Ploidy level of dataset [default 2].

ncores

How many cores should be used [default 1].

cleanup

Clean data in tmp [default TRUE].

plot.out

Specify if plot is to be produced [default TRUE].

plot.dir

Directory in which to save files [default = working directory].

plot.file

Name for the RDS binary file to save (base name only, exclude extension) [default NULL].

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity].

...

Parameters passed to function snmf (package LEA).

Value

The file list of best run, plot of cross-entropy across different number of K and Q matrices,

Author(s)

Custodian: Ching Ching Lau – Post to https://groups.google.com/d/forum/dartr

References

  • Frichot E, Mathieu F, Trouillon T, Bouchard G, Francois O. (2014). Fast and Efficient Estimation of Individual Ancestry Coefficients. Genetics, 194(4): 973–983.

Examples

## Not run: 
m <- gl.run.snmf(x = bandicoot.gl, minK = 1, maxK = 5, rep = 10)
Q <- gl.plot.snmf(snmf_result = m, plot.K = 3, ind_name = TRUE)
gl.map.snmf(bandicoot.gl, qmat = Q)
# move population 4 (out of 5) 0.5 degrees to the right and populations 1
# 0.3 degree to the north of the map.
mp <- data.frame(lon = c(0,0,0,0.5,0), lat = c(-0.3,0,0,0,0))
gl.map.snmf(bandicoot.gl, qmat = Q, movepops = mp)

## End(Not run)

dartR.popgen documentation built on March 16, 2026, 9:07 a.m.