Skip to content

Commit

Permalink
refactor: throw ValueError instead of AssertionError in case of desig…
Browse files Browse the repository at this point in the history
…n with invalid type
  • Loading branch information
BorisMuzellec committed Nov 18, 2024
1 parent 8a70263 commit 97e72f5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pydeseq2/dds.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,13 @@ def __init__(
)
self.design = "~" + " + ".join(design_factors)

assert isinstance(self.design, (str, pd.DataFrame)) or isinstance(
self.design, str
), "design must be a string representing a formulaic formula,"
"or a pandas DataFrame."
if not (
isinstance(self.design, (str, pd.DataFrame)) or isinstance(self.design, str)
):
raise ValueError(
"design must be a string representing a formulaic formula,"
"or a pandas DataFrame."
)

if isinstance(self.design, str):
self.factor_storage, self.variable_to_factors, materializer_class = (
Expand Down

0 comments on commit 97e72f5

Please sign in to comment.