Skip to content

Commit 181318f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/aligned-axis-key-join
# Conflicts: # src/anndata/_core/merge.py
2 parents f4ea166 + 39db433 commit 181318f

35 files changed

Lines changed: 407 additions & 324 deletions

.github/workflows/test-cpu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
needs: get-environments
4242
runs-on: ubuntu-latest
4343
strategy:
44+
fail-fast: false
4445
matrix:
4546
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
4647
io_mark: ["zarr_io", "not zarr_io", "dask_distributed"] # dask_distributed should not be run with -n auto as it uses a client with processes

docs/concatenation.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Let's start off with an example:
3030
obsm: 'X_pca', 'X_umap'
3131
varm: 'PCs'
3232
obsp: ...
33+
layers: None
3334

3435
If we split this object up by clusters of observations, then stack those subsets we'll obtain the same values – just ordered differently.
3536

@@ -42,6 +43,7 @@ If we split this object up by clusters of observations, then stack those subsets
4243
var: 'n_counts', 'means', 'dispersions', 'dispersions_norm', 'highly_variable'
4344
obsm: 'X_pca', 'X_umap'
4445
varm: 'PCs'
46+
layers: None
4547

4648
Note that we concatenated along the observations by default, and that most elements aligned to the observations were concatenated as well.
4749
A notable exception is :attr:`~anndata.AnnData.obsp`, which can be re-enabled with the `pairwise` keyword argument.
@@ -168,6 +170,7 @@ First, our example case:
168170
uns: 'pca'
169171
obsm: 'X_pca'
170172
varm: 'PCs'
173+
layers: None
171174

172175
Now we will split this object by the categorical `"blobs"` and recombine it to illustrate different merge strategies.
173176

@@ -184,6 +187,7 @@ Now we will split this object by the categorical `"blobs"` and recombine it to i
184187
uns: 'pca'
185188
obsm: 'X_pca', 'qc'
186189
varm: 'PCs', '0_qc'
190+
layers: None
187191

188192
`adatas` is now a list of datasets with disjoint sets of observations and a common set of variables.
189193
Each object has had QC metrics computed, with observation-wise metrics stored under `"qc"` in `.obsm`, and variable-wise metrics stored with a unique key for each subset.
@@ -193,16 +197,19 @@ Taking a look at how this affects concatenation:
193197
AnnData object with n_obs × n_vars = 640 × 30
194198
obs: 'blobs'
195199
obsm: 'X_pca', 'qc'
200+
layers: None
196201
>>> ad.concat(adatas, merge="same")
197202
AnnData object with n_obs × n_vars = 640 × 30
198203
obs: 'blobs'
199204
obsm: 'X_pca', 'qc'
200205
varm: 'PCs'
206+
layers: None
201207
>>> ad.concat(adatas, merge="unique")
202208
AnnData object with n_obs × n_vars = 640 × 30
203209
obs: 'blobs'
204210
obsm: 'X_pca', 'qc'
205211
varm: 'PCs', '0_qc', '1_qc', '2_qc', '3_qc', '4_qc'
212+
layers: None
206213

207214
Note that comparisons are made after indices are aligned.
208215
That is, if the objects only share a subset of indices on the alternative axis, it's only required that values for those indices match when using a strategy like `"same"`.

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def res(
181181
("py:class", "anndata.acc.GenericAlias"),
182182
("py:obj", "typing.R"),
183183
("py:class", "_M"),
184+
("py:class", "anndata.utils.Default"),
184185
]
185186

186187
# -- Social cards ---------------------------------------------------------
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove `dtype` argument from {class}`~anndata.AnnData` constructor. {user}`flying-sheep`

docs/release-notes/1707.feat.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Move {attr}`~anndata.AnnData.X` into {attr}`anndata.AnnData.layers` under the `None` key.
2+
As result, `layers: X` shows up in `AnnData`’s text representation, `None` appears in `.layers.items()`/`.keys()`, {func}`~anndata.concat` now works when some `AnnData`s have no `X`.
3+
{user}`flying-sheep` & {user}`ilan-gold`

docs/release-notes/2419.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Don't force {attr}`anndata.settings.check_uniqueness` if user loads an annotation index with {func}`anndata.experimental.read_lazy` {user}`ilan-gold`.

docs/release-notes/2423.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure non-string indexes are preserved in {attr}`~anndata.AnnData.uns` using {func}`~anndata.experimental.read_lazy` (introduced by {pr}`2419`) {user}`ilan-gold`

docs/tutorials/notebooks

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ classifiers = [
3636
"Topic :: Scientific/Engineering :: Visualization",
3737
]
3838
dependencies = [
39-
"pandas >=2.2.2",
40-
"numpy>=2",
41-
"scipy >=1.13,!=1.17.0",
39+
"pandas >=2.3",
40+
"numpy>=2.1",
41+
"scipy >=1.14,!=1.17.0",
4242
"h5py>=3.11",
4343
"natsort",
4444
"packaging>=24.2",

src/anndata/_core/access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from anndata import AnnData
88

99

10-
class ElementRef(NamedTuple):
10+
class ElementRef[K: (str, str | None)](NamedTuple):
1111
parent: AnnData
1212
attrname: str
13-
keys: tuple[str, ...] = ()
13+
keys: tuple[K, ...] = ()
1414

1515
def __str__(self) -> str:
1616
return f".{self.attrname}" + "".join(f"[{x!r}]" for x in self.keys)

0 commit comments

Comments
 (0)