INNER CODE UNIT · Python
to_picklable_anndata
scverse/PyDESeq2 · src/pydeseq2/dds.py:1072
def to_picklable_anndata(self) -> ad.AnnData:
"""Convert the DESeqDataSet to a picklable AnnData object.
Builds an AnnData object from the DESeqDataSet with the same data, but converts the design matrix to a DataFrame to remove the formulaic model_spec attribute, which is not picklable.
Returns
-------
The AnnData object, without DeseqDataSet unpicklable attributes.
"""
# Initialize an AnnData object
adata = ad.AnnData(
X=self.X,
obs=self.obs,
var=self.var,
obsm=self.obsm,
varm=self.varm,
uns=self.uns,
layers=self.layers,