Open radiasso opened 7 months ago
@radiasso Can you check the updated tutorial
Hi! Thank you for your answer. Unfortunately, I had followed that tutorial and I tried again right now, but the error is always the same when I try to launch computeCommunProb.
> library(anndata)
> ad <- read_h5ad("ad.h5ad")
> data.input <- t(as.matrix(ad$X)) #my normalized and log1p data is in X already
> meta <- ad$obs
> meta$labels <- meta[["Cell_types"]]
> library(CellChat)
> cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")
[1] "Create a CellChat object from a data matrix"
Set cell identities for the new CellChat object
The cell groups used for CellChat analysis are Collecting Duct, DCT-CNT, Endothelial, Leucocytes, Loop of Henle, PEC, PT-S1, PT-S2, PT-S3
> CellChatDB <- CellChatDB.mouse
> showDatabaseCategory(CellChatDB)
> CellChatDB.use <- CellChatDB
> cellchat@DB <- CellChatDB.use
> cellchat <- subsetData(cellchat)
> cellchat <- identifyOverExpressedGenes(cellchat)
> cellchat <- identifyOverExpressedInteractions(cellchat)
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s
The number of highly variable ligand-receptor pairs used for signaling inference is 1027
> cellchat <- computeCommunProb(cellchat, type = "triMean")
triMean is used for calculating the average gene expression per cell group.
[1] ">>> Run CellChat on sc/snRNA-seq data <<< [2024-02-19 14:12:48]"
| | 0%Error in if (sum(P1_Pspatial) == 0) { :
missing value where TRUE/FALSE needed
Basically the only different thing from the tutorial you linked is > meta$labels <- meta[["Cell_types"]]
, but the rest is the same.
If it helps, I get warnings()
, it says In log(x) : NaNs produced
.
Same thing happens when I start from the sce object with zellkonverter. How can I fix this please?
@radiasso Can you show data.input[1:10, 1:10]
?
Hi! I'm new to CellChat (just installed recently), but I can't seem to make it work. A bit of context: I have an h5ad data object from 10x scRNA experiments (batch correction for multiple samples). My anndata object has cells as columns, genes as rows, and a normalized and log1p expression matrix in X. I also have the raw counts in
adata.obs['n_counts']
.I followed the tutorial here starting from AnnData objects, and here for the following parts.
My lines of code specifically are:
The problem arises right after, when launching:
cellchat <- computeCommunProb(cellchat, type = "triMean")
At first it seems to work but then it outputs:Error in if (sum(P1) == 0) {: missing value where TRUE/FALSE needed
I can't figure out what bothers that function. I've looked through issues and questions here on Git but I still have no clue. Can anyone help me please? Thank you in advance, so so much!