| MakeCounts | R Documentation |
MakeCounts creates a matrix of genotype counts, with one row for
each bi-allelic marker, containing 4 columns with the counts AA, AB, BB
and NA (missings) respectively
MakeCounts(X, alleles, pos1 = 1, pos2 = 3, coding = c(AA=0,AB=1,BB=2), sep = "")
X |
A matrix or dataframe with bi-allelic genotyping information, markers in columns, individuals in rows |
alleles |
a vector of alleles for each marker
(e.g. c("A/T","A/G",...)). Only relevanit if |
pos1 |
position of the first allele in the allele string (1 by default) |
pos2 |
position of the second allele in the allele string (3 by default) |
coding |
indicates how homozygotes and heterozygote are coded as
numbers. Only relevant if |
sep |
allele separator character for genotype data in text format ("" for AA; "/" for "A/A") |
MakeCounts is thought for bi-allelic marker data only. Missings
are should be coded by NA. It produces the right input for
HWTernaryPlot.
Heterozygotes may be coded in the data as "AB" or "BA". Both entries will be counted as a heterozygote.
A matrix of 4 columns
Jan Graffelman jan.graffelman@upc.edu
HWTernaryPlot
SNP1 <- c("GG","GG","GG","GG","GG","GG","GG","GG","GG")
SNP2 <- c("CG","GG","CC","GG","GG","CG","CG","CG","CG")
SNP3 <- c("AA","AA","AA","AG","AA","AG","AA","AA","AA")
SNP4 <- c("GG","GG","GG","GG","GG","GG","GG","GG","GG")
SNP5 <- c("CC","CC","CC","CC","CC","CC","CT","CT","CT")
X <- cbind(SNP1,SNP2,SNP3,SNP4,SNP5)
Y <- MakeCounts(X,c("A/G","C/G","A/G","A/G","C/T"))
print(Y)
W <- matrix(sample(c(0,1,2,NA),100,replace=TRUE),ncol=5)
Z <- MakeCounts(W,coding=c(0,1,2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.