Description Usage Arguments Value Examples
Creates an allele count matrix used on other analysis. The structure
encapsulates the allele count and number of individual with variant as rows
and groups as columns. It allows subsetting ([]
), to check dimensions
(with dim
, nrow
, and ncol
), and renaming them.
1 2 3 | allele_count(count, n)
allele_count_from_genotype(genotype, groups = NULL)
|
count |
Matrix giving the number of alternative (or mutant) alleles with variants as rows and samples as columns. |
n |
Matrix giving the total number of alleles observed with variants as rows and samples as columns. |
genotype |
Sample genotype matrix with the variants as rows and samples
as column in the format |
groups |
List of sample vector or a single vector of groups used to compute the allele count. When is NULL (default value) it considers all samples as a single group, when is either a vector it considers only the corresponding samples, and when is a list it computes the allele count for each sub-vector. |
Allele count matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ac <- allele_count(matrix(0:5, ncol = 2), matrix(rep(6, 6), ncol = 2))
print(ac[1:2, ]) # allows subsetting
nrow(ac) # number of variants
rownames(ac) # variants identifier
ncol(ac) # number of groups
colnames(ac) # groups names
## From genotype matrix
geno_sample <- matrix(sample(0:2, 100, replace = TRUE), ncol = 10)
ac_matrix_from_genotype(geno_sample) ## all samples
ac_matrix_from_genotype(geno_sample, 1:5) ## only the first 5
## for three groups
ac_matrix_from_genotype(
geno_sample,
list(a = 1:5, b = 3:7, c = 6:10))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.