View source: R/allele_counts.R
allele_counts | R Documentation |
Calculate allele counts
allele_counts(dat, biallelic = TRUE)
dat |
Character/Integer: A vector of genotypes. If the class
is |
biallelic |
Logical: Is the data biallelic? Affects processing and output (see also "Value" section). |
A vector of alleles counts. If biallelic==TRUE
, returns
vector with names 'ref'
and 'alt'
. If biallelic==FALSE
,
returns a vector with names as alleles.
library(genomalicious)
# Genotypes as separated alleles, biallelic
allele_counts(c('1/1', '0/1', '0/1', '0/0', '0/0'))
# Genotypes as separated alleles, not biallelic
allele_counts(c('1/1', '2/3', '1/3', '0/0', '2/2'), biallelic=FALSE)
# Genotypes as counts of the Alt allele
allele_counts(c(2, 1, 1, 0, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.