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

Problems plotting interactions with multiple words in cpdb4 #96

Open
jweefergs opened this issue Jan 24, 2024 · 2 comments
Open

Problems plotting interactions with multiple words in cpdb4 #96

jweefergs opened this issue Jan 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jweefergs
Copy link

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
Copy link
Owner

zktuong commented Jan 24, 2024

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:

ktplots/R/plot_cpdb4.R

Lines 44 to 56 in a7bb0e6

genes <- strsplit(interaction, "-")
genesx <- unlist(lapply(genes, function(g) {
c(paste(g, collapse = "-"), paste(rev(g), collapse = "-"))
}))
if (class(scdata) == "Seurat") {
stop("Sorry not supported. Please use a SingleCellExperiment object.")
}
lr_interactions <- plot_cpdb(scdata = scdata, cell_type1 = ".", cell_type2 = ".",
celltype_key = celltype_key, splitby_key = splitby_key, means = means, pvals = pvals,
keep_significant_only = keep_significant_only, standard_scale = standard_scale,
return_table = TRUE, degs_analysis = degs_analysis, ...)
lr_interactions <- lr_interactions[gsub(paste0(".*", SPECIAL_SEP), "", lr_interactions$Var1) %in%
genesx, ]

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"

@zktuong zktuong added the bug Something isn't working label Feb 2, 2024
@zktuong zktuong linked a pull request Feb 17, 2024 that will close this issue
Copy link

stale bot commented Apr 22, 2024

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.

@stale stale bot added the wontfix This will not be worked on label Apr 22, 2024
@zktuong zktuong removed the wontfix This will not be worked on label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants