cpg_flow.targets.pedigree_info
1from dataclasses import dataclass 2from typing import TYPE_CHECKING, Union 3 4from cpg_flow.targets import Sex 5 6if TYPE_CHECKING: 7 from cpg_flow.targets import SequencingGroup 8 9 10@dataclass 11class PedigreeInfo: 12 """ 13 Pedigree relationships with other sequencing groups in the cohort, and other PED data 14 """ 15 16 sequencing_group: 'SequencingGroup' 17 sex: 'Sex' = Sex.UNKNOWN 18 fam_id: str | None = None 19 phenotype: str | int = 0 20 dad: Union['SequencingGroup', None] = None 21 mom: Union['SequencingGroup', None] = None 22 23 def get_ped_dict(self, use_participant_id: bool = False) -> dict[str, str]: 24 """ 25 Returns a dictionary of pedigree fields for this sequencing group, corresponding 26 a PED file entry. 27 """ 28 29 def _get_id(_s: Union['SequencingGroup', None]) -> str: 30 if _s is None: 31 return '0' 32 if use_participant_id: 33 return _s.participant_id 34 return _s.id 35 36 return { 37 'Family.ID': self.fam_id or self.sequencing_group.participant_id, 38 'Individual.ID': _get_id(self.sequencing_group), 39 'Father.ID': _get_id(self.dad), 40 'Mother.ID': _get_id(self.mom), 41 'Sex': str(self.sex.value), 42 'Phenotype': str(self.phenotype), 43 }
@dataclass
class
PedigreeInfo:
11@dataclass 12class PedigreeInfo: 13 """ 14 Pedigree relationships with other sequencing groups in the cohort, and other PED data 15 """ 16 17 sequencing_group: 'SequencingGroup' 18 sex: 'Sex' = Sex.UNKNOWN 19 fam_id: str | None = None 20 phenotype: str | int = 0 21 dad: Union['SequencingGroup', None] = None 22 mom: Union['SequencingGroup', None] = None 23 24 def get_ped_dict(self, use_participant_id: bool = False) -> dict[str, str]: 25 """ 26 Returns a dictionary of pedigree fields for this sequencing group, corresponding 27 a PED file entry. 28 """ 29 30 def _get_id(_s: Union['SequencingGroup', None]) -> str: 31 if _s is None: 32 return '0' 33 if use_participant_id: 34 return _s.participant_id 35 return _s.id 36 37 return { 38 'Family.ID': self.fam_id or self.sequencing_group.participant_id, 39 'Individual.ID': _get_id(self.sequencing_group), 40 'Father.ID': _get_id(self.dad), 41 'Mother.ID': _get_id(self.mom), 42 'Sex': str(self.sex.value), 43 'Phenotype': str(self.phenotype), 44 }
Pedigree relationships with other sequencing groups in the cohort, and other PED data
PedigreeInfo( sequencing_group: cpg_flow.targets.sequencing_group.SequencingGroup, sex: cpg_flow.targets.types.Sex = <Sex.UNKNOWN: 0>, fam_id: str | None = None, phenotype: str | int = 0, dad: Optional[cpg_flow.targets.sequencing_group.SequencingGroup] = None, mom: Optional[cpg_flow.targets.sequencing_group.SequencingGroup] = None)
sequencing_group: cpg_flow.targets.sequencing_group.SequencingGroup
def
get_ped_dict(self, use_participant_id: bool = False) -> dict[str, str]:
24 def get_ped_dict(self, use_participant_id: bool = False) -> dict[str, str]: 25 """ 26 Returns a dictionary of pedigree fields for this sequencing group, corresponding 27 a PED file entry. 28 """ 29 30 def _get_id(_s: Union['SequencingGroup', None]) -> str: 31 if _s is None: 32 return '0' 33 if use_participant_id: 34 return _s.participant_id 35 return _s.id 36 37 return { 38 'Family.ID': self.fam_id or self.sequencing_group.participant_id, 39 'Individual.ID': _get_id(self.sequencing_group), 40 'Father.ID': _get_id(self.dad), 41 'Mother.ID': _get_id(self.mom), 42 'Sex': str(self.sex.value), 43 'Phenotype': str(self.phenotype), 44 }
Returns a dictionary of pedigree fields for this sequencing group, corresponding a PED file entry.