@@ -81,7 +81,7 @@ def __hash__(self):
81
81
return hash (self .family_guid )
82
82
83
83
@staticmethod
84
- def parse_direct_lineage (rows : list [hl .Struct ]) -> dict [str , Sample ]: # noqa: C901
84
+ def parse_direct_lineage (rows : list [hl .Struct ]) -> dict [str , Sample ]:
85
85
samples = {}
86
86
for row in rows :
87
87
samples [row .s ] = Sample (
@@ -94,22 +94,15 @@ def parse_direct_lineage(rows: list[hl.Struct]) -> dict[str, Sample]: # noqa: C
94
94
for row in rows :
95
95
# Maternal GrandParents
96
96
maternal_s = samples [row .s ].mother
97
- if maternal_s and maternal_s not in samples :
98
- # A sample id may be referenced for a proband that has been
99
- # removed from the pedigree as an individual. We handle this by
100
- # nulling out the parent here.
101
- samples [row .s ].mother = None
102
- elif maternal_s :
97
+ if maternal_s and maternal_s in samples :
103
98
if samples [maternal_s ].mother :
104
99
samples [row .s ].maternal_grandmother = samples [maternal_s ].mother
105
100
if samples [maternal_s ].father :
106
101
samples [row .s ].maternal_grandfather = samples [maternal_s ].father
107
102
108
103
# Paternal GrandParents
109
104
paternal_s = samples [row .s ].father
110
- if paternal_s and paternal_s not in samples :
111
- samples [row .s ].father = None
112
- elif paternal_s :
105
+ if paternal_s and paternal_s in samples :
113
106
if samples [paternal_s ].mother :
114
107
samples [row .s ].paternal_grandmother = samples [paternal_s ].mother
115
108
if samples [paternal_s ].father :
0 commit comments