Open LucaTucciarone opened 2 years ago
head(meta)
celltype
<fct>
MM_555_AAACCCAAGTAGTCTC macrophage
MM_555_AAACCCACAGGTATGG acinar
MM_555_AAACCCAGTGATGTAA ductal
MM_555_AAACCCAGTGGTTTGT acianr
MM_555_AAACCCATCAGGAGAC ductal
MM_555_AAACCCATCCGATAAC immune
unique(cellchat@idents)
macrophageacinarductalacianrimmunebetalymph_endoalphaactivated_stellateq_stellatemastREG+_acinardeltaendothelialschwannmuc5b_ductal
Levels:
REG+_acinar''acianr''acinar''activated_stellate''alpha''beta''delta''ductal''endothelial''immune''lymph_endo''macrophage''mast''muc5b_ductal''q_stellate''schwann'
cellchat@data
6731 x 8823 sparse Matrix of class "dgCMatrix"
LINC01409 -0.510120094 2.18581080 -0.45797196 -1.626048e-01 -0.533872306 -0.355126828
KLHL17 -0.070135087 -0.07109839 -0.07218006 -8.376281e-02 -0.069203652 -0.076213107
PLEKHN1 -0.020366136 -0.02335113 -0.02670295 1.669724e+01 -0.017479870 -0.039200246
AL645608.7 -0.052686848 -0.04829920 -0.04337235 9.384927e-03 -0.056929369 -0.025002571
HES4 -0.180781931 -0.17278679 -0.16380911 -6.767511e-02 -0.188512623 -0.130335823
ISG15 -0.115727194 -0.11784433 -0.12022164 -1.456781e-01 -0.113680087 -0.129085451
AGRN -0.123824224 -0.12478121 -0.12585582 -1.373628e-01 5.355777740 -0.129862487
C1orf159 -0.316225499 -0.30426022 3.24064207 -1.469536e-01 -0.327794999 -0.240729496
LINC01342 -0.062820159 -0.06174705 -0.06054206 -4.763892e-02 -0.063857771 -0.056049258
AL390719.2 -0.271775156 -0.26923713 -0.26638722 -2.358700e-01 -0.274229228 -0.255761266
TTLL10 -0.102808177 -0.10000265 -0.09685236 -6.311864e-02 8.126688004 -0.085106477
SDF4 -0.266289592 -0.26307189 -0.25945878 -2.207691e-01 -0.269400865 -0.245987251
B3GALT6 -0.072275154 -0.07167491 -0.07100092 -6.378365e-02 -0.072855540 -0.068487905
Digging into the problem it comes out my data, that I repeat is coming from a pull of different samples and exp-points, has also been normalised in scanPy in this way:
sc.pp.normalize_per_cell(adata_merged, counts_per_cell_after=1e4)
and Harmony normalisation
@LucaTucciarone You cannot use data with negative values as input of CellChat. I think the Harmony normalized data is a corrected data, which cannnot be used as an input.
Just in case someone is facing the same problem, when trying to run cellchat on AnnData object. The following worked for me:
library(anndata)
data.input <- t(adata$raw$X) colnames(data.input) <- adata$raw$obs_names rownames(data.input) <- adata$raw$var_names dim(data.input)
meta= adata$obs
cellchat <- createCellChat(object = as.matrix(data.input), meta = meta, group.by = "cluster_ids")
cellchat <- addMeta(cellchat, meta = meta) cellchat <- setIdent(cellchat, ident.use = "celltype") # set "labels" as default cell identity levels(cellchat@idents) # show factor levels of the cell labels groupSize <- as.numeric(table(cellchat@idents)) # number of cells in each cell group
Hello @LucaTucciarone ,
How do you solved the problem? I am having same issues
@sqjin I have encountered same error while running computeCommunProb(): (sum(P1_Pspatial) == 0) {: missing value where TRUE/FALSE needed
The data has non-negative normalized expression count. Have you found the source of error and possible solution for it? Thanks!
@sandhusumiti Do you also extract the data from scanpy?
@sqjin Thank you for prompt response. I am using normalized matrix from a Seurat object.
Hello, I'm having the same issue. My data is imported from Scanpy. Can you help me?
@LucaTucciarone You cannot use data with negative values as input of CellChat. I think the Harmony normalized data is a corrected data, which cannnot be used as an input.
@sqjin I encountered the exact issue with @LucaTucciarone , do you know how to slove this? Thank you so much!
@LucaTucciarone
cellchat <- addMeta(cellchat, meta = meta) cellchat <- setIdent(cellchat, ident.use = "celltype") # set "labels" as default cell identity levels(cellchat@idents) # show factor levels of the cell labels groupSize <- as.numeric(table(cellchat@idents)) # number of cells in each cell group
Hello @LucaTucciarone ,
How do you solved the problem? I am having same issues
@DRSEI Hi have you solved this issue?
Hi @YOU-k , currently I do not have a better suggestion on the generation of batch-corrected count matrix. Generally, we simply merge the data matrix from different batches and use normalization methods such as in Seurat to obtain a data matrix as input of cellchat.
@LucaTucciarone You cannot use data with negative values as input of CellChat. I think the Harmony normalized data is a corrected data, which cannnot be used as an input.
Hello!
I can run cell-chat without any issue from a scRNAseq Seurat object but I'm finding problems with a ScanPy multiomics (rna+atacseq) object: This is how I load the dataset:
Then I create the cellchat object:
Load the L/R database:
Add the cell info into the meta slot
Pre-process the expression data
Then here It says there are a lot of NAs And that for that reason I get this error Error in if (sum(P1) == 0) {: missing value where TRUE/FALSE needed
The problem is in the "computeCommunProb(cellchat)" step
Please let me know!
I have to say that the data I am starting from Is from multiple samples and then I made a subset in python to extrapolate what I needed