strataG (version 2.4.905)

sfs: Site Frequency Spectrum

Description

Calculate the SFS from a data frame of SNP genotypes

Usage

sfs(
  x,
  strata.col = 2,
  locus.col = 3,
  fsc.dimnames = TRUE,
  sort.strata = TRUE,
  na.action = c("fail", "filter")
)

Arguments

x

a data frame of SNP genotypes where the first two columns are id and strata designations and SNPs start on the third column. SNP genotypes are coded as integers where 0 and 2 are the major and minor homozygotes and 1 is the heterozygote.

strata.col

column number that strata designations are in.

locus.col

column number that loci start in. All columns after this are assumed to be loci.

fsc.dimnames

format matrix dimnames for fastsimcoal2? If TRUE, then row and column names will be prefixed with the deme number (e.g., "d0_") that they represent.

sort.strata

if joint = TRUE, are strata to be sorted alphabetically? If FALSE then strata are taken in the order found in strata.col.

na.action

action to take if genotypes are missing for some samples. If "fail", an error is thrown if any genotypes are missing. If "filter", SNPs with missing genotypes are removed.

Value

A list of the marginal (1D) and joint (2D) site frequency spectra. If only one stratum is present, then $marginal will be NULL.