Skip to content

V2.1.0 - #286

Merged
dbdimitrov merged 6 commits into
mainfrom
v2.1.0
Oct 31, 2026
Merged

V2.1.0#286
dbdimitrov merged 6 commits into
mainfrom
v2.1.0

Conversation

@dbdimitrov

@dbdimitrov dbdimitrov commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

2.1.0 (31.10.2026)

Removed

  • Breaking: li.mt.lric(pair_chunk=...) is removed, after being deprecated and ignored in 2.0.0.
  • Breaking: li.mt.lric(transform_fn=...) is removed. Its default, mean-normalising each gene to 1, was redundant: after introducing analytical normalisation for the area of interest, any per-gene rescaling cancels exactly in every LRIC ratio (g, g_expr). To weight by a nonlinear transform of expression, store it as a layer and pass it -- e.g. adata.layers["sqrt"] = np.sqrt(adata.X), then li.mt.lric(..., layer="sqrt"). Unlike transform_fn, a layer goes through the non-negativity check.

Changed

  • Permutation-based methods now reject n_perms values that are 0, negative or not integers with a clear ValueError; None skips permutations.
  • The permutation statistics behind cellphonedb, cellchat, geometric_mean and rank_aggregate p-values are gathered and reduced a block of permutations at a time instead of as one (2, n_perms, n_interactions) tensor, so their peak memory no longer scales with n_perms (Bound the peak memory of the permutation statistics #282, by @pwwang). P-values are bit-identical for a given seed. Peak RSS / wall time, cellphonedb, MacBook Pro M3, 24 GB: 462k interactions, 1000 permutations 14.7 GB / 27 s -> 1.6 GB / 9 s; 4.2M interactions, 300 permutations 15.2 GB (memory-bound) / 510 s -> 3.7 GB / 35 s. Up to ~15% slower when the whole tensor fits in memory. Internally, the pipeline now owns the permutation test: a permutation-based method only declares how it combines ligand and receptor statistics (MethodMeta(combine=...)), plus an optional observed-only adjustment (observed_fn=, CellPhoneDB's zero mask), instead of each method re-implementing proximity weighting and p-value counting.
  • Bumped CI actions (setup-uv 10.3.2, gh-action-pypi-publish 1.14.3, codecov-action 7.1.1) and pre-commit hooks (biome, pyproject-fmt, ruff, zizmor) (Bump the pre-commit group across 1 directory with 4 updates #278, Bump the actions-deps group across 1 directory with 2 updates #279, Bump the actions-deps group across 1 directory with 3 updates #285).

Fixed

  • Explicit zeros stored in a sparse X no longer count as expressing cells in ligand_props/receptor_props (and thus expr_prop). li.pp.zi_minmax now prunes its sub-cutoff zeros, so with it as x_transform/y_transform far fewer interactions pass expr_prop.
  • MISTy raises if a view's obs_names differ from the intra-view's; views were paired by row position, so a reordered view gave silently wrong results.
  • li.mt.lric/li.mt.cross_pcf: pairs exactly on a radius-tile edge (e.g. gridded spots with radius_step equal to the spacing) no longer drift into the neighbouring tile; the number of annuli is floor(max_radius / radius_step), so float steps no longer add a spurious annulus (e.g. 0.3 / 0.1) and max_radius < radius_step raises.
  • li.mt.get_lric_auc normalises by the radial width it actually integrates, so an empty interior bin no longer pulls the score toward 0.
  • Docs build with sphinx-autodoc-typehints>=3.17 (the alias_typehints shim is removed); README and decision-tree links point to liana.readthedocs.io (Update Decision Tree links to latest tutorial template #283).
  • The pyCrossTalkeR tutorial runs in CI again; the tutorials extra requires pycrosstalker>=2.1.8 (CrossTalkeR versioning issues for CI #271).

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.63636% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.05%. Comparing base (08590db) to head (8f69e36).

Files with missing lines Patch % Lines
src/liana/method/sp/_LRIC.py 68.18% 7 Missing ⚠️
src/liana/method/sc/_liana_pipe.py 92.30% 2 Missing ⚠️
src/liana/method/sp/_misty/_Misty.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
+ Coverage   91.02%   91.05%   +0.03%     
==========================================
  Files          79       79              
  Lines        4533     4526       -7     
==========================================
- Hits         4126     4121       -5     
+ Misses        407      405       -2     
Files with missing lines Coverage Δ
src/liana/_core/_docs.py 97.80% <ø> (ø)
src/liana/_core/_pipe_utils/_get_mean_perms.py 64.67% <100.00%> (+0.38%) ⬆️
src/liana/_core/_pipe_utils/_pre.py 95.96% <100.00%> (+0.03%) ⬆️
src/liana/method/sc/_Method.py 91.11% <100.00%> (+0.52%) ⬆️
src/liana/method/sc/_cellchat.py 100.00% <100.00%> (ø)
src/liana/method/sc/_cellphonedb.py 100.00% <100.00%> (ø)
src/liana/method/sc/_geometric_mean.py 100.00% <100.00%> (ø)
src/liana/method/sp/_lric_helpers.py 94.18% <100.00%> (-0.07%) ⬇️
src/liana/multisample/to_mudata.py 86.08% <100.00%> (ø)
src/liana/preprocessing/transform.py 100.00% <100.00%> (ø)
... and 3 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbdimitrov

Copy link
Copy Markdown
Collaborator Author

@AtheerAS can you please double check the changes. I believe all had to be done so I will merge.

  • Removed lric(transform_fn=...), which was redundant: per-gene rescaling cancels in every LRIC ratio. For a nonlinear transform, pass a layer (layer="sqrt"). Also removed the deprecated pair_chunk.
  • The number of annuli is now floor(max_radius / radius_step), so float steps (e.g. 0.3/0.1) no longer add a spurious annulus. max_radius < radius_step now raises.
  • Pairs exactly on a radius-tile edge (e.g. gridded spots with radius_step equal to the spacing) no longer drift into the neighbouring tile through float error.
  • get_lric_auc now normalises by the width it actually integrates. An empty bin inside the curve (no pairs at that radius, e.g. gridded data with radius_step smaller than the spacing, or rare cell-type pairs) used to shrink the area but not the width, which pulled scores toward 0.

@dbdimitrov
dbdimitrov merged commit 3140d5c into main Oct 31, 2026
25 checks passed
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