alleleSplit | R Documentation |
Split loci stored in one column to two columns for each allele in a matrix of diploid data.
alleleSplit(x, sep = NULL)
x |
a matrix or data.frame containing diploid data. Every column represents one locus with two alleles. |
sep |
separator used between alleles of a locus. If |
matrix with alleles for each locus in one column split into separate columns.
Eric Archer eric.archer@noaa.gov
# A sample SNP data set with no separators between nucleotides in a genotype snps <- do.call(cbind, lapply(1:3, function(i) { a1 <- sample(c("A", "G"), 10, rep = TRUE) a2 <- sample(c("A", "G"), 10, rep = TRUE) paste(a1, a2, sep = "") })) colnames(snps) <- paste("Loc", LETTERS[1:3], sep = "_") snps alleleSplit(snps) # A sample microsatellie data set with alleles separated by "/" alleles <- seq(100, 150, 2) msats <- do.call(cbind, lapply(1:3, function(i) { a1 <- sample(alleles, 10, rep = TRUE) a2 <- sample(alleles, 10, rep = TRUE) paste(a1, "/", a2, sep = "") })) colnames(msats) <- paste("Loc", LETTERS[1:3], sep = "_") msats alleleSplit(msats, sep = "/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.