genos2freqs | R Documentation |
Parses a data table of genotypes and returns a matrix of allele frequencies.
genos2freqs(
dat,
popCol = "POP",
sampCol = "SAMPLE",
locusCol = "LOCUS",
genoCol = "GT",
returnMat = TRUE
)
dat |
Data table: It is expected that there are only two alleles, and therefore, only three possible genotypes: 0/0, 0/1 (or 1/0), and 1/1, where the Ref allele is '0'. This data.table needs the following columns:
|
popCol |
Character: The column name with the sampled individual information. Default = |
sampCol |
Character: The column name with the sampled individual information. Default = |
locusCol |
Character: The column name with the locus information. Default = |
genoCol |
Character: The column name with the genotype information. Default = |
returnMat |
Logical: Should an allele frequency matrix be returned?
Default = |
Returns a matrix of allele frequencies for the Alt allele, or
a data table with the columns $POP
, $SAMPLE
, $LOCUS
and $FREQ
.
library(genomalicious)
# Import genotype data
data(data_Genos)
data_Genos
# Convert to frequency matrix
freqMat <- genos2freqs(data_Genos)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.