Learn R Programming

ibdreg (version 0.3.8)

sim.ibd.var: Create an ibd.var object via simulations using gene-dropping

Description

Create an ibd.var object, containing a mean vector and covariance matrix for the ibd sharing values between each pair of relative pairs in each pedigree. Use a gene-dropping approach with 2 unique alleles for each founder, and simulate n.sim times. Then calculate the moments based on the vector of allele sharing between all relative pairs within the pedigree.

Usage

sim.ibd.var(pedfile, 
            male.code=1, 
            female.code=2, 
            x.linked=FALSE, 
            n.sim=1000, 
            print.resources=FALSE)

Value

The return value, call it ret, is an ibd.var object that contains the following elements for each pedigree:

ped.id

pedigree id

person1.id

vector of ids for first person in the relative pair

person2.id

vector of ids for second person in the relative pair

sm

mean vector of ibd sharing between relative pairs: person1.id, person2.id

sv

variance-covariance matrix for ibd sharing between pairs of relative pairs

Arguments

pedfile

file containing ids for pedigree, person, father, and mother, and gender. Also known as a pre-MAKEPED format file.

male.code

The code that denotes a sex classification of "male".

female.code

The code that denotes a sex classification of "female".

x.linked

A flag that denotes whether the inheritance mode should be autosomal (x.linked=FALSE, the default) or X-linked (x.linked=TRUE).

n.sim

Number of simulations

print.resources

logical, set to TRUE to print CPU and memory usage for calculations on each pedigree.

Details

The bulk of the work for simulating ibd sharing vectors is in sim.mark.prop(). These methods will handle practically any correctly formed pedigree structure. This includes pedigrees containing loops, multiple pairs of ancestoral founders, and both loops and multiple pairs of ancestoral founders. Thus, maximum flexibility may be obtained. Both autosomal and X-linked methods of inheritance are supported through the use of the x.linked parameter.

References

Schaid DJ, Sinnwell JP, Thibodeau SN. Testing Genetic Linkage with Relative Pairs and Covariates by Quasi-Likelihood Score Statistics. Submitted.

See Also

exact.ibd.var, sim.ibd.setup, sim.mark.prop

Examples

Run this code
## See manual(s) for full example usage
## Below is a basic example for one pedigree
## Not Run:
# Since input parameter is a "pre" file, create a "pre" file for one pedigree

# make a data.frame to write to a file
ped.id <- rep(7,7)
person <- c(1,2,3,4,5,6,7)
father <- c(0,0,0,1,0,3,5)
mother <- c(0,0,0,2,0,4,4)
sex    <- c(1,2,1,2,1,1,1)
chrom1 <- c(1,3,5,0,7,0,0)
chrom2 <- c(2,4,6,0,8,0,0)
ped7.df <- data.frame(ped.id, person, father, mother, 
                     sex, chrom1, chrom2)

# write the file
if (FALSE) write.table(ped7.df, file="ped7.pre", row.names=FALSE, col.names=FALSE)

if (FALSE) ped7.ibdVar <- sim.ibd.var("ped7.pre", n.sim=1000)

# results are long and difficult to interpret
# here is an example of how to view
if (FALSE) print(ped7.ibdVar[[1]], digits=2)

# demonstrate for x.linked=TRUE
if (FALSE) ped7.ibdVarX <- sim.ibd.var("ped7.pre", n.sim=1000, x.linked=TRUE)

Run the code above in your browser using DataLab