Full accessor support#158
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
==========================================
- Coverage 91.53% 91.09% -0.45%
==========================================
Files 10 11 +1
Lines 1619 1819 +200
==========================================
+ Hits 1482 1657 +175
- Misses 137 162 +25
🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
| del MuAcc.__dataclass_fields__["layers"] | ||
| del MuAcc.__dataclass_fields__["layer_cls"] | ||
|
|
||
| A: MuAcc[AdRef] = MuAcc() |
There was a problem hiding this comment.
| A: MuAcc[AdRef] = MuAcc() | |
| M: MuAcc[AdRef] = MuAcc() |
or?
There was a problem hiding this comment.
I assumed A stands for accessor, not AnnData. But I'm fine with calling this M.
There was a problem hiding this comment.
I had genuinely never thought of that but it makes sense. I thought of it as accessor for AnnData. @flying-sheep thoughts here?
| def to_json(self, ref: R) -> list[str | int | None]: | ||
| """Serialize :class:`~anndata.acc.AdRef` to a JSON-compatible list.""" | ||
| if isinstance(ref.acc, ModMapAcc): | ||
| return [f"{ref.acc.dim}map", ref.idx] | ||
|
|
||
| ret = super().to_json(ref) | ||
| if isinstance(ref.acc, _ModalityMixin): | ||
| ret = ["mod", ref.acc.mod, ret] | ||
| return ret | ||
|
|
There was a problem hiding this comment.
We have a JSON-schema for this - it may be worth doing this for MuData (in a way that builds on ours maybe?): https://anndata.scverse.org/en/latest/generated/anndata.acc.AdAcc.html#anndata.acc.AdAcc.from_json
There was a problem hiding this comment.
I've added a schema.
| del MuAcc.__dataclass_fields__["X"] | ||
| del MuAcc.__dataclass_fields__["layers"] | ||
| del MuAcc.__dataclass_fields__["layer_cls"] | ||
|
|
There was a problem hiding this comment.
I wonder if there is a better way to support this, maybe @flying-sheep has an idea. Bu this seems fine to me at first glance
Co-authored-by: Ilan Gold <ilanbassgold@gmail.com>
This reverts commit 36b3aea.
Implement MuData acessors. These are similar to and build on AnnData accessors, but add an additional level for modalities. So it is now possible to e.g. do