ventolab / CellphoneDB

CellPhoneDB can be used to search for a particular ligand/receptor, or interrogate your own HUMAN single-cell transcriptomics data.
https://www.cellphonedb.org/
MIT License
335 stars 53 forks source link

One sided analysis for set of genes (DEGs) #104

Open Xparx opened 1 year ago

Xparx commented 1 year ago

I'm trying to infer influence between cell-type contexts but only have 1 of the celltypes availible.

I want to be able to generate a set of potential cell-cell interactions that might not be autocrine signaling. I currently have the component that are autocrine from a previous DEG analysis. What I'm wondering is if I can extract potential interactions that are fulfilled in a one sided analysis. My plan is then to remove the interactions that are autocrine from my previous analysis.

Can this be done with the current cellphoneDB pipeline?

ktroule commented 1 year ago

Thanks for using CellPhoneDB.

I'm not 100% sure that I've understood your question, however, to remove autocrine cell-cell interactions, you just need to filter out columns where the interacting cells are the same, for instance, B cell|B cell or Endothelial|Endothelial.

Let us know it this has solved your issue.

Thanks

Xparx commented 1 year ago

Thank you for your response! My situation is a bit conditional. I have cells (lets call them A) grown in vicinity of a different celltype (B), and cell grown without these other cells (A). But only sequenced A, and A. So now I want to determine if there is any activated signaling in the presence of celltype B. So I was thinking if I determine A|A and A|A i get the autocrine signalling. I Now want to probe cellphonedb for signaling that might be activated that are not aurocrine, I called it 1 sided test here. I.e. if we have unpaired receptor or ligand pathways that are not in the A|A or A|A set of pairs.

I base this analysis on DEGs I found in A and A*. EDIT: To clarify. I want to get potential signaling between A|B.

luzgaral commented 1 year ago

Hi,

To get A|B interactions one sided (i.e. DEGs in A - one sided), you just have to add is B cells (as well as A and A*) in the count and metadata files. In this way, cellphoneDB will retrieve all A|B interactions where:

Let us know if this is of help.

Best

Luz

Xparx commented 1 year ago

Thanks again for the answer.

When setting this problem up and running it I get the error that Exception: Some clusters/cell_types in microenvironments file are not present in metadata Which seems reasonable. I do not have any B cells at all. I'm using the code from the examples

deconvoluted, means, relevant_interactions, significant_means = cpdb_degs_analysis_method.call(
    cpdb_file_path = cpdb_file_path,                            # mandatory: CellPhoneDB database zip file.
    meta_file_path = meta_file_path,                            # mandatory: tsv file defining barcodes to cell label.
    counts_file_path = counts_file_path,                        # mandatory: normalized count matrix.
    degs_file_path = degs_file_path,                            # mandatory: tsv file with DEG to account.
    counts_data = 'hgnc_symbol',                                # defines the gene annotation in counts matrix.
    microenvs_file_path = microenvs_file_path,                  # optional (default: None): defines cells per microenvironment.
    threshold = 0.1,                                            # defines the min % of cells expressing a gene for this to be employed in the analysis.
    result_precision = 3,                                       # Sets the rounding for the mean values in significan_means.
    separator = '|',                                            # Sets the string to employ to separate cells in the results dataframes "cellA|CellB".
    debug = False,                                              # Saves all intermediate tables emplyed during the analysis in pkl format.
    output_path = out_path,                                     # Path to save results
    output_suffix = None                                        # Replaces the timestamp in the output files by a user defined string in the  (default: None)
    )

How do I attain that 1 sided test when I have no B cells? Can I just add them as dummy data. I would expected all interactions would then get filtered as the B cells do not provide any genes/expressions. Or should I skip defining the "B" cells in the cell environment file? Then How do I run a 1 sided test?

Many thanks.