-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When passing a pandas DataFrame (a precomputed design matrix) directly to the design argument of DeseqDataSet, an AttributeError is raised later when creating a DeseqStats object.
Specifically, DeseqStats fails with:
AttributeError: 'DeseqDataSet' object has no attribute 'formulaic_contrasts'
This does not occur when design is provided as a formula string.
To Reproduce
from pydeseq2.utils import load_example_data
from pydeseq2.default_inference import DefaultInference
from formulaic_contrasts import FormulaicContrasts
from pydeseq2.dds import DeseqDataSet
from pydeseq2.ds import DeseqStats
counts_df = load_example_data(
modality="raw_counts",
dataset="synthetic",
debug=False,
)
metadata = load_example_data(
modality="metadata",
dataset="synthetic",
debug=False,
)
inference = DefaultInference(n_cpus=8)
design = FormulaicContrasts(
metadata, '~ C(condition, contr.treatment(base="B"))'
).design_matrix
dds = DeseqDataSet(
counts=counts_df,
metadata=metadata,
design=design,
refit_cooks=True,
inference=inference,
)
dds.deseq2()
ds = DeseqStats(dds, contrast=["condition", "B", "A"], inference=inference)This raises:
AttributeError: 'DeseqDataSet' object has no attribute 'formulaic_contrasts'
pydeseq2 version: 0.5.4
Expected behavior
Either:
- Passing a design matrix directly should be fully supported, and
DeseqStatsshould work without error, or - A clear and explicit error should be raised earlier, indicating that
designmust be a formula string (or that additional information such as contrasts is required).
Screenshots
Desktop (please complete the following information):
- OS: macOS
- Version: 26.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working