imputeSnpMatrix: Missing values handling for SnpMatrix object

Description Usage Arguments Details Value See Also Examples

View source: R/imputeSnpMatrix.R

Description

imputeSnpMatrix is a generic wrapper of snp.imputation and impute.snps functions from snpStats package. This function mimics a Leave-One-Out process where missing SNPs are imputed for an individual based on a model trained on all other individuals.

Usage

1
2
imputeSnpMatrix(snpX, genes.info, on.rem = c("SNP", "ind", "none"),
  quiet = FALSE)

Arguments

snpX

snpMatrix object of which SNPs are to be removed

genes.info

A data.frame with four columns named Genenames, SNPnames, Position and Chromosome. Each row describes a SNP and missing values are not allowed.

on.rem

(optional) a character string matching one of the following items: SNP, ind, none. Describes the action taken in case of remaining missing values. See details

quiet

(optional) a boolean describing wether or not progress bar should be displayed.

Details

For the ith row in the snpX argument (i.e. the ith individual in the dataset), the following steps are performed:

Although, such a process allows the imputation of a large number of missing SNPs, some missing values may remains. In that case, the user can specify the action to be done thanks to the om.rem arguments:

Removing all SNPs is often more parsimonious than removing individuals and allows to get a dataset without any missing values with minimum information-loss.

Value

a list object with two named elements:

snpX

a SnpMatrix object corresponding to input matrix with imputed values.

genes.info

a data frame object corresponding to an updated version of input genes.info in case SNP had to be removed.

A warning is printed when SNPs or individuals are removed.

See Also

GGI snpMatrixScour

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
ped <- system.file("extdata/example.ped", package="GeneGeneInteR")
info <- system.file("extdata/example.info", package="GeneGeneInteR")
posi <- system.file("extdata/example.txt", package="GeneGeneInteR")
data.imported <- importFile(file=ped, snps=info, pos=posi, pos.sep="\t")

## Example 1 without SNPs filtering
## In this example, 9 SNPs were removed due to remaining missing values.
imputed.snps.1 <- imputeSnpMatrix(data.imported$snpX, genes.info = data.imported$genes.info)


## Example 2 with SNPs filtering priori to the imputation
## Filtering of the data: SNPs with MAF < 0.05 or p.value for HWE < 1e-3 or SNPs with
## call.rate < 0.9 are removed. 
data.scour <- snpMatrixScour(snpX=dta$snpX,genes.info=dta$genes.info,min.maf=0.05,
                              min.eq=1e-3,call.rate=0)


## End(Not run)

## Equivalent loading of data for example 2
## Imputation of the missing genotypes
load(system.file("extdata/dataScour.Rdata", package="GeneGeneInteR"))

data.imputed <- imputeSnpMatrix(data.scour$snpX, genes.info = data.scour$genes.info)

GeneGeneInteR documentation built on Nov. 1, 2018, 2:22 a.m.