king2mat: Convert KING text output to an R Matrix

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/king2mat.R


king2mat is used to extract the pairwise kinship coefficient estimates or IBS0 values from the output text files of KING and put them into an R object of class matrix that can be read by the functions pcair and pcairPartition. This function is deprecated; use kingToMatrix instead.


king2mat(file.kin0, file.kin = NULL, iids = NULL, 
            type = "kinship", verbose = TRUE)



File name of the .kin0 text file output from KING.


Optional file name of the .kin text file output from KING.


An optional vector of individual IDs in the same order as desired for the output matrix. See 'Details' for more information.


Character string taking the values "kinship" (default) or "IBS0", to inform the function to read in kinship coefficeints or IBS0 values from the KING output.


A logical indicating whether or not to print status updates to the console; the default is TRUE.


When using the function pcair, it is important that the order of individuals in the kinMat matrix matches the order of individuals in genoData. The KING software has a tendency to reorder individuals. If iids = NULL, the default is for the order to be taken from the KING output text file. By specifying iids the user can control the order of individuals in the output matrix. The IDs used for iids must be the same set of character IDs that are output as columns 'ID1' and 'ID2' in the KING output text files; all of the IDs specified in iids must be in the KING output, and all IDs in the KING output must be specified in iids.


An object of class 'matrix' with pairwise kinship coefficients or IBS0 values as estimated by KING for each pair of individuals in the sample. The estimates are on both the upper and lower triangle of the matrix, and the diagonal is arbitrailly set to 0.5. Individual IDs are set as the column and row names of the matrix.


Matthew P. Conomos


Conomos M.P., Miller M., & Thornton T. (2015). Robust Inference of Population Structure for Ancestry Prediction and Correction of Stratification in the Presence of Relatedness. Genetic Epidemiology, 39(4), 276-293.

Manichaikul, A., Mychaleckyj, J.C., Rich, S.S., Daly, K., Sale, M., & Chen, W.M. (2010). Robust relationship inference in genome-wide association studies. Bioinformatics, 26(22), 2867-2873.

See Also

pcair and pcairPartition for functions that use the output matrix.


## Not run: 
file.kin0 <- system.file("extdata", "MXL_ASW.kin0", package="GENESIS")
file.kin <- system.file("extdata", "MXL_ASW.kin", package="GENESIS")
KINGmat <- king2mat(file.kin0 = file.kin0, file.kin = file.kin, type="kinship")

## End(Not run)

GENESIS documentation built on Nov. 1, 2018, 6:01 p.m.