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
.king2mat(file.kin0, file.kin = NULL, iids = NULL, type = "kinship", verbose = TRUE)
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.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
.pcair
and pcairPartition
for functions that use the output matrix.
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")
Run the code above in your browser using DataLab