scverse / mudata

Multimodal Data (.h5mu) implementation for Python
https://mudata.rtfd.io
BSD 3-Clause "New" or "Revised" License
72 stars 16 forks source link

How to concatenate 2 mdata? #35

Closed danli349 closed 1 year ago

danli349 commented 1 year ago

Hello

How to concatenate 2 mdata? How can I combine more than 2 samples for analysis together?

mdata3 = mdata.concatenate(mdata2, batch_key='sample_id')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[25], line 1
----> 1 mdata3 = mdata.concatenate(mdata2, batch_key='sample_id')
      2 mdata3

AttributeError: 'MuData' object has no attribute 'concatenate'

Thanks

gtca commented 1 year ago

@danli349 Thanks, concatenation API is something that hasn't been implemented yet in MuData but we'll be looking into it for the next releases. It has also been discussed here: https://github.com/scverse/mudata/issues/20.

As a way to mitigate it now, one can concatenate individual modalities in the beginning of the processing workflow and construct a MuData object with the concatenated cells.

grst commented 1 year ago

Hi @danli349,

we now put up a tutorial on concatenating multimodal data in the scverse-tutorials page: https://scverse-tutorials.readthedocs.io/en/latest/notebooks/tutorial_concatenation_anndata_mudata.html

I'm closing this issue, as we have #20 to track a feature request to implement concatenation in MuData directly.