zktuong / ktplots

Some tools for plotting single-cell data
https://zktuong.github.io/ktplots/
MIT License
162 stars 31 forks source link

where to get "interactions_groups.txt" file in plot_cpdb2 #77

Closed wenqihu1995 closed 1 year ago

wenqihu1995 commented 1 year ago

Hi, Thanks a lot for this excellent package! plot_cpdb2 function requires a "interactions_groups.txt" input, which can group interactions, but I don't know how to produce this txt, do you have such a file like that or where could I download one? I also tried "interaction_grouping = interaction_annotation", but the result shows a lot of "NA"s. Best, Wenqi

zktuong commented 1 year ago

hi @wenqihu1995, thank you for the interest in this package.

i have created an initial table here : https://docs.google.com/spreadsheets/d/1O9OKU7J0NdeQNJAIMpsHtWAFvY014GDQ7aigdGUSTmc/edit?usp=sharing

and for interaction_annotation, i just created a table based on the above.

I haven't gone through to annotate all 3000+ interactions as it's a lot of work and some interactions can have different contexts.

So my suggestion is for you to create your own interactions_groups.txt based on your short list of interactions, following the table format as in interaction_annotation.

After that, you can also contribute to the table on the google drive as well.

wenqihu1995 commented 1 year ago

Thanks very much for your quick reply! I tried my own txt. but when I tried the plot_cpdb2 function, It runs a very long time, and I got a warning message:

Multiple parents. Unfolding graph Warning message: ggrepel: 1411 unlabeled data points (too many overlaps). Consider increasing max.overlaps

the result shows a lot of interactions, image

here is the code: plot_cpdb2(cell_type1 = 'AESC|EMT cells|Epithelial cells', cell_type2 = 'Mesenchymal cells|Endothelial|Fibroblast|AMSC|Neural progenitor cells|Smooth mucle', idents = 'celltype', scdata = cellsce, means = means, pvals = pvals, deconvoluted = deconvoluted, # new options from here on specific to plot_cpdb2 interaction_grouping = interaction_grouping, edge_group_colors = c("BMP signaling" = "#e15759", "Unknown" = "white","WNT signaling" = "#59a14f", "Cadherin" = "#4e79a7", "Collagen" = "#9c755f", "Cell adhesion and signaling" = "#B07aa1"), node_group_colors = c("AMSC" = "#86bc86", "Mesenchymal cells" = "#79706e", "Endothelial" = "#ff7f0e", "Fibroblast" = "#bcbd22"), keep_significant_only = TRUE, standard_scale = TRUE, remove_self = TRUE, frac=0.5, degs_analysis = T)

Morerover, when I tried plot_cpdb3, it also shows a lot of interactions, I was wondering if you have any idea on this matter, image here the code: plot_cpdb3(cell_type1 = 'AESC|EMT cells|Epithelial cells', cell_type2 = 'Mesenchymal cells|Endothelial|Fibroblast|AMSC|Neural progenitor cells|Smooth mucle', scdata = cellsce, idents = 'celltype', # column name where the cell ids are located in the metadata means = means, pvals = pvals, deconvoluted = deconvoluted, # new options from here on specific to plot_cpdb3 keep_significant_only = TRUE, standard_scale = TRUE, remove_self = TRUE, frac = 0.1, degs_analysis = T, legend.pos.x = -5,legend.pos.y = 5 )

Thanks again for your time and patience! Wenqi

zktuong commented 1 year ago

Hi Wenqi, the issue is because you have tried to plot too many interactions.

My suggestion is to try and include to trim what you wish to plot by exploring your data with plot_cpdb.

You can also pass the same genes option to plot_cpdb2, plot_cpdb3 and plot_cpdb4 as internally they pass it to plot_cpdb.

In plot_cpdb4, you can also further specify the specific interaction e.g. CD40-CD40LG

wenqihu1995 commented 1 year ago

Thank very much for your replying!