Skip to content

Commit b3f8f2e

Browse files
committed
ruff
1 parent c85784e commit b3f8f2e

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

v03_pipeline/lib/misc/pedigree.py

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,21 @@ def is_aunt_nephew(self: 'Sample', other: 'Sample') -> bool:
5555
)
5656

5757
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+
}
7673

7774

7875
@dataclass
@@ -143,12 +140,8 @@ def parse_collateral_lineage(
143140
continue
144141

145142
# 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
152145
):
153146
sample_i.half_siblings.append(sample_j.sample_id)
154147
continue
@@ -157,7 +150,7 @@ def parse_collateral_lineage(
157150
# they're aunt/uncle related
158151
# NB: because we will only check an i, j pair of samples a single time, (itertools.combinations)
159152
# 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):
161154
sample_i.aunt_nephews.append(sample_j.sample_id)
162155
return samples
163156

v03_pipeline/lib/misc/pedigree_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test_parse_parent_not_aunt_uncle(self) -> None:
229229
paternal_s=None,
230230
sex='F',
231231
),
232-
hl.Struct(
232+
hl.Struct(
233233
s='sample_5',
234234
maternal_s='sample_3',
235235
paternal_s=None,
@@ -305,10 +305,9 @@ def test_parse_parent_not_aunt_uncle(self) -> None:
305305
half_siblings=[],
306306
aunt_nephews=[],
307307
),
308-
}
308+
},
309309
)
310310

311-
312311
def test_parse_project(self) -> None:
313312
pedigree_ht = import_pedigree(TEST_PEDIGREE_2)
314313
self.assertCountEqual(

v03_pipeline/lib/model/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from v03_pipeline.lib.model.definitions import (
66
AccessControl,
77
PipelineVersion,
8-
Sex,
98
ReferenceGenome,
109
SampleType,
10+
Sex,
1111
)
1212
from v03_pipeline.lib.model.environment import Env
1313
from v03_pipeline.lib.model.reference_dataset_collection import (

0 commit comments

Comments
 (0)