@@ -55,24 +55,21 @@ def is_aunt_nephew(self: 'Sample', other: 'Sample') -> bool:
55
55
)
56
56
57
57
def is_in_direct_lineage (self : 'Sample' , other : 'Sample' ) -> bool :
58
- return (
59
- self .sample_id in {
60
- other .mother ,
61
- other .father ,
62
- other .maternal_grandmother ,
63
- other .maternal_grandfather ,
64
- other .paternal_grandmother ,
65
- other .paternal_grandfather ,
66
- }
67
- or other .sample_id in {
68
- self .mother ,
69
- self .father ,
70
- self .maternal_grandmother ,
71
- self .maternal_grandfather ,
72
- self .paternal_grandmother ,
73
- self .paternal_grandfather ,
74
- }
75
- )
58
+ return self .sample_id in {
59
+ other .mother ,
60
+ other .father ,
61
+ other .maternal_grandmother ,
62
+ other .maternal_grandfather ,
63
+ other .paternal_grandmother ,
64
+ other .paternal_grandfather ,
65
+ } or other .sample_id in {
66
+ self .mother ,
67
+ self .father ,
68
+ self .maternal_grandmother ,
69
+ self .maternal_grandfather ,
70
+ self .paternal_grandmother ,
71
+ self .paternal_grandfather ,
72
+ }
76
73
77
74
78
75
@dataclass
@@ -143,12 +140,8 @@ def parse_collateral_lineage(
143
140
continue
144
141
145
142
# If only a single parent is identified and the same, samples are half siblings
146
- if (
147
- sample_i .mother
148
- and sample_i .mother == sample_j .mother
149
- ) or (
150
- sample_i .father
151
- and sample_i .father == sample_j .father
143
+ if (sample_i .mother and sample_i .mother == sample_j .mother ) or (
144
+ sample_i .father and sample_i .father == sample_j .father
152
145
):
153
146
sample_i .half_siblings .append (sample_j .sample_id )
154
147
continue
@@ -157,7 +150,7 @@ def parse_collateral_lineage(
157
150
# they're aunt/uncle related
158
151
# NB: because we will only check an i, j pair of samples a single time, (itertools.combinations)
159
152
# we need to check both grandparents_i == parents_j and parents_i == grandparents_j.
160
- if ( sample_i .is_aunt_nephew (sample_j ) or sample_j .is_aunt_nephew (sample_i ) ):
153
+ if sample_i .is_aunt_nephew (sample_j ) or sample_j .is_aunt_nephew (sample_i ):
161
154
sample_i .aunt_nephews .append (sample_j .sample_id )
162
155
return samples
163
156
0 commit comments