CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

Make LR contribution comparable across pathways, sources and targets

Open Puriney opened this issue 2 years ago • 0 comments

Motivation:

Find the LR contributions that are comparable across pathways, sources, and targets. After using this PR, users can rank the LR from various pathways. Importantly, the contribution value is 'global' and comparable across various pathways, sources, and targets.

For example, now I am examing LRs from multiple pathways signaling = c('ICOS', 'PD-L1', 'TIGIT', 'SELE'). image

Problem:

For the same LR, the contributions are different depending on the selected pathways, sources and targets. Because the contributions are 'relative'. See line: https://github.com/sqjin/CellChat/blob/418b660aa896758a6a7858a443c56ffcb522c672/R/analysis.R#L86

Solution:

I modified the original netAnalysis_contribution into another function netAnalysis_contribution_allLR. It has two improvements: 1) comparing multiple pathways, and 2) avoiding the relative prob.

Misc:

  • The new function generates the same result based on a single pathway and all sources and targets, in my own dataset. This probably confirms the new function works.
  • The new function just spreads this idea. Feel free to edit and incorporate into the original function if you find the idea of this PR is helpful.
  xx = CellChat::netAnalysis_contribution(
    cellchat, signaling = 'ICOS', return.data = T, 
    sources.use = levels(cellchat@idents), 
    targets.use = levels(cellchat@idents))
  yy = CellChat::netAnalysis_contribution_allLR(
    cellchat, signaling = 'ICOS', return.data = T, 
    sources.use = levels(cellchat@idents), 
    targets.use = levels(cellchat@idents))
  
  head(xx)
  head(yy)
>   head(xx)
$LR.contribution
                     name contribution
ICOSL_ICOS   ICOSL - ICOS   0.46771954
ICOSL_CTLA4 ICOSL - CTLA4   0.43755524
ICOSL_CD28   ICOSL - CD28   0.09472522

$gg.obj

>   head(yy)
$LR.contribution
                     name contribution
ICOSL_ICOS   ICOSL - ICOS 2.646738e-07
ICOSL_CTLA4 ICOSL - CTLA4 2.476044e-07
ICOSL_CD28   ICOSL - CD28 5.360325e-08

$gg.obj
image

Unresolved issue:

I did not use the vertex.receiver para and I did not find a demo for it. I am not sure how to handle the normalization part for the 'hierarchy1' and 'herarchy2'.

See the code block in: https://github.com/Puriney/CellChat/blob/25fac78c144c831a01eddb239537826ed17979f3/R/analysis.R#L338-L344

Puriney avatar Sep 26 '23 17:09 Puriney