You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing the new mutlitple tables feature on the main branch, and noticed that automatic backing of sdata.tables to the backing zarr store no longer works (or I fail to get it working). This is how it used to work:
import anndata as ad
import numpy as np
import pandas as pd
from spatialdata import SpatialData
import spatialdata
import os
path=""
n_cells = 100
n_genes = 50
# Creating random data
X = np.random.randn(n_cells, n_genes)
obs = pd.DataFrame(index=[f'cell_{i}' for i in range(n_cells)])
var = pd.DataFrame(index=[f'gene_{i}' for i in range(n_genes)])
adata = ad.AnnData(X=X, obs=obs, var=var)
adata.obs['cell_type'] = ['type1' if i < n_cells // 2 else 'type2' for i in range(n_cells)]
adata.var['highly_variable'] = np.random.choice([True, False], size=n_genes)
sdata=SpatialData()
sdata.write( os.path.join( path, "sdata_dummy.zarr" ) )
sdata.tables[ "dummy_table" ] = spatialdata.models.TableModel.parse( adata,
)
assert sdata.table is not None # this is ok
sdata=SpatialData.read( os.path.join( path, "sdata_dummy.zarr" ) )
sdata
assert sdata.table is not None # this gives assertionerror
Hi, thanks for reporting. Yes it is related to the bug you mentioned. I will fix this over the weekend before the next release. You can call the internal functions that we use when calling write() for the moment. Sorry for the inconvenience.
I was testing the new mutlitple tables feature on the main branch, and noticed that automatic backing of sdata.tables to the backing zarr store no longer works (or I fail to get it working). This is how it used to work:
Is this related to #496?
The text was updated successfully, but these errors were encountered: