LDMatrix

class hail.LDMatrix(jldm)[source]

Represents a symmetric matrix encoding the Pearson correlation between each pair of variants in the accompanying variant list.

Methods

__init__
matrix Gets the distributed matrix backing this LD matrix.
read Reads the LD matrix from a file.
to_local_matrix Converts the LD matrix to a local Spark matrix.
variant_list Gets the list of variants.
write Writes the LD matrix to a file.
matrix()[source]

Gets the distributed matrix backing this LD matrix.

Returns:Matrix of Pearson correlation values.
Return type:IndexedRowMatrix
static read(path)[source]

Reads the LD matrix from a file.

Examples

Read an LD matrix from a file.

>>> ld_matrix = LDMatrix.read('data/ld_matrix')
Parameters:path (str) – the path from which to read the LD matrix
to_local_matrix()[source]

Converts the LD matrix to a local Spark matrix.

Caution

Only call this method when the LD matrix is small enough to fit in local memory on the driver.

Returns:Matrix of Pearson correlation values.
Return type:Matrix
variant_list()[source]

Gets the list of variants. The (i, j) entry of the matrix encodes the Pearson correlation between the ith and jth variants.

Returns:List of variants.
Return type:list of Variant
write(path)[source]

Writes the LD matrix to a file.

Examples

Write an LD matrix to a file.

>>> vds.ld_matrix().write('output/ld_matrix')
Parameters:path (str) – the path to which to write the LD matrix