zktuong / ktplots

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

error while plotting plot_cpdb_heatmap #82

Closed Prathyusha-konda closed 1 year ago

Prathyusha-konda commented 1 year ago

Hi, I finished the cellphonedb analysis and trying to plot the heatmap but for some reason I keep encountering the following error, converting pvalues dataframe into matrix didn't help either. Could you please let me know what I can do here? Thank you very much!

Error in t.default(all_intr[, -c(1:11)]) : argument is not a matrix

Here is the code of how I am importing the cellphonedb data to plot

library(ktplots) library(SingleCellExperiment) library(SeuratDisk) library(Seurat)

count.data <- sub@assays$RNA@counts new_seurat <- CreateSeuratObject(counts = count.data)

sce_object <- as.SingleCellExperiment(new_seurat)

pvals <- read.delim("cellphonedb/tumor_tme/statistical_analysis_pvalues_broad.txt", check.names = FALSE) p.matrix <- as.matrix(pvals)

means <- read.delim("cellphonedb/tumor_tme/statistical_analysis_means_broad.txt", check.names = FALSE) decon <- read.delim("cellphonedb/tumor_tme/statistical_analysis_deconvoluted_broad.txt", check.names = FALSE)

means2[is.na(means2)] <- 0

plot_cpdb_heatmap(sce_object, 'annot_broad', p.matrix, cellheight = 10, cellwidth = 10, symmetrical = FALSE)

zktuong commented 1 year ago

hi, firstly, can you try installing this version here:

devtools::install_github("zktuong/ktplots", ref = "refactor_prep")

With this new version, there's a slightly different argument list: see the updated tutorial

If that doesn't work, can i ask you to send me the statistical_analysis_pvalues_broad.txt file to z.tuong@uq.edu.au so that i can take a look further?

zktuong commented 1 year ago

ok sounds like both of you are using an updated version of ktplots as the new versions expects the pvals object as the first argument.

plot_cpdb_heatmap(pvals, cellheight = 10, cellwidth = 10, symmetrical = FALSE)
YzGLab commented 1 year ago

Thanks very much for u new tutorial

Prathyusha-konda commented 1 year ago

ok sounds like both of you are using an updated version of ktplots as the new versions expects the pvals object as the first argument.

plot_cpdb_heatmap(pvals, cellheight = 10, cellwidth = 10, symmetrical = FALSE)

Thank you so much for the quick response! that worked!