Skip to content

Fix AttributeError when design is a DataFrame#443

Open
Ekin-Kahraman wants to merge 1 commit intoscverse:mainfrom
Ekin-Kahraman:fix/dataframe-design-attributeerror
Open

Fix AttributeError when design is a DataFrame#443
Ekin-Kahraman wants to merge 1 commit intoscverse:mainfrom
Ekin-Kahraman:fix/dataframe-design-attributeerror

Conversation

@Ekin-Kahraman
Copy link
Copy Markdown

Fixes #440.

When DeseqDataSet is created with a precomputed design matrix (DataFrame) instead of a formula string, cond() and contrast() raise a confusing AttributeError: 'DeseqDataSet' object has no attribute 'formulaic_contrasts'.

Added try/except guards with clear error messages directing users to pass contrast vectors directly. Follows the same pattern already used for the variables property (line 341-347).

When DeseqDataSet is created with a precomputed design matrix (DataFrame)
instead of a formula string, cond() and contrast() raise a confusing
AttributeError because formulaic_contrasts is never set.

Added guard with a clear error message directing users to pass contrast
vectors directly, matching the existing pattern used for the variables
property.

Fixes scverse#440.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DeseqStats fails with AttributeError when design is a pandas DataFrame

1 participant