Skip to content

fix: PCA centering in ingest#4208

Open
Intron7 wants to merge 2 commits into
mainfrom
fix-ingest-PCA
Open

fix: PCA centering in ingest#4208
Intron7 wants to merge 2 commits into
mainfrom
fix-ingest-PCA

Conversation

@Intron7

@Intron7 Intron7 commented Jul 13, 2026

Copy link
Copy Markdown
Member

Ingest centers its PCA against the query data not the fit data. I also made PCA sparse

Signed-off-by: Intron7 <severin.dicks@icloud.com>
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.97%. Comparing base (7df9ad6) to head (2d4cffc).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4208      +/-   ##
==========================================
+ Coverage   79.91%   79.97%   +0.06%     
==========================================
  Files         121      121              
  Lines       12949    12953       +4     
==========================================
+ Hits        10348    10359      +11     
+ Misses       2601     2594       -7     
Flag Coverage Δ
hatch-test.low-vers 79.10% <100.00%> (+0.06%) ⬆️
hatch-test.pre 79.93% <100.00%> (+0.06%) ⬆️

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

Files with missing lines Coverage Δ
src/scanpy/tools/_ingest.py 81.02% <100.00%> (+3.11%) ⬆️

... and 1 file with indirect coverage changes

Signed-off-by: Intron7 <severin.dicks@icloud.com>
@Intron7 Intron7 requested a review from flying-sheep July 13, 2026 13:09
Comment thread tests/test_ingest.py
def fail_toarray(*args, **kwargs) -> None:
pytest.fail("PCA ingest must not densify the query matrix")

monkeypatch.setattr(type(adata_new.X), "toarray", fail_toarray)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a bit fragile, but I can’t think of a better way …

@flying-sheep

Copy link
Copy Markdown
Member

just add a relnote

@flying-sheep flying-sheep changed the title fix PCA centering in ingest fix: PCA centering in ingest Jul 13, 2026
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.

2 participants