@@ -81,7 +81,7 @@ def __hash__(self):
8181 return hash (self .family_guid )
8282
8383 @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 ]:
8585 samples = {}
8686 for row in rows :
8787 samples [row .s ] = Sample (
@@ -94,22 +94,15 @@ def parse_direct_lineage(rows: list[hl.Struct]) -> dict[str, Sample]: # noqa: C
9494 for row in rows :
9595 # Maternal GrandParents
9696 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 :
10398 if samples [maternal_s ].mother :
10499 samples [row .s ].maternal_grandmother = samples [maternal_s ].mother
105100 if samples [maternal_s ].father :
106101 samples [row .s ].maternal_grandfather = samples [maternal_s ].father
107102
108103 # Paternal GrandParents
109104 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 :
113106 if samples [paternal_s ].mother :
114107 samples [row .s ].paternal_grandmother = samples [paternal_s ].mother
115108 if samples [paternal_s ].father :
0 commit comments