Skip to content

Conversation

@flying-sheep
Copy link
Member

@flying-sheep flying-sheep commented Nov 14, 2025

I double-checked everything in #2578 and mostly winged it for the rest.

Would be nice if one of you could take a look if I mis-specified something.

  • I didn’t check if some flavors of highly_variable_genes supports only CSR. Any idea?
  • I tried to document things that implicitly convert to csr as “not supporting csc”, except when that’s conditional (i.e sc.pp.scale supports CSC if you don’t specify mask_obs, so that’s detailed in mask_obs).

@flying-sheep flying-sheep added this to the 1.12.0 milestone Nov 14, 2025
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.80%. Comparing base (b85d814) to head (c9c352b).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3895      +/-   ##
==========================================
+ Coverage   76.77%   76.80%   +0.03%     
==========================================
  Files         116      117       +1     
  Lines       12398    12440      +42     
==========================================
+ Hits         9518     9554      +36     
- Misses       2880     2886       +6     
Flag Coverage Δ
hatch-test.pre 76.80% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/_utils/_docs.py 100.00% <100.00%> (ø)
...c/scanpy/experimental/pp/_highly_variable_genes.py 18.44% <ø> (ø)
src/scanpy/get/_aggregated.py 92.78% <ø> (ø)
src/scanpy/neighbors/__init__.py 80.05% <ø> (ø)
src/scanpy/preprocessing/_combat.py 88.46% <ø> (ø)
src/scanpy/preprocessing/_highly_variable_genes.py 94.71% <ø> (ø)
src/scanpy/preprocessing/_normalization.py 94.66% <ø> (ø)
src/scanpy/preprocessing/_pca/__init__.py 90.65% <ø> (ø)
src/scanpy/preprocessing/_qc.py 95.83% <ø> (ø)
src/scanpy/preprocessing/_scale.py 91.20% <ø> (ø)
... and 15 more

... and 1 file with indirect coverage changes

@flying-sheep flying-sheep marked this pull request as ready for review November 17, 2025 11:27
@flying-sheep flying-sheep changed the title docs: add array-types directive docs: document array type support Nov 17, 2025
@grst
Copy link
Contributor

grst commented Nov 20, 2025

How hard would it be to make an overview page that lists all functions in a single table?

@ilan-gold
Copy link
Contributor

@flying-sheep I'll try to look tomorrow more closely but I do like @grst's suggestion. That being said, I don't think it should be instead of what is here, this is really cool!

@flying-sheep
Copy link
Member Author

Can you draft how that would look like? Tables for something like PCA are already quite big, and I can’t imagine how to lay out one big table in a way that it would be clear what’s going on.

image

@grst
Copy link
Contributor

grst commented Dec 4, 2025

I had in mind something like this

✅ = supported
❌ = not supported
⚡= supported in dask

Function numpy.ndarray csr_array csr_matrix csc_array csc_matrix
sc.tl.pca ✅⚡ ✅⚡ ✅⚡
sc.tl.tsne
sc.tl.umap ✅⚡
...

@Intron7
Copy link
Member

Intron7 commented Dec 8, 2025

@flying-sheep I have not checked how this work or not. But do umap and tsne work with sp_matrix and arrays?

@flying-sheep
Copy link
Member Author

Yes! In umap, doing sc.pp.neighbors(adata, use_rep="X") results in X being passed to simplicial_set_embedding, which will do a TruncatedSVD on it.

TSNE calls validate_data(self, X, accept_sparse=["csr", "csc", "coo"], ...) which very likely also means it supports it.

Thanks, thinking like this is exactly the reason I requested your reviews! Could have easily been that I messed this up.

Comment on lines +14 to +16
.. array-support:: all
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this table needs a key at least for what the lightning bolt means (dask?)

f"API not in `array_support`, add it in `docs/conf.py`: {self.arguments[0]}"
)
array_types = list(_docs.parse(*self._array_support[self.arguments[0]]))
headers = ("Array type", "supported", "… in dask :class:`~dask.array.Array`")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
headers = ("Array type", "supported", "… in dask :class:`~dask.array.Array`")
headers = ("Array type", "supported", "… experimentally in dask :class:`~dask.array.Array`")

@@ -0,0 +1,117 @@
"""Add `array-support` directive."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something else to say here? Seems like "utils for array-support directive"

@grst
Copy link
Contributor

grst commented Dec 9, 2025

The table leads to horizontal scrolling for me

image

Also not sure if the top of the API page is the best place to place it? Maybe even have a dedicated page for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document dask support for highly variable genes

5 participants