haplosim {hapsim}R Documentation

Haplotype data simulator

Description

Generates a random sample of haplotypes, given an haplotype object created from a data set.

Usage

haplosim(n, hap, which.snp = NULL, seed = NULL, force.polym = TRUE)

Arguments

n Number of haplotypes to generate
hap Haplotype object created with haplodata
which.snp A vector specifying which SNPs to include
seed Seed for the random number generator
force.polym if TRUE, all loci are polymorphic

Value

A list containing:

data Simulated sample
freqs Allele frequency vector
cor Correlation matrix
div Locus-specific diversity scores
mse.freqs MSE of allele frequencies
mse.cor MSE of correlations

Author(s)

Giovanni Montana

References

Montana, G. HapSim: a simulation tool for generating haplotype data with pre-specified allele frequencies and LD coefficients. 2005.

See Also

See also haplodata

Examples


data(ACEdata)

# create the haplotype object 
x <- haplodata(ACEdata) 

# simulates a first sample of 100 haplotypes using all markers
y1 <- haplosim(100, x) 

# compares allele frequencies in real and simulated samples
plot(x$freqs, y1$freqs, title=paste("MSE:",y1$mse.freqs)); abline(a=0, b=1)

# compares LD coefficients in real and simulated samples
ldplot(mergemats(x$cor, y1$cor), ld.type='r') 

# simulates a second sample of 1000 haplotypes using the first 20 markers only
y2 <- haplosim(1000, which.snp=seq(20), x) 


[Package hapsim version 0.1 Index]