Pedigree

class hail.genetics.Pedigree[source]

Class containing a list of trios, with extra functionality.

Parameters:

trios (list of Trio) – list of trio objects to include in pedigree

Attributes

trios

List of trio objects in this pedigree.

Methods

complete_trios

List of trio objects that have a defined father and mother.

filter_to

Filter the pedigree to a given list of sample IDs.

read

Read a PLINK .fam file and return a pedigree object.

write

Write a .fam file to the given path.

complete_trios()[source]

List of trio objects that have a defined father and mother.

Return type:

list of Trio

filter_to(samples)[source]

Filter the pedigree to a given list of sample IDs.

Notes

For any trio, the following steps will be applied:

  • If the proband is not in the list of samples provided, the trio is removed.

  • If the father is not in the list of samples provided, pat_id is set to None.

  • If the mother is not in the list of samples provided, mat_id is set to None.

Parameters:

samples (list [str]) – Sample IDs to keep.

Returns:

Pedigree

classmethod read(fam_path, delimiter='\\s+')[source]

Read a PLINK .fam file and return a pedigree object.

Examples

>>> ped = hl.Pedigree.read('data/test.fam')

Notes

See PLINK .fam file for the required format.

Parameters:
  • fam_path (str) – path to .fam file.

  • delimiter (str) – Field delimiter.

Return type:

Pedigree

property trios

List of trio objects in this pedigree.

Return type:

list of Trio

write(path)[source]

Write a .fam file to the given path.

Examples

>>> ped = hl.Pedigree.read('data/test.fam')
>>> ped.write('output/out.fam')

Notes

This method writes a PLINK .fam file.

Caution

Phenotype information is not preserved in the Pedigree data structure in Hail. Reading and writing a PLINK .fam file will result in loss of this information. Use import_fam() to manipulate this information.

Parameters:

path (str) – output path