Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about the resource of liana+cell2cell and further L-R pairs determination of among cell cell communication #14

Open
xflicsu opened this issue Jan 19, 2024 · 3 comments

Comments

@xflicsu
Copy link

xflicsu commented Jan 19, 2024

Dear ccc_protocols developer,
Thanks for the combination of the two powerful ccc detection methods.
I have two question:

  1. When I read the cell2cell paper, they collect the L-R pairs from LewisLabUCSD/Ligand-Receptor-Pairs(https://raw.githubusercontent.com/LewisLabUCSD/Ligand-Receptor-Pairs/master/Human/Human-2020-Jin-LR-pairs.csv). And the legend of tensor_factors_plot contains three type of L-R pairs (Secreted Signaling, ECM-Receptor and Cell-Cell Contact).
    So, could you also integrate the L-R pairs information in liana+?

  2. After the context-dependent communication pattern detection, we also want to get the information of one L-R pair and their corresponding cell-cell pair.
    So, how can we get those information?
    And any suggestion for visualization of one cell communication form mutiple conditions?

@hmbaghdassarian
Copy link
Collaborator

I'll let @earmingol and @dbdimitrov elaborate if they feel it's necessary, but in the meantime:

LIANA can take in custom resources so long as it's formatted in the standard manner, i.e. an adjacency list with each row representing an interaction between a ligand and a receptor. So, while it hasn't been integrated as a resource in LIANA, you could use the Jin resource with those annotations directly by passing it as a custom resource. See Tutorial 02, "Alternative Resources" for a sense of how this is implemented.

To see what the formatting of the input resource should look like, in Python, call "li.resource.select_resource('consensus')" and in R, call "liana::select_resource('Consensus')[['Consensus']])[c('source_genesymbol', 'target_genesymbol')".

You can then color the factorization plots by their LR annotations using the meta_tensor variable introduced in Tutorial 04. You can also see how this is implemented as the variable "meta_tf" of Notebook 06 in the Code Ocean capsule. @dbdimitrov I don't think the plot_c2c_overview in R can color the LRs, but looks like it's just a minor modification around line 362, if needed.

  1. Tensor-cell2cell is designed to capture how the combinations of the four dimensions form distinct patterns. To use the loadings for the purpose you're asking about, I believe the closest analysis would be the one titled "Evaluation of sender-receiver pair and LR pairs used in a specific factor" in Tutorial 05 in which the variable "lr_cell_product" is generated. Alternatively, if you identify a context-specific factor, you could pull out that context from the LIANA by sample output and look at the communication score of the specific cell-cell/LR pair of interest. @earmingol may have additional suggestions.

I hope this helps!

@earmingol
Copy link
Collaborator

earmingol commented Jan 23, 2024

Assuming you are using python, as @hmbaghdassarian said, you can personalize the LR pairs used with liana.
With that said, you can tune a bit the LR pairs used in the Tensor-cell2cell tutorial to use those from CellChat (https://raw.githubusercontent.com/LewisLabUCSD/Ligand-Receptor-Pairs/master/Human/Human-2020-Jin-LR-pairs.csv) so you keep the info about the type of LR pair.

Before converting the LR pairs into the LIANA format as shown in this example, I recommend using this line of code as in the Tensor-cell2cell tutorial:

ppi_functions = dict()

for idx, row in lr_pairs.iterrows():
    ppi_label = row[int_columns[0]] + '^' + row[int_columns[1]]
    ppi_functions[ppi_label] = row['annotation']

So with this you can use such information for generating the metadata for the tensor, which is used for coloring the plots. Also make sure to replace the '^' above by the proper separator added when building the tensor (check tensor.order_names[1] to see how LR pair names look like).

You will use this ppi_functions dictionary to build the tensor metadata:

meta_tf = c2c.tensor.generate_tensor_metadata(interaction_tensor=tensor,
                                              metadata_dicts=[context_dict, ppi_functions, None, None],
                                              fill_with_order_elements=True
                                             )

For you second question, you can do what @hmbaghdassarian said, but I also recommend building the tensor with only that LR pair of interest and run the decomposition (you can subset your original tensor to only have that LR pair as shown here, then visualize the cell-cell pairs as shown here

I hope this helps

@dbdimitrov
Copy link
Collaborator

Hey,

Thanks for answering @earmingol @hmbaghdassarian.

I'm planning to rebuild the liana database all together. And I'm also planning to have utilities to annotate any resource with any type of annotations (e.g. secreted signalling, ECM, etc).

I will keep this in mind and I can come back to you once the functionalities in place.

We could perhaps add this small annotation step to the tutorials here.

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

No branches or pull requests

4 participants