Sharing OBS between modalities

Hello, all,

I’m new to the scverse and I love it so far! Just one quick question with muon object. I’m trying to load .obs with data for RNA and abt after I’ve already created the muon data object. My question is will I have to set each modalities .obs (even though they share the same data)? I’ve run mdata.update(), but that seems to only work on filtering/update index names?

Curious to know if there’s a better way other than setting each modalities .obs.

Thank you,

Daniel

Hey @djlisko01,

Global metadata can be stored in mdata.obs rather than in individual modalities. There’s no API to “push down” global metadata to individual modalities at the moment but I am not sure if that was part of the question.

If there’s a code snippet that you might need more help with, feel free to share it!

Hey @gtca,

Thanks for the response. Yeah, you answered my question thank you! So I guess the follow up question is, if I filter observations from one modality, I’ll have to manually do that for another? For example I remove poor quality reads from RNA - Seq data, I’ll then I have to use those indexes from RNA-seq data to filter ATAC-seq data?

Cheers,

Daniel

@djlisko01, you can do that, or you can just slice the whole MuData object, which will slice all the modalities inside:

mdata_filtered_view = mdata[obs_names_to_keep]
# .copy() to make another MuData object

Alternatively you can use muon.pp.filter_obs to avoid extra copies:

mu.pp.filter_obs(mdata, obs_names_to_keep)