From 98d4c01e90c22bbe0e1558853e94f336f5338c4d Mon Sep 17 00:00:00 2001 From: Hana Snow Date: Thu, 7 Mar 2024 14:44:37 -0500 Subject: [PATCH] update solve_status reporting --- seqr/views/apis/report_api_tests.py | 18 +++++++++--------- seqr/views/apis/summary_data_api_tests.py | 4 ++-- seqr/views/utils/anvil_metadata_utils.py | 10 ++++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/seqr/views/apis/report_api_tests.py b/seqr/views/apis/report_api_tests.py index b6ce200b4b..647ff3d730 100644 --- a/seqr/views/apis/report_api_tests.py +++ b/seqr/views/apis/report_api_tests.py @@ -250,7 +250,7 @@ {'column': 'affected_status', 'required': True, 'data_type': 'enumeration', 'enumerations': ['Affected', 'Unaffected', 'Unknown']}, {'column': 'phenotype_description'}, {'column': 'age_at_enrollment'}, - {'column': 'solve_status', 'required': True, 'data_type': 'enumeration', 'enumerations': ['Yes', 'Likely', 'No', 'Partial']}, + {'column': 'solve_status', 'required': True, 'data_type': 'enumeration', 'enumerations': ['Solved', 'Partially solved', 'Probably solved', 'Unsolved', 'Unaffected']}, {'column': 'missing_variant_case', 'required': True, 'data_type': 'enumeration', 'enumerations': ['Yes', 'No']}, ], }, @@ -505,7 +505,7 @@ 'phenotype_description': None, 'pmid_id': None, 'seqr_chosen_consequence': None, - 'solve_status': 'No', + 'solve_status': 'Unsolved', 'svName': None, 'svType': None, 'sv_name': None, @@ -589,7 +589,7 @@ def test_anvil_export(self, mock_google_authenticated, mock_zip): 'dbgap_subject_id_1', 'No', '1', 'NA19678', 'NA19679', '-', 'Self', 'Male', 'Middle Eastern or North African', '-', '-', '-', 'OMIM:615120', 'Myasthenic syndrome, congenital, 8, with pre- and postsynaptic defects', 'Affected', 'Adult onset', '-', 'HP:0001631|HP:0002011|HP:0001636', 'HP:0011675|HP:0001674|HP:0001508', - 'myopathy', 'No'], subject_file) + 'myopathy', 'Unsolved'], subject_file) self.assertEqual(sample_file[0], [ 'entity:sample_id', '01-subject_id', '02-sample_id', '03-dbgap_sample_id', '04-sequencing_center', @@ -809,23 +809,23 @@ def _assert_expected_gregor_files(self, mock_open, has_second_project=False): self.assertListEqual([ 'Broad_NA19675_1', 'Broad_1kg project nme with unide', 'BROAD', 'HMB', 'Yes', 'IKBKAP|CCDC102B|CMA - normal', '34415322', 'Broad_1', 'Broad_NA19678', 'Broad_NA19679', '', 'Self', '', 'Male', '', - 'Middle Eastern or North African', '', '', '21', 'Affected', 'myopathy', '18', 'No', 'No', + 'Middle Eastern or North African', '', '', '21', 'Affected', 'myopathy', '18', 'Unsolved', 'No', ], row) hispanic_row = next(r for r in participant_file if r[0] == 'Broad_HG00731') self.assertListEqual([ 'Broad_HG00731', 'Broad_1kg project nme with unide', 'BROAD', 'HMB', '', '', '', 'Broad_2', 'Broad_HG00732', - 'Broad_HG00733', '', 'Self', '', 'Female', '', '', 'Hispanic or Latino', 'Other', '', 'Affected', '', '', 'No', 'No', + 'Broad_HG00733', '', 'Self', '', 'Female', '', '', 'Hispanic or Latino', 'Other', '', 'Affected', '', '', 'Unsolved', 'No', ], hispanic_row) solved_row = next(r for r in participant_file if r[0] == 'Broad_NA20876') self.assertListEqual([ 'Broad_NA20876', 'Broad_1kg project nme with unide', 'BROAD', 'HMB', '', '', '', 'Broad_7', '0', - '0', '', '', '', 'Male', '', '', '', '', '', 'Affected', '', '', 'Yes', 'No', + '0', '', '', '', 'Male', '', '', '', '', '', 'Affected', '', '', 'Solved', 'No', ], solved_row) multi_data_type_row = next(r for r in participant_file if r[0] == 'Broad_NA20888') self.assertListEqual([ 'Broad_NA20888', 'Broad_Test Reprocessed Project' if has_second_project else 'Broad_1kg project nme with unide', 'BROAD', 'HMB', 'No', '', '', 'Broad_12' if has_second_project else 'Broad_8', '0', '0', '', '', '', - 'Male' if has_second_project else 'Female', '', '', '', '', '', 'Affected', '', '', 'No', 'No', + 'Male' if has_second_project else 'Female', '', '', '', '', '', 'Affected', '', '', 'Unsolved', 'No', ], multi_data_type_row) self.assertEqual(len(family_file), 11 if has_second_project else 10) @@ -1076,7 +1076,7 @@ def test_family_metadata(self): 'familyGuid': 'F000012_12', 'family_id': '12', 'displayName': '12', - 'solve_status': 'No', + 'solve_status': 'Unsolved', 'actual_inheritance': 'unknown', 'date_data_generation': '2017-02-05', 'data_type': 'WES', @@ -1111,7 +1111,7 @@ def test_family_metadata(self): 'familyGuid': 'F000003_3', 'family_id': '3', 'displayName': '3', - 'solve_status': 'No', + 'solve_status': 'Unsolved', 'actual_inheritance': '', 'date_data_generation': '2017-02-05', 'data_type': 'WES', diff --git a/seqr/views/apis/summary_data_api_tests.py b/seqr/views/apis/summary_data_api_tests.py index 9b1af12329..18c72f6fd3 100644 --- a/seqr/views/apis/summary_data_api_tests.py +++ b/seqr/views/apis/summary_data_api_tests.py @@ -35,7 +35,7 @@ EXPECTED_NO_AIRTABLE_SAMPLE_METADATA_ROW = { "projectGuid": "R0003_test", "num_saved_variants": 2, - "solve_status": "No", + "solve_status": "Unsolved", "sample_id": "NA20889", "gene_known_for_phenotype-1": "Known", "gene_known_for_phenotype-2": "Known", @@ -143,7 +143,7 @@ 'pmid_id': None, 'proband_relationship': 'Self', 'sex': 'Female', - 'solve_status': 'No', + 'solve_status': 'Unsolved', 'alt-1': 'T', 'chrom-1': '1', 'gene_known_for_phenotype-1': 'Candidate', diff --git a/seqr/views/utils/anvil_metadata_utils.py b/seqr/views/utils/anvil_metadata_utils.py index 07c576c773..800887229e 100644 --- a/seqr/views/utils/anvil_metadata_utils.py +++ b/seqr/views/utils/anvil_metadata_utils.py @@ -51,9 +51,9 @@ } SOLVE_STATUS_LOOKUP = { - **{s: 'Yes' for s in Family.SOLVED_ANALYSIS_STATUSES}, - **{s: 'Likely' for s in Family.STRONG_CANDIDATE_ANALYSIS_STATUSES}, - Family.ANALYSIS_STATUS_PARTIAL_SOLVE: 'Partial', + **{s: 'Solved' for s in Family.SOLVED_ANALYSIS_STATUSES}, + Family.ANALYSIS_STATUS_PARTIAL_SOLVE: 'Partially solved', + Family.ANALYSIS_STATUS_PROBABLE_SOLVE: 'Probably solved', } MIM_INHERITANCE_MAP = { @@ -103,7 +103,7 @@ def _get_family_metadata(family_filter, family_fields, include_metadata, include for f in family_data: family_id = f.pop('id') f.update({ - 'solve_status': SOLVE_STATUS_LOOKUP.get(f['analysisStatus'], 'No'), + 'solve_status': SOLVE_STATUS_LOOKUP.get(f['analysisStatus'], 'Unsolved'), **{k: v['format'](f) for k, v in (family_fields or {}).items()}, }) if format_id: @@ -201,6 +201,8 @@ def parse_anvil_metadata( if individual.id in matchmaker_individuals: subject_row['MME'] = matchmaker_individuals[individual.id] if mme_values else 'Yes' subject_row.update(family_subject_row) + if individual.affected != Individual.AFFECTED_STATUS_AFFECTED: + subject_row['solve_status'] = 'Unaffected' add_row(subject_row, family_id, SUBJECT_ROW_TYPE) participant_id = subject_row['participant_id']