imputeSnpMatrix: Impute allele in formation to SNPs with missing data

Description Usage Arguments Examples

View source: R/snpImpute.R

Description

Uses neighbor SNPs from the clustering hierarchy to impute alleles to positions with missing values.

Usage

1
imputeSnpMatrix(snp, snpClust, min.absCor = 0.1, mc.cores = 1)

Arguments

snp

an object of class snpMatrix.

snpClust

an object of class qtcatClust.

min.absCor

a minimum value of correlation. If missing values still exist if this point in the hierarchy is reached, imputing is done via allele frequencies.

mc.cores

a number of cores for parallelising. Theoretical maximum is 'B'. For details see mclapply.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# file containing example data for SNP data
gfile <- system.file("extdata/snpdata.csv", package = "qtcat")
snp1 <- read.snpData(gfile, sep = ",")
# delete SNP information from Matrix, 33.33% NAs (-> 66.67% SNP info)
snp2 <- snp1
nainx <- sample(1:length(snp2@snpData), length(snp2@snpData) / 3)
snp2@snpData[nainx] <- as.raw(0)
# clustering
snp2clust <- qtcatClust(snp2)

# imputing
snp3 <- imputeSnpMatrix(snp2, snp2clust)
# comparison of the full and the imputed data set
snpmat1 <- as.matrix(snp1)
snpmat3 <- as.matrix(snp3)
(1 - sum(abs(snpmat1- snpmat3)) / length(snpmat1)) * 100

QTCAT/qtcat documentation built on April 20, 2021, 11:20 p.m.