SFS: Site Frequency Spectrum

Description Usage Arguments Details Value Examples

View source: R/SFS.R

Description

The function calculates the site frequency spectrum.

Usage

1
SFS(DNAmat)

Arguments

DNAmat

matrix; either a single-nucleotide polymorphism matrix or a segregating sites matrix. See details.

Details

The site frequency spectrum is a vector of length n-1, where n is the sample size. The i'th entry is the number of segregating sites where a mutation occur in i sequences.

The input to the function should be either a single-nucleotide polymorphism matrix or a segregating sites matrix. Either way, each row in the matrix represents a DNA sequence. The matrix should have a 1 where a mutation has occured and a 0 otherwise. If this is not the case, it will cause an error. If there exists a position on which all sequences have a mutation, it will cause a warning, and such a position will be treated as if it had no mutations.

Value

The site frequency spectrum with class 'SFS_class'.

Examples

1
SFS(matrix(c(0,1,0,1,0,0,0,0,0),nrow=3))

aumath-advancedr2019/simDNA documentation built on Nov. 27, 2019, 11 a.m.