rbm.haplos.freqs {Ravages} | R Documentation |
Simulation of genetic data based on haplotypic frequencies
Description
Simulates genetic data with respect to allele frequency spectrum and linkage disequilibrium pattern observed on given haplotypes and their frequencies
Usage
rbm.haplos.freqs(haplos, freqs, size, replicates)
Arguments
haplos |
A matrix of haplotypes with one row per haplotype and one column per variant |
freqs |
A matrix of haplotypes frequencies in each group of individuals |
size |
The sizes of each group of individuals |
replicates |
The number of simulations to perform |
Details
Simulations are performed to respect linkage disequilibrium pattern and allelic frequency spectrum in each group of individuals
The phenotypic values will be the colnames of freqs
and stored in @ped$pheno
. The simulation number will be in @snps$genomic.region
.
Value
x |
A bed matrix with simulated genotypes |
Examples
#Simulations of 5 groups of individuals with haplotypes frequencies
#from the 5 EUR populations
#Load LCT dataset for haplotype matrix
data(LCT.haplotypes)
#Haplotypes for the variants in the LCT gene in the EUR population
LCT.gene.hap <- LCT.hap[which(LCT.sample$super.population=="EUR"),
which(LCT.snps$pos>=136545410 & LCT.snps$pos<=136594750)]
#Individuals from EUR
LCT.sample.EUR <- subset(LCT.sample, super.population=="EUR")
#Matrix of haplotypic frequencies
LCT.freqs <- sapply(unique(LCT.sample.EUR$population), function(z)
ifelse(LCT.sample.EUR$population==z,
1/table(LCT.sample.EUR$population)[z], 0))
#Simulation of genetic data for five groups of 50 individuals
x <- rbm.haplos.freqs(haplos=LCT.gene.hap, freqs=LCT.freqs, size=rep(50,5), replicates=5)
[Package Ravages version 1.1.3 Index]