Adata.obs entries for specific layers

Does the anndata/scanpy API provide layer-specific masking for adata.obs? Alternatively, is there something like adata.layers['mylayer'].obs?

No, but you can use mudata!

1 Like

Iā€™d suggest you use the obsm attribute of your adata to add a pd.DataFrame with what you want. say:

import numpy, pandas, scanpy
adata   = sc.AnnData(np.zeros((1, 1)))
layer_obs = pd.DataFrame([['abc', 1]], columns=['text', 'int'], index=['0'])
adata.obsm['mylayer'] = layer_obs
1 Like