Skip to content

Commit

Permalink
remove NA check in _check_allele_col
Browse files Browse the repository at this point in the history
  • Loading branch information
rxu17 committed Nov 7, 2023
1 parent e84124a commit 4fea695
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
8 changes: 0 additions & 8 deletions genie_registry/maf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ def _check_allele_col(df, col):
error = ""
warning = ""
if col_exist:
# CHECK: The value "NA" can't be used as a placeholder
if sum(df[col].fillna("") == "NA") > 0:
warning = (
"maf: "
f"{col} column contains 'NA' values, "
"which cannot be placeholders for blank values. "
"Please put in empty strings for blank values.\n"
)
# CHECK: There can't be any null values
if sum(df[col].isnull()) > 0:
error = f"maf: {col} can't have any blank or null values.\n"
Expand Down
22 changes: 1 addition & 21 deletions tests/test_maf.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ def test_errors_validation(maf_class):
"Does not have the column headers that can give "
"extra information to the processed maf: "
"T_REF_COUNT, N_DEPTH.\n"
"maf: "
"REFERENCE_ALLELE column contains 'NA' values, "
"which cannot be placeholders for blank values. "
"Please put in empty strings for blank values.\n"
)

assert error == expectedErrors
Expand Down Expand Up @@ -213,9 +209,6 @@ def test_invalid_validation(maf_class):
"This is the list of accepted allele values that can only appear individually: -\n"
)
expectedWarnings = (
"maf: TUMOR_SEQ_ALLELE2 column contains 'NA' values, "
"which cannot be placeholders for blank values. "
"Please put in empty strings for blank values.\n"
"maf: Does not have the column headers that can give "
"extra information to the processed maf: T_REF_COUNT.\n"
)
Expand All @@ -226,25 +219,12 @@ def test_invalid_validation(maf_class):
@pytest.mark.parametrize("col", ["temp", "REFERENCE_ALLELE"])
def test_noerror__check_allele_col(col):
"""Test error and warning is an empty string if REF col isn't passed in"""
df = pd.DataFrame(dict(REFERENCE_ALLELE=["A", "A"]))
df = pd.DataFrame(dict(REFERENCE_ALLELE=["NA", "A"]))
error, warning = genie_registry.maf._check_allele_col(df, col)
assert error == ""
assert warning == ""


def test_warning__check_allele_col():
"""Test warning occurs when 'NA' string is passed in"""
df = pd.DataFrame(dict(TEMP=["NA", "A"]))
error, warning = genie_registry.maf._check_allele_col(df, "TEMP")
assert error == ""
assert warning == (
"maf: "
"TEMP column contains 'NA' values, "
"which cannot be placeholders for blank values. "
"Please put in empty strings for blank values.\n"
)


def test_error__check_allele_col():
"""Test error occurs when blank allele is passed in"""
df = pd.DataFrame(dict(TEMP=[float("nan"), "A"]))
Expand Down

0 comments on commit 4fea695

Please sign in to comment.