h.zygosity: Determine per sample heterozygosity and inbreeding...

View source: R/statistics.R

h.zygosityR Documentation

Determine per sample heterozygosity and inbreeding coefficient

Description

This function will calculate the heterozygosity on a per-sample basis from vcf files (snps), and most importantly inbreeding coefficient which is used to filter out the samples with bad mapping quality.

Usage

h.zygosity(vcf, plot = FALSE, pops = NA, verbose = TRUE, parallel = FALSE)

Arguments

vcf

an imported vcf file in in a list using readVCF or a data frame of genotypes generated using hetTgen

plot

logical. Whether to plot a boxplot of inbreeding coefficients for populations. A list of populations must be provided

pops

character. A list of population names with the same length and order as the number of samples in the vcf

verbose

logical. Show progress

parallel

logical. Parallelize the process

Value

Returns a data frame of expected “E(Hom)” and observed “O(Hom)” homozygotes with their inbreeding coefficients.

Author(s)

Piyal Karunarathne, Pascal Milesi, Klaus Schliep

Examples

## Not run: vcf.file.path <- paste0(path.package("rCNV"), "/example.raw.vcf.gz")
vcf <- readVCF(vcf.file.path=vcf.file.path)
pp<-substr(colnames(vcf$vcf)[-c(1:9)],1,8)
hzygots<-h.zygosity(vcf,plot=TRUE,pops=pp)
## End(Not run)


rCNV documentation built on Sept. 30, 2024, 9:39 a.m.