Skip to content

PedigreeInfo class

You can import this class directly from the cpg_flow package:

from cpg_flow.targets import PedigreeInfo

cpg_flow.targets.PedigreeInfo dataclass

PedigreeInfo(
    sequencing_group,
    sex=UNKNOWN,
    fam_id=None,
    phenotype=0,
    dad=None,
    mom=None,
)

Pedigree relationships with other sequencing groups in the cohort, and other PED data

get_ped_dict

get_ped_dict(use_participant_id=False)

Returns a dictionary of pedigree fields for this sequencing group, corresponding a PED file entry.

Source code in src/cpg_flow/targets/pedigree_info.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def get_ped_dict(self, use_participant_id: bool = False) -> dict[str, str]:
    """
    Returns a dictionary of pedigree fields for this sequencing group, corresponding
    a PED file entry.
    """

    def _get_id(_s: Union['SequencingGroup', None]) -> str:
        if _s is None:
            return '0'
        if use_participant_id:
            return _s.participant_id
        return _s.id

    return {
        'Family.ID': self.fam_id or self.sequencing_group.participant_id,
        'Individual.ID': _get_id(self.sequencing_group),
        'Father.ID': _get_id(self.dad),
        'Mother.ID': _get_id(self.mom),
        'Sex': str(self.sex.value),
        'Phenotype': str(self.phenotype),
    }