Description Usage Arguments Details Value Examples
Simulates genotypes from a table of haplotypes.
1 2 | simGenoFromHaplo(haploTable, haploFreqs, n = 1,
ploidy = 2)
|
haploTable |
The list of haplotypes in table format |
haploFreqs |
A named vector of haplotype frequencies. |
n |
How many genotypes to simulate. |
ploidy |
How many alleles per locus. Default = 2. |
Simulates n genotypes from a table of haplotypes. Genotypes will include one allele per ploidy level.
A data.frame of genotypes. Each locus will have multiple colums as per the ploidy level.
1 2 3 4 5 6 7 8 9 10 11 12 | # create a data frame to store alleles of haplotypes. Columns are loci.
haplotypes <- data.frame( A= c("a","b","c","a","b","c","b"),
B= c("a","b","c","b","c","a","a"),
C= c("a","b","c","b","c","a","a") )
# give the haplotypes sensible names as rownames.
rownames(haplotypes) <- apply(haplotypes, 1, paste,sep="" , collapse="")
# Create a named vector of haplotype frequencies.
haploFreqs <- c(0.4, 0.3, 0.15, 0.07,0.05, 0.02, 0.01)
names(haploFreqs) <- rownames(haplotypes)
# simulate a set of genotypes
my.genotypes <- simGenoFromHaplo(haploTable=haplotypes, haploFreqs=haploFreqs , n=20, ploidy=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.