Skip to contents

The output of this function is suitable for analysis in fastsimcoal2 or dada.


  n.invariant.tags = 0,
  outfile_root = "gl2sfs",
  outpath = tempdir(),
  verbose = NULL



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


Number of invariant sites[default 0].


The root of the name of the output file [default "gl2sfs"].


Path where to save the output file [default tempdir()].


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


Deprecated. Please use gl.sfs instead.


It saves a derived sfs, assuming that the reference allele is the ancestral, and a MAF sfs.

At this stage this function caters only for diploid organisms, for samples from one population only, and for genotypes without missing data. Note that sfs uses frequencies considered independent, data are assumed to be from independent (i.e. not linked) loci. This means that only one site per tag should be considered 9i.e. secondaries should be removed). If no monomorphic site estimates is provided (with n.invariant.tags), the sfs will only include the number of monomorphic sites in the data (but this will be a biased estimates as it doesn't take into account the invariant tags that have not been included. This will affect parameter estimates in the analyses). Note that the number of invariant tags can be estimated with In a limited number of cases, ascertainment bias can be explicitly modelled in fastsimcoal2. See fastsimcoal2 manual for details.

It expects a dartR formatted genlight object, but it should also work with other genlight objects.


Excoffier L., Dupanloup I., Huerta-Sánchez E., Sousa V. C. and Foll M. (2013) Robust demographic inference from genomic and SNP data. PLoS genetics 9(10)


Custodian: Carlo Pacioni (Post to