Skip to content

get_metalinks(split=True): return resource, pd_net and t_net - #294

Open
dbdimitrov wants to merge 1 commit into
mainfrom
feat/metalinks-split
Open

dbdimitrov wants to merge 1 commit into
mainfrom
feat/metalinks-split

Conversation

@dbdimitrov

Copy link
Copy Markdown
Collaborator

Removes the MetalinksDB munging users (and the skill) currently write by hand before estimate_metalinks.

Changes

  • li.rs.get_metalinks(..., split=True) (keyword-only, default False, typed with overloads) returns (resource, pd_net, t_net):
    • resource: lr rows as ligand (metabolite) / receptor, deduplicated;
    • pd_net: mean mor per (metabolite, gene) as source/target/weight (votes across curators; zeros kept);
    • t_net: transport direction out → +1, in → −1, averaged, zeros dropped; None if no transport rows.
    • With split=True, types defaults to ["lr", "pd"]; raises ValueError if either is excluded.
  • li.mt.estimate_metalinks accepts a resource with a ligand or source column (raises otherwise), so the split resource goes straight into both estimate_metalinks and the CCC methods.
resource, pd_net, t_net = li.rs.get_metalinks(tissue_location="Brain", split=True)
meta = li.mt.estimate_metalinks(adata, resource, pd_net=pd_net, t_net=t_net)

Tests

  • tests/resource/test_get_metalinks.py: split output on a toy SQLite DB (db_path=), types validation, empty transport.
  • tests/method/test_estimate_metalinks.py: ligand and source resource columns.
  • On the real MetalinksDB the output matches the sc_multi tutorial's hand-built tables. Tutorials are unchanged.

Follow-up: the skill's metabolites.md (#293) can switch to split=True once this is merged.

🤖 Generated with Claude Code

… estimate_metalinks accepts a ligand column

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 liana | 🛠️ Build #35755582 | 📁 Comparing 304c7b3 against latest (3b3559b)

  🔍 Preview build  

108 files changed · ± 108 modified

± Modified

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.10%. Comparing base (df0200e) to head (304c7b3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #294      +/-   ##
==========================================
+ Coverage   91.05%   91.10%   +0.04%     
==========================================
  Files          79       79              
  Lines        4526     4540      +14     
==========================================
+ Hits         4121     4136      +15     
+ Misses        405      404       -1     
Files with missing lines Coverage Δ
src/liana/method/fun/_estimate_metalinks.py 100.00% <100.00%> (+3.03%) ⬆️
src/liana/resource/get_metalinks.py 94.73% <100.00%> (+1.05%) ⬆️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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