Closed AdemSaglamRB closed 1 year ago
Hi @AdemSaglamRB 😊
When we designed the package we had extensive discussions on having one versus multiple tables (see for example some notes here https://github.com/scverse/spatialdata/issues/43). For instance one disadvantage of not having multiple tables in the same object is that one would have to use separate objects to represent multimodal data, but in turn one advantage is that the APIs for data manipulation are generally simpler to implement.
After balancing the pros and cons we decided to support single tables in our first release, collect feedbacks from the users, and see how to relax this limitation.
To represent multiple modalities you can go for one of the following:
SpatialData
objectsAnnData
.obsm
/ .obs
in the tableGeoDataFrame
representing shapesAnnData
table and replace the sdata.table
slotOur preferred ways are the first two, but we recognize that none of these is optimal and we are exploring alternatives. To this regard, it would be appreciated if you could share an outline of your use cases (which multi-modal data you want to store and which types of cross-modality operations/manipulations you want to perform).
Hi @LucaMarconato ,
Thank you for your answer.
Using several SpatialData
is definitely the easiest way to go.
The multi-omics data I have been dealing with encompass RNA, protein and ATAC-seq information. These have always the same number of cells but different number of features. The count matrix for each will look like this:
Because of the different size of the count matrices, having different layers in AnnData
won't work as each layer is required to have the same sizes.
On the other side, the solution I was thinking about was that the sdata.table
could hold a MuData
object rather than AnnData
. I don't know if this is easy or complicated to implement though.
Out of curiosity, how do you use multiple AnnData
table to replace the sdata.table
slot?
Thank you for your help.
Thank you for the explanation of your use case, we will consider this feedback when discussion the new table designs. Having a MuData
object instead than an AnnData
object would work in this case, and the implementation is feasible, but there would be some drawbacks:
MuData
would not be ideal for the case in which different sets of shapes (e.g. cells segmentation masks, same cells but with different segmentation mask, anatomical annotations) are annotated with the same MuData
, because in that case having multiple individual tables would be handier for indices manipulation, especially after filtering rows and adding/removing new sets of shapesMuData
table. Note that we could still store multiple AnnData
tables and loading them as a MuData
, and when saving a MuData
object we could discard the information that is not contained in the individual tables.Thank you for your answer @LucaMarconato . Then we can close this thread.
Hello,
For multi-omics data, is it possible to add more tables to Table in a spatialdata object?