Skip to content

Commit

Permalink
Raise an error when assay 'logcounts' is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed May 30, 2024
1 parent f686c26 commit 22f7d13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/celldex/save_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,15 @@ def _save_se(x: SummarizedExperiment, path, metadata):
f"All labels in 'column_data' must be a list of strings; column {_cn} does not."
)

if "logcounts" not in list(x.get_assay_names()):
raise ValueError("Assay 'logcounts' does not exist.")

_mat = x.assay("logcounts")
if not numpy.issubdtype(_mat.dtype, numpy.floating):
raise ValueError("Assay 'logcounts' must be log-normalized values (floats).")

if numpy.any(numpy.isnan(_mat)):
raise ValueError("Assay 'logcounts' cannot contain NaN values.")
raise ValueError("Assay 'logcounts' cannot contain 'NaN' values.")

_rows = x.get_row_names()
if len(set(_rows)) != len(_rows):
Expand Down

0 comments on commit 22f7d13

Please sign in to comment.