as.mutation.matrix: Conversion of ten-state sequencing matrix to 0/1-mutation...

Description Usage Arguments Value Examples

View source: R/scelestial.R

Description

Conversion of ten-state sequencing matrix to 0/1-mutation matrix.

Usage

1

Arguments

seq

A dataframe representing the ten-state sequencing matrix. Elements of the matrix are the from "X/Y" for X and Y being nucleotides or "./." for missing value. Rows represent loci and columns represent samples.

Value

A data frame with exactly the same size as the input seq matrix. The most abundant state in each loci (row) translated to 0, and the others are translated to 1. Missing values are translated to 3.

Examples

1
2
3
4
5
6
7
## A small 10-state matrix
seq = data.frame("C1" = c("C/C", "C/C"), "C2" = c("A/A", NA), "C3" = c("C/C", "A/A"))
## Convert it to mutation matrix
as.mutation.matrix(seq)
#   C1 C2 C3
# 1  0  1  0
# 2  1  3  0

RScelestial documentation built on Dec. 11, 2021, 10:02 a.m.