Pedigree

class hail.representation.Pedigree(trios)[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

__init__ x.__init__(…) initializes x; see help(type(x)) for signature
complete_trios List of trio objects that have a defined father, mother, and sex.
filter_to Filter the pedigree to a given list of sample IDs.
read Read a .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, mother, and sex.

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, the father is set to None.
  • If the mother is not in the list of samples provided, the mother is set to None.
Parameters:samples (list of str) – list of sample IDs to keep
Return type:Pedigree
static read(fam_path, delimiter='\\s+')[source]

Read a .fam file and return a pedigree object.

Examples

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

Notes

This method reads a PLINK .fam file.

Hail expects a file in the same spec as PLINK outlines.

Parameters:
  • fam_path (str) – path to .fam file.
  • delimiter (str) – Field delimiter.
Return type:

Pedigree

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 = Pedigree.read('data/test.fam')
>>> ped.write('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 the key table method import_fam() to manipulate this information.

Parameters:path (str) – output path