Learn R Programming

QTLRel (version 0.2-9)

genoSim: Generate Genotypic Data

Description

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

Usage

genoSim(ped,gmap,ids,hap.data,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", ... N
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 leftmost SNP (marker) on the chromosome.
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

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.data 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
data(miscEx)

# prepare pedigree in desired format
pedR<- pedRecode(ped)

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

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

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

Run the code above in your browser using DataLab