sqjin / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data
GNU General Public License v3.0
622 stars 142 forks source link

Error in computeCommunProb #263

Open daxianghuibian opened 3 years ago

daxianghuibian commented 3 years ago

cellchat <- computeCommunProb(cellchat,raw.use = F,population.size = T) Error in computeCommunProb(cellchat, raw.use = F, population.size = T) : Please check your input data matrix and ensure that you use the normalized data instead of count data!

sorry, I had used normalized data, and other groups can run successful except this group. All groups data were from one seuratobject.

sqjin commented 3 years ago

@daxianghuibian Can you show me your data in object@data.project and object@data.signaling

zpingfeng commented 3 years ago

str(cellchat@data.signaling) Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:1197638] 0 23 30 43 47 53 72 77 81 85 ... ..@ p : int [1:2815] 0 329 721 1094 1512 1895 2439 2941 3309 3767 ... ..@ Dim : int [1:2] 3000 2814 ..@ Dimnames:List of 2 .. ..$ : chr [1:3000] "Rb1cc1" "Mybl1" "Gsta3" "Gm28836" ... .. ..$ : chr [1:2814] "AAACCTGAGCGCTCCA-1_1" "AAACCTGAGTATCGAA-1_1" "AAACCTGCAACGCACC-1_1" "AAACCTGCAGCATGAG-1_1" ... ..@ x : num [1:1197638] 1.79 2.3 1.1 1.79 1.1 ... ..@ factors : list() str(cellchat@data.project) num [1:3000, 1:2814] 1.79 0 0 0 0 ...

  • attr(*, "dimnames")=List of 2 ..$ : chr [1:3000] "Rb1cc1" "Mybl1" "Gsta3" "Gm28836" ... ..$ : chr [1:2814] "AAACCTGAGCGCTCCA-1_1" "AAACCTGAGTATCGAA-1_1" "AAACCTGCAACGCACC-1_1" "AAACCTGCAGCATGAG-1_1" ...

cellchat <- computeCommunProb(cellchat) Error in data.use[RsubunitsV, ] : subscript out of bounds

I have checked everything mentioned listed in issue #111, still got similar error message

sqjin commented 3 years ago

@zpingfeng It looks like the genes in the @data.signaling is not the signaling genes. e.g., "Rb1cc1" "Mybl1" "Gsta3" "Gm28836" ... You cannot use the HVGs

zpingfeng commented 3 years ago

Thanks for your beautiful work! I can only have results of “Secreted Signalling” from one sample and “Cell-Cell Contact” from another sample. Is this an issue from my data or have I done something incorrectly?

DRSEI commented 1 year ago

Hi,

I am having a bid diffrent problem please see below.

cellchat <- computeCommunProb(cellchat,raw.use = F,population.size = T)
triMean is used for calculating the average gene expression per cell group. 
Error in computeCommunProb(cellchat, raw.use = F, population.size = T) : 
  Please check `unique(object@idents)` and ensure that the factor levels are correct!
         You may need to drop unused levels using 'droplevels' function. e.g.,
         `meta$labels = droplevels(meta$labels, exclude = setdiff(levels(meta$labels),unique(meta$labels)))`
I am not sure why I have <NA> in my dataset. This was appeared right after i run the 
`
cellchat <- computeCommunProb(cellchat,raw.use = F,population.size = T)

`> unique(cellchat@idents)
 [1] Cd4 Treg           B cell             Nk cell            Myeloid           
 [5] CD4 T cell         CD8 T cell         RB_unknown         CD4 naive         
 [9] Macrophage         pDC                Mast cell          Fibroblasts       
[13] Epithelial         4T1 epithelial     <NA>               EMT6 myofibroblast
[17] Neutrophils       
16 Levels: 4T1 epithelial B cell CD4 T cell CD4 naive CD8 T cell Cd4 Treg ... pDC

Then I run this but still having error meta$Cell_type = droplevels(meta$Cell_type, exclude = setdiff(levels(meta$Cell_type),unique(meta$Cell_type)))

Really appriciate your helps

sqjin commented 1 year ago

@DRSEI When you see in unique(cellchat@idents), you should check and correct your input cell label vector.

DRSEI commented 1 year ago

@sqjin I checked and my cell labell was correct when i load my file Please see below

levels(cellchat@idents) # show factor levels of the cell labels [1] "4T1 epithelial" "B cell" "CD4 T cell" "CD4 naive" [5] "CD8 T cell" "Cd4 Treg" "EMT6 myofibroblast" "Epithelial" [9] "Fibroblasts" "Macrophage" "Mast cell" "Myeloid" [13] "Neutrophils" "Nk cell" "RB_unknown" "pDC"


 unique(meta$Cell_type)
 [1] Cd4 Treg           B cell             Nk cell            Myeloid           
 [5] CD4 T cell         CD8 T cell         RB_unknown         CD4 naive         
 [9] Macrophage         pDC                Mast cell          Fibroblasts       
[13] Epithelial         4T1 epithelial     <NA>               EMT6 myofibroblast
[17] Neutrophils       
16 Levels: 4T1 epithelial B cell CD4 T cell CD4 naive CD8 T cell Cd4 Treg ... pDC

But I still don't get why I am getting errors ?

DRSEI commented 1 year ago

I forget to mention that This dataset converted from the scanpy . based on this link https://htmlpreview.github.io/?https://github.com/sqjin/CellChat/blob/master/tutorial/Interface_with_other_single-cell_analysis_toolkits.html

sqjin commented 1 year ago

@DRSEI You should correct your input data. unique(meta$Cell_type) still contains 'NA'.

DRSEI commented 1 year ago

@sqjin I managed to removed "NA" but i have New issues which i posted in here https://github.com/sqjin/CellChat/issues/525