zktuong / ktplots

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

Problems plotting interactions with multiple words in cpdb4 #96

Open jweefergs opened 5 months ago

jweefergs commented 5 months ago

Hi,

Thank you for this very helpful package - I'm having a lot of fun plotting my data!

However, I'm having trouble plotting specific interactions which include multiple words (such as IL18-IL18-receptor) in plot_cpdb4. The below should be a significant interaction, as is plotted as such in plot_cpdb, and I can plot other interactions (such as CXCL2-DPP4) without problem in plot_cpdb4. Can you advise?

plot_cpdb4( = sce, interaction = "IL18-IL18_receptor", #IL18_IL18_receptor also tried cell_type1 = "CD56posCD16neg_NK", cell_type2 = "Mast_cells", celltype_key = "cell_annotation", means = means, pvals = pvals, deconvoluted = decons, degs_analysis = TRUE )

I get the following error: Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 't': 'data' must be of a vector type, was 'NULL'

From the looks of things, it is struggling to handle the "-" in the first string splitting step. Also, in the input data for parameter means and pvals, gene_b value was blank for those that did not work and filled for those that did (example attached). Is this indicative of an issue upstream as well?

Many thanks! means_example.csv

zktuong commented 5 months ago

hi @jweefergs! Thank you for your interest and for bringing this up to me.

I found the issue but i will need time to implement a fix.

For now, can you try specifying the interaction as "IL18 receptor-IL18"

The bug is here:

https://github.com/zktuong/ktplots/blob/a7bb0e6324942728a3c10c727049c46e3bfe99fb/R/plot_cpdb4.R#L44-L56

basically, i ran the last line but with a grep and this is what it returns:

grep("IL18", gsub(paste0(".*", SPECIAL_SEP), "", lr_interactions$Var1), value=TRUE)
  [1] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
  [4] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
  [7] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [10] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [13] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [16] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [19] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [22] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [25] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [28] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [31] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [34] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [37] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [40] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [43] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [46] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [49] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [52] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [55] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [58] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [61] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [64] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [67] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [70] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [73] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [76] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [79] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [82] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [85] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [88] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [91] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [94] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
 [97] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[100] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[103] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[106] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[109] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[112] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[115] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[118] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[121] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[124] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[127] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[130] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[133] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[136] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[139] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
[142] "IL18 receptor-IL18" "IL18 receptor-IL18" "IL18 receptor-IL18"
stale[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.