Skip to content

Commit 73c47f6

Browse files
committed
remove the legacy update()
1 parent 5ccf921 commit 73c47f6

File tree

9 files changed

+296
-901
lines changed

9 files changed

+296
-901
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning][].
88
[keep a changelog]: https://keepachangelog.com/en/1.1.0/
99
[semantic versioning]: https://semver.org/spec/v2.0.0.html
1010

11+
## [0.4.0] (unreleased)
12+
13+
### Changed
14+
15+
- `update()` no longer automatically pulls obs/var columns from individual modalities by default. Set `mudata.set_options(pull_on_update=true)`
16+
to restore the old behavior. Use `pull_obs/pull_var` and `push_obs/push_var` for more flexibility.
17+
1118
## [0.3.4] (unreleased)
1219

1320
### Added
@@ -139,6 +146,7 @@ To copy the annotations explicitly, you will need to use `pull_obs()` and/or `pu
139146

140147
Initial `mudata` release with `MuData`, previously a part of the `muon` framework.
141148

149+
[0.4.0]: https://github.com/scverse/mudata/compare/v0.3.4...v0.4.0
142150
[0.3.4]: https://github.com/scverse/mudata/compare/v0.3.3...v0.3.4
143151
[0.3.3]: https://github.com/scverse/mudata/compare/v0.3.2...v0.3.3
144152
[0.3.2]: https://github.com/scverse/mudata/compare/v0.3.1...v0.3.2

src/mudata/_core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging as log
22

3-
OPTIONS = {"display_style": "text", "display_html_expand": 0b010, "pull_on_update": None}
3+
OPTIONS = {"display_style": "text", "display_html_expand": 0b010, "pull_on_update": False}
44

55
_VALID_OPTIONS = {
66
"display_style": lambda x: x in ("text", "html"),

src/mudata/_core/io.py

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from anndata.compat import _read_attr
2929
from scipy import sparse
3030

31-
from .config import OPTIONS
3231
from .file_backing import AnnDataFileManager, MuDataFileManager
3332
from .mudata import ModDict, MuData
3433

@@ -46,22 +45,8 @@ def _is_openfile(obj) -> bool:
4645
def _write_h5mu(file: h5py.File, mdata: MuData, write_data=True, **kwargs):
4746
from .. import __anndataversion__, __mudataversion__, __version__
4847

49-
write_elem(
50-
file,
51-
"obs",
52-
mdata.strings_to_categoricals(
53-
mdata._shrink_attr("obs", inplace=False).copy() if OPTIONS["pull_on_update"] is None else mdata.obs.copy()
54-
),
55-
dataset_kwargs=kwargs,
56-
)
57-
write_elem(
58-
file,
59-
"var",
60-
mdata.strings_to_categoricals(
61-
mdata._shrink_attr("var", inplace=False).copy() if OPTIONS["pull_on_update"] is None else mdata.var.copy()
62-
),
63-
dataset_kwargs=kwargs,
64-
)
48+
write_elem(file, "obs", mdata.strings_to_categoricals(mdata.obs.copy()), dataset_kwargs=kwargs)
49+
write_elem(file, "var", mdata.strings_to_categoricals(mdata.var.copy()), dataset_kwargs=kwargs)
6550
write_elem(file, "obsm", dict(mdata.obsm), dataset_kwargs=kwargs)
6651
write_elem(file, "varm", dict(mdata.varm), dataset_kwargs=kwargs)
6752
write_elem(file, "obsp", dict(mdata.obsp), dataset_kwargs=kwargs)
@@ -157,26 +142,8 @@ def write_zarr(
157142
# zarr_format is not supported in this version of zarr
158143
file = zarr.open(store, mode="w")
159144
mdata = data
160-
write_elem(
161-
file,
162-
"obs",
163-
mdata.strings_to_categoricals(
164-
mdata._shrink_attr("obs", inplace=False).copy()
165-
if OPTIONS["pull_on_update"] is None
166-
else mdata.obs.copy()
167-
),
168-
dataset_kwargs=kwargs,
169-
)
170-
write_elem(
171-
file,
172-
"var",
173-
mdata.strings_to_categoricals(
174-
mdata._shrink_attr("var", inplace=False).copy()
175-
if OPTIONS["pull_on_update"] is None
176-
else mdata.var.copy()
177-
),
178-
dataset_kwargs=kwargs,
179-
)
145+
write_elem(file, "obs", mdata.strings_to_categoricals(mdata.obs.copy()), dataset_kwargs=kwargs)
146+
write_elem(file, "var", mdata.strings_to_categoricals(mdata.var.copy()), dataset_kwargs=kwargs)
180147
write_elem(file, "obsm", dict(mdata.obsm), dataset_kwargs=kwargs)
181148
write_elem(file, "varm", dict(mdata.varm), dataset_kwargs=kwargs)
182149
write_elem(file, "obsp", dict(mdata.obsp), dataset_kwargs=kwargs)

0 commit comments

Comments
 (0)