Skip to content

Commit

Permalink
convert to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rxu17 committed Jan 16, 2024
1 parent 503b21d commit b27d134
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
10 changes: 6 additions & 4 deletions genie/process_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def check_annotation_error_reports(
maf_table_synid (str): synapse_id of the narrow maf table
full_error_report (pd.DataFrame): the failed annotations error report
center (str): the center this is for
"""
maf_table_df = extract.get_syntabledf(
syn=syn,
Expand All @@ -351,10 +352,11 @@ def check_annotation_error_reports(
"Annotation_Status = 'FAILED'"
),
)
assert len(maf_table_df) == len(full_error_report), (
"Genome nexus's failed annotations error report rows doesn't match"
f"maf table's failed annotations for {center}"
)
if len(maf_table_df) != len(full_error_report):
logger.warning(
"Genome nexus's failed annotations error report rows doesn't match"
f"maf table's failed annotations for {center}"
)


def store_annotation_error_reports(
Expand Down
27 changes: 14 additions & 13 deletions tests/test_process_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,26 @@ def test_check_annotation_error_reports_passes_if_match(
"Annotation_Status = 'FAILED'",
)

def test_check_annotation_error_reports_throws_assertion_if_no_match(
self, syn, test_error_report
def test_check_annotation_error_reports_raises_warning_if_no_match(
self, syn, test_error_report, caplog
):
with patch.object(
extract,
"get_syntabledf",
return_value=pd.DataFrame({"test": [1], "test2": [2]}),
):
with pytest.raises(
AssertionError,
match="Genome nexus's failed annotations error report rows doesn't match"
"maf table's failed annotations for SAGE",
):
process_mutation.check_annotation_error_reports(
syn=syn,
maf_table_synid="synZZZZ",
full_error_report=test_error_report,
center="SAGE",
)
process_mutation.check_annotation_error_reports(
syn=syn,
maf_table_synid="synZZZZ",
full_error_report=test_error_report,
center="SAGE",
)
assert (
"Genome nexus's failed annotations error report rows doesn't match"
"maf table's failed annotations for SAGE" in caplog.text
)
# check that at least one is a warning
assert any(record.levelname == "WARNING" for record in caplog.records)

def test_concat_annotation_error_reports_returns_expected(self, test_error_report):
compiled_report = process_mutation.concat_annotation_error_reports(
Expand Down

0 comments on commit b27d134

Please sign in to comment.