Skip to content

Commit

Permalink
Merge pull request #295 from VariantEffect/bugfix/bencap/294/score-se…
Browse files Browse the repository at this point in the history
…t-update-variant-validation-failures

Score set update variant validation failures
  • Loading branch information
bencap authored Sep 13, 2024
2 parents 66506ff + fa984bb commit 2542feb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/mavedb/lib/mave/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

import pandas as pd

NA_VALUE = "NA"

NULL_VALUES = ("", "na", "nan", "nil", "none", "null", "n/a", "undefined", NA_VALUE)
Expand All @@ -22,6 +24,9 @@

def is_csv_null(value):
"""Return True if a string from a CSV file represents a NULL value."""
# Avoid any boolean miscasts from comparisons by handling NA types up front.
if pd.isna(value):
return True
# Number 0 is treated as False so that all 0 will be converted to NA value.
if value == 0:
return value
Expand Down
10 changes: 7 additions & 3 deletions src/mavedb/routers/score_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,13 @@ async def update_score_set(
scores_data = pd.DataFrame(
variants_to_csv_rows(item.variants, columns=score_columns, dtype="score_data")
).replace("NA", pd.NA)
count_data = pd.DataFrame(
variants_to_csv_rows(item.variants, columns=count_columns, dtype="count_data")
).replace("NA", pd.NA)

if item.dataset_columns["count_columns"]:
count_data = pd.DataFrame(
variants_to_csv_rows(item.variants, columns=count_columns, dtype="count_data")
).replace("NA", pd.NA)
else:
count_data = None

# Although this is also updated within the variant creation job, update it here
# as well so that we can display the proper UI components (queue invocation delay
Expand Down

0 comments on commit 2542feb

Please sign in to comment.