The function calculates the SNP matrix.

SNP(segSites)

Arguments

segSites

segregating sites matrix. See details.

Value

List containing the following components:

positions

the positions on which one or more mutations occurred.

SNPmat

the single-nucleotide polymorphism matrix with class 'DNAmat_class'.

Details

In the segregating sites matrix, each row is a DNA sequence represented by zeros and ones, where 1 indicates that a mutation has occurred, 0 that no mutations have occurred. If the segSites matrix contains anything other than zeros and ones, it will cause an error.

The SNP matrix extracts the columns from the segregating sites matrix where one or more mutations have happened, and thus it is a more compact representation than the segregating sites matrix.

Examples

SNP(matrix(c(0,0,0,1,0,0,0,0,1),nrow=3))
#> $positions #> [1] 2 3 #> #> $SNPmat #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 0 #> [3,] 0 1 #>