From 4c1375ccc9943d5cf98cd385c6a848e66099068c Mon Sep 17 00:00:00 2001 From: MattWellie Date: Mon, 28 Oct 2024 16:45:37 +1000 Subject: [PATCH] test fixture update - family and individual IDs from Metamist Pedigree are always Strings --- cpg_workflows/inputs.py | 8 +++----- test/test_cohort.py | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cpg_workflows/inputs.py b/cpg_workflows/inputs.py index f9690b6c9..bcc9066e3 100644 --- a/cpg_workflows/inputs.py +++ b/cpg_workflows/inputs.py @@ -281,7 +281,7 @@ def populate_pedigree(dataset: Dataset) -> None: Populate pedigree data for sequencing groups. """ - sg_by_participant_id = dict() + sg_by_participant_id = {} for sg in dataset.get_sequencing_groups(): sg_by_participant_id[sg.participant_id] = sg @@ -299,13 +299,11 @@ def populate_pedigree(dataset: Dataset) -> None: continue ped_entry = ped_entry_by_participant_id[sequencing_group.participant_id] - maternal_sg = sg_by_participant_id.get(ped_entry['maternal_id']) - paternal_sg = sg_by_participant_id.get(ped_entry['paternal_id']) sequencing_group.pedigree = PedigreeInfo( sequencing_group=sequencing_group, fam_id=ped_entry['family_id'], - mom=maternal_sg, - dad=paternal_sg, + mom=sg_by_participant_id.get(ped_entry['maternal_id']), + dad=sg_by_participant_id.get(ped_entry['paternal_id']), sex=Sex.parse(str(ped_entry['sex'])), phenotype=ped_entry['affected'] or '0', ) diff --git a/test/test_cohort.py b/test/test_cohort.py index f7a8f13ab..457c20992 100644 --- a/test/test_cohort.py +++ b/test/test_cohort.py @@ -261,15 +261,15 @@ def mock_get_analysis_by_sgs(*args, **kwargs) -> dict: def mock_get_pedigree(*args, **kwargs): # pylint: disable=unused-argument return [ { - 'family_id': 123, + 'family_id': '123', 'individual_id': '8', - 'paternal_id': 14, + 'paternal_id': '14', 'maternal_id': None, 'sex': 1, 'affected': 1, }, { - 'family_id': 124, + 'family_id': '124', 'individual_id': '14', 'paternal_id': None, 'maternal_id': None,