simGenoFromHaplo: Simulate genotypes

Description Usage Arguments Details Value Examples

Description

Simulates genotypes from a table of haplotypes.

Usage

1
2
  simGenoFromHaplo(haploTable, haploFreqs, n = 1,
    ploidy = 2)

Arguments

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.

Details

Simulates n genotypes from a table of haplotypes. Genotypes will include one allele per ploidy level.

Value

A data.frame of genotypes. Each locus will have multiple colums as per the ploidy level.

Examples

 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)

Example output



mlPhaser documentation built on May 2, 2019, 7:59 a.m.