Skip to content

Commit 2542feb

Browse files
authored
Merge pull request #295 from VariantEffect/bugfix/bencap/294/score-set-update-variant-validation-failures
Score set update variant validation failures
2 parents 66506ff + fa984bb commit 2542feb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/mavedb/lib/mave/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import re
22

3+
import pandas as pd
4+
35
NA_VALUE = "NA"
46

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

2325
def is_csv_null(value):
2426
"""Return True if a string from a CSV file represents a NULL value."""
27+
# Avoid any boolean miscasts from comparisons by handling NA types up front.
28+
if pd.isna(value):
29+
return True
2530
# Number 0 is treated as False so that all 0 will be converted to NA value.
2631
if value == 0:
2732
return value

src/mavedb/routers/score_sets.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,13 @@ async def update_score_set(
854854
scores_data = pd.DataFrame(
855855
variants_to_csv_rows(item.variants, columns=score_columns, dtype="score_data")
856856
).replace("NA", pd.NA)
857-
count_data = pd.DataFrame(
858-
variants_to_csv_rows(item.variants, columns=count_columns, dtype="count_data")
859-
).replace("NA", pd.NA)
857+
858+
if item.dataset_columns["count_columns"]:
859+
count_data = pd.DataFrame(
860+
variants_to_csv_rows(item.variants, columns=count_columns, dtype="count_data")
861+
).replace("NA", pd.NA)
862+
else:
863+
count_data = None
860864

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

0 commit comments

Comments
 (0)