KinshipMatrix

class hail.KinshipMatrix(jkm)[source]

Represents a symmetric matrix encoding the relatedness of each pair of samples in the accompanying sample list.

The output formats are consistent with PLINK formats as created by the make-rel and make-grm commands and used by GCTA.

Attributes

key_schema Returns the signature of the key indexing this matrix.

Methods

__init__
export_gcta_grm Export kinship matrix as .grm file.
export_gcta_grm_bin Export kinship matrix as .grm.bin file or as .grm.N.bin file, depending on whether an N file is specified.
export_id_file Export samples as .id file.
export_rel Export kinship matrix as .rel file.
export_tsv Export kinship matrix to tab-delimited text file with sample list as header.
matrix Gets the matrix backing this kinship matrix.
sample_list Gets the list of samples.
export_gcta_grm(output)[source]

Export kinship matrix as .grm file. See PLINK formats.

Parameters:output (str) – File path for output.
export_gcta_grm_bin(output, opt_n_file=None)[source]

Export kinship matrix as .grm.bin file or as .grm.N.bin file, depending on whether an N file is specified. See PLINK formats.

Parameters:
  • output (str) – File path for output.
  • opt_n_file (str or None) – The file path to the N file.
export_id_file(output)[source]

Export samples as .id file. See PLINK formats.

Parameters:output (str) – File path for output.
export_rel(output)[source]

Export kinship matrix as .rel file. See PLINK formats.

Parameters:output (str) – File path for output.
export_tsv(output)[source]

Export kinship matrix to tab-delimited text file with sample list as header.

Parameters:output (str) – File path for output.
key_schema

Returns the signature of the key indexing this matrix.

Return type:Type
matrix()[source]

Gets the matrix backing this kinship matrix.

Returns:Matrix of kinship values.
Return type:IndexedRowMatrix
sample_list()[source]

Gets the list of samples. The (i, j) entry of the matrix encodes the relatedness of the ith and jth samples.

Returns:List of samples.
Return type:list of str