R: Create genotype counts from bi-allelic marker data
MakeCounts
R Documentation
Create genotype counts from bi-allelic marker data
Description
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
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))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HardyWeinberg)
Loading required package: mice
Loading required package: Rcpp
mice 2.25 2015-11-09
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HardyWeinberg/MakeCounts.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MakeCounts
> ### Title: Create genotype counts from bi-allelic marker data
> ### Aliases: MakeCounts
> ### Keywords: misc
>
> ### ** Examples
>
> 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)
AA AB BB NA
[1,] 0 0 9 0
[2,] 1 5 3 0
[3,] 7 2 0 0
[4,] 0 0 9 0
[5,] 6 3 0 0
> W <- matrix(sample(c(0,1,2,NA),100,replace=TRUE),ncol=5)
> Z <- MakeCounts(W,coding=c(0,1,2))
>
>
>
>
>
> dev.off()
null device
1
>