snpStats (version 1.22.0)

impute.snps: Impute snps

Description

Given SNPs stored in an object of class "SnpMatrix" or "XSnpMatrix" and a set of imputation rules in an object of class "ImputationRules", this function calculates imputed values.

Usage

impute.snps(rules, snps, subset = NULL, as.numeric = TRUE)

Arguments

rules
The imputation rules; an object of class "ImputationRules"
snps
The object of class "SnpMatrix" or "XSnpMatrix" containing the observed SNPs
subset
A vector describing the subset of subjects to be used. If NULL (default), then use all subjects
as.numeric
If TRUE, the output is a numeric matrix containing posterior expectations of the imputed SNPs. Otherwise the output matrix is of the same class as snps and contains uncertain genotype calls

Value

A matrix with imputed SNPs as columns. The imputed values are the estimated expected values of each SNP when coded 0, 1 or 2.

References

Wallace, C. et al. (2010) Nature Genetics, 42:68-71

See Also

snp.imputation

Examples

Run this code
# Remove 5 SNPs from a datset and derive imputation rules for them
data(for.exercise)
sel <- c(20, 1000, 2000, 3000, 5000)
to.impute <- snps.10[,sel]
impute.from <- snps.10[,-sel]
pos.to <- snp.support$position[sel]
pos.fr <- snp.support$position[-sel]
imp <- snp.imputation(impute.from, to.impute, pos.fr, pos.to)
# Now calculate the imputed values
imputed <- impute.snps(imp, impute.from)

Run the code above in your browser using DataLab