Skip to content

Commit 3a6c725

Browse files
committed
formatting
1 parent b583a26 commit 3a6c725

File tree

3 files changed

+50
-30
lines changed

3 files changed

+50
-30
lines changed

v03_pipeline/lib/misc/family_loading_failures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ def get_families_failed_imputed_sex_ploidy(
206206
discrepant_samples = mt.aggregate_cols(
207207
hl.agg.filter(mt.discrepant, hl.agg.collect_as_set(mt.s)),
208208
)
209-
failed_families = {}
209+
failed_families = defaultdict(list)
210210
for family in families:
211211
discrepant_loadable_samples = set(family.samples.keys()) & discrepant_samples
212212
if discrepant_loadable_samples:
213213
sorted_discrepant_samples = sorted(discrepant_loadable_samples)
214-
failed_families[
215-
family
216-
] = f'Found samples with misaligned ploidy with their provided imputed sex: {sorted_discrepant_samples}'
214+
failed_families[family].append(
215+
f'Found samples with misaligned ploidy with their provided imputed sex: {sorted_discrepant_samples}',
216+
)
217217
return failed_families

v03_pipeline/lib/misc/family_loading_failures_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,9 @@ def test_get_families_failed_imputed_sex_ploidy(self) -> None:
416416
self.assertCountEqual(
417417
failed_families.values(),
418418
[
419-
"Found samples with misaligned ploidy with their provided imputed sex: ['HG00731_1', 'HG00732_1', 'NA20889_1', 'NA20899_1']",
419+
[
420+
"Found samples with misaligned ploidy with their provided imputed sex: ['HG00731_1', 'HG00732_1', 'NA20889_1', 'NA20899_1']",
421+
],
420422
],
421423
)
422424

@@ -435,6 +437,8 @@ def test_get_families_failed_imputed_sex_ploidy(self) -> None:
435437
self.assertCountEqual(
436438
failed_families.values(),
437439
[
438-
"Found samples with misaligned ploidy with their provided imputed sex: ['HG00731_1']",
440+
[
441+
"Found samples with misaligned ploidy with their provided imputed sex: ['HG00731_1']",
442+
],
439443
],
440444
)

v03_pipeline/lib/tasks/write_remapped_and_subsetted_callset_test.py

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,30 @@ def test_write_remapped_and_subsetted_callset_task_failed_some_family_checks(
179179
},
180180
},
181181
ploidy_check={
182-
'234_1': hl.Struct(
183-
samples=['NA19678_1'],
184-
reasons="Found samples with misaligned ploidy with their provided imputed sex: ['NA19678_1']",
185-
),
186-
'567_1': hl.Struct(
187-
samples=['NA20872_1'],
188-
reasons="Found samples with misaligned ploidy with their provided imputed sex: ['NA20872_1']",
189-
),
190-
'bcd_1': hl.Struct(
191-
samples=['NA20878_1'],
192-
reasons="Found samples with misaligned ploidy with their provided imputed sex: ['NA20878_1']",
193-
),
194-
'cde_1': hl.Struct(
195-
samples=['NA20881_1'],
196-
reasons="Found samples with misaligned ploidy with their provided imputed sex: ['NA20881_1']",
197-
),
182+
'234_1': {
183+
'reasons': [
184+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA19678_1']",
185+
],
186+
'samples': ['NA19678_1'],
187+
},
188+
'567_1': {
189+
'reasons': [
190+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA20872_1']",
191+
],
192+
'samples': ['NA20872_1'],
193+
},
194+
'bcd_1': {
195+
'reasons': [
196+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA20878_1']",
197+
],
198+
'samples': ['NA20878_1'],
199+
},
200+
'cde_1': {
201+
'reasons': [
202+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA20881_1']",
203+
],
204+
'samples': ['NA20881_1'],
205+
},
198206
},
199207
),
200208
),
@@ -298,21 +306,29 @@ def test_write_remapped_and_subsetted_callset_task_all_families_failed(
298306
},
299307
},
300308
'ploidy_check': {
301-
'cde_1': {
302-
'samples': ['NA20881_1'],
303-
'reasons': "Found samples with misaligned ploidy with their provided imputed sex: ['NA20881_1']",
309+
'567_1': {
310+
'samples': ['NA20872_1'],
311+
'reasons': [
312+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA20872_1']",
313+
],
304314
},
305315
'234_1': {
306316
'samples': ['NA19678_1'],
307-
'reasons': "Found samples with misaligned ploidy with their provided imputed sex: ['NA19678_1']",
317+
'reasons': [
318+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA19678_1']",
319+
],
308320
},
309321
'bcd_1': {
310322
'samples': ['NA20878_1'],
311-
'reasons': "Found samples with misaligned ploidy with their provided imputed sex: ['NA20878_1']",
323+
'reasons': [
324+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA20878_1']",
325+
],
312326
},
313-
'567_1': {
314-
'samples': ['NA20872_1'],
315-
'reasons': "Found samples with misaligned ploidy with their provided imputed sex: ['NA20872_1']",
327+
'cde_1': {
328+
'samples': ['NA20881_1'],
329+
'reasons': [
330+
"Found samples with misaligned ploidy with their provided imputed sex: ['NA20881_1']",
331+
],
316332
},
317333
},
318334
},

0 commit comments

Comments
 (0)