Learn R Programming

QTLRel (version 0.2-15)

genoSim: Generate Genotypic Data

Description

Simulate genotypic data from a pedigree in advanced intercross lines (AIL).

Usage

genoSim(ped,gmap,ids,hap,method=c("Haldane","Kosambi"),
   recode.pedigree=FALSE)

Arguments

ped

a pedigree, which is a data frame (id, sex, sire, dam, ...). In "sex", male should be "M", "Male" or 1, and female should be "F", "Female" or 2 (other than 0 and 1). If given, "generation" can be numeric 0, 1, 2, ... or non-numeric "F0", "F1", "F2", ... Note that 0 is reserved for missing values.

gmap

a genetic map. Should be data frame (snp, chr, dist, ...), where "snp" is the SNP (marker) name, "chr" is the chromosome where the "snp" is, and "dist" is the genetic distance in centi-Morgan (cM) from the left of the chromosome. If gmap is missing but hap not, all but the first two columns of hap are ignored.

ids

genotypic data are extracted only for individuals with IDs specified by ids. If missing, genotypic data are extracted for all individuals in the pedigree. If ped is an object of pedRecode, ids should be referred to "old" IDs.

hap

founders' haplotype data if not missing. Rows correspond to all founders, which should be in the first places in the pedigree ped, in the exact order and columns correspond to loci in the genetic map gmap in the exact order. For an individual, the haplotype should be (f1 m1 f2 m2 ...) where fi is the allele from father at the i-th locus and mi is the allele from mother at the i-th locus. Elements should be non-negative integers that are not larger than 16384. If missing, two founders with alleles 1 and 2 are assumed.

method

whether "Haldane" or "Kosambi" mapping function should be used. This will be ignored if the recombination rate recRate is a component of gmap.

recode.pedigree

a logical variable. True if the pedigree needs to be recoded.

Value

A matrix, with entry value s-1 where s is the summation of the numbers representing two alleles at a locus. For instance, 1, 2, and 3 representing genotypes "AA", "AB" and "BB" respectively if hap is not specified. Each row represent an observation, and each column corresponds to SNP in gmap.

Details

The pedigree should be in the same format as an output of pedRecode. Note that two and only two founders are allowed; Otherwise, errors will occur without notice.

See Also

pedRecode for more information.

Examples

Run this code
# NOT RUN {
data(miscEx)

# }
# NOT RUN {
# prepare pedigree in desired format
pedR<- pedRecode(pedF8)

# simulate genotype data for all individuals
gd1<- genoSim(pedR, gmapF8)
dim(gd1)

# simulate genotype data for all individuals
# no need to recode pedigree ahead
gd2<- genoSim(pedF8, gmapF8, recode.pedigree=TRUE)
dim(gd2)

# simulate genotypes for F8 individuals
gd3<- genoSim(pedR, gmapF8, ids=pedR$id[pedR$gen=="F8"],
   recode.pedigree=TRUE)
dim(gd3)
gd3[1:5,1:5]
# }

Run the code above in your browser using DataLab