kinship: Kinship matrix from haplotypes

Description Usage Arguments Details Value Author(s) References Examples

Description

This function computes a HapAllele-based kinship matrix from a GHap.haplo object.

Usage

 1 2 ghap.kinship(haplo, weights, batchsize = 500, only.active.samples = TRUE, only.active.alleles = TRUE, verbose = TRUE) 

Arguments

 haplo A GHap.haplo object. weights A numeric vector providing HapAllele-specific weights. batchsize A numeric value controlling the number of haplotype alleles to be processed at a time (default = 500). only.active.samples A logical value specifying whether only active samples should be included in the output (default = TRUE). only.active.alleles A logical value specifying whether only active haplotype alleles should be included in the output (default = TRUE). verbose A logical value specfying whether log messages should be printed (default = TRUE).

Details

Let \mathbf{M} be the centered N x H matrix of HapGenotypes, where N is the number of individuals and H is the number of HapAlleles. The HapAllele covariance among individuals is computed as:

\mathbf{K} = q\mathbf{MDM}'

where \mathbf{D} = diag(d_i), d_i is the weight of HapAllele i (default d_i = 1), and q is a scaling factor defined as tr(\mathbf{MDM}')^{-1}M. This is a generalization of the SNP-based genomic relationship matrix (VanRaden, 2008).

Value

The function returns a n x n matrix of HapAllele-based kinships, where n is the number of individuals.

Author(s)

Yuri Tani Utsunomiya <ytutsunomiya@gmail.com>

Marco Milanesi <marco.milanesi.mm@gmail.com>

References

P. M. VanRaden. Efficient methods to compute genomic predictions. J. Dairy. Sci. 2008. 91:4414-4423.

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 26 27 28 29 30 31 # #### DO NOT RUN IF NOT NECESSARY ### # # # Copy the example data in the current working directory # ghap.makefile() # # # Load data # phase <- ghap.loadphase("human.samples", "human.markers", "human.phase") # # # Subset data - markers with maf > 0.05 # maf <- ghap.maf(phase, ncores = 2) # markers <- phase$marker[maf > 0.05] # phase <- ghap.subsetphase(phase, unique(phase$id), markers) # # # Generate blocks of 5 markers sliding 5 markers at a time # blocks.mkr <- ghap.blockgen(phase, windowsize = 5, slide = 5, unit = "marker") # # # Generate matrix of haplotype genotypes # ghap.haplotyping(phase, blocks.mkr, batchsize = 100, ncores = 2, outfile = "human") # # # Load haplotype genotypes # haplo <- ghap.loadhaplo("human.hapsamples", "human.hapalleles", "human.hapgenotypes") # # # ### RUN ### # # # Exclude minor alleles and singletons # hapstats <- ghap.hapstats(haplo, ncores = 2) # haplo <- ghap.subsethaplo(haplo,ids=haplo$id,alleles = hapstats$TYPE %in% c("REGULAR","MAJOR")) # # # Compute Kinship matrix # K <- ghap.kinship(haplo, batchsize = 100) 

Search within the GHap package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.