Closed hmassalha closed 6 months ago
After decreasing the number of cell types, I observed that the function attempts to identify all possible combinations of celltypes between cell_type1
and cell_type2
. In exploratory projects, we may not anticipate relevant interactions for every cell type. Therefore, I presume that plot_cpdb
will generate output for whichever combinations exist between cell_type1
and cell_type2
, without assuming that all combinations will be included in the output. Thank you.
Hi, i can't replicate this issue with the test set. i'm guessing your single-cell data contains a lot more celltypes than what was provided to run cellphonedb? if so, just slice your single-cell data first.
thanks for your reply. Not sure what do you mean by slicing the single-cell data first. Do you mean to remove cell types from the adata? I guess the issue is about combination of cell types. Removing one cell types will dramatically affect the results of other combinations that might have significant interactions.
By tracing the functions' code, I see you filter for genes while calling for all cell types combinations to be present in the relevant_interactions
file... which is similar to my case...
correct. remove the celltypes from the adata you are providing to plot_cpdb
. this does not impact on your actual cellphonedb
run as this is purely for visualisation.
I have the same problem. I found that the problem was with the CellphoneDB results. I am using cpdb_degs_analysis_method for the calculations and then I am getting the following results:
list(cpdb_results.keys()) ['deconvoluted', 'deconvoluted_percents', 'means', 'relevant_interactions', 'significant_means', 'CellSign_active_interactions', 'CellSign_active_interactions_deconvoluted', 'interaction_scores']
The problem is that there are missing columns in the dataframe relevant_interactions (the missing column names are those where no interactions are calculated between the two cell types, i.e. the column A|B of relevant_interactions is all 0, and the column does not appear in relevant_interactions)
col1 = means.columns.to_list() col2 = pvals.columns.to_list() list(set(col1) - set(col2)) ['CD4_Th17|CD8_Tn_IFN_response', 'CD4_Th17|None_T', 'None_T|None_T', 'CD8_Tn_IFN_response|CD8_Tn_IFN_response', 'None_T|CD8_Tn_IFN_response', 'CD8_Tn_IFN_response|None_T']
The solution is just to add the missing columns in relevant_interactions:
for col in cpdb_results['means'].columns: if col not in cpdb_results['relevant_interactions'].columns: cpdb_results['relevant_interactions'][col] = 0
thanks @shenwenkang for finding the solution! will try and fix this when i have time.
seems like the fix introduces further bugs (e.g. plotting non-significant interactions). need to think of a different solution
@hmassalha @shenwenkang, could i ask you to try if this version works?
you can install with pip install git+https://www.github.com/zktuong/ktplots@fix-uneven-columns-and-rows
or just the master branch after i've merged this
Hello, thanks for this package to explore cpdb output.
I am facing the following issue with
plot_cpdb
function:any hint what I did wrong ? thanks