scverse / mudata

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

Enable propagating obs columns to individual modalities #2

Closed mffrank closed 2 months ago

mffrank commented 2 years ago

There is currently no way of propagating columns in the global .obs slot of a mudata object to all modalities. This could be a useful feature, e.g. when you have metadata that you want to be present in all modalites (for example when unimodal methods depend on that metadata).

I think the easiest solution would be to have a mdata.propagate_obs() method that looks through the columns of the mudata.obs table and writes columns not currently present in the individual modalites to their respective .obs in 2 ways:

This would enable something like this:

mdata.obs.merge(metadata)
mdata.propagate_obs()
gtca commented 2 months ago

This is now implemented with the pull/push interface in #56